index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div class="quality-container layout-pd">
  3. <el-card shadow="never">
  4. <el-tabs v-model="state.queryParams.Source" @tab-change="handleQuery">
  5. <el-tab-pane :label="item.value" :name="item.key" v-for="item in qualitySourceOptions" :key="item.key"></el-tab-pane>
  6. </el-tabs>
  7. <el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent>
  8. <el-form-item label="关键词" prop="Keyword">
  9. <el-input v-model="state.queryParams.Keyword" placeholder="关键词" clearable @keyup.enter="handleQuery" class="keyword-input" />
  10. </el-form-item>
  11. <el-form-item label="创建时间" prop="exTime">
  12. <el-date-picker
  13. v-model="state.queryParams.exTime"
  14. type="datetimerange"
  15. unlink-panels
  16. range-separator="至"
  17. start-placeholder="开始时间"
  18. end-placeholder="结束时间"
  19. :shortcuts="shortcuts"
  20. @change="timeStartChangeCr"
  21. value-format="YYYY-MM-DD[T]HH:mm:ss"
  22. :default-time="defaultTimeStartEnd"
  23. />
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  27. <el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
  28. </el-form-item>
  29. </el-form>
  30. <ProTable
  31. ref="proTableRef"
  32. :columns="columns"
  33. :data="state.tableData"
  34. @updateTable="queryList"
  35. :loading="state.loading"
  36. :total="state.total"
  37. v-model:page-index="state.queryParams.PageIndex"
  38. v-model:page-size="state.queryParams.PageSize"
  39. :key="Math.random()"
  40. >
  41. <template #title="{ row }">
  42. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  43. </template>
  44. <!-- 表格操作 -->
  45. <template #operation="{ row }">
  46. <el-button link type="primary" @click="onQualityInspection(row)" v-auth="'quality:inspection'" title="质检"> 质检 </el-button>
  47. <order-detail :order="row.order" />
  48. </template>
  49. </ProTable>
  50. </el-card>
  51. <!-- 质检 -->
  52. <quality-inspection ref="qualityInspectionRef" @updateList="queryList" />
  53. </div>
  54. </template>
  55. <script lang="tsx" setup name="quality">
  56. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  57. import { FormInstance } from 'element-plus';
  58. import { formatDate } from '@/utils/formatTime';
  59. import { qualityBaseData, qualityList } from '@/api/quality';
  60. import { defaultTimeStartEnd, shortcuts } from "@/utils/constants";
  61. // 引入组件
  62. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  63. const QualityInspection = defineAsyncComponent(() => import('@/views/quality/index/components/Quality-inspection.vue')); // 质检
  64. const proTableRef = ref<RefType>(); // 表格ref
  65. // 表格配置项
  66. const columns = ref<any[]>([
  67. { prop: 'order.no', label: '工单编码', width: 150 },
  68. { prop: 'aiQuality', label: '质检方式', width: 100, render: (scope: any) => (scope.row.aiQuality ? '智能质检' : '人工质检') },
  69. { prop: 'order.sourceChannel', label: '来源渠道' },
  70. { prop: 'order.startTime', label: '受理时间', width: 170, render: (scope: any) => formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS') },
  71. { prop: 'order.acceptType', label: '受理类型' },
  72. { prop: 'order.statusText', label: '工单状态' },
  73. { prop: 'order.title', label: '工单标题', width: 300 },
  74. { prop: 'order.hotspotName', label: '热点分类' },
  75. { prop: 'order.acceptorName',label: '受理人',width: 120},
  76. { prop: 'order.fromPhone', label: '来电电话', width: 120 },
  77. {label: '操作',width: 140,fixed: 'right',align: 'center',prop: 'operation'}
  78. ]);
  79. // 定义变量内容
  80. const state = reactive({
  81. loading: false, // 加载状态
  82. queryParams: {
  83. // 查询参数
  84. PageIndex: 1,
  85. PageSize: 10,
  86. Source: 1, // 受理待质检
  87. CreationTimeStart: null, // 创建时间 开始
  88. CreationTimeEnd: null, // 创建时间 结束
  89. exTime: [], // 办理期限
  90. State: 0, // 待质检
  91. Keyword: null,
  92. },
  93. total: 0, // 总条数
  94. tableData: [], // 表格数据
  95. });
  96. const ruleFormRef = ref<RefType>(null); // 表单ref
  97. const qualitySourceOptions = ref<EmptyArrayType>([]); // 违禁词分类
  98. const qualityStateOptions = ref<EmptyArrayType>([]); // 违禁词属性
  99. const getBaseData = async () => {
  100. try {
  101. const res = await qualityBaseData();
  102. qualitySourceOptions.value = res.result?.qualitySource ?? [];
  103. qualityStateOptions.value = res.result?.qualityState ?? [];
  104. } catch (error) {
  105. console.log(error);
  106. }
  107. };
  108. const handleTimeChange = (val: string[], startKey: string, endKey: string) => {
  109. if (val) {
  110. state.queryParams[startKey] = val[0];
  111. state.queryParams[endKey] = val[1];
  112. } else {
  113. state.queryParams[startKey] = null;
  114. state.queryParams[endKey] = null;
  115. }
  116. handleQuery()
  117. };
  118. // 甄别时间
  119. const timeStartChangeCr = (val: string[]) => {
  120. handleTimeChange(val, 'CreationTimeStart', 'CreationTimeEnd');
  121. };
  122. // 受理待质检表头
  123. const acceptQualityColumns = [
  124. { prop: 'order.no', label: '工单编码', width: 150 },
  125. { prop: 'aiQuality', label: '质检方式', width: 100, render: (scope: any) => (scope.row.aiQuality ? '智能质检' : '人工质检') },
  126. { prop: 'order.sourceChannel', label: '来源渠道' },
  127. { prop: 'order.startTime', label: '受理时间', width: 170, render: (scope: any) => formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS') },
  128. { prop: 'order.acceptType', label: '受理类型' },
  129. { prop: 'order.statusText', label: '工单状态' },
  130. { prop: 'order.title', label: '工单标题', width: 300 },
  131. { prop: 'order.hotspotName', label: '热点分类' },
  132. {
  133. prop: 'order.acceptorName',
  134. label: '受理人',
  135. width: 120,
  136. },
  137. { prop: 'order.fromPhone', label: '来电电话', width: 120 },
  138. { label: '操作', width: 140, fixed: 'right', align: 'center', prop: 'operation' },
  139. ];
  140. // 交办待质检表头
  141. const assignQualityColumns = [
  142. { prop: 'order.no', label: '工单编码', width: 150 },
  143. { prop: 'aiQuality', label: '质检方式', width: 100, render: (scope: any) => (scope.row.aiQuality ? '智能质检' : '人工质检') },
  144. { prop: 'order.sourceChannel', label: '来源渠道' },
  145. { prop: 'order.startTime', label: '受理时间', width: 170, render: (scope: any) => formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS') },
  146. { prop: 'order.acceptType', label: '受理类型' },
  147. { prop: 'order.statusText', label: '工单状态' },
  148. { prop: 'title', label: '工单标题', width: 300 },
  149. { prop: 'order.hotspotName', label: '热点分类' },
  150. { prop: 'order.acceptorName', label: '受理人', width: 120 },
  151. { prop: 'order.centerToOrgTime', label: '交办时间', width: 170, render: (scope: any) => formatDate(scope.row.centerToOrgTime?.creationTime, 'YYYY-mm-dd HH:MM:SS') },
  152. { prop: 'order.fromPhone', label: '来电电话', width: 120 },
  153. { label: '操作', width: 140, fixed: 'right', align: 'center', prop: 'operation' },
  154. ];
  155. // 回访待质检表头
  156. const visitQualityColumns = [
  157. { prop: 'order.no', label: '工单编码', width: 150 },
  158. { prop: 'aiQuality', label: '质检方式', width: 100, render: (scope: any) => (scope.row.aiQuality ? '智能质检' : '人工质检') },
  159. { prop: 'title', label: '工单标题', width: 300 },
  160. { prop: 'order.sourceChannel', label: '来源渠道' },
  161. { prop: 'visit.visitStateText', label: '回访状态' },
  162. { prop: 'visit.visitTypeText', label: '回访方式', width: 100 },
  163. { prop: 'order.acceptType', label: '受理类型' },
  164. { prop: 'order.hotspotName', label: '热点分类', width: 120 },
  165. { prop: 'order.acceptorName', label: '受理人', width: 120 },
  166. { prop: 'order.actualHandleOrgName', label: '接办部门', width: 170 },
  167. { prop: 'order.startTime', label: '受理时间', width: 170, render: (scope: any) => formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS') },
  168. { prop: 'order.filedTime', label: '办结时间', width: 170, render: (scope: any) => formatDate(scope.row.order?.filedTime, 'YYYY-mm-dd HH:MM:SS') },
  169. {
  170. prop: 'visit.publishTime',
  171. label: '发布时间',
  172. width: 170,
  173. render: (scope: any) => formatDate(scope.row.visit?.publishTime, 'YYYY-mm-dd HH:MM:SS'),
  174. },
  175. {
  176. prop: 'visit.creationTime',
  177. label: '回访任务创建时间',
  178. width: 170,
  179. render: (scope: any) => formatDate(scope.row.visit?.creationTime, 'YYYY-mm-dd HH:MM:SS'),
  180. },
  181. { prop: 'visit.employeeName', label: '回访人', width: 170 },
  182. { prop: 'visit.visitTime', label: '回访时间', width: 170, render: (scope: any) => formatDate(scope.row.visit?.visitTime, 'YYYY-mm-dd HH:MM:SS') },
  183. { prop: 'order.counterSignTypeText', label: '是否会签' },
  184. { label: '操作', width: 140, fixed: 'right', align: 'center', prop: 'operation' },
  185. ];
  186. // 手动查询,将页码设置为1
  187. const handleQuery = () => {
  188. state.queryParams.PageIndex = 1;
  189. queryList();
  190. };
  191. // 查询质检列表
  192. const queryList = () => {
  193. state.loading = true;
  194. switch (state.queryParams.Source) {
  195. case 1:
  196. columns.value = acceptQualityColumns;
  197. break;
  198. case 2:
  199. columns.value = assignQualityColumns;
  200. break;
  201. case 3:
  202. columns.value = visitQualityColumns;
  203. break;
  204. default:
  205. break;
  206. }
  207. qualityList(state.queryParams)
  208. .then((res) => {
  209. state.loading = false;
  210. state.tableData = res.result.items ?? [];
  211. state.total = res.result.total ?? 0;
  212. })
  213. .finally(() => {
  214. state.loading = false;
  215. });
  216. };
  217. // 重置表单
  218. const resetQuery = (formEl: FormInstance | undefined) => {
  219. if (!formEl) return;
  220. formEl.resetFields();
  221. state.queryParams.CreationTimeStart = null;
  222. state.queryParams.CreationTimeEnd = null;
  223. queryList();
  224. };
  225. // 质检
  226. const qualityInspectionRef = ref<RefType>();
  227. const onQualityInspection = (row: any) => {
  228. qualityInspectionRef.value.openDialog(row, state.queryParams.Source);
  229. };
  230. // 页面加载时
  231. onMounted(() => {
  232. getBaseData();
  233. queryList();
  234. });
  235. </script>
  236. <style lang="scss" scoped>
  237. .quality-container {
  238. }
  239. </style>