index.vue 5.7 KB

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