index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="business-end-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 inline>
  16. <el-form-item label="关键词" prop="Keyword">
  17. <el-input v-model="state.queryParams.Keyword" placeholder="工单编码/标题" clearable @keyup.enter="handleQuery" class="keyword-input" />
  18. </el-form-item>
  19. <el-form-item>
  20. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  21. <el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button" :loading="state.loading">
  22. <SvgIcon name="ele-Refresh" class="mr5" />重置
  23. </el-button>
  24. </el-form-item>
  25. </el-form>
  26. </template>
  27. <template #tableHeader="scope">
  28. <el-button type="primary" @click="oncancelEnd" v-auth="'business:order:end'" :disabled="!scope.isSelected">
  29. <SvgIcon name="ele-Stopwatch" class="mr5" />取消终结件<span v-if="proTableRef?.selectedList?.length">({{proTableRef?.selectedList?.length}})</span>
  30. </el-button>
  31. </template>
  32. <template #expiredStatusText="{ row }">
  33. <span :class="'overdue-status-' + row.order?.expiredStatus" :title="row.order?.expiredStatusText"></span>
  34. </template>
  35. <template #title="{ row }">
  36. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  37. </template>
  38. </ProTable>
  39. </div>
  40. </div>
  41. </template>
  42. <script setup lang="tsx" name="businessEnd">
  43. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  44. import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
  45. import { formatDate } from '@/utils/formatTime';
  46. import { useRouter } from 'vue-router';
  47. import { deleteEnd, endList } from '@/api/query/end';
  48. // 引入组件
  49. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  50. // 定义变量内容
  51. const ruleFormRef = ref<RefType>(); // 表单ref
  52. const router = useRouter(); // 路由
  53. const proTableRef = ref<RefType>(); // 表格ref
  54. // 表格配置项
  55. const columns = ref<any[]>([
  56. { type: 'selection', fixed: 'left', width: 40,align: 'center' },
  57. { prop: 'order.expiredStatusText', label: '超期状态', align: 'center',width: 80 },
  58. { prop: 'order.no', label: '工单编码', minWidth: 140 },
  59. { prop: 'order.sourceChannel', label: '来源渠道', minWidth: 100 },
  60. { prop: 'order.currentStepName', label: '当前节点', minWidth: 120 },
  61. { prop: 'order.isProvinceText', label: '省/市工单', minWidth: 90 },
  62. {
  63. prop: 'order.expiredTime',
  64. label: '工单期满时间',
  65. minWidth: 160,
  66. render: (scope: any) => {
  67. return <span>{formatDate(scope.row.order?.expiredTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  68. },
  69. },
  70. {
  71. prop: 'order.startTime',
  72. label: '受理时间',
  73. minWidth: 160,
  74. render: (scope: any) => {
  75. return <span>{formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  76. },
  77. },
  78. { prop: 'order.acceptType', label: '受理类型', minWidth: 100 },
  79. { prop: 'order.statusText', label: '工单状态', minWidth: 100 },
  80. { prop: 'order.title', label: '工单标题', minWidth: 200 },
  81. { prop: 'order.actualHandleOrgName', label: '接办部门', minWidth: 140 },
  82. {
  83. prop: 'order.actualHandleTime',
  84. label: '接办时间',
  85. minWidth: 160,
  86. render: (scope: any) => {
  87. return <span>{formatDate(scope.row.order?.actualHandleTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  88. },
  89. },
  90. { prop: 'order.hotspotName', label: '热点分类', minWidth: 150 },
  91. { prop: 'creatorOrgName', label: '设置部门', minWidth: 140 },
  92. { prop: 'creatorName', label: '设置人', minWidth: 120 },
  93. {
  94. prop: 'creationTime',
  95. label: '设置时间',
  96. minWidth: 160,
  97. render: (scope: any) => {
  98. return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  99. },
  100. }
  101. ]);
  102. const state = reactive({
  103. queryParams: {
  104. // 查询条件
  105. PageIndex: 1,
  106. PageSize: 20,
  107. Keyword: null, // 关键字
  108. },
  109. tableData: [], //表单
  110. loading: false, // 加载
  111. total: 0, // 总数
  112. });
  113. // 手动查询,将页码设置为1
  114. const handleQuery = () => {
  115. state.queryParams.PageIndex = 1;
  116. queryList();
  117. };
  118. /** 获取列表 */
  119. const queryList = () => {
  120. state.loading = true;
  121. endList(state.queryParams)
  122. .then((res) => {
  123. state.tableData = res?.result.items ?? [];
  124. state.total = res?.result.total;
  125. state.loading = false;
  126. })
  127. .finally(() => {
  128. state.loading = false;
  129. });
  130. };
  131. /** 重置按钮操作 */
  132. const resetQuery = (formEl: FormInstance | undefined) => {
  133. if (!formEl) return;
  134. formEl.resetFields();
  135. queryList();
  136. };
  137. // 取消终结件
  138. const oncancelEnd = () => {
  139. const ids = proTableRef.value.selectedList.map((item: any) => item.id);
  140. ElMessageBox.confirm(`选择的${proTableRef.value.selectedList.length}个工单取消终结件吗?`, '提示', {
  141. confirmButtonText: '确定',
  142. cancelButtonText: '取消',
  143. type: 'warning',
  144. draggable: true,
  145. autofocus: false,
  146. })
  147. .then(() => {
  148. deleteEnd({ ids }).then(() => {
  149. ElMessage.success('操作成功');
  150. queryList();
  151. });
  152. })
  153. .catch(() => {});
  154. };
  155. onMounted(() => {
  156. queryList();
  157. });
  158. </script>