Smart-visit-Detail.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <el-dialog v-model="state.dialogVisible" width="60%" draggable title="回访明细" append-to-body destroy-on-close @close="close">
  3. <el-form :model="state.queryParams" ref="queryParamsRef" inline @submit.native.prevent>
  4. <el-form-item label="关键词" prop="Keyword">
  5. <el-input v-model="state.queryParams.Keyword" placeholder="工单标题/工单编码" clearable @keyup.enter="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="任务状态" prop="AiOrderVisitState">
  8. <el-select v-model="state.queryParams.AiOrderVisitState" placeholder="请选择任务状态" @change="handleQuery" clearable>
  9. <el-option v-for="item in aiOrderVisitState" :value="item.key" :key="item.key" :label="item.value" />
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  14. <el-button @click="resetQuery(queryParamsRef)" :loading="state.loading" class="default-button">
  15. <SvgIcon name="ele-Refresh" class="mr5" />重置
  16. </el-button>
  17. </el-form-item>
  18. </el-form>
  19. <ProTable
  20. ref="proTableRef"
  21. :columns="columns"
  22. :data="state.tableData"
  23. @updateTable="queryList"
  24. :loading="state.loading"
  25. :pagination="false"
  26. :toolButton="['refresh', 'setting', 'exportCurrent', 'exportAll']"
  27. @export-current="exportTable($event)"
  28. @export-all="exportTable($event, true)"
  29. >
  30. <template #title="{ row }">
  31. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  32. </template>
  33. <template #isSuccess="{ row }">
  34. <span v-if="row.isSuccess">{{ row.isSuccess === true ? '成功' : '失败' }}</span>
  35. </template>
  36. <template #acceptorName="{ row }">
  37. <span
  38. >{{ row.order?.acceptorName }} <span v-if="row.order?.acceptorStaffNo">[{{ row.order?.acceptorStaffNo }}]</span>
  39. </span>
  40. </template>
  41. <template #hyypj="{ row }">
  42. <span v-for="item in row.orderVisit?.orderVisitDetails">
  43. <span v-if="item.visitTarget === 10">{{ item.seatEvaluateText }}</span>
  44. </span>
  45. </template>
  46. <template #bmbjjg="{ row }">
  47. <span v-for="item in row.orderVisit?.orderVisitDetails">
  48. <span v-if="item.visitTarget === 20">{{ item.orgProcessingResults?.value }}</span>
  49. </span>
  50. </template>
  51. <!-- <template #bmbjtd="{ row }">
  52. <span v-for="item in row.orderVisit?.orderVisitDetails">
  53. <span v-if="item.visitTarget === 20">{{ item.orgHandledAttitude?.value }}</span>
  54. </span>
  55. </template>-->
  56. <template #bmsflx="{ row }">
  57. <span v-for="item in row.orderVisit?.orderVisitDetails">
  58. <span v-if="item.visitTarget === 20">{{ item.isContact === null ? '' : item.isContact === true ? '是' : '否' }}</span>
  59. </span>
  60. </template>
  61. <template #cljg="{ row }">
  62. <span v-for="item in row.orderVisit?.orderVisitDetails">
  63. <span v-if="item.visitTarget === 20">{{ item.volved === null ? '' : item.volved === true ? '已得到解决' : '未得到解决' }}</span>
  64. </span>
  65. </template>
  66. </ProTable>
  67. <!-- 分页 -->
  68. <pagination
  69. @pagination="queryList"
  70. :total="state.total"
  71. v-model:current-page="state.queryParams.PageIndex"
  72. v-model:page-size="state.queryParams.PageSize"
  73. />
  74. </el-dialog>
  75. </template>
  76. <script setup lang="tsx">
  77. import { formatDate } from '@/utils/formatTime';
  78. import { FormInstance } from 'element-plus';
  79. import { defineAsyncComponent, reactive, ref } from 'vue';
  80. import { getSmartVisitBaseData, getSmartVisitDetail, getSmartVisitDetailExport } from "@/api/smartVisit";
  81. import { downloadFileByStream } from '@/utils/tools';
  82. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  83. const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
  84. const state = reactive({
  85. queryParams: {
  86. // 查询条件
  87. PageIndex: 1,
  88. PageSize: 10,
  89. Keyword: null, // 关键字
  90. id: '',
  91. AiOrderVisitState: null,
  92. },
  93. tableData: [], //表格
  94. loading: false, // 加载
  95. total: 0, // 总数
  96. dialogVisible: false, // 弹窗
  97. });
  98. const columns = ref<any[]>([
  99. { prop: 'order.no', label: '工单编码', width: 150 },
  100. {
  101. label: '标题',
  102. prop: 'row.title',
  103. width: 300,
  104. },
  105. { prop: 'aiOrderVisitStateText', label: '外呼状态', width: 150 },
  106. {
  107. label: '是否成功',
  108. prop: 'isSuccess',
  109. width: 80,
  110. },
  111. { prop: 'outerNo', label: '外呼电话', width: 150 },
  112. { prop: 'order.fromName', label: '姓名', width: 150 },
  113. { prop: 'order.fromGenderText', label: '性别', width: 150 },
  114. {
  115. label: '受理时间',
  116. prop: 'order.startTime',
  117. width: 170,
  118. render: (scope: any) => {
  119. return <span>{formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  120. },
  121. },
  122. {
  123. label: '办结时间',
  124. prop: 'order.filedTime',
  125. width: 170,
  126. render: (scope: any) => {
  127. return <span>{formatDate(scope.row.order?.filedTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  128. },
  129. },
  130. {
  131. label: '话务员评价',
  132. prop: 'hyypj',
  133. width: 120,
  134. },
  135. {
  136. label: '部门办件结果',
  137. prop: 'bmbjjg',
  138. width: 170,
  139. },
  140. /* {
  141. label: '部门办件态度',
  142. prop: 'bmbjtd',
  143. width: 170,
  144. },*/
  145. {
  146. label: '部门是否联系',
  147. prop: 'bmsflx',
  148. width: 170,
  149. },
  150. {
  151. label: '处理结果',
  152. prop: 'cljg',
  153. width: 170,
  154. },
  155. ]);
  156. // 页面基础数据
  157. const aiOrderVisitState = ref([]);
  158. const getBaseData = async () => {
  159. try {
  160. const { result } = await getSmartVisitBaseData();
  161. aiOrderVisitState.value = result.aiOrderVisitState;
  162. } catch (e) {
  163. console.log(e);
  164. }
  165. };
  166. // 打开弹窗
  167. const openDialog = (row?: any) => {
  168. if (row) {
  169. getBaseData();
  170. state.queryParams.id = row.id;
  171. queryList();
  172. }
  173. };
  174. // 手动查询,将页码设置为1
  175. const handleQuery = () => {
  176. state.queryParams.PageIndex = 1;
  177. queryList();
  178. };
  179. // 查询智能回访明细表
  180. const queryList = async () => {
  181. state.dialogVisible = true;
  182. try {
  183. state.loading = true;
  184. const res = await getSmartVisitDetail(state.queryParams);
  185. state.tableData = res.result.items ?? [];
  186. state.total = res.result.total ?? 0;
  187. state.loading = false;
  188. } catch (e) {
  189. console.log(e);
  190. state.loading = false;
  191. }
  192. };
  193. const close = () => {
  194. queryParamsRef.value?.resetFields();
  195. queryParamsRef.value?.resetFields();
  196. };
  197. // 重置所有工单列表
  198. const queryParamsRef = ref<RefType>();
  199. const resetQuery = (formEl: FormInstance | undefined) => {
  200. if (!formEl) return;
  201. formEl.resetFields();
  202. queryList();
  203. };
  204. // 表格导出
  205. const exportTable = (val: any, isExportAll = false) => {
  206. const columnInfos = val.map((item: any) => {
  207. return {
  208. prop: item.prop,
  209. name: item.label,
  210. };
  211. });
  212. const req = {
  213. queryDto: state.queryParams,
  214. columnInfos,
  215. isExportAll,
  216. };
  217. state.loading = true;
  218. getSmartVisitDetailExport(req)
  219. .then((res: any) => {
  220. state.loading = false;
  221. downloadFileByStream(res);
  222. })
  223. .catch(() => {
  224. state.loading = false;
  225. });
  226. };
  227. defineExpose({
  228. openDialog,
  229. });
  230. </script>