index.vue 13 KB

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