index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div class="business-visit-container layout-pd">
  3. <!-- 搜索 -->
  4. <el-card shadow="never">
  5. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent label-width="100px">
  6. <el-row :gutter="20">
  7. <el-col>
  8. <el-form-item label="数据范围" prop="IsProvince">
  9. <el-segmented
  10. :options="[
  11. {
  12. value: 'all',
  13. label: '全部',
  14. },
  15. {
  16. value: 'city',
  17. label: '市工单',
  18. },
  19. {
  20. value: 'province',
  21. label: '省工单',
  22. },
  23. ]"
  24. v-model="fastSearch"
  25. @change="fastSearchChange"
  26. />
  27. </el-form-item>
  28. </el-col>
  29. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  30. <el-form-item label="工单标题" prop="Keyword">
  31. <el-input v-model="state.queryParams.Keyword" placeholder="工单标题" clearable @keyup.enter="handleQuery" />
  32. </el-form-item>
  33. </el-col>
  34. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  35. <el-form-item label="工单编码" prop="No">
  36. <el-input v-model="state.queryParams.No" placeholder="工单编码" clearable @keyup.enter="handleQuery" />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  40. <el-form-item label="归档类型" prop="FiledType">
  41. <el-select v-model="state.queryParams.FiledType" placeholder="请选择归档类型" @change="handleQuery" class="w100">
  42. <el-option label="中心归档" value="10" />
  43. <el-option label="部门归档" value="20" />
  44. </el-select>
  45. </el-form-item>
  46. </el-col>
  47. <transition name="el-zoom-in-top">
  48. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol">
  49. <el-form-item label="是否会签" prop="IsCountersign">
  50. <el-select v-model="state.queryParams.IsCountersign" placeholder="请选择是否会签" @change="handleQuery" class="w100">
  51. <el-option label="是" value="true" />
  52. <el-option label="否" value="false" />
  53. </el-select>
  54. </el-form-item>
  55. </el-col>
  56. </transition>
  57. <transition name="el-zoom-in-top">
  58. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol">
  59. <el-form-item label="回访状态" prop="VisitState">
  60. <el-select v-model="state.queryParams.VisitState" placeholder="请选择回访状态" @change="handleQuery" class="w100">
  61. <el-option v-for="item in state.visitStateOptions" :value="item.value" :key="item.value" :label="item.label" />
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. </transition>
  66. <transition name="el-zoom-in-top">
  67. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol">
  68. <el-form-item label="回访方式" prop="VisitType">
  69. <el-select v-model="state.queryParams.VisitType" placeholder="请选择回访方式" @change="handleQuery" class="w100">
  70. <el-option v-for="item in state.visitTypeOptions" :value="item.key" :key="item.key" :label="item.value" />
  71. </el-select>
  72. </el-form-item>
  73. </el-col>
  74. </transition>
  75. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  76. <el-form-item label="">
  77. <div class="flex-end w100">
  78. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  79. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  80. <SvgIcon name="ele-Refresh" class="mr5" />重置
  81. </el-button>
  82. <el-button link type="primary" @click="closeSearch" :loading="state.loading">
  83. {{ searchCol ? '展开' : '收起' }}
  84. <SvgIcon :class="{ 'is-reverse': searchCol }" name="ele-ArrowUp" class="mr5 arrow" size="18px" />
  85. </el-button>
  86. </div>
  87. </el-form-item>
  88. </el-col>
  89. </el-row>
  90. </el-form>
  91. </el-card>
  92. <el-card shadow="never">
  93. <ProTable
  94. ref="proTableRef"
  95. :columns="columns"
  96. :data="state.tableData"
  97. @updateTable="queryList"
  98. :loading="state.loading"
  99. :total="state.total"
  100. v-model:page-index="state.queryParams.PageIndex"
  101. v-model:page-size="state.queryParams.PageSize"
  102. @exportCurrent="exportCurrent"
  103. >
  104. <template #title="{ row }">
  105. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  106. </template>
  107. <template #voicePj="{ row }">
  108. <span v-for="item in row.orderVisitDetails">
  109. <span v-if="item.visitTarget === 10">{{ item.voiceEvaluateText }}</span>
  110. </span>
  111. </template>
  112. <template #hwyPj="{ row }">
  113. <span v-for="item in row.orderVisitDetails">
  114. <span v-if="item.visitTarget === 10">{{ item.seatEvaluateText }}</span>
  115. </span>
  116. </template>
  117. <!-- 表格操作 -->
  118. <template #operation="{ row }">
  119. <el-button link type="primary" @click="visitDetail(row)" title="查看回访详情"> 回访详情 </el-button>
  120. <order-detail :order="row.order" @updateList="queryList" />
  121. </template>
  122. </ProTable>
  123. </el-card>
  124. <!-- 回访详情 -->
  125. <visit-detail-com ref="visitDetailRef" @updateList="queryList" />
  126. </div>
  127. </template>
  128. <script setup lang="tsx" name="businessVisit">
  129. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  130. import { FormInstance } from 'element-plus';
  131. import { formatDate } from '@/utils/formatTime';
  132. import { useRouter } from 'vue-router';
  133. import { visitList, visitSearchBaseData } from '@/api/business/visit';
  134. // 引入组件
  135. const VisitDetailCom = defineAsyncComponent(() => import('@/views/business/visit/component/Visit-detail.vue')); // 回访
  136. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  137. // 定义变量内容
  138. const ruleFormRef = ref<RefType>(); // 表单ref
  139. const router = useRouter(); // 路由
  140. const proTableRef = ref<RefType>(); // 表格ref
  141. const searchCol = ref(true); // 展开/收起
  142. const fastSearch = ref('all'); // tab位置
  143. const fastSearchChange = (val: string) => {
  144. fastSearch.value = val;
  145. switch (val) {
  146. case 'all':
  147. state.queryParams.IsProvince = null;
  148. break;
  149. case 'city':
  150. state.queryParams.IsProvince = false;
  151. break;
  152. case 'province':
  153. state.queryParams.IsProvince = true;
  154. break;
  155. }
  156. handleQuery();
  157. };
  158. // 展开/收起
  159. const closeSearch = () => {
  160. searchCol.value = !searchCol.value;
  161. };
  162. // 表格配置项
  163. const columns = ref<any[]>([
  164. { prop: 'order.no', label: '工单编码', minWidth: 140 },
  165. { prop: 'order.isProvinceText', label: '省/市工单', minWidth: 90 },
  166. { prop: 'order.title', label: '工单标题', minWidth: 200 },
  167. { prop: 'order.sourceChannel', label: '来源渠道', minWidth: 100 },
  168. { prop: 'visitStateText', label: '回访状态', minWidth: 100 },
  169. { prop: 'visitTypeText', label: '回访方式', minWidth: 100 },
  170. { prop: 'order.acceptType', label: '受理类型', minWidth: 100 },
  171. { prop: 'order.hotspotName', label: '热点分类', minWidth: 150 },
  172. { prop: 'order.acceptorName', label: '受理人', minWidth: 120 },
  173. { prop: 'order.orgLevelOneName', label: '一级部门', minWidth: 140 },
  174. { prop: 'order.actualHandleOrgName', label: '接办部门', minWidth: 140 },
  175. {
  176. prop: 'order.startTime',
  177. label: '受理时间',
  178. minWidth: 160,
  179. render: (scope) => {
  180. return <span>{formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  181. },
  182. },
  183. {
  184. prop: 'order.filedTime',
  185. label: '办结时间',
  186. minWidth: 160,
  187. render: (scope) => {
  188. return <span>{formatDate(scope.row.order?.filedTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  189. },
  190. },
  191. {
  192. prop: 'publishTime',
  193. label: '发布时间',
  194. minWidth: 160,
  195. render: (scope) => {
  196. return <span>{formatDate(scope.row.publishTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  197. },
  198. },
  199. {
  200. prop: 'creationTime',
  201. label: '回访任务创建时间',
  202. minWidth: 160,
  203. render: (scope) => {
  204. return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  205. },
  206. },
  207. { prop: 'employeeName', label: '回访人', minWidth: 120 },
  208. {
  209. prop: 'visitTime',
  210. label: '回访时间',
  211. minWidth: 160,
  212. render: (scope) => {
  213. return <span>{formatDate(scope.row.visitTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  214. },
  215. },
  216. { prop: 'order.counterSignTypeText', label: '是否会签', minWidth: 90 },
  217. // { prop: 'voicePj', label: '语音评价', width: 150 },
  218. { prop: 'hwyPj', label: '话务员满意度', minWidth: 120 },
  219. { prop: 'operation', label: '操作', fixed: 'right', width: 170, align: 'center' },
  220. ]);
  221. const state = reactive<any>({
  222. queryParams: {
  223. // 查询条件
  224. PageIndex: 1,
  225. PageSize: 10,
  226. Keyword: null, // 关键字
  227. VisitState: null, // 回访状态
  228. VisitType: null, // 回访方式
  229. No: null,
  230. IsCountersign: null, // 是否会签
  231. FiledType: null, // 归档类型
  232. IsProvince: null,
  233. },
  234. tableData: [], //表单
  235. loading: false, // 加载
  236. total: 0, // 总数
  237. visitStateOptions: [
  238. {
  239. label: '已回访',
  240. value: '1',
  241. },
  242. {
  243. label: '待回访',
  244. value: '2',
  245. },
  246. ], // 回访状态
  247. visitTypeOptions: [],
  248. });
  249. // 获取基础数据
  250. const getBaseData = () => {
  251. visitSearchBaseData().then((res: any) => {
  252. state.visitTypeOptions = res.result?.visitType ?? [];
  253. });
  254. };
  255. // 手动查询,将页码设置为1
  256. const handleQuery = () => {
  257. state.queryParams.PageIndex = 1;
  258. queryList();
  259. };
  260. /** 获取列表 */
  261. const queryList = () => {
  262. state.loading = true;
  263. visitList(state.queryParams)
  264. .then((res: any) => {
  265. state.tableData = res.result?.items ?? [];
  266. state.total = res.result?.total ?? 0;
  267. state.loading = false;
  268. })
  269. .catch(() => {
  270. state.loading = false;
  271. });
  272. };
  273. /** 重置按钮操作 */
  274. const resetQuery = (formEl: FormInstance | undefined) => {
  275. if (!formEl) return;
  276. formEl.resetFields();
  277. state.queryParams.QuerySelf = 'true';
  278. state.queryParams.IsProvince = null;
  279. fastSearch.value = 'all';
  280. queryList();
  281. };
  282. // 回访详情
  283. const visitDetailRef = ref<RefType>();
  284. const visitDetail = (row: any) => {
  285. visitDetailRef.value.openDialog(row, '回访详情');
  286. };
  287. onMounted(() => {
  288. getBaseData();
  289. queryList();
  290. });
  291. </script>
  292. <style scoped lang="scss">
  293. .business-visit-container {
  294. .arrow {
  295. transition: transform var(--el-transition-duration);
  296. cursor: pointer;
  297. }
  298. .arrow.is-reverse {
  299. transform: rotateZ(-180deg);
  300. }
  301. }
  302. </style>