todo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div class="business-visit-todo-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <ProTable
  5. ref="proTableRef"
  6. :columns="columns"
  7. :data="state.tableData"
  8. @updateTable="queryList"
  9. :loading="state.loading"
  10. :total="state.total"
  11. v-model:page-index="state.queryParams.PageIndex"
  12. v-model:page-size="state.queryParams.PageSize"
  13. >
  14. <template #table-search>
  15. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline label-width="100px">
  16. <el-form-item label="数据范围" prop="QuerySelf" v-auth="'business:visit:todo:querySelf'">
  17. <el-segmented
  18. :options="[
  19. { label: '我的', value: 'true' },
  20. { label: '全部', value: 'false' },
  21. ]"
  22. v-model="state.queryParams.QuerySelf"
  23. @change="handleQuery"
  24. />
  25. </el-form-item>
  26. <el-form-item label="工单类型" prop="IsProvince" v-auth="'business:visit:todo:orderType'">
  27. <el-segmented
  28. :options="[
  29. {
  30. value: 'all',
  31. label: '全部',
  32. },
  33. {
  34. value: 'city',
  35. label: '市工单',
  36. },
  37. {
  38. value: 'province',
  39. label: '省工单',
  40. },
  41. ]"
  42. v-model="fastSearch"
  43. @change="fastSearchChange"
  44. />
  45. </el-form-item>
  46. <el-form-item label="工单标题" prop="Keyword">
  47. <el-input v-model="state.queryParams.Keyword" placeholder="工单标题" clearable @keyup.enter="handleQuery" class="keyword-input"/>
  48. </el-form-item>
  49. <el-form-item label="工单编码" prop="No">
  50. <el-input v-model="state.queryParams.No" placeholder="工单编码" clearable @keyup.enter="handleQuery" class="keyword-input"/>
  51. </el-form-item>
  52. <el-form-item label="">
  53. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  54. <el-button @click="drawer = true" class="default-button"> <SvgIcon name="ele-Search" class="mr5" />更多查询</el-button>
  55. </el-form-item>
  56. </el-form>
  57. </template>
  58. <template #tableHeader="scope">
  59. <el-button type="primary" @click="multiplePeople" :disabled="!scope.isSelected" v-auth="'business:visit:todo:multiplePeople'">
  60. <SvgIcon name="ele-User" class="mr5" />分配回访人</el-button
  61. >
  62. <el-button type="primary" @click="onMigration" v-auth="'business:visit:todo:migration'" :disabled="!scope.isSelected">
  63. <SvgIcon name="ele-Rank" class="mr5" />平级移动
  64. </el-button>
  65. </template>
  66. <template #title="{ row }">
  67. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  68. </template>
  69. <!-- <template #isPutThrough="{ row }">
  70. <span v-if="row.isPutThrough">{{ row.isPutThrough ? '未接通' : '已接通' }}</span>
  71. </template>-->
  72. <!-- 表格操作 -->
  73. <template #operation="{ row }">
  74. <el-button link type="primary" @click="onManpower(row)" title="工单回访" v-auth="'business:visit:todo:manpower'"> 回访 </el-button>
  75. </template>
  76. </ProTable>
  77. </div>
  78. <!-- 回访 -->
  79. <visit-detail ref="visitDetailRef" @updateList="queryList" />
  80. <!-- 分配回访人 -->
  81. <assign-return-visitors ref="assignReturnVisitorsRef" @updateList="queryList" />
  82. <!-- 工单平移 -->
  83. <order-migration ref="orderMigrationRef" @updateList="queryList" />
  84. <!-- 更多查询 -->
  85. <el-drawer v-model="drawer" title="更多查询" size="500px">
  86. <el-form :model="state.queryParams" ref="drawerRuleFormRef" @submit.native.prevent label-width="100px">
  87. <el-form-item label="回访人" prop="EmployeeName">
  88. <el-input v-model="state.queryParams.EmployeeName" placeholder="回访人" clearable @keyup.enter="handleQuery" />
  89. </el-form-item>
  90. <el-form-item label="归档类型" prop="FiledType">
  91. <el-select v-model="state.queryParams.FiledType" placeholder="请选择归档类型" @change="handleQuery" clearable>
  92. <el-option label="中心归档" value="10" />
  93. <el-option label="部门归档" value="20" />
  94. </el-select>
  95. </el-form-item>
  96. <el-form-item label="是否会签" prop="IsCountersign">
  97. <el-select v-model="state.queryParams.IsCountersign" placeholder="请选择是否会签" @change="handleQuery" clearable>
  98. <el-option label="是" value="true" />
  99. <el-option label="否" value="false" />
  100. </el-select>
  101. </el-form-item>
  102. <el-form-item label="回访方式" prop="VisitType">
  103. <el-select v-model="state.queryParams.VisitType" placeholder="请选择回访方式" @change="handleQuery" clearable>
  104. <el-option v-for="item in state.visitTypeOptions" :value="item.key" :key="item.key" :label="item.value" />
  105. </el-select>
  106. </el-form-item>
  107. </el-form>
  108. <template #footer>
  109. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  110. <el-button @click="resetQuery(drawerRuleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
  111. </template>
  112. </el-drawer>
  113. </div>
  114. </template>
  115. <script setup lang="tsx" name="businessVisitTodo">
  116. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  117. import { ElMessageBox, FormInstance } from 'element-plus';
  118. import { formatDate } from '@/utils/formatTime';
  119. import { useRouter } from 'vue-router';
  120. import { visitList } from '@/api/todo/visit';
  121. import { visitSearchBaseData } from '@/api/business/visit';
  122. // 引入组件
  123. const VisitDetail = defineAsyncComponent(() => import('/src/views/business/visit/component/Visit-detail.vue')); // 回访
  124. const AssignReturnVisitors = defineAsyncComponent(() => import('@/views/business/visit/component/Assign-return-visitors.vue')); // 分配回访人
  125. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  126. const OrderMigration = defineAsyncComponent(() => import('@/views/todo/center/Order-migration.vue')); // 工单平移
  127. // 定义变量内容
  128. const proTableRef = ref<RefType>(); // 表格ref
  129. const fastSearch = ref('all'); // tab位置
  130. const fastSearchChange = (val: string) => {
  131. fastSearch.value = val;
  132. switch (val) {
  133. case 'all':
  134. state.queryParams.IsProvince = null;
  135. break;
  136. case 'city':
  137. state.queryParams.IsProvince = false;
  138. break;
  139. case 'province':
  140. state.queryParams.IsProvince = true;
  141. break;
  142. }
  143. handleQuery();
  144. };
  145. // 表格配置项
  146. const columns = ref<any[]>([
  147. { type: 'selection', fixed: 'left', width: 40, align: 'center' },
  148. { prop: 'order.no', label: '工单编码', minWidth: 140 },
  149. { prop: 'order.isProvinceText', label: '省/市工单', minWidth: 90 },
  150. { prop: 'order.title', label: '工单标题', minWidth: 200 },
  151. { prop: 'order.sourceChannel', label: '来源渠道', minWidth: 100 },
  152. { prop: 'visitStateText', label: '回访状态', minWidth: 100 },
  153. { prop: 'visitTypeText', label: '回访方式', minWidth: 100 },
  154. { prop: 'order.acceptType', label: '受理类型', minWidth: 100 },
  155. { prop: 'order.hotspotName', label: '热点分类', minWidth: 150 },
  156. { prop: 'order.acceptorName', label: '受理人', minWidth: 120 },
  157. { prop: 'order.orgLevelOneName', label: '一级部门', minWidth: 140 },
  158. { prop: 'order.currentHandleOrgName', label: '接办部门', minWidth: 140 },
  159. { prop: 'order.currentHandleOrgName', label: '接办部门', minWidth: 140 },
  160. {
  161. prop: 'order.startTime',
  162. label: '受理时间',
  163. minWidth: 160,
  164. render: (scope) => {
  165. return <span>{formatDate(scope.row.order?.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  166. },
  167. },
  168. {
  169. prop: 'order.filedTime',
  170. label: '办结时间',
  171. minWidth: 160,
  172. render: (scope) => {
  173. return <span>{formatDate(scope.row.order?.filedTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  174. },
  175. },
  176. {
  177. prop: 'publishTime',
  178. label: '发布时间',
  179. minWidth: 160,
  180. render: (scope) => {
  181. return <span>{formatDate(scope.row.publishTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  182. },
  183. },
  184. {
  185. prop: 'creationTime',
  186. label: '回访任务创建时间',
  187. minWidth: 160,
  188. render: (scope) => {
  189. return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  190. },
  191. },
  192. { prop: 'employeeName', label: '回访人', minWidth: 120 },
  193. /*{
  194. prop: 'isPutThrough',
  195. label: '是否接通',
  196. width: 150,
  197. },*/
  198. { prop: 'operation', label: '操作', fixed: 'right', width: 80, align: 'center' },
  199. ]);
  200. const state = reactive<any>({
  201. queryParams: {
  202. // 查询条件
  203. PageIndex: 1,
  204. PageSize: 20,
  205. Keyword: null, // 关键字
  206. FiledType: null, // 归档类型
  207. IsCountersign: null, // 是否会签
  208. VisitState: '2', // 回访状态 待回访
  209. VisitType: null, // 回访方式
  210. No: null,
  211. QuerySelf: 'true', // 是否只查询自己的待回访工单
  212. EmployeeName: null, // 回访人
  213. IsProvince: null, // 是否省工单
  214. },
  215. tableData: [], //表单
  216. loading: false, // 加载
  217. total: 0, // 总数
  218. visitTypeOptions: [],
  219. });
  220. // 获取基础数据
  221. const getBaseData = () => {
  222. visitSearchBaseData().then((res: any) => {
  223. state.visitTypeOptions = res.result?.visitType ?? [];
  224. });
  225. };
  226. // 手动查询,将页码设置为1
  227. const handleQuery = () => {
  228. state.queryParams.PageIndex = 1;
  229. queryList();
  230. };
  231. /** 获取列表 */
  232. const queryList = () => {
  233. state.loading = true;
  234. visitList(state.queryParams)
  235. .then((res: any) => {
  236. state.tableData = res.result?.items ?? [];
  237. state.total = res.result?.total ?? 0;
  238. state.loading = false;
  239. })
  240. .catch(() => {
  241. state.loading = false;
  242. });
  243. };
  244. /** 重置按钮操作 */
  245. const drawerRuleFormRef = ref();
  246. const ruleFormRef = ref<RefType>(); // 表单ref
  247. const drawer = ref(false);
  248. const resetQuery = (formEl: FormInstance | undefined) => {
  249. if (!formEl) return;
  250. formEl.resetFields();
  251. state.queryParams.QuerySelf = 'true';
  252. state.queryParams.IsProvince = null;
  253. fastSearch.value = 'all';
  254. ruleFormRef.value?.resetFields();
  255. queryList();
  256. };
  257. // 批量分配
  258. const assignReturnVisitorsRef = ref<RefType>();
  259. const multiplePeople = () => {
  260. const ids = proTableRef.value.selectedList.map((item: any) => item.id);
  261. assignReturnVisitorsRef.value.openDialog(ids);
  262. };
  263. // 回访
  264. const visitDetailRef = ref<RefType>();
  265. const onManpower = (row: any) => {
  266. visitDetailRef.value.openDialog(row);
  267. };
  268. // 平移功能
  269. const orderMigrationRef = ref<RefType>();
  270. const onMigration = () => {
  271. const ids = proTableRef.value.selectedList.map((item: any) => item.id);
  272. orderMigrationRef.value.openDialog('visitTodo', ids);
  273. };
  274. onMounted(() => {
  275. getBaseData();
  276. queryList();
  277. });
  278. </script>