todo.vue 17 KB

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