index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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. >
  103. <template #title="{ row }">
  104. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  105. </template>
  106. <template #voicePj="{ row }">
  107. <span v-for="item in row.orderVisitDetails">
  108. <span v-if="item.visitTarget === 10">{{ item.voiceEvaluateText }}</span>
  109. </span>
  110. </template>
  111. <template #hwyPj="{ row }">
  112. <span v-for="item in row.orderVisitDetails">
  113. <span v-if="item.visitTarget === 10">{{ item.seatEvaluateText }}</span>
  114. </span>
  115. </template>
  116. <!-- 表格操作 -->
  117. <template #operation="{ row }">
  118. <el-button link type="primary" @click="visitDetail(row)" title="查看回访详情"> 回访详情 </el-button>
  119. <order-detail :order="row.order" @updateList="queryList" />
  120. </template>
  121. </ProTable>
  122. </el-card>
  123. <!-- 回访详情 -->
  124. <visit-detail-com ref="visitDetailRef" @updateList="queryList" />
  125. </div>
  126. </template>
  127. <script setup lang="tsx" name="businessVisit">
  128. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  129. import { FormInstance } from 'element-plus';
  130. import { formatDate } from '@/utils/formatTime';
  131. import { useRouter } from 'vue-router';
  132. import { visitList, visitSearchBaseData } from '@/api/business/visit';
  133. // 引入组件
  134. const VisitDetailCom = defineAsyncComponent(() => import('@/views/business/visit/component/Visit-detail.vue')); // 回访
  135. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  136. // 定义变量内容
  137. const ruleFormRef = ref<RefType>(); // 表单ref
  138. const router = useRouter(); // 路由
  139. const proTableRef = ref<RefType>(); // 表格ref
  140. const searchCol = ref(true); // 展开/收起
  141. const fastSearch = ref('all'); // tab位置
  142. const fastSearchChange = (val: string) => {
  143. fastSearch.value = val;
  144. switch (val) {
  145. case 'all':
  146. state.queryParams.IsProvince = null;
  147. break;
  148. case 'city':
  149. state.queryParams.IsProvince = false;
  150. break;
  151. case 'province':
  152. state.queryParams.IsProvince = true;
  153. break;
  154. }
  155. handleQuery();
  156. };
  157. // 展开/收起
  158. const closeSearch = () => {
  159. searchCol.value = !searchCol.value;
  160. };
  161. // 表格配置项
  162. const columns = ref<any[]>([
  163. { prop: 'order.no', label: '工单编码', minWidth: 140 },
  164. { prop: 'order.isProvinceText', label: '省/市工单', minWidth: 90 },
  165. { prop: 'order.title', label: '工单标题', minWidth: 200 },
  166. { prop: 'order.sourceChannel', label: '来源渠道', minWidth: 100 },
  167. { prop: 'visitStateText', label: '回访状态', minWidth: 100 },
  168. { prop: 'visitTypeText', label: '回访方式', minWidth: 100 },
  169. { prop: 'order.acceptType', label: '受理类型', minWidth: 100 },
  170. { prop: 'order.hotspotName', label: '热点分类', minWidth: 150 },
  171. { prop: 'order.acceptorName', label: '受理人', minWidth: 120 },
  172. { prop: 'order.orgLevelOneName', label: '一级部门', minWidth: 140 },
  173. { prop: 'order.actualHandleOrgName', label: '接办部门', minWidth: 140 },
  174. {
  175. prop: 'order.startTime',
  176. label: '受理时间',
  177. minWidth: 160,
  178. render: (scope) => {
  179. return <span>{formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  180. },
  181. },
  182. {
  183. prop: 'order.filedTime',
  184. label: '办结时间',
  185. minWidth: 160,
  186. render: (scope) => {
  187. return <span>{formatDate(scope.row.order?.filedTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  188. },
  189. },
  190. {
  191. prop: 'publishTime',
  192. label: '发布时间',
  193. minWidth: 160,
  194. render: (scope) => {
  195. return <span>{formatDate(scope.row.publishTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  196. },
  197. },
  198. {
  199. prop: 'creationTime',
  200. label: '回访任务创建时间',
  201. minWidth: 160,
  202. render: (scope) => {
  203. return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  204. },
  205. },
  206. { prop: 'employeeName', label: '回访人', minWidth: 120 },
  207. {
  208. prop: 'visitTime',
  209. label: '回访时间',
  210. minWidth: 160,
  211. render: (scope) => {
  212. return <span>{formatDate(scope.row.visitTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  213. },
  214. },
  215. { prop: 'order.counterSignTypeText', label: '是否会签', minWidth: 90 },
  216. // { prop: 'voicePj', label: '语音评价', width: 150 },
  217. { prop: 'hwyPj', label: '话务员满意度', minWidth: 120 },
  218. { prop: 'operation', label: '操作', fixed: 'right', width: 170, align: 'center' },
  219. ]);
  220. const state = reactive<any>({
  221. queryParams: {
  222. // 查询条件
  223. PageIndex: 1,
  224. PageSize: 10,
  225. Keyword: null, // 关键字
  226. VisitState: null, // 回访状态
  227. VisitType: null, // 回访方式
  228. No: null,
  229. IsCountersign: null, // 是否会签
  230. FiledType: null, // 归档类型
  231. IsProvince: null,
  232. },
  233. tableData: [], //表单
  234. loading: false, // 加载
  235. total: 0, // 总数
  236. visitStateOptions: [
  237. {
  238. label: '已回访',
  239. value: '1',
  240. },
  241. {
  242. label: '待回访',
  243. value: '2',
  244. },
  245. ], // 回访状态
  246. visitTypeOptions: [],
  247. });
  248. // 获取基础数据
  249. const getBaseData = () => {
  250. visitSearchBaseData().then((res: any) => {
  251. state.visitTypeOptions = res.result?.visitType ?? [];
  252. });
  253. };
  254. // 手动查询,将页码设置为1
  255. const handleQuery = () => {
  256. state.queryParams.PageIndex = 1;
  257. queryList();
  258. };
  259. /** 获取列表 */
  260. const queryList = () => {
  261. state.loading = true;
  262. visitList(state.queryParams)
  263. .then((res: any) => {
  264. state.tableData = res.result?.items ?? [];
  265. state.total = res.result?.total ?? 0;
  266. state.loading = false;
  267. })
  268. .catch(() => {
  269. state.loading = false;
  270. });
  271. };
  272. /** 重置按钮操作 */
  273. const resetQuery = (formEl: FormInstance | undefined) => {
  274. if (!formEl) return;
  275. formEl.resetFields();
  276. state.queryParams.QuerySelf = 'true';
  277. state.queryParams.IsProvince = null;
  278. fastSearch.value = 'all';
  279. queryList();
  280. };
  281. // 回访详情
  282. const visitDetailRef = ref<RefType>();
  283. const visitDetail = (row: any) => {
  284. visitDetailRef.value.openDialog(row, '回访详情');
  285. };
  286. onMounted(() => {
  287. getBaseData();
  288. queryList();
  289. });
  290. </script>
  291. <style scoped lang="scss">
  292. .business-visit-container {
  293. .arrow {
  294. transition: transform var(--el-transition-duration);
  295. cursor: pointer;
  296. }
  297. .arrow.is-reverse {
  298. transform: rotateZ(-180deg);
  299. }
  300. }
  301. </style>