index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <div class="todo-order-container layout-pd">
  3. <el-card shadow="never">
  4. <el-tabs v-model="state.queryParams.IsHandled" @tab-change="handleQuery">
  5. <el-tab-pane name="false" label="工单待办"></el-tab-pane>
  6. <el-tab-pane name="true" label="工单已办"></el-tab-pane>
  7. </el-tabs>
  8. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent>
  9. <el-row :gutter="20">
  10. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  11. <el-form-item label="工单标题" prop="Keyword">
  12. <el-input v-model="state.queryParams.Keyword" placeholder="工单标题" clearable @keyup.enter="handleQuery" />
  13. </el-form-item>
  14. </el-col>
  15. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  16. <el-form-item label="工单编码" prop="No">
  17. <el-input v-model="state.queryParams.No" placeholder="工单编码" clearable @keyup.enter="handleQuery" />
  18. </el-form-item>
  19. </el-col>
  20. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  21. <el-form-item label="生成时间" prop="scTime">
  22. <el-date-picker
  23. v-model="state.queryParams.scTime"
  24. type="datetimerange"
  25. unlink-panels
  26. range-separator="至"
  27. start-placeholder="开始时间"
  28. end-placeholder="结束时间"
  29. :shortcuts="shortcuts"
  30. @change="handleQuery"
  31. value-format="YYYY-MM-DD[T]HH:mm:ss"
  32. :default-time="defaultTimeStartEnd"
  33. />
  34. </el-form-item>
  35. </el-col>
  36. <transition name="el-zoom-in-top">
  37. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol">
  38. <el-form-item label="是否省工单" prop="IsProvince">
  39. <el-select v-model="state.queryParams.IsProvince" placeholder="请选择是否省工单" @change="handleQuery" class="w100">
  40. <el-option label="是" value="true" />
  41. <el-option label="否" value="false" />
  42. </el-select>
  43. </el-form-item>
  44. </el-col>
  45. </transition>
  46. <transition name="el-zoom-in-top">
  47. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol">
  48. <el-form-item label="是否会签" prop="IsCounterSign">
  49. <el-select v-model="state.queryParams.IsCounterSign" placeholder="请选择是否会签" @change="handleQuery" class="w100">
  50. <el-option label="是" value="true" />
  51. <el-option label="否" value="" />
  52. </el-select>
  53. </el-form-item>
  54. </el-col>
  55. </transition>
  56. <transition name="el-zoom-in-top">
  57. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol">
  58. <el-form-item label="超期状态" prop="ExpiredOrAlmostOverdue">
  59. <el-select v-model="state.queryParams.ExpiredOrAlmostOverdue" placeholder="请选择超期状态" @change="handleQuery" class="w100">
  60. <el-option label="已超期" value="true" />
  61. <el-option label="即将超期" value="false" />
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. </transition>
  66. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  67. <el-form-item label="">
  68. <div class="flex-end w100">
  69. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  70. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  71. <SvgIcon name="ele-Refresh" class="mr5" />重置
  72. </el-button>
  73. <el-button link type="primary" @click="closeSearch" :loading="state.loading">
  74. {{ searchCol ? '展开' : '收起' }}
  75. <SvgIcon :class="{ 'is-reverse': searchCol }" name="ele-ArrowUp" class="mr5 arrow" size="18px" />
  76. </el-button>
  77. </div>
  78. </el-form-item>
  79. </el-col>
  80. </el-row>
  81. </el-form>
  82. <!-- 表格 -->
  83. <!-- :toolButton="['refresh', 'setting', 'exportCurrent', 'exportAll']"-->
  84. <ProTable
  85. ref="proTableRef"
  86. :columns="columns"
  87. :data="state.tableData"
  88. @updateTable="queryList"
  89. :loading="state.loading"
  90. :total="state.total"
  91. v-model:page-index="state.queryParams.PageIndex"
  92. v-model:page-size="state.queryParams.PageSize"
  93. :key="Math.random()"
  94. @export-current="exportTable($event)"
  95. @export-all="exportTable($event, true)"
  96. >
  97. <template #tableHeader="scope">
  98. <el-button type="primary" @click="onJbExport" :disabled="!scope.isSelected" :loading="state.loading" v-auth="'todo:seats:jbdExport'"
  99. ><SvgIcon name="iconfont icon-daochu" class="mr5" />交办单导出
  100. </el-button>
  101. </template>
  102. <template #expiredStatusText="{ row }">
  103. <span :class="'overdue-status-' + row.expiredStatus" :title="row.expiredStatusText"></span>
  104. </template>
  105. <template #title="{ row }">
  106. <order-detail :order="row" @updateList="queryList">{{ row.title }}</order-detail>
  107. </template>
  108. <!-- 表格操作 -->
  109. <template #operation="{ row }">
  110. <order-detail :order="row" @updateList="queryList" />
  111. </template>
  112. </ProTable>
  113. </el-card>
  114. </div>
  115. </template>
  116. <script setup lang="tsx" name="todoOrder">
  117. import { defineAsyncComponent, onMounted, reactive, ref,onActivated, onBeforeUnmount } from 'vue';
  118. import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
  119. import { formatDate } from '@/utils/formatTime';
  120. import { useRouter } from 'vue-router';
  121. import { orderListTodo } from '@/api/todo/order';
  122. import { exportJbOrder, exportOrder } from "@/api/business/order";
  123. import { downloadFileByStream, downloadZip } from "@/utils/tools";
  124. import { defaultDateThree, defaultTimeStartEnd, shortcuts } from "@/utils/constants";
  125. import Other from '@/utils/other';
  126. import mittBus from "@/utils/mitt";
  127. // 引入组件
  128. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  129. // 定义变量内容
  130. const state = reactive<any>({
  131. queryParams: {
  132. // 查询条件
  133. PageIndex: 1, // 当前页
  134. PageSize: 10, // 每页条数
  135. IsHandled: 'false', // 工单状态
  136. Keyword: null, // 工单标题
  137. No: null, // 工单编码
  138. IsProvince: null, // 是否省工单
  139. IsCounterSign: null, // 是否会签
  140. ExpiredOrAlmostOverdue: null, // 超期状态
  141. scTime: defaultDateThree,
  142. StartTime: null,
  143. EndTime: null,
  144. },
  145. tableData: [], //表单
  146. loading: false, // 加载
  147. total: 0, // 总数
  148. });
  149. const ruleFormRef = ref<RefType>(); // 表单ref
  150. const searchCol = ref(true); // 展开/收起
  151. // 展开/收起
  152. const closeSearch = () => {
  153. searchCol.value = !searchCol.value;
  154. };
  155. const router = useRouter(); // 路由
  156. const proTableRef = ref<RefType>(); // 表格ref
  157. // 表格配置项
  158. const columns = ref<any[]>([]);
  159. const columnsTodo = [
  160. { type: 'selection', fixed: 'left', width: 55, align: 'center' },
  161. { prop: 'expiredStatusText', label: '超期状态', align: 'center', width: 80 },
  162. { prop: 'no', label: '工单编码', width: 150 },
  163. { prop: 'isProvinceText', label: '省/市工单', width: 100 },
  164. // { prop: 'emergencyLevelText', label: '是否紧急'},
  165. { prop: 'actualHandleStepName', label: '办理节点', width: 150 },
  166. { prop: 'statusText', label: '工单状态', width: 100 },
  167. { prop: 'title', label: '工单标题', width: 300 },
  168. { prop: 'counterSignTypeText', label: '是否会签', width: 100 },
  169. {
  170. prop: 'creationTime',
  171. label: '生成时间',
  172. width: 170,
  173. render: (scope) => {
  174. return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  175. },
  176. },
  177. {
  178. prop: 'startTime',
  179. label: '受理时间',
  180. width: 170,
  181. render: (scope) => {
  182. return <span>{formatDate(scope.row.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  183. },
  184. },
  185. {
  186. prop: 'expiredTime',
  187. label: '工单期满时间',
  188. width: 170,
  189. render: (scope) => {
  190. return <span>{formatDate(scope.row.expiredTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  191. },
  192. },
  193. { prop: 'acceptType', label: '受理类型', width: 150 },
  194. { prop: 'sourceChannel', label: '来源方式', width: 100 },
  195. { prop: 'hotspotName', label: '热点分类', width: 200 },
  196. { prop: 'acceptorName', label: '受理人', width: 120 },
  197. {
  198. prop: 'reTransactNum',
  199. label: '重办次数',
  200. },
  201. { prop: 'operation', label: '操作', fixed: 'right', width: 140, align: 'center' },
  202. ];
  203. const columnsDone = [
  204. // 已办
  205. { type: 'selection', fixed: 'left', width: 55, align: 'center' },
  206. { prop: 'expiredStatusText', label: '超期状态', align: 'center', width: 80 },
  207. { prop: 'no', label: '工单编码', width: 150 },
  208. { prop: 'isProvinceText', label: '省/市工单', width: 100 },
  209. { prop: 'actualHandleStepName', label: '办理节点', width: 150 },
  210. { prop: 'statusText', label: '工单状态', width: 100 },
  211. { prop: 'title', label: '工单标题', width: 300 },
  212. { prop: 'counterSignTypeText', label: '是否会签', width: 100 },
  213. {
  214. prop: 'creationTime',
  215. label: '生成时间',
  216. width: 170,
  217. render: (scope) => {
  218. return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  219. },
  220. },
  221. {
  222. prop: 'startTime',
  223. label: '受理时间',
  224. width: 170,
  225. render: (scope) => {
  226. return <span>{formatDate(scope.row.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  227. },
  228. },
  229. {
  230. prop: 'expiredTime',
  231. label: '工单期满时间',
  232. width: 170,
  233. render: (scope) => {
  234. return <span>{formatDate(scope.row.expiredTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  235. },
  236. },
  237. { prop: 'orgLevelOneName', label: '一级部门', width: 150 },
  238. { prop: 'actualHandleOrgName', label: '接办部门', width: 150 },
  239. { prop: 'acceptType', label: '受理类型', width: 150 },
  240. { prop: 'sourceChannel', label: '来源方式', width: 100 },
  241. { prop: 'hotspotName', label: '热点分类', width: 200 },
  242. { prop: 'acceptorName', label: '受理人', width: 120 },
  243. {
  244. prop: 'reTransactNum',
  245. label: '重办次数',
  246. },
  247. { prop: 'operation', label: '操作', fixed: 'right', width: 140, align: 'center' },
  248. ];
  249. // 手动查询,将页码设置为1
  250. const handleQuery = () => {
  251. state.queryParams.PageIndex = 1;
  252. queryList();
  253. };
  254. /** 获取列表 */
  255. const queryList = async () => {
  256. try {
  257. state.loading = true;
  258. if (state.queryParams.IsHandled === 'true') {
  259. columns.value = columnsDone;
  260. } else {
  261. columns.value = columnsTodo;
  262. }
  263. let request = Other.deepClone(state.queryParams);
  264. request.StartTime = state.queryParams.scTime === null ? null : state.queryParams.scTime[0];
  265. request.EndTime = state.queryParams.scTime === null ? null : state.queryParams.scTime[1];
  266. Reflect.deleteProperty(request, 'scTime');
  267. const res: any = await orderListTodo(request);
  268. state.tableData = res.result?.items ?? [];
  269. state.total = res.result?.total ?? 0;
  270. state.loading = false;
  271. } catch (e) {
  272. state.loading = false;
  273. }
  274. };
  275. /** 重置按钮操作 */
  276. const resetQuery = (formEl: FormInstance | undefined) => {
  277. if (!formEl) return;
  278. formEl.resetFields();
  279. queryList();
  280. };
  281. // 交办单导出
  282. const onJbExport = () => {
  283. const ids = proTableRef.value.selectedList.map((item: any) => item.id);
  284. ElMessageBox.confirm(`您确定导出选中的${proTableRef.value.selectedList.length}个工单的交办单,是否继续?`, '提示', {
  285. confirmButtonText: '确认',
  286. cancelButtonText: '取消',
  287. type: 'warning',
  288. draggable: true,
  289. cancelButtonClass: 'default-button',
  290. autofocus: false,
  291. })
  292. .then(() => {
  293. state.loading = true;
  294. exportJbOrder(ids)
  295. .then((res: any) => {
  296. downloadZip(res);
  297. state.loading = false;
  298. ElMessage.success('导出成功');
  299. })
  300. .catch(() => {
  301. state.loading = false;
  302. });
  303. })
  304. .catch(() => {});
  305. };
  306. // 表格导出
  307. const exportTable = (val: any, isExportAll = false) => {
  308. const columnInfos = val.map((item: any) => {
  309. return {
  310. prop: item.prop,
  311. name: item.label,
  312. };
  313. });
  314. const req = {
  315. queryDto: { ...state.queryParams },
  316. columnInfos,
  317. isExportAll,
  318. };
  319. state.loading = true;
  320. exportOrder(req)
  321. .then((res: any) => {
  322. state.loading = false;
  323. downloadFileByStream(res);
  324. })
  325. .catch(() => {
  326. state.loading = false;
  327. });
  328. };
  329. const historyParams = history.state;
  330. onMounted(() => {
  331. if (historyParams.IsCountersign) {
  332. // 会签待办
  333. // 先重置其他查询条件
  334. ruleFormRef.value.resetFields();
  335. state.queryParams = { ...state.queryParams, IsCountersign: historyParams.IsCountersign };
  336. }
  337. if (historyParams.ExpiredOrAlmostOverdue) {
  338. // 即将超期 已超期
  339. ruleFormRef.value.resetFields();
  340. state.queryParams = { ...state.queryParams, ExpiredOrAlmostOverdue: historyParams.ExpiredOrAlmostOverdue };
  341. }
  342. queryList();
  343. });
  344. onActivated(() => {
  345. mittBus.on('clearCachePage', () => {
  346. //清除缓存
  347. queryList();
  348. });
  349. });
  350. onBeforeUnmount(() => {
  351. mittBus.off('clearCachePage');
  352. });
  353. </script>
  354. <style scoped lang="scss">
  355. .todo-order-container {
  356. .arrow {
  357. transition: transform var(--el-transition-duration);
  358. cursor: pointer;
  359. }
  360. .arrow.is-reverse {
  361. transform: rotateZ(-180deg);
  362. }
  363. }
  364. </style>