diff --git a/src/views/aftersales/aftersalesWorkOrderTemp.vue b/src/views/aftersales/aftersalesWorkOrderTemp.vue index e817f482..b2db5410 100644 --- a/src/views/aftersales/aftersalesWorkOrderTemp.vue +++ b/src/views/aftersales/aftersalesWorkOrderTemp.vue @@ -73,7 +73,11 @@ 结果批量审核 - 工单指派 + + + + + + + + + + + @@ -401,6 +442,15 @@ const workOrderStatus = ref(30); //工单状态 const PageLoading = ref(false); //页面loading const warehouseData = ref([]); //仓库信息 const UserInfo = ref({}); //登陆人信息 +const assignFromForm = ref(null); //指派客服表单实例 +const assignFrom = ref({ + dialogassign: false, + AssignLoad: false, + customerService: [], //客服列表 + rules: { + businessDepartment: [{ required: true, message: '请选择要指派的客服', trigger: 'blur' }], + }, +}); //工单指派总部客服 const batchReturnForm = ref(null); const BatchReturn = ref({ //批量打回弹窗 @@ -608,7 +658,7 @@ const ButtonPermissions = computed(() => { return { add: false, //新增按钮 batchReject: UserPermissions.value == Useridentity.Headquarters_customer_service, //批量打回 - assignment: false, //工单指派 + assignment: UserPermissions.value != Useridentity.Warehouse_customer_service, //工单指派 applyArbitration: false, //客服介入 DingTalkNumber: false, //钉钉号填 batchFinish: false, //批量完结 @@ -857,9 +907,7 @@ watch( TabPermissions.value = $useStore.state.Customer.Customerobj; tabValue.value = $useStore.state.Customer.Customerobj; //菜单编号 if ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].includes(TabPermissions.value)) { - let _Obj = MatchCurrentMenu(); //匹配出当前菜单 - _Obj.request = true; //更新请求状态 - PublicDataRequest(TabPermissions.value); //请求数据 + updateMenuAndData(); //获取最新数据 $useStore.commit('Customer_Menu', 0); //设置回初始值 } $useStore.commit('EDIT_REFRESHITEM', { title: 'aftersalesWorkOrderTemp', status: false }); //重新缓存页面 @@ -920,15 +968,13 @@ const selectionChange = list => { }; // 网页顶部搜索按钮 const searchChange = () => { - PublicDataRequest(); + updateMenuAndData(); //获取最新数据 }; // 刷新按钮 const searchChangeS = () => { details.search = false; //关闭搜索 - let _Obj = MatchCurrentMenu(); - _Obj.request = true; - PublicDataRequest(TabPermissions.value); + updateMenuAndData(); //获取最新数据 }; // 重置表格搜索 const ResetTableSearch = async () => { @@ -1082,6 +1128,25 @@ const GetWarehouse = () => { }); }); }; +/** + * 获取客服人员 + * + * @returns {Promise} + */ +const GetCustomerService = async () => { + try { + let _res = await $_getCustomerServicePersonnel(); + const { code, data } = _res.data; + if (code != 200) { + return; + } + assignFrom.value.customerService = data; + } catch (e) { + console.log(e); + } finally { + } +}; + /** *页面初始化函数,包含字典,等必要请求 */ @@ -1094,10 +1159,11 @@ const PageOnlaod = async () => { Roleverification(), // 获取角色信息 SelectionInitialization(), // 下拉框初始化赋值 GetWarehouse(), //获取仓库 + GetCustomerService(), //获取总部客服列表 ]); // 获取页面数据 - PublicDataRequest(TabPermissions.value); + await PublicDataRequest(TabPermissions.value); } catch (error) { console.log(error); } finally { @@ -1358,7 +1424,17 @@ const getQuery = () => { let _Obj = MatchCurrentMenu(); return _Obj.query; }; - +/** + * @description: 更新当前菜单的请求状态并请求数据 + * @return {void} 无返回值 + */ +const updateMenuAndData = () => { + const currentMenu = MatchCurrentMenu(); // 匹配当前菜单 + if (currentMenu) { + currentMenu.request = true; // 更新请求状态 + } + PublicDataRequest(TabPermissions.value); // 请求数据 +}; /** * @description 通用函数用于处理数据请求(包含待回复、理赔金额未出、申诉、超时未处理) * @param {Function} fetchFunction - 用于执行具体数据请求的函数 @@ -1566,9 +1642,7 @@ const Appealbutton = async state => { } appeal.value.dialogappeal = false; - const currentMenu = MatchCurrentMenu(); - currentMenu.request = true; - PublicDataRequest(TabPermissions.value); + updateMenuAndData(); //更新菜单数据 } finally { appeal.value.loadingappeal = false; } @@ -1593,9 +1667,7 @@ const Deleteappealrecords = async row => { message: '删除成功', type: 'success', }); - let _Obj = MatchCurrentMenu(); - _Obj.request = true; - PublicDataRequest(TabPermissions.value); //获取新数据 + updateMenuAndData(); //获取新数据 } } catch { } finally { @@ -1626,9 +1698,7 @@ const CancelWorkOrderAppeal = row => { .then(res => { console.log(res, '取消申诉返回值'); if (res.data.code == 200) { - let _Obj = MatchCurrentMenu(); - _Obj.request = true; - PublicDataRequest(TabPermissions.value); //获取新数据 + updateMenuAndData(); //获取新数据 ElMessage({ message: '取消申诉成功', type: 'success', @@ -1930,9 +2000,7 @@ const ResultConfirmed = async row => { if (code == 200) { console.log(_res, '理赔金额未出处理结果确定'); ElMessage.success(msg); - let _Obj = MatchCurrentMenu(); - _Obj.request = true; - PublicDataRequest(TabPermissions.value); + updateMenuAndData(); //获取最新数据 } }) .catch(() => {}); @@ -1984,9 +2052,7 @@ const ConfirmReturn = async () => { if (code === 200) { ElMessage.success(msg); BatchReturn.value.dialogReturn = false; //关闭弹窗 - const _Obj = MatchCurrentMenu(); - _Obj.request = true; - PublicDataRequest(TabPermissions.value); + updateMenuAndData(); //获取最新数据 } } catch (e) { console.error(e); @@ -2007,6 +2073,88 @@ const ConfirmReturn = async () => { } }); }; +/** + * @description 工单指派 + * @return {void} 无返回值 + */ +const WorkOrderAssignment = () => { + // 检查是否选中任何工单 + if (!details.selectionList.length) { + // 提示用户选择数据 + ElMessage({ + message: '请勾选要处理的数据', + type: 'warning', + }); + return; + } + // 初始化指派表单并打开指派弹窗 + assignFrom.value = { ...assignFrom.value, businessDepartment: '', dialogassign: true }; +}; + +/** + * 工单指派确定按钮 + * 1.根据选择的客服ID,名称,和选择的工单ID,将其组装成一个data对象 + * 2.然后调用$_assignCustomerService(data)接口, + * 3.成功后关闭加载,关闭弹窗,重新拉取数据 + */ +const Assignbutton = async () => { + const WorkOrderAssignmentFunction = async () => { + const assignForm = assignFrom.value; + assignForm.AssignLoad = true; // 开启加载 + + try { + // 筛选选择的工单 + const foundObjs = assignForm.customerService.find( + obj => obj.id == assignForm.businessDepartment + ); + + if (!foundObjs) { + console.error('未找到对应的工单信息'); + return; + } + + // 构建请求数据 + const data = { + customerServiceId: foundObjs.id, // 归属客服ID + customerServiceName: foundObjs.realName, // 归属客服名称 + assignList: details.selectionList.map(item => item.id), // 异常工单ID/工单ID + }; + + // 发起请求 + const _res = await $_assignCustomerService(data); + const { code, msg } = _res.data; + + if (code !== 200) { + console.error('分配客服失败:', msg); + return; + } + + // 关闭弹窗 + assignForm.dialogassign = false; + + // 更新当前菜单和请求数据 + updateMenuAndData(); + } catch (error) { + console.error('分配客服时发生错误:', error); + } finally { + assignForm.AssignLoad = false; // 关闭加载 + } + }; + + assignFromForm.value.validate(async valid => { + if (valid) { + ElMessageBox.confirm('是否确认指派该客服?', '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }).then(async () => { + await WorkOrderAssignmentFunction(); + }); + } else { + ElMessage.warning('请检查表单是否填写否完整'); + } + }); +}; diff --git a/src/views/finance/ReconciliationDepositSlip.vue b/src/views/finance/ReconciliationDepositSlip.vue index 75875c7e..07c9e943 100644 --- a/src/views/finance/ReconciliationDepositSlip.vue +++ b/src/views/finance/ReconciliationDepositSlip.vue @@ -40,7 +40,7 @@ - +