todo.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <div class="business-visit-todo-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <vxe-grid v-bind="gridOptions" ref="gridRef" @checkbox-all="selectAllChangeEvent" @checkbox-change="selectChangeEvent">
  5. <template #form>
  6. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline label-width="100px" :disabled="gridOptions.loading">
  7. <el-form-item label="数据范围" prop="QuerySelf" v-auth="'business:visit:todo:querySelf'">
  8. <el-segmented
  9. :options="[
  10. { label: '我的', value: true },
  11. { label: '全部', value: false },
  12. ]"
  13. v-model="state.queryParams.QuerySelf"
  14. @change="handleQuery"
  15. :disabled="state.loading"
  16. />
  17. </el-form-item>
  18. <el-form-item label="工单类型" prop="IsProvince" v-auth="'business:visit:todo:orderType'">
  19. <el-segmented
  20. :options="[
  21. {
  22. value: 'all',
  23. label: '全部',
  24. },
  25. {
  26. value: 'city',
  27. label: '市工单',
  28. },
  29. {
  30. value: 'province',
  31. label: '省工单',
  32. },
  33. ]"
  34. v-model="fastSearch"
  35. @change="fastSearchChange"
  36. :disabled="state.loading"
  37. />
  38. </el-form-item>
  39. <el-form-item label="回访状态" prop="VisitStateQuery">
  40. <el-segmented :options="visitStateOptions" v-model="state.queryParams.VisitStateQuery" @change="handleQuery" :disabled="state.loading" />
  41. </el-form-item>
  42. <el-form-item label="工单标题" prop="Keyword">
  43. <el-input v-model.trim="state.queryParams.Keyword" placeholder="工单标题" clearable @keyup.enter="handleQuery" class="keyword-input" />
  44. </el-form-item>
  45. <el-form-item label="工单编码" prop="No">
  46. <el-input v-model.trim="state.queryParams.No" placeholder="工单编码" clearable @keyup.enter="handleQuery" class="keyword-input" />
  47. </el-form-item>
  48. <el-form-item>
  49. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  50. <el-button @click="drawer = true" class="default-button"> <SvgIcon name="ele-Search" class="mr5" />更多查询</el-button>
  51. </el-form-item>
  52. </el-form>
  53. </template>
  54. <template #toolbar_buttons>
  55. <el-button
  56. type="primary"
  57. @click="messageVisit"
  58. :disabled="isChecked"
  59. v-auth="'business:visit:todo:message'"
  60. >
  61. <SvgIcon name="ele-Message" class="mr5" />短信回访</el-button
  62. >
  63. <el-button
  64. type="primary"
  65. @click="batchVisit"
  66. :disabled="isChecked"
  67. v-auth="'business:visit:todo:batch'"
  68. v-if="['ZiGong', 'LuZhou'].includes(themeConfig.appScope)"
  69. >
  70. <SvgIcon name="ele-DocumentCopy" class="mr5" />批量回访</el-button
  71. >
  72. <!-- <el-button type="primary" @click="multiplePeople" :disabled="isChecked" v-auth="'business:visit:todo:multiplePeople'">
  73. <SvgIcon name="ele-User" class="mr5" />分配回访人</el-button
  74. >-->
  75. <el-button type="primary" @click="onMigration" v-auth="'business:visit:todo:migration'" :disabled="isChecked">
  76. <SvgIcon name="ele-Rank" class="mr5" />平级移动<span v-if="checkTable.length">({{ checkTable.length }})</span>
  77. </el-button>
  78. </template>
  79. <template #order_detail="{ row }">
  80. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  81. </template>
  82. <template #action="{row}">
  83. <el-button link type="primary" @click="onManpower(row)" title="工单回访" v-auth="'business:visit:todo:manpower'"> 回访 </el-button>
  84. </template>
  85. <template #pager>
  86. <pagination
  87. @pagination="queryList"
  88. :total="state.total"
  89. v-model:current-page="state.queryParams.PageIndex"
  90. v-model:page-size="state.queryParams.PageSize"
  91. :disabled="state.loading"
  92. />
  93. </template>
  94. </vxe-grid>
  95. </div>
  96. <!-- 更多查询 -->
  97. <el-drawer v-model="drawer" title="更多查询" size="500px">
  98. <el-form :model="state.queryParams" ref="drawerRuleFormRef" @submit.native.prevent label-width="100px">
  99. <el-form-item label="来电号码" prop="FromPhone">
  100. <el-input v-model.trim="state.queryParams.FromPhone" placeholder="来电号码" clearable @keyup.enter="handleQuery" />
  101. </el-form-item>
  102. <el-form-item label="联系电话" prop="Contact">
  103. <el-input v-model.trim="state.queryParams.Contact" placeholder="联系电话" clearable @keyup.enter="handleQuery" />
  104. </el-form-item>
  105. <el-form-item label="回访人" prop="EmployeeName">
  106. <el-input v-model="state.queryParams.EmployeeName" placeholder="回访人" clearable @keyup.enter="handleQuery" />
  107. </el-form-item>
  108. <el-form-item label="来电主体" prop="IdentityType">
  109. <el-select v-model="state.queryParams.IdentityType" placeholder="请选择来电主体" clearable @change="handleQuery">
  110. <el-option :value="1" label="市民" />
  111. <el-option :value="2" label="企业" />
  112. </el-select>
  113. </el-form-item>
  114. <el-form-item label="一级部门" prop="OrgLevelOneName">
  115. <el-input v-model="state.queryParams.OrgLevelOneName" placeholder="一级部门" clearable @keyup.enter="handleQuery" />
  116. </el-form-item>
  117. <el-form-item label="接办部门" prop="ActualHandleOrgName">
  118. <el-input v-model="state.queryParams.ActualHandleOrgName" placeholder="接办部门" clearable @keyup.enter="handleQuery" />
  119. </el-form-item>
  120. <el-form-item label="归档类型" prop="FiledType">
  121. <el-select v-model="state.queryParams.FiledType" placeholder="请选择归档类型" @change="handleQuery" clearable>
  122. <el-option label="中心归档" value="10" />
  123. <el-option label="部门归档" value="20" />
  124. </el-select>
  125. </el-form-item>
  126. <el-form-item label="是否会签" prop="IsCountersign">
  127. <el-select v-model="state.queryParams.IsCountersign" placeholder="请选择是否会签" @change="handleQuery" clearable>
  128. <el-option label="是" value="true" />
  129. <el-option label="否" value="false" />
  130. </el-select>
  131. </el-form-item>
  132. <el-form-item label="发布时间" prop="fbTime">
  133. <el-date-picker
  134. v-model="state.queryParams.fbTime"
  135. type="datetimerange"
  136. unlink-panels
  137. range-separator="至"
  138. start-placeholder="开始时间"
  139. end-placeholder="结束时间"
  140. :shortcuts="shortcuts"
  141. @change="handleQuery"
  142. value-format="YYYY-MM-DD[T]HH:mm:ss"
  143. :default-time="defaultTimeStartEnd"
  144. />
  145. </el-form-item>
  146. <el-form-item label="回访方式" prop="VisitType">
  147. <el-select v-model="state.queryParams.VisitType" placeholder="请选择回访方式" @change="handleQuery" clearable>
  148. <el-option v-for="item in state.visitTypeOptions" :value="item.key" :key="item.key" :label="item.value" />
  149. </el-select>
  150. </el-form-item>
  151. <el-form-item label="来源渠道" prop="Channel">
  152. <el-select v-model="state.queryParams.Channel" placeholder="请选择来源渠道" clearable @change="handleQuery">
  153. <el-option v-for="item in channelOptions" :value="item.dicDataValue" :key="item.dicDataValue" :label="item.dicDataName" />
  154. </el-select>
  155. </el-form-item>
  156. <el-form-item label="是否超期" prop="IsOverTime">
  157. <el-select v-model="state.queryParams.IsOverTime" placeholder="请选择是否超期" class="w100" clearable @change="handleQuery">
  158. <el-option label="是" :value="true" />
  159. <el-option label="否" :value="false" />
  160. </el-select>
  161. </el-form-item>
  162. </el-form>
  163. <template #footer>
  164. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  165. <el-button @click="resetQuery(drawerRuleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
  166. </template>
  167. </el-drawer>
  168. <!-- 回访 -->
  169. <visit-detail ref="visitDetailRef" @updateList="queryList" />
  170. <!-- 分配回访人 -->
  171. <assign-return-visitors ref="assignReturnVisitorsRef" @updateList="queryList" />
  172. <!-- 工单平移 -->
  173. <order-migration ref="orderMigrationRef" @updateList="queryList" />
  174. <!-- 批量回访 -->
  175. <visit-batch ref="visitBatchRef" @updateList="queryList" />
  176. </div>
  177. </template>
  178. <script setup lang="tsx" name="businessVisitTodo">
  179. import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  180. import { ElMessageBox, FormInstance, ElMessage } from 'element-plus';
  181. import { visitList } from '@/api/todo/visit';
  182. import { visitListExport, visitSearchBaseData, visitSendSms } from '@/api/business/visit';
  183. import { useThemeConfig } from '@/stores/themeConfig';
  184. import { storeToRefs } from 'pinia';
  185. import { defaultTimeStartEnd, shortcuts } from '@/utils/constants';
  186. import Other from '@/utils/other';
  187. // 引入组件
  188. const VisitDetail = defineAsyncComponent(() => import('/src/views/business/visit/components/Visit-detail.vue')); // 回访
  189. const AssignReturnVisitors = defineAsyncComponent(() => import('@/views/business/visit/components/Assign-return-visitors.vue')); // 分配回访人
  190. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  191. const OrderMigration = defineAsyncComponent(() => import('@/views/todo/center/Order-migration.vue')); // 工单平移
  192. const VisitBatch = defineAsyncComponent(() => import('@/views/business/visit/components/Visit-batch.vue')); // 批量回访
  193. const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
  194. // 定义变量内容
  195. const fastSearch = ref('all'); // tab位置
  196. const fastSearchChange = (val: string) => {
  197. fastSearch.value = val;
  198. switch (val) {
  199. case 'all':
  200. state.queryParams.IsProvince = null;
  201. break;
  202. case 'city':
  203. state.queryParams.IsProvince = false;
  204. break;
  205. case 'province':
  206. state.queryParams.IsProvince = true;
  207. break;
  208. }
  209. handleQuery();
  210. };
  211. const state = reactive<any>({
  212. queryParams: {
  213. // 查询条件
  214. PageIndex: 1,
  215. PageSize: 20,
  216. Keyword: null, // 关键字
  217. FiledType: null, // 归档类型
  218. IsCountersign: null, // 是否会签
  219. VisitStateQuery: 2, // 回访状态 2待回访
  220. VisitType: null, // 回访方式
  221. No: null,
  222. QuerySelf: true, // 是否只查询自己的待回访工单
  223. EmployeeName: null, // 回访人
  224. IsProvince: null, // 是否省工单
  225. FromPhone: null, //来电号码
  226. Contact: null, //联系电话
  227. ActualHandleOrgName: null, // 接办部门
  228. fbTime: [], // 发布时间
  229. StartPublishTime: null,
  230. EndPublishTime: null,
  231. OrgLevelOneName: null, // 一级部门
  232. IdentityType:null,
  233. },
  234. tableData: [], //表单
  235. loading: false, // 加载
  236. total: 0, // 总数
  237. visitTypeOptions: [],
  238. });
  239. const storesThemeConfig = useThemeConfig();
  240. const { themeConfig } = storeToRefs(storesThemeConfig);
  241. const requestParams = ref<EmptyObjectType>({});
  242. const gridOptions = reactive<any>({
  243. loading: false,
  244. border: true,
  245. showOverflow: true,
  246. columnConfig: {
  247. resizable: true,
  248. },
  249. scrollY: {
  250. enabled: true,
  251. gt: 100,
  252. },
  253. toolbarConfig: {
  254. zoom: true,
  255. custom: true,
  256. refresh: {
  257. queryMethod: () => {
  258. handleQuery();
  259. },
  260. },
  261. tools: [{ toolRender: { name: 'exportCurrent' } }, { toolRender: { name: 'exportAll' } }],
  262. slots: {
  263. buttons: 'toolbar_buttons',
  264. },
  265. },
  266. customConfig: {
  267. storage: true,
  268. },
  269. id: 'businessVisitTodo',
  270. rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
  271. height: 'auto',
  272. columns:[
  273. { type: 'checkbox', width: 50, align: 'center' },
  274. {
  275. field: 'order.expiredStatusText',
  276. title: '状态',
  277. width: 60,
  278. align: 'center',
  279. slots: {
  280. default: ({ row }) => {
  281. return <span class={'overdue-status-' + row.order?.expiredStatus} title={row.order.expiredStatusText}></span>;
  282. },
  283. },
  284. },
  285. { field: 'order.no', title: '工单编码', width: 140 },
  286. { field: 'order.isProvinceText', title: '省/市工单', width: 90 },
  287. {
  288. field: 'order.title',
  289. title: '工单标题',
  290. minWidth: 200,
  291. slots: { default: 'order_detail' },
  292. },
  293. { field: 'order.sourceChannel', title: '来源渠道', width: 110 },
  294. { field: 'visitStateText', title: '回访状态', width: 100 },
  295. { field: 'visitTypeText', title: '回访方式', width: 100 },
  296. { field: 'order.acceptType', title: '受理类型', width: 110 },
  297. { field: 'order.acceptorName', title: '受理人', width: 120 },
  298. { field: 'order.hotspotName', title: '热点分类', width: 150 },
  299. { field: 'order.orgLevelOneName', title: '一级部门', width: 150 },
  300. { field: 'order.actualHandleOrgName', title: '接办部门', width: 140 },
  301. {
  302. field: 'order.startTime',
  303. title: '受理时间',
  304. width: 160,
  305. formatter: 'formatDate',
  306. },
  307. {
  308. field: 'order.filedTime',
  309. title: '办结时间',
  310. width: 160,
  311. formatter: 'formatDate',
  312. },
  313. {
  314. field: 'publishTime',
  315. title: '发布时间',
  316. width: 160,
  317. formatter: 'formatDate',
  318. },
  319. {
  320. field: 'creationTime',
  321. title: '回访任务创建时间',
  322. width: 160,
  323. formatter: 'formatDate',
  324. },
  325. { field: 'employeeName', title: '回访人', width: 120 },
  326. { title: '操作', width: 80, fixed: 'right', align: 'center', slots: { default: 'action' } },
  327. ],
  328. data: [],
  329. params: {
  330. exportMethod: visitListExport,
  331. exportParams: requestParams,
  332. },
  333. sortConfig: {
  334. remote: true,
  335. },
  336. });
  337. const visitStateOptions = ref<EmptyArrayType>([
  338. { label: '待回访', value: 2 },
  339. { label: '短信回访中', value: 21 },
  340. { label: '短信不满意待回访', value: 41 },
  341. { label: '未接通', value: 51 },
  342. ]);
  343. if (themeConfig.value.appScope === 'YiBin') {
  344. visitStateOptions.value = [
  345. { label: '待回访', value: 2 },
  346. { label: '短信回访中', value: 21 },
  347. { label: '短信不满意待回访', value: 41 },
  348. { label: '未接通', value: 51 },
  349. { label: '智能回访中', value: 61 },
  350. ];
  351. } else {
  352. visitStateOptions.value = [
  353. { label: '待回访', value: 2 },
  354. { label: '短信回访中', value: 21 },
  355. { label: '短信不满意待回访', value: 41 },
  356. { label: '未接通', value: 51 },
  357. ];
  358. }
  359. const channelOptions = ref<EmptyArrayType>([]);
  360. // 获取基础数据
  361. const getBaseData = () => {
  362. visitSearchBaseData().then((res: any) => {
  363. state.visitTypeOptions = res.result?.visitType ?? [];
  364. channelOptions.value = res.result?.sourceChannel ?? [];
  365. });
  366. };
  367. // 手动查询,将页码设置为1
  368. const handleQuery = () => {
  369. state.queryParams.PageIndex = 1;
  370. queryList();
  371. };
  372. /** 获取列表 */
  373. const queryList = () => {
  374. return new Promise((resolve, reject) => {
  375. state.loading = true;
  376. gridOptions.loading = true;
  377. requestParams.value = Other.deepClone(state.queryParams);
  378. requestParams.value.StartPublishTime = state.queryParams.fbTime === null ? null : state.queryParams.fbTime[0];
  379. requestParams.value.EndPublishTime = state.queryParams.fbTime === null ? null : state.queryParams.fbTime[1];
  380. Reflect.deleteProperty(requestParams.value, 'fbTime');
  381. visitList(requestParams.value)
  382. .then((res: any) => {
  383. state.tableData = res.result?.items ?? [];
  384. gridOptions.data = state.tableData;
  385. state.total = res.result?.total ?? 0;
  386. state.loading = false;
  387. resolve(res);
  388. gridRef.value.clearCheckboxRow();
  389. checkTable.value = [];
  390. gridOptions.loading = false;
  391. })
  392. .catch(() => {
  393. state.loading = false;
  394. gridRef.value.clearCheckboxRow();
  395. checkTable.value = [];
  396. gridOptions.loading = false;
  397. reject();
  398. });
  399. });
  400. };
  401. /** 重置按钮操作 */
  402. const drawerRuleFormRef = ref();
  403. const ruleFormRef = ref<RefType>(); // 表单ref
  404. const drawer = ref(false);
  405. const resetQuery = (formEl: FormInstance | undefined) => {
  406. if (!formEl) return;
  407. formEl.resetFields();
  408. state.queryParams.QuerySelf = true;
  409. state.queryParams.IsProvince = null;
  410. fastSearch.value = 'all';
  411. ruleFormRef.value?.resetFields();
  412. queryList();
  413. };
  414. // 批量分配
  415. const assignReturnVisitorsRef = ref<RefType>();
  416. const multiplePeople = () => {
  417. const ids = checkTable.value.map((item: any) => item.id);
  418. assignReturnVisitorsRef.value.openDialog(ids);
  419. };
  420. // 回访
  421. const visitDetailRef = ref<RefType>();
  422. const onManpower = (row: any) => {
  423. visitDetailRef.value.openDialog(row);
  424. };
  425. // 平移功能
  426. const orderMigrationRef = ref<RefType>();
  427. const onMigration = () => {
  428. const ids = checkTable.value.map((item: any) => item.id);
  429. orderMigrationRef.value.openDialog('visitTodo', ids);
  430. };
  431. // 短信回访
  432. const messageVisit = () => {
  433. const ids = checkTable.value.map((item: any) => item.id);
  434. ElMessageBox.confirm(`您确定要选中的工单进行短信回访?`, '提示', {
  435. confirmButtonText: '确定',
  436. cancelButtonText: '取消',
  437. type: 'warning',
  438. draggable: true,
  439. autofocus: false,
  440. })
  441. .then(() => {
  442. visitSendSms({ ids })
  443. .then((res: any) => {
  444. ElMessage.success('操作成功');
  445. queryList();
  446. })
  447. .catch((e) => {
  448. console.log(e);
  449. });
  450. })
  451. .catch(() => {});
  452. };
  453. // 批量回访
  454. const visitBatchRef = ref<RefType>();
  455. const batchVisit = () => {
  456. const visit = checkTable.value.map((item: any) => {
  457. return {
  458. orderId: item.order?.id,
  459. visitId: item.id,
  460. no: item.order?.no,
  461. };
  462. });
  463. visitBatchRef.value.openDialog(visit);
  464. };
  465. const checkTable = ref<EmptyArrayType>([]);
  466. const gridRef = ref<RefType>();
  467. const selectAllChangeEvent = ({ checked }) => {
  468. if (gridRef.value) {
  469. const records = gridRef.value.getCheckboxRecords();
  470. checkTable.value = records;
  471. console.log(checked ? '所有勾选事件' : '所有取消事件', records);
  472. }
  473. };
  474. const selectChangeEvent = ({ checked }) => {
  475. if (gridRef.value) {
  476. const records = gridRef.value.getCheckboxRecords();
  477. checkTable.value = records;
  478. console.log(checked ? '勾选事件' : '取消事件', records);
  479. }
  480. };
  481. const isChecked = computed(() => {
  482. return !Boolean(checkTable.value.length);
  483. });
  484. onMounted(() => {
  485. queryList().then(() => {
  486. getBaseData();
  487. });
  488. });
  489. </script>