index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <div class="business-overdue-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
  5. <el-form-item label="工单标题" prop="Title">
  6. <el-input v-model.trim="state.queryParams.Title" placeholder="工单标题" clearable @keyup.enter="handleQuery" class="keyword-input" />
  7. </el-form-item>
  8. <el-form-item label="工单编码" prop="No">
  9. <el-input v-model.trim="state.queryParams.No" placeholder="工单编码" clearable @keyup.enter="handleQuery" class="keyword-input" />
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  13. <el-button @click="drawer = true" class="default-button"> <SvgIcon name="ele-Search" class="mr5" />更多查询</el-button>
  14. </el-form-item>
  15. </el-form>
  16. <vxe-toolbar
  17. ref="toolbarRef"
  18. :loading="state.loading"
  19. custom
  20. :refresh="{
  21. queryMethod: handleQuery,
  22. }"
  23. :tools="[{ toolRender: { name: 'exportCurrent' } }, { toolRender: { name: 'exportAll' } }]"
  24. >
  25. <template #buttons>
  26. <el-button type="primary" @click="onJbExport" :loading="state.loading" :disabled="isChecked"
  27. ><SvgIcon name="iconfont icon-daochu" class="mr5" />交办单导出<span v-if="checkTable.length">({{checkTable.length}})</span>
  28. </el-button>
  29. </template>
  30. </vxe-toolbar>
  31. <div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
  32. <vxe-table
  33. border
  34. :loading="state.loading"
  35. :data="state.tableData"
  36. :sort-config="{ remote: true }"
  37. :column-config="{ resizable: true }"
  38. :row-config="{ isCurrent: true, isHover: true, height: 30,useKey:true }"
  39. ref="tableRef"
  40. @sort-change="sortChange"
  41. @checkbox-all="selectAllChangeEvent"
  42. @checkbox-change="selectChangeEvent"
  43. height="auto"
  44. auto-resize
  45. show-overflow
  46. :scrollY="{ enabled: true, gt: 100 }"
  47. id="businessOverdue"
  48. :custom-config="{ storage: true }"
  49. :params="{ exportMethod: exportOverdueList, exportParams: requestParams }"
  50. showHeaderOverflow
  51. >
  52. <vxe-column type="checkbox" width="60" align="center"></vxe-column>
  53. <vxe-column field="no" title="工单编码" width="140"></vxe-column>
  54. <vxe-column field="isProvinceText" title="省/市工单" width="90"></vxe-column>
  55. <vxe-column field="currentStepName" title="当前节点" width="100"></vxe-column>
  56. <vxe-column field="delayText" title="是否延期" width="100"></vxe-column>
  57. <vxe-column field="statusText" title="工单状态" width="100">
  58. <template #default="{ row }">
  59. <el-text type="danger" tag="b" v-if="[1, 2, 3, 9, 101, 102, 103, 104, 105, 200].includes(row.status)">{{ row.statusText }}</el-text>
  60. <span v-else>{{ row.statusText }}</span>
  61. </template>
  62. </vxe-column>
  63. <vxe-column field="title" title="工单标题" width="200">
  64. <template #default="{ row }">
  65. <order-detail :order="row" @updateList="handleQuery">{{ row.title }}</order-detail>
  66. </template>
  67. </vxe-column>
  68. <vxe-column field="centerToOrgHandlerName" title="派单员" width="120"></vxe-column>
  69. <vxe-column field="startTime" title="受理时间" sortable width="160">
  70. <template #default="{ row }">
  71. {{ formatDate(row.startTime, 'YYYY-mm-dd HH:MM:SS') }}
  72. </template>
  73. </vxe-column>
  74. <vxe-column field="expiredTime" title="工单期满时间" sortable width="160">
  75. <template #default="{ row }">
  76. {{ formatDate(row.expiredTime, 'YYYY-mm-dd HH:MM:SS') }}
  77. </template>
  78. </vxe-column>
  79. <vxe-column field="filedTime" title="办结时间" sortable width="160">
  80. <template #default="{ row }">
  81. {{ formatDate(row.filedTime, 'YYYY-mm-dd HH:MM:SS') }}
  82. </template>
  83. </vxe-column>
  84. <vxe-column field="actualHandleOrgName" title="接办部门" width="140"></vxe-column>
  85. <vxe-column field="orgLevelOneName" title="一级部门" width="140"></vxe-column>
  86. <vxe-column field="acceptType" title="受理类型" width="100"></vxe-column>
  87. <vxe-column field="counterSignTypeText" title="是否会签" width="90"></vxe-column>
  88. <vxe-column field="sourceChannel" title="来源渠道" width="100"></vxe-column>
  89. <vxe-column field="hotspotName" title="热点分类" width="150"></vxe-column>
  90. <vxe-column field="acceptorName" title="受理人" width="120"></vxe-column>
  91. </vxe-table>
  92. </div>
  93. <pagination
  94. @pagination="queryList"
  95. :total="state.total"
  96. v-model:current-page="state.queryParams.PageIndex"
  97. v-model:page-size="state.queryParams.PageSize"
  98. :disabled="state.loading"
  99. />
  100. </div>
  101. <!-- 更多查询 -->
  102. <el-drawer v-model="drawer" title="更多查询" size="500px">
  103. <el-form :model="state.queryParams" ref="drawerRuleFormRef" @submit.native.prevent label-width="100px">
  104. <el-form-item label="来电号码" prop="FromPhone">
  105. <el-input v-model.trim="state.queryParams.FromPhone" placeholder="来电号码" clearable @keyup.enter="handleQuery" />
  106. </el-form-item>
  107. <el-form-item label="接办部门" prop="ActualHandleOrgName">
  108. <el-input v-model="state.queryParams.ActualHandleOrgName" placeholder="请填写接办部门名称" clearable @keyup.enter="handleQuery" />
  109. </el-form-item>
  110. <el-form-item label="受理类型" prop="AcceptType">
  111. <el-select v-model="state.queryParams.AcceptType" placeholder="请选择受理类型" clearable @change="handleQuery">
  112. <el-option v-for="item in state.acceptTypeOptions" :value="item.dicDataValue" :key="item.dicDataValue" :label="item.dicDataName" />
  113. </el-select>
  114. </el-form-item>
  115. <el-form-item label="热点分类" prop="HotspotName">
  116. <el-input v-model.trim="state.queryParams.HotspotName" placeholder="热点分类名称" clearable @keyup.enter="handleQuery" />
  117. </el-form-item>
  118. <el-form-item label="受理时间" prop="crTime">
  119. <el-date-picker
  120. v-model="state.queryParams.crTime"
  121. type="datetimerange"
  122. unlink-panels
  123. range-separator="至"
  124. start-placeholder="开始时间"
  125. end-placeholder="结束时间"
  126. :shortcuts="shortcuts"
  127. @change="handleQuery"
  128. value-format="YYYY-MM-DD[T]HH:mm:ss"
  129. :default-time="defaultTimeStartEnd"
  130. />
  131. </el-form-item>
  132. <el-form-item label="当前节点" prop="CurrentStepCode">
  133. <el-select v-model="state.queryParams.CurrentStepCode" placeholder="请选择当前节点" clearable @change="handleQuery">
  134. <el-option v-for="item in state.currentStepOptions" :value="item.key" :key="item.key" :label="item.value" />
  135. </el-select>
  136. </el-form-item>
  137. <el-form-item label="办结时间" prop="doneTime">
  138. <el-date-picker
  139. v-model="state.queryParams.doneTime"
  140. type="datetimerange"
  141. unlink-panels
  142. range-separator="至"
  143. start-placeholder="开始时间"
  144. end-placeholder="结束时间"
  145. :shortcuts="shortcuts"
  146. @change="handleQuery"
  147. value-format="YYYY-MM-DD[T]HH:mm:ss"
  148. :default-time="defaultTimeStartEnd"
  149. />
  150. </el-form-item>
  151. <el-form-item label="工单状态" prop="Status">
  152. <el-select v-model="state.queryParams.Status" placeholder="请选择工单状态" clearable @change="handleQuery">
  153. <el-option v-for="item in state.orderStatusOptions" :value="item.key" :key="item.key" :label="item.value" />
  154. </el-select>
  155. </el-form-item>
  156. <el-form-item label="是否省工单" prop="IsProvince">
  157. <el-select v-model="state.queryParams.IsProvince" placeholder="请选择是否省工单" @change="handleQuery" clearable>
  158. <el-option label="是" value="true" />
  159. <el-option label="否" value="false" />
  160. </el-select>
  161. </el-form-item>
  162. <el-form-item label="是否延期" prop="Delay">
  163. <el-select v-model="state.queryParams.Delay" placeholder="请选择是否延期" @change="handleQuery" clearable>
  164. <el-option label="是" :value="1" />
  165. <el-option label="否" :value="2" />
  166. </el-select>
  167. </el-form-item>
  168. </el-form>
  169. <template #footer>
  170. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  171. <el-button @click="resetQuery(drawerRuleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
  172. </template>
  173. </el-drawer>
  174. </div>
  175. </template>
  176. <script setup lang="tsx" name="businessOverdue">
  177. import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  178. import { FormInstance } from 'element-plus';
  179. import { formatDate } from '@/utils/formatTime';
  180. import { exportOverdueList, overdueList } from '@/api/query/overdue';
  181. import { exportAssignment } from '@/utils/tools';
  182. import { defaultTimeStartEnd, shortcuts } from '@/utils/constants';
  183. import Other from '@/utils/other';
  184. import { listBaseData } from '@/api/business/order';
  185. import { departmentSatisfactionDetailBase } from '@/api/statistics/department';
  186. // 引入组件
  187. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  188. const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
  189. // 定义变量内容
  190. const state = reactive<any>({
  191. queryParams: {
  192. // 查询条件
  193. PageIndex: 1,
  194. PageSize: 20,
  195. Title: null, // 关键字
  196. No: null, // 工单编码
  197. IsProvince: null, // 是否省工单
  198. Delay: null, // 是否延期
  199. SortField: null,
  200. SortRule: null,
  201. FromPhone:null, // 来电号码
  202. ActualHandleOrgName:null, // 接办部门
  203. AcceptType:null, // 受理类型
  204. HotspotName:null, // 热点
  205. crTime:[], // 受理时间
  206. CreationTimeStart:null,
  207. CreationTimeEnd:null,
  208. CurrentStepCode:null,
  209. doneTime:[], // 办结时间
  210. FiledTimeStart:null,
  211. FiledTimeEnd:null,
  212. Status:null,// 工单状态
  213. },
  214. tableData: [], //表单
  215. loading: false, // 加载
  216. total: 0, // 总数
  217. acceptTypeOptions: [], //受理类型
  218. channelOptions: [], // 来源频道
  219. orderStatusOptions: [], // 工单状态
  220. currentStepOptions: [], // 办理节点
  221. });
  222. // 排序
  223. const sortChange = (val: any) => {
  224. state.queryParams.SortField = val.order ? val.field : null;
  225. // 0 升序 1 降序
  226. state.queryParams.SortRule = val.order ? (val.order == 'desc' ? 1 : 0) : null;
  227. handleQuery();
  228. };
  229. // 手动查询,将页码设置为1
  230. const handleQuery = () => {
  231. state.queryParams.PageIndex = 1;
  232. queryList();
  233. };
  234. /** 获取列表 */
  235. const requestParams = ref<EmptyObjectType>({});
  236. const queryList = () => {
  237. state.loading = true;
  238. requestParams.value = Other.deepClone(state.queryParams);
  239. requestParams.value.CreationTimeStart = state.queryParams.crTime === null ? null : state.queryParams.crTime[0]; // 受理时间
  240. requestParams.value.CreationTimeEnd = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  241. Reflect.deleteProperty(requestParams.value, 'crTime'); // 删除无用的参数
  242. requestParams.value.FiledTimeStart = state.queryParams.doneTime === null ? null : state.queryParams.doneTime[0]; // 办结时间
  243. requestParams.value.FiledTimeEnd = state.queryParams.doneTime === null ? null : state.queryParams.doneTime[1];
  244. Reflect.deleteProperty(requestParams.value, 'doneTime'); // 删除无用的参数
  245. overdueList(requestParams.value)
  246. .then((res) => {
  247. state.tableData = res.result?.items ?? [];
  248. state.total = res.result?.total ?? 0;
  249. state.loading = false;
  250. tableRef.value.clearCheckboxRow();
  251. checkTable.value = [];
  252. })
  253. .catch((err) => {
  254. tableRef.value.clearCheckboxRow();
  255. checkTable.value = [];
  256. console.log(err);
  257. })
  258. .finally(() => {
  259. state.loading = false;
  260. });
  261. };
  262. // 交办单导出
  263. const onJbExport = () => {
  264. const ids = checkTable.value.map((item: any) => item.id);
  265. exportAssignment(ids)
  266. };
  267. const tableRef = ref<RefType>();
  268. const checkTable = ref<EmptyArrayType>([]);
  269. const selectAllChangeEvent = ({ checked }) => {
  270. if (tableRef.value) {
  271. const records = tableRef.value.getCheckboxRecords();
  272. checkTable.value = records;
  273. console.log(checked ? '所有勾选事件' : '所有取消事件', records);
  274. }
  275. };
  276. const selectChangeEvent = ({ checked }) => {
  277. if (tableRef.value) {
  278. const records = tableRef.value.getCheckboxRecords();
  279. checkTable.value = records;
  280. console.log(checked ? '勾选事件' : '取消事件', records);
  281. }
  282. };
  283. const isChecked = computed(() => {
  284. return !Boolean(checkTable.value.length);
  285. });
  286. /** 重置按钮操作 */
  287. const drawerRuleFormRef = ref();
  288. const ruleFormRef = ref<RefType>(); // 表单ref
  289. const drawer = ref(false);
  290. const resetQuery = (formEl: FormInstance | undefined) => {
  291. if (!formEl) return;
  292. formEl.resetFields();
  293. ruleFormRef.value?.resetFields();
  294. handleQuery();
  295. };
  296. // 获取查询基础数据
  297. const getBaseData = async () => {
  298. try {
  299. const res: any = await departmentSatisfactionDetailBase();
  300. const mappings: any = {
  301. acceptTypeOptions: 'acceptTypeOptions',
  302. channelOptions: 'channelOptions',
  303. orderStatusOptions: 'orderStatusOptions',
  304. currentStepOptions: 'currentStepOptions',
  305. };
  306. for (const key in mappings) {
  307. state[key] = res.result?.[mappings[key]] ?? [];
  308. }
  309. }catch (e){
  310. console.log(e);
  311. }
  312. }
  313. const toolbarRef = ref<RefType>();
  314. onMounted(() => {
  315. queryList();
  316. if (tableRef.value && toolbarRef.value) {
  317. tableRef.value.connect(toolbarRef.value);
  318. }
  319. getBaseData();
  320. });
  321. </script>