浏览代码

reactor:修复语音助手分类筛选BUG;外部市民新增删除和修改;

zhangchong 6 月之前
父节点
当前提交
6ef0db04bc

+ 20 - 0
src/api/auxiliary/externalCitizen.ts

@@ -39,4 +39,24 @@ export const externalCitizenImport = (data: object) => {
 		},
 		data
 	});
+};
+/**
+ * @description 删除外部市民信息
+ */
+export const externalCitizenDelete = (data: object) => {
+  return request({
+		url: '/api/v1/Order/del-externalcitizens',
+		method: 'delete',
+		data
+	});
+};
+/**
+ * @description 修改市民信息
+ */
+export const externalCitizenUpdate = (data: object) => {
+  return request({
+		url: '/api/v1/Order/modify-externalcitizens',
+		method: 'post',
+		data
+	});
 };

+ 2 - 3
src/views/auxiliary/eventClass/index.vue

@@ -61,13 +61,12 @@
 import type { FunctionalComponent } from 'vue';
 import { computed, defineAsyncComponent, onActivated, onMounted, reactive, ref, unref, watch } from 'vue';
 import type { CheckboxValueType, FormInstance } from 'element-plus';
-import { ElMessage, ElMessageBox } from 'element-plus';
+import { ElMessage, ElMessageBox,ElCheckbox } from 'element-plus';
 import { formatDate } from '@/utils/formatTime';
 import { throttle } from '@/utils/tools';
 import other from '@/utils/other';
 import { treeEventClassAll, treeEventClassDelete } from '@/api/auxiliary/eventClass';
 import { auth } from '@/utils/authFunction';
-import { useResizeObserver } from '@vueuse/core';
 // 引入组件
 const EventAdd = defineAsyncComponent(() => import('@/views/auxiliary/eventClass/component/Event-add.vue')); // 新增事件
 const EventEdit = defineAsyncComponent(() => import('@/views/auxiliary/eventClass/component/Event-edit.vue')); // 修改事件
@@ -197,7 +196,7 @@ const state = reactive<any>({
 		{
 			key: 'id',
 			dataKey: 'id',
-			title: 'id',
+			title: '编码',
 			width: 400,
 		},
 		{

+ 6 - 4
src/views/auxiliary/externalCitizen/components/Edit.vue

@@ -20,6 +20,8 @@
 <script setup lang="ts">
 import { reactive, ref } from 'vue';
 import { ElMessage, FormInstance } from 'element-plus';
+import { externalCitizenUpdate } from '@/api/auxiliary/externalCitizen';
+import Other from '@/utils/other';
 
 // 定义子组件向父组件传值/事件
 const emit = defineEmits(['updateList']);
@@ -37,7 +39,7 @@ const state = reactive<any>({
 // 打开弹窗
 const openDialog = async (val:any) => {
 	state.dialogVisible = true;
-	state.ruleForm = val;
+	state.ruleForm = Other.deepClone(val);
 };
 // 关闭弹窗
 const closeDialog = () => {
@@ -52,8 +54,8 @@ const onSubmit = (formEl: FormInstance | undefined) => {
 	if (!formEl) return;
 	formEl.validate((valid: boolean) => {
 		if (!valid) return;
-		/*state.loading = true;
-		treeEventClassEdit(state.ruleForm)
+		state.loading = true;
+		externalCitizenUpdate(state.ruleForm)
 			.then(() => {
 				emit('updateList');
 				closeDialog(); // 关闭弹窗
@@ -64,7 +66,7 @@ const onSubmit = (formEl: FormInstance | undefined) => {
 				emit('updateList');
 				state.loading = false;
 				closeDialog();
-			});*/
+			});
 	});
 };
 // 暴露变量

+ 13 - 4
src/views/auxiliary/externalCitizen/index.vue

@@ -65,8 +65,8 @@
 
 <script lang="tsx" setup name="auxiliaryExternalCitizen">
 import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
-import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
-import { externalCitizenImport, externalCitizenList, externalCitizenTemplate } from '@/api/auxiliary/externalCitizen';
+import { ElMessage, ElMessageBox, ElNotification, FormInstance } from 'element-plus';
+import { externalCitizenDelete, externalCitizenImport, externalCitizenList, externalCitizenTemplate } from '@/api/auxiliary/externalCitizen';
 import { downloadFileByStream } from '@/utils/tools';
 import { formatDate } from '@/utils/formatTime';
 
@@ -137,8 +137,11 @@ const onImport = async (file: any) => {
 	fd.append('file', fileObj); // 文件对象
 	try {
 		const { result } = await externalCitizenImport(fd);
-		console.log(result)
-		ElMessage.success('导入完成');
+		ElNotification({
+			title: '导入完成',
+			message: `总条数:${result.count}条,新增:${result.addCount}条,失败:${result.errorCount}条`,
+			type: 'success',
+		})
 		queryList();
 		state.loading = false;
 	} catch (e) {
@@ -182,6 +185,12 @@ const onDelete = () => {
 	})
 		.then(() => {
 			state.loading = true;
+			externalCitizenDelete(ids).then(()=>{
+				ElMessage.success('删除成功');
+				queryList();
+			}).catch(()=>{
+				state.loading = false;
+			})
 		}).catch(() => {
 		state.loading = false;
 	});

+ 0 - 2
src/views/todo/seats/accept/Script-navigation.vue

@@ -11,10 +11,8 @@
 <script setup lang="ts" name="orderAcceptScriptNavigation">
 import { ref, onActivated, onDeactivated, onMounted } from 'vue';
 import mittBus from '@/utils/mitt';
-import { useRoute } from 'vue-router';
 const active = ref(0);
 // 订阅消息
-const route = useRoute();
 const subscribe = () => {
 	// 接受消息
 	mittBus.on('wsReceive', (message: any) => {

+ 34 - 10
src/views/todo/seats/accept/Voice-assistant.vue

@@ -1,5 +1,24 @@
 <template>
 	<div class="voice-assistant">
+		<el-segmented
+			:options="[
+				{
+					value: '',
+					label: '全部',
+				},
+				{
+					value: 'user',
+					label: '市民',
+				},
+				{
+					value: 'agent',
+					label: '坐席',
+				},
+			]"
+			v-model="voiceType"
+			@change="changeVoiceType"
+			style="position: absolute; right: 0; top: -40px"
+		/>
 		<!-- 聊天框 -->
 		<el-scrollbar class="h100" ref="scrollbarRef" max-height="400px" v-if="showMessageList.length" @click="stopScroll">
 			<div class="chat-box" ref="chatBoxRef">
@@ -30,7 +49,7 @@
 				<el-text class="end-call" tag="p" v-if="talkEnd">-- 通话结束 --</el-text>
 			</div>
 		</el-scrollbar>
-    <el-empty v-else :image-size="100"/>
+		<el-empty v-else :image-size="100" />
 		<el-button @click.stop="keepScroll" class="keep-scroll" title="回到底部" circle v-if="!isScrollBottom && !talkEnd">
 			<SvgIcon name="ele-ArrowDown" size="18px" />
 		</el-button>
@@ -178,7 +197,7 @@ const wsReceive = (message: any) => {
 					messageList.value = [...messageList.value, data];
 				}
 				scrollToBottom();
-				showMessageList.value = other.deepClone(messageList.value);
+				filterMessage(voiceType.value, other.deepClone(messageList.value));
 				console.log('通话消息转写内容:', showMessageList.value);
 			}
 			if (data.body.content.action === 4) {
@@ -205,6 +224,11 @@ const wsReceive = (message: any) => {
 		console.log('坐席辅助收到消息', message);
 	}
 };
+const voiceType = ref('');
+// 选择坐席还是市民通话内容
+const changeVoiceType = () => {
+	filterMessage(voiceType.value, messageList.value);
+};
 // 记录日志
 const submitLogFn = async (request: any) => {
 	try {
@@ -274,26 +298,26 @@ const wsNotice = (message: any) => {
 					i.tags.push(data.body.content[0]);
 				}
 			}
-			showMessageList.value = other.deepClone(messageList.value);
+			filterMessage(voiceType.value, other.deepClone(messageList.value));
 		}
 	} catch (error) {
 		console.log('坐席辅助收到消息', error);
 	}
 };
 // 消息筛选
-const filterMessage = (type: string) => {
+const filterMessage = (type: string,arr: any[]) => {
 	switch (type) {
 		case 'user':
-			showMessageList.value = messageList.value.filter((item: any) => item.body.content.callSentenceInfo.role === 'user');
+			showMessageList.value = arr.filter((item: any) => item.body.content.callSentenceInfo.role === 'user');
 			break;
 		case 'agent':
-			showMessageList.value = messageList.value.filter((item: any) => item.body.content.callSentenceInfo.role === 'agent');
+			showMessageList.value = arr.filter((item: any) => item.body.content.callSentenceInfo.role === 'agent');
 			break;
 		case 'all':
-			showMessageList.value = messageList.value;
+			showMessageList.value = arr;
 			break;
 		default:
-			showMessageList.value = messageList.value;
+			showMessageList.value = arr;
 			break;
 	}
 };
@@ -302,8 +326,8 @@ const state = reactive({
 	ruleForm: {
 		callId: '',
 	},
-})
-onMounted( async () => {
+});
+onMounted(async () => {
 	tagsViewList.value = await Session.get('tagsViewList');
 	if (route.query.callId) {
 		state.ruleForm.callId = route.query?.callId as string; // 通话id

+ 2 - 25
src/views/todo/seats/accept/ybAccept.vue

@@ -7,26 +7,8 @@
 					<el-card shadow="never">
 						<div class="flex-center-between pb10">
 							<p class="border-title mb10">语音助手</p>
-							<el-segmented
-								:options="[
-									{
-										value: '',
-										label: '全部',
-									},
-									{
-										value: 'user',
-										label: '市民',
-									},
-									{
-										value: 'agent',
-										label: '坐席',
-									},
-								]"
-								v-model="voiceType"
-								@change="changeVoiceType"
-							/>
 						</div>
-						<voice-assistant @orderOverwrite="orderOverwrite" ref="voiceAssistantRef" />
+						<voice-assistant @orderOverwrite="orderOverwrite" />
 					</el-card>
 					<el-card shadow="never">
 						<el-tabs v-model="leftTopActive" @tab-change="handleLeftTop" stretch>
@@ -648,12 +630,7 @@ const { AppConfigInfo } = storeToRefs(appConfigStore); // 系统配置信息
 state.ruleForm.acceptorName = userInfos.value.name; // 员工姓名
 state.ruleForm.acceptorStaffNo = userInfos.value.staffNo; // 员工工号
 const route = useRoute(); // 路由
-const voiceType = ref('');
-// 选择坐席还是市民通话内容
-const voiceAssistantRef = ref<RefType>();
-const changeVoiceType = () => {
-	voiceAssistantRef.value.filterMessage(voiceType.value);
-};
+
 const leftTopActive = ref('realtime');
 // 切换工单小结和实时质检
 const callSummaryRef = ref<RefType>();