index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <div class="todo-center-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <ProTable
  5. ref="proTableRef"
  6. :columns="columns"
  7. :data="state.tableData"
  8. @updateTable="queryList"
  9. :loading="state.loading"
  10. :total="state.total"
  11. v-model:page-index="state.queryParams.PageIndex"
  12. v-model:page-size="state.queryParams.PageSize"
  13. @sort-change="sortChange"
  14. >
  15. <template #table-search>
  16. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent class="mb10" inline>
  17. <el-form-item label="工单标题" prop="Title">
  18. <el-input v-model="state.queryParams.Title" placeholder="工单标题" clearable @keyup.enter="handleQuery" class="keyword-input" />
  19. </el-form-item>
  20. <el-form-item label="工单编码" prop="No">
  21. <el-input v-model="state.queryParams.No" placeholder="工单编码" clearable @keyup.enter="handleQuery" class="keyword-input" />
  22. </el-form-item>
  23. <el-form-item label="">
  24. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  25. <el-button @click="drawer = true" class="default-button"> <SvgIcon name="ele-Search" class="mr5" />更多查询</el-button>
  26. </el-form-item>
  27. </el-form>
  28. </template>
  29. <template #tableHeader="scope">
  30. <el-button type="primary" @click="onJbExport" :disabled="!scope.isSelected" :loading="state.loading" v-auth="'todo:center:jbdExport'"
  31. ><SvgIcon name="iconfont icon-daochu" class="mr5" />交办单导出<span v-if="proTableRef?.selectedList?.length">({{proTableRef?.selectedList?.length}})</span>
  32. </el-button>
  33. <el-button type="primary" @click="onToEnd" :disabled="!scope.isSelected" :loading="state.loading" v-auth="'todo:center:toEnd:multiple'"
  34. ><SvgIcon name="ele-List" class="mr5" />批量归档<span v-if="proTableRef?.selectedList?.length">({{proTableRef?.selectedList?.length}})</span>
  35. </el-button>
  36. <el-button type="primary" @click="onAssignOrders" :loading="state.loading" v-auth="'todo:center:assignOrders'"
  37. ><SvgIcon name="ele-List" class="mr5" />分配工单
  38. </el-button>
  39. </template>
  40. <template #expiredStatusText="{ row }">
  41. <span :class="'overdue-status-' + row.expiredStatus" :title="row.expiredStatusText"></span>
  42. </template>
  43. <template #title="{ row }">
  44. <order-detail :order="row" @updateList="queryList">{{ row.title }}</order-detail>
  45. </template>
  46. <!-- 表格操作 -->
  47. <template #operation="{ row }">
  48. <el-button link type="primary" @click="onSign(row)" title="签收工单" v-if="row.canSign" v-auth="'todo:center:sign'"> 签收 </el-button>
  49. <el-button link type="success" @click="onOrderEdit(row)" title="编辑工单" v-if="row.canEdit" v-auth="'todo:center:edit'"> 修改 </el-button>
  50. <el-button link type="primary" @click="onMigration(row)" title="平级移动" v-auth="'todo:center:migration'"> 平级移动 </el-button>
  51. </template>
  52. </ProTable>
  53. </div>
  54. <!-- 工单平移 -->
  55. <order-migration ref="orderMigrationRef" @updateList="queryList" />
  56. <!-- 批量归档 -->
  57. <to-end ref="toEndOrderRef" @updateList="queryList" />
  58. <!-- 更多查询 -->
  59. <el-drawer v-model="drawer" title="更多查询" size="500px">
  60. <el-form :model="state.queryParams" ref="drawerRuleFormRef" @submit.native.prevent label-width="100px">
  61. <el-form-item label="生成时间" prop="scTime">
  62. <el-date-picker
  63. v-model="state.queryParams.scTime"
  64. type="datetimerange"
  65. unlink-panels
  66. range-separator="至"
  67. start-placeholder="开始时间"
  68. end-placeholder="结束时间"
  69. :shortcuts="shortcuts"
  70. @change="handleQuery"
  71. value-format="YYYY-MM-DD[T]HH:mm:ss"
  72. :default-time="defaultTimeStartEnd"
  73. />
  74. </el-form-item>
  75. <el-form-item label="受理时间" prop="slTime">
  76. <el-date-picker
  77. v-model="state.queryParams.slTime"
  78. type="datetimerange"
  79. unlink-panels
  80. range-separator="至"
  81. start-placeholder="开始时间"
  82. end-placeholder="结束时间"
  83. :shortcuts="shortcuts"
  84. @change="handleQuery"
  85. value-format="YYYY-MM-DD[T]HH:mm:ss"
  86. :default-time="defaultTimeStartEnd"
  87. />
  88. </el-form-item>
  89. <el-form-item label="当前节点" prop="StepName">
  90. <el-select v-model="state.queryParams.StepName" placeholder="请选择当前节点" clearable class="w100" @change="handleQuery">
  91. <el-option v-for="item in state.stepNamesOptions" :value="item" :key="item" :label="item" />
  92. </el-select>
  93. </el-form-item>
  94. <el-form-item label="派单员" prop="CenterToOrgHandlerName">
  95. <el-input v-model="state.queryParams.CenterToOrgHandlerName" placeholder="派单员" clearable @keyup.enter="handleQuery" />
  96. </el-form-item>
  97. <el-form-item label="是否紧急" prop="IsUrgent">
  98. <el-select v-model="state.queryParams.IsUrgent" placeholder="请选择是否紧急" clearable class="w100" @change="handleQuery">
  99. <el-option :value="true" label="紧急" />
  100. <el-option :value="false" label="不紧急" />
  101. </el-select>
  102. </el-form-item>
  103. <el-form-item label="接办部门" prop="ActualHandleOrgName">
  104. <el-input v-model="state.queryParams.ActualHandleOrgName" placeholder="接办部门名称" clearable @keyup.enter="handleQuery" />
  105. </el-form-item>
  106. <el-form-item label="工单状态" prop="Status">
  107. <el-select v-model="state.queryParams.Status" placeholder="请选择工单状态" clearable class="w100" @change="handleQuery">
  108. <el-option v-for="item in state.orderStatusOptions" :value="item.key" :key="item.key" :label="item.value" />
  109. </el-select>
  110. </el-form-item>
  111. <el-form-item label="受理人" prop="AcceptorName">
  112. <el-input v-model="state.queryParams.AcceptorName" placeholder="受理人" clearable @keyup.enter="handleQuery" />
  113. </el-form-item>
  114. <el-form-item label="超期状态" prop="ExpiredStatus">
  115. <el-select v-model="state.queryParams.ExpiredStatus" placeholder="请选择超期状态" clearable class="w100" @change="handleQuery">
  116. <el-option v-for="item in state.expiredStatusOptions" :value="item.key" :key="item.key" :label="item.value" />
  117. </el-select>
  118. </el-form-item>
  119. </el-form>
  120. <template #footer>
  121. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  122. <el-button @click="resetQuery(drawerRuleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
  123. </template>
  124. </el-drawer>
  125. </div>
  126. </template>
  127. <script setup lang="tsx" name="todoCenter">
  128. import { defineAsyncComponent, onActivated, onBeforeUnmount, onMounted, reactive, ref } from 'vue';
  129. import type { FormInstance } from 'element-plus';
  130. import { ElMessage, ElMessageBox } from 'element-plus';
  131. import { defaultTimeStartEnd, shortcuts } from '@/utils/constants';
  132. import other from '@/utils/other';
  133. import { useRouter } from 'vue-router';
  134. import { formatDate } from '@/utils/formatTime';
  135. import { centerTodo, centerTodoBase } from '@/api/todo/center';
  136. import { orderAverage, orderSign } from '@/api/todo/order';
  137. import { exportJbOrder } from '@/api/business/order';
  138. import { downloadZip } from '@/utils/tools';
  139. import mittBus from '@/utils/mitt';
  140. // 引入组件
  141. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  142. const OrderMigration = defineAsyncComponent(() => import('@/views/todo/center/Order-migration.vue')); // 工单平移
  143. const ToEnd = defineAsyncComponent(() => import('@/views/todo/center/components/To-end.vue')); // 批量归档
  144. // 定义变量内容
  145. const state = reactive<any>({
  146. queryParams: {
  147. PageIndex: 1, // 当前页
  148. PageSize: 20, // 每页条数
  149. Title: null, // 标题
  150. No: null, // 工单编号
  151. scTime: [], // 生成时间
  152. StCreationTime: null, // 生成开始时间
  153. EnCreationTime: null, // 生成结束时间
  154. slTime: [], // 受理时间
  155. StartTimeSt: null, // 受理开始时间
  156. StartTimeEnd: null, // 受理结束时间
  157. AcceptorName: null, // 受理人
  158. ActualHandleOrgName: null, // 接办部门
  159. Status: null, // 工单状态
  160. ExpiredStatus: null, // 超期状态
  161. StepName: null, // 当前节点名称
  162. IsUrgent: null,
  163. CenterToOrgHandlerName: null, // 派单员
  164. SortField:null,
  165. SortRule:null,
  166. },
  167. tableData: [], //表单
  168. loading: false, // 加载
  169. total: 0, // 总数
  170. expiredStatusOptions: [], //超期状态
  171. orderStatusOptions: [], //工单状态
  172. stepNamesOptions: [], //步骤名称
  173. });
  174. const router = useRouter(); // 路由
  175. const proTableRef = ref<RefType>(); // 表格ref
  176. // 表格配置项
  177. const columns = ref<any[]>([
  178. { type: 'selection', minWidth: 40, align: 'center' },
  179. { prop: 'expiredStatusText', label: '超期状态', minWidth: 80, align: 'center' },
  180. { prop: 'no', label: '工单编码', minWidth: 140 },
  181. { prop: 'isProvinceText', label: '省/市工单', minWidth: 90 },
  182. {
  183. prop: 'isUrgentText',
  184. label: '是否紧急',
  185. render: (scope:any) => {
  186. return <span class="color-danger font-bold">{scope.row.isUrgentText}</span>;
  187. },
  188. },
  189. { prop: 'currentStepName', label: '当前节点', minWidth: 120 },
  190. { prop: 'statusText', label: '工单状态', minWidth: 100 },
  191. { prop: 'title', label: '工单标题', minWidth: 200 },
  192. { prop: 'centerToOrgHandlerName', label: '派单员', minWidth: 120 },
  193. {
  194. prop: 'startTime',
  195. label: '受理时间',
  196. minWidth: 160,
  197. render: (scope:any) => {
  198. return <span>{formatDate(scope.row.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  199. },
  200. sortable: 'custom',
  201. },
  202. {
  203. prop: 'expiredTime',
  204. label: '工单期满时间',
  205. minWidth: 160,
  206. render: (scope:any) => {
  207. return <span>{formatDate(scope.row.expiredTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  208. },
  209. sortable: 'custom',
  210. },
  211. {
  212. prop: 'filedTime',
  213. label: '办结时间',
  214. minWidth: 160,
  215. render: (scope:any) => {
  216. return <span>{formatDate(scope.row.filedTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  217. },
  218. sortable: 'custom',
  219. },
  220. { prop: 'orgLevelOneName', label: '一级部门', minWidth: 140 },
  221. { prop: 'actualHandleOrgName', label: '接办部门', minWidth: 140 },
  222. { prop: 'acceptType', label: '受理类型', minWidth: 100 },
  223. { prop: 'counterSignTypeText', label: '是否会签', minWidth: 90 },
  224. { prop: 'sourceChannel', label: '来源渠道', minWidth: 100 },
  225. { prop: 'hotspotName', label: '热点分类', minWidth: 150 },
  226. {
  227. prop: 'sensitive',
  228. label: '敏感词',
  229. minWidth: 150,
  230. },
  231. { prop: 'acceptorName', label: '受理人', minWidth: 120 },
  232. {
  233. prop: 'reTransactNum',
  234. label: '重办次数',
  235. },
  236. { prop: 'operation', label: '操作', fixed: 'right', minWidth: 140, align: 'center' },
  237. ]);
  238. // 获取查询条件基础信息
  239. const getBaseData = async () => {
  240. try {
  241. const res: any = await centerTodoBase();
  242. const mappings: any = {
  243. expiredStatusOptions: 'expiredStatus',
  244. orderStatusOptions: 'orderStatus',
  245. stepNamesOptions: 'stepNames',
  246. };
  247. for (const key in mappings) {
  248. state[key] = res.result?.[mappings[key]] ?? [];
  249. }
  250. } catch (error) {
  251. console.log(error);
  252. }
  253. };
  254. // 排序
  255. const sortChange = (val: any) => {
  256. state.queryParams.SortField = val.order ? val.prop : null;
  257. // 0 升序 1 降序
  258. state.queryParams.SortRule = val.order ? (val.order == 'descending' ? 1 : 0) : null;
  259. handleQuery();
  260. };
  261. // 手动查询,将页码设置为1
  262. const handleQuery = () => {
  263. state.queryParams.PageIndex = 1;
  264. queryList();
  265. };
  266. /** 获取列表 */
  267. const requestParams = ref<EmptyObjectType>({});
  268. const queryList = () => {
  269. requestParams.value = other.deepClone(state.queryParams);
  270. requestParams.value.StCreationTime = state.queryParams.scTime === null ? null : state.queryParams.scTime[0];
  271. requestParams.value.EndCreationTime = state.queryParams.scTime === null ? null : state.queryParams.scTime[1];
  272. Reflect.deleteProperty(requestParams.value, 'scTime');
  273. requestParams.value.StartTimeSt = state.queryParams.slTime === null ? null : state.queryParams.slTime[0];
  274. requestParams.value.StartTimeEnd = state.queryParams.slTime === null ? null : state.queryParams.slTime[1];
  275. Reflect.deleteProperty(requestParams.value, 'slTime');
  276. state.loading = true;
  277. centerTodo(requestParams.value)
  278. .then((response: any) => {
  279. state.tableData = response?.result.items ?? [];
  280. state.total = response?.result.total;
  281. state.loading = false;
  282. })
  283. .catch(() => {
  284. state.loading = false;
  285. });
  286. };
  287. /** 重置按钮操作 */
  288. const drawerRuleFormRef = ref();
  289. const ruleFormRef = ref<RefType>(); // 表单ref
  290. const drawer = ref(false);
  291. const resetQuery = (formEl: FormInstance | undefined) => {
  292. if (!formEl) return;
  293. formEl.resetFields();
  294. ruleFormRef.value?.resetFields();
  295. queryList();
  296. };
  297. // 签收工单
  298. const onSign = (row: any) => {
  299. ElMessageBox.confirm(`您确定要要签收【${row.title}】,是否继续?`, '提示', {
  300. confirmButtonText: '确认',
  301. cancelButtonText: '取消',
  302. type: 'warning',
  303. draggable: true,
  304. cancelButtonClass: 'default-button',
  305. autofocus: false,
  306. })
  307. .then(() => {
  308. orderSign(row.id).then(() => {
  309. ElMessage.success('签收成功');
  310. queryList();
  311. });
  312. })
  313. .catch(() => {});
  314. };
  315. // 编辑工单
  316. const onOrderEdit = (row: any) => {
  317. router.push({
  318. name: 'orderAccept',
  319. query: {
  320. id: row.id,
  321. tagsViewName: `编辑工单-${row.title}`,
  322. },
  323. });
  324. };
  325. // 交办单导出
  326. const onJbExport = () => {
  327. const ids = proTableRef.value.selectedList.map((item: any) => item.id);
  328. ElMessageBox.confirm(`您确定导出选中的${proTableRef.value.selectedList.length}个工单的交办单,是否继续?`, '提示', {
  329. confirmButtonText: '确认',
  330. cancelButtonText: '取消',
  331. type: 'warning',
  332. draggable: true,
  333. cancelButtonClass: 'default-button',
  334. autofocus: false,
  335. })
  336. .then(() => {
  337. state.loading = true;
  338. exportJbOrder(ids)
  339. .then((res: any) => {
  340. downloadZip(res);
  341. state.loading = false;
  342. ElMessage.success('导出成功');
  343. })
  344. .catch(() => {
  345. state.loading = false;
  346. });
  347. })
  348. .catch(() => {});
  349. };
  350. // 平移功能
  351. const orderMigrationRef = ref<RefType>();
  352. const onMigration = (row: any) => {
  353. orderMigrationRef.value.openDialog('centerTodo', row);
  354. };
  355. // 分配工单
  356. const onAssignOrders = () => {
  357. ElMessageBox.confirm(`您确定分配工单,是否继续?`, '提示', {
  358. confirmButtonText: '确认',
  359. cancelButtonText: '取消',
  360. type: 'warning',
  361. draggable: true,
  362. cancelButtonClass: 'default-button',
  363. autofocus: false,
  364. })
  365. .then(() => {
  366. state.loading = true;
  367. orderAverage()
  368. .then(() => {
  369. state.loading = false;
  370. ElMessage.success('分配成功');
  371. handleQuery();
  372. })
  373. .catch(() => {
  374. state.loading = false;
  375. });
  376. })
  377. .catch(() => {});
  378. };
  379. // 批量归档
  380. const toEndOrderRef = ref<RefType>();
  381. const onToEnd = ()=>{
  382. toEndOrderRef.value.openDialog();
  383. }
  384. onMounted(() => {
  385. getBaseData();
  386. queryList();
  387. });
  388. onActivated(() => {
  389. mittBus.on('clearCachePage', () => {
  390. //清除缓存
  391. queryList();
  392. });
  393. });
  394. onBeforeUnmount(() => {
  395. mittBus.off('clearCachePage');
  396. });
  397. </script>