Browse Source

reactor:工单回访新增批量分配回访人;

zhangchong 1 year ago
parent
commit
a85ec4b9a3

+ 11 - 0
src/api/business/followUp.ts

@@ -45,4 +45,15 @@ export const visitDetailList = (params: object) => {
         method: 'get',
         params
     });
+};
+/**
+ * @description 批量分配回访人员
+ * @param {object} data
+ */
+export const distribution = (data: object) => {
+    return request({
+        url: `/api/v1/Order/visit/distribution`,
+        method: 'post',
+        data
+    });
 };

+ 9 - 0
src/api/public/wex.ts

@@ -8,6 +8,15 @@
  */
 import request from '/@/utils/request';
 import qs from "qs";
+/**
+ * @description  分机小休原本
+ */
+export const telRestBaseData = () => {
+    return request({
+        url: `/api/v1/Pbx/rest/basedata`,
+        method: 'get'
+    });
+};
 /**
  * @description 分机休息(wex)
  */

+ 25 - 32
src/layout/navBars/breadcrumb/telControl.vue

@@ -1,12 +1,12 @@
 <template>
 	<div class="phoneControls" v-loading="state.loading">
 		<div class="infos">
-			<div class="pt5" :class="state.talkTime ? '' : 'mt8'"><span>分机号:</span>{{ telStatusInfo.telsNo }}</div>
-			<div class="pt5" :class="state.talkTime ? '' : 'mt8'">
+			<div class="pt5" :class="talkTime ? '' : 'mt8'"><span>分机号:</span>{{ telStatusInfo.telsNo }}</div>
+			<div class="pt5" :class="talkTime ? '' : 'mt8'">
 				<span>状态:</span><b class="dutyOn_status">{{ currentStatusText }}</b>
 			</div>
-			<div class="pt5" v-if="state.talkTime">
-				<span>通话时长:</span><b class="dutyOn_timer">{{ formatDuration(state.talkTime, false) }}</b>
+			<div class="pt5" v-if="talkTime">
+				<span>通话时长:</span><b class="dutyOn_timer">{{ formatDuration(talkTime, false) }}</b>
 			</div>
 		</div>
 		<div class="btn">
@@ -246,7 +246,7 @@
 					<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="8">
 						<el-form-item label="小休" prop="reason" :rules="[{ required: true, message: '请选择小休原因', trigger: 'change' }]">
 							<el-select v-model="state.restForm.reason" placeholder="请选择小休原因" class="w100" clearable>
-								<el-option v-for="item in state.restReasonOptions" :key="item.id" :label="item.content" :value="item.content" />
+                <el-option v-for="item in state.restReasonOptions" :key="item.dicDataValue" :label="item.dicDataName" :value="item.dicDataValue" />
 							</el-select>
 						</el-form-item>
 					</el-col>
@@ -325,12 +325,7 @@
 					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
 						<el-form-item label="小休" prop="reason" :rules="[{ required: true, message: '请选择小休原因', trigger: 'change' }]">
 							<el-select v-model="state.restForm.reason" placeholder="请选择小休原因" class="w100" clearable>
-              <el-option v-for="item in state.restReasonOptions" :key="item.id" :label="item.content" :value="item.content" />
-								<el-option label="小休中" value="rest" />
-								<el-option label="外出" value="away" />
-								<el-option label="培训" value="trainning" />
-								<el-option label="辅导" value="coach" />
-								<el-option label="会议" value="conference" />
+              <el-option v-for="item in state.restReasonOptions" :key="item.dicDataValue" :label="item.dicDataName" :value="item.dicDataValue" />
 							</el-select>
 						</el-form-item>
 					</el-col>
@@ -406,8 +401,7 @@ import { commonEnum } from '/@/utils/constants';
 import other from '/@/utils/other';
 import mittBus from '/@/utils/mitt';
 import { workflowStepOptions } from '/@/api/system/workflow';
-import {restFlowStart, restFlowDel, restFlowStartWex, getTelList, telRestProcess, telRestAdd} from '/@/api/public/wex';
-import { commonList } from '/@/api/auxiliary/advice';
+import {restFlowStart, restFlowDel, restFlowStartWex, getTelList, telRestProcess, telRestAdd, telRestBaseData} from '/@/api/public/wex';
 import { auth } from '/@/utils/authFunction';
 import { VoiceInterfaceObject } from '/@/utils/PhoneScript';
 import signalR from '/@/utils/signalR';
@@ -452,8 +446,6 @@ const state = reactive<any>({
 		// 外呼表单
 		telNo: null, //外呼号码
 	},
-	talkTime: 0, //通话时长
-	talkTimer: null, //通话时长定时器
 	dutyOnSrc: getImageUrl('phoneControls/dutyOn_blue.png'), //签入图片
 	dutyOffSrc: getImageUrl('phoneControls/dutyOff_blue.png'), //签出图片
 	hangupSrc: getImageUrl('phoneControls/hangup_blue.png'), //挂断图片
@@ -486,27 +478,29 @@ const { AppConfigInfo } = storeToRefs(appConfigStore); // 系统配置信息
 const storesUserInfo = useUserInfo();
 const { userInfos } = storeToRefs(storesUserInfo); // 用户信息
 
+const talkTime = ref<Number>(0);// 通话时长
+const talkTimer = ref<any>(null);// 通话时长定时器
 // 开始计时
 const startTime = debounce(() => {
 	let talkTime = Local.get('talkTime');
 	if (talkTime) {
-		state.talkTime = Number(talkTime);
-		state.talkTimer = setInterval(() => {
-			state.talkTime++;
-			Local.set('talkTime', String(state.talkTime));
+    talkTime.value = Number(talkTime);
+    talkTimer.value = setInterval(() => {
+      talkTime.value++;
+			Local.set('talkTime', String(talkTime.value));
 		}, 1000);
 	} else {
-		state.talkTimer = setInterval(() => {
-			state.talkTime++;
-			Local.set('talkTime', String(state.talkTime));
+    talkTimer.value = setInterval(() => {
+      talkTime.value++;
+			Local.set('talkTime', String(talkTime.value));
 		}, 1000);
 	}
 }, 1000);
 // 结束计时
 const removeTimer = debounce(() => {
-	state.talkTime = 0;
+  talkTime.value = 0;
 	Local.remove('talkTime');
-	clearInterval(state.talkTimer);
+	clearInterval(talkTimer.value);
 }, 1000);
 
 //  signalR 初始化signalr
@@ -825,22 +819,21 @@ const break_reason = (reason: string) => {
       restReason.value = '外出中';
       break;
     case 'rest':
-      restReason.value = '休中';
+      restReason.value = '休中';
       break;
     case 'conference':
       restReason.value = '会议中';
       break;
-    case 'trainning':
+    case 'train':
       restReason.value = '培训中';
       break;
-    case 'coach':
-      restReason.value = '辅导中';
+    case 'eat':
+      restReason.value = '用餐中';
       break;
     default:
-      restReason.value = '示忙中';
+      restReason.value = '休息中';
       break;
   }
-  console.log(restReason.value)
 };
 //签入
 const dutyFormRef = ref<RefType>();
@@ -918,8 +911,8 @@ const onRest = async () => {
 	//  重置表单
 	restFormRef.value?.resetFields();
 	// 查询小休原因
-	const response: any = await commonList({ commonType: commonEnum.RestReason });
-	state.restReasonOptions = response.result;
+	const response: any = await telRestBaseData();
+	state.restReasonOptions = response.result?.restReason ?? [];
 	state.restDialogVisible = true;
 };
 // 打开弹窗清空表单

+ 5 - 2
src/views/auxiliary/businessTag/components/Business-tag-add.vue

@@ -1,5 +1,5 @@
 <template>
-		<el-dialog v-model="state.dialogVisible" width="800px" draggable title="新增业务标签">
+		<el-dialog v-model="state.dialogVisible" width="800px" draggable title="新增业务标签" @close="close">
 			<el-form :model="state.ruleForm" label-width="90px" ref="ruleFormRef">
 				<el-row :gutter="10">
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
@@ -78,7 +78,6 @@ let loading = ref<boolean>(false);  // 加载状态
 // 打开弹窗
 const ruleFormRef = ref<RefType>();
 const openDialog = async () => {
-	ruleFormRef.value?.resetFields();
 	try {
 		state.dialogVisible = true;
 	} catch (error) {
@@ -89,6 +88,10 @@ const openDialog = async () => {
 const closeDialog = () => {
 	state.dialogVisible = false;
 };
+const close = () => {
+  ruleFormRef.value?.resetFields();
+  ruleFormRef.value?.resetFields();
+};
 const classifyList = ref<EmptyArrayType>([]);// 分类列表
 const isClassify = ref<boolean>(false);// 是否显示分类
 const getClassify =()=>{

+ 5 - 2
src/views/auxiliary/businessTag/components/Business-tag-edit.vue

@@ -1,5 +1,5 @@
 <template>
-		<el-dialog v-model="state.dialogVisible" width="800px" draggable :title="dialogTitle">
+		<el-dialog v-model="state.dialogVisible" width="800px" draggable :title="dialogTitle" @close="close">
       <el-form :model="state.ruleForm" label-width="90px" ref="ruleFormRef">
         <el-row :gutter="10">
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
@@ -81,7 +81,6 @@ const dialogTitle = computed(() => {
 // 打开弹窗
 const ruleFormRef = ref<RefType>();
 const openDialog = async (id: string, isDisabled?: boolean) => {
-	ruleFormRef.value?.resetFields();
 	try {
 		const res: any = await businessTagDetail(id);
 		state.ruleForm = res.result ?? <EmptyObjectType>{};
@@ -99,6 +98,10 @@ const openDialog = async (id: string, isDisabled?: boolean) => {
 const closeDialog = () => {
 	state.dialogVisible = false;
 };
+const close = () => {
+  ruleFormRef.value?.resetFields();
+  ruleFormRef.value?.resetFields();
+};
 const classifyList = ref<EmptyArrayType>([]);// 分类列表
 const isClassify = ref<boolean>(false);// 是否显示分类
 const getClassify =()=>{

+ 2 - 1
src/views/business/followUp/backlog/index.vue

@@ -170,7 +170,8 @@ const onTextMessageFollowUp = () => {
 // 批量分配
 const assignReturnVisitorsRef = ref<RefType>();
 const multiplePeople = () => {
-  assignReturnVisitorsRef.value.openDialog();
+  const ids = multipleSelection.value.map((item: any) => item.id);
+  assignReturnVisitorsRef.value.openDialog(ids);
 };
 // 智能回访
 const smartFollowUp = () => {

+ 28 - 13
src/views/business/followUp/component/Assign-return-visitors.vue

@@ -1,9 +1,9 @@
 <template>
-	<el-dialog v-model="state.dialogVisible" width="600px" draggable title="分配回访人">
+	<el-dialog v-model="state.dialogVisible" width="600px" draggable title="分配回访人" @close="close">
 		<el-form :model="state.ruleForm" label-width="90px" ref="ruleFormRef">
-			<el-form-item label="回访人" prop="names" :rules="[{ required: true, message: '请选择回访人', trigger: 'change' }]">
+			<el-form-item label="回访人" prop="employee" :rules="[{ required: true, message: '请选择回访人', trigger: 'change' }]">
         <el-select
-            v-model="state.ruleForm.names"
+            v-model="state.ruleForm.employee"
             filterable
             remote
             class="w100"
@@ -12,7 +12,6 @@
             remote-show-suffix
             :remote-method="remoteMethod"
             :loading="loading"
-            @change="getSelectValue"
             value-key="id"
         >
           <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item" />
@@ -30,10 +29,11 @@
 
 <script setup lang="ts" name="assignReturnVisitors">
 import { reactive, ref } from 'vue';
-import { ElMessage, FormInstance } from 'element-plus';
+import {ElMessage, FormInstance} from 'element-plus';
 import { throttle } from '/@/utils/tools';
 import {queryUser} from "/@/api/system/workflow";
 import {removeDuplicate} from "/@/utils/arrayOperation";
+import {distribution} from '/@/api/business/followUp';
 
 // 定义子组件向父组件传值/事件
 const emit = defineEmits(['updateList']);
@@ -42,15 +42,16 @@ const emit = defineEmits(['updateList']);
 const state = reactive<any>({
 	dialogVisible: false,
 	ruleForm: {
-		name: '', // 标签名
+    employee: null, // 当前用户
+    ids:[],
 	},
 });
 let loading = ref<boolean>(false); // 加载状态
 // 打开弹窗
 const ruleFormRef = ref<RefType>();
-const openDialog = async () => {
-	ruleFormRef.value?.resetFields();
+const openDialog = async (ids:any[]) => {
 	try {
+    state.ruleForm.ids = ids;
 		state.dialogVisible = true;
 	} catch (error) {
 		console.log(error);
@@ -60,6 +61,10 @@ const openDialog = async () => {
 const closeDialog = () => {
 	state.dialogVisible = false;
 };
+const close = ()=>{
+  ruleFormRef.value?.resetFields();
+  ruleFormRef.value?.clearValidate();
+}
 // 远程搜索用户名称
 // 指定用户列表
 const userList = ref<EmptyArrayType>([]);
@@ -78,17 +83,27 @@ const remoteMethod = (query: string) => {
     });
   }
 };
-// 获取选择对象
-const getSelectValue = (query: any) => {
-  console.log(query);
-};
 // 新增
 const onSubmit = throttle(async (formEl: FormInstance | undefined) => {
 	if (!formEl) return;
 	await formEl.validate((valid: boolean) => {
 		if (!valid) return;
 		loading.value = true;
-
+    const request = {
+      ids:state.ruleForm.ids,
+      employeeId:state.ruleForm.employee.id,
+    };
+    distribution(request).then(()=>{
+      ElMessage({
+        message: '操作成功',
+        type: 'success',
+      });
+      loading.value = false;
+      closeDialog();
+      emit('updateList');
+    }).finally(()=>{
+      loading.value = false;
+    })
 	});
 }, 300);
 // 暴露变量