zhangchong 1 год назад
Родитель
Сommit
a68e43ad9c

+ 5 - 0
src/components/Empty/index.vue

@@ -89,3 +89,8 @@ const props = defineProps({
 	},
 });
 </script>
+<style scoped lang="scss">
+:deep(.el-empty__description) {
+  margin-top:0;
+}
+</style>

+ 7 - 6
src/layout/footer/index.vue

@@ -1,8 +1,7 @@
 <template>
 	<div class="layout-footer pb15">
 		<div class="layout-footer-warp">
-			<div>vue-next-admin,Made by lyt with ❤️</div>
-			<div class="mt5">深圳市 xxx 公司版权所有</div>
+      <el-link href="https://element-plus.org" target="_blank" type="info"> 丰窝科技❤️</el-link>
 		</div>
 	</div>
 </template>
@@ -16,10 +15,12 @@
 	width: 100%;
 	display: flex;
 	&-warp {
-		margin: auto;
-		color: var(--el-text-color-secondary);
-		text-align: center;
-		animation: error-num 0.3s ease;
+    margin: auto;
+    text-align: center;
+    animation: error-num 0.3s ease;
+    :deep(.el-link){
+      //color: var(--el-text-color-secondary);
+    }
 	}
 }
 </style>

+ 17 - 122
src/layout/navBars/breadcrumb/telControl.vue

@@ -168,7 +168,6 @@
 			</template>
 
 			<!-- 三方会议 可用(两个通话 一个取消保持 一个保持 才能使用三方通话) -->
-			<!--    && activeArr.includes('conference')   -->
 			<template v-if="telStatusInfo.isDutyOn && activeArr.includes('conference')">
 				<div
 					class="item active"
@@ -209,27 +208,6 @@
 					<span>呼叫</span>
 				</div>
 			</template>
-
-			<!-- 评价 可用 来电才可以评价 callType === 3 -->
-			<!--			<template v-if="telStatusInfo.isDutyOn && activeArr.includes('evaluate') && telStatusInfo.telType === 3">
-				<div
-					class="item active"
-					@mouseenter="onHover('evaluateSrc', 'phoneControls/evaluate_white.png')"
-					title="评价"
-					@mouseleave="onHover('evaluateSrc', 'phoneControls/evaluate_blue.png')"
-					@click="onControlClick('evaluate')"
-				>
-					<img :src="state.evaluateSrc" alt="" />
-					<span>评价</span>
-				</div>
-			</template>-->
-			<!-- 评价 不可用 -->
-			<!--			<template v-else>
-				<div class="item disabled" title="评价">
-					<img :src="getImageUrl('phoneControls/evaluate_grey.png')" alt="" />
-					<span>评价</span>
-				</div>
-			</template>-->
 		</div>
 	</div>
 	<!-- 占位标签 -->
@@ -408,29 +386,10 @@
 			</span>
 		</template>
 	</el-dialog>
-
-	<!-- 三方会议弹窗 -->
-	<el-dialog v-model="state.metingDialogVisible" draggable title="三方会议" width="500px">
-		<el-form :model="state.metingForm" label-width="120px" ref="metingFormRef">
-			<el-form-item label="会议号码" prop="metingId" :rules="[{ required: true, message: '请输入会议号码', trigger: 'blur' }]">
-				<el-input v-model="state.metingForm.metingId" placeholder="请输入会议号码" clearable></el-input>
-			</el-form-item>
-			<el-form-item label="参加会议号码" prop="phoneNo" :rules="[{ required: true, message: '请输入会议号码', trigger: 'blur' }]">
-				<el-input v-model="state.metingForm.phoneNo" placeholder="请输入转移号码以英文逗号隔开" clearable></el-input>
-			</el-form-item>
-		</el-form>
-		<template #footer>
-			<span class="dialog-footer">
-				<el-button @click="state.metingDialogVisible = false" class="default-button" :loading="state.loading">取 消</el-button>
-				<el-button type="primary" @click="onMetingSubmit(metingFormRef)" :loading="state.loading">确 定</el-button>
-			</span>
-		</template>
-	</el-dialog>
 </template>
 
 <script setup lang="ts" name="telControl">
 import { reactive, ref, computed, watch, defineAsyncComponent, onMounted, onBeforeMount } from 'vue';
-import { useRouter } from 'vue-router';
 import { ElMessageBox, ElNotification, ElMessage, FormInstance } from 'element-plus';
 import { storeToRefs } from 'pinia';
 import { useTelStatus, TelStates, RestStates } from '/@/stores/telStatus';
@@ -450,8 +409,6 @@ import { WebsocketInterface } from '/@/utils/websocket';
 import signalR from '/@/utils/signalR';
 import { Local } from '/@/utils/storage';
 import {getGroup} from '/@/api/device/group';
-const storesUserInfo = useUserInfo();
-const { userInfos } = storeToRefs(storesUserInfo);
 
 // 引入组件
 const CommonAdvice = defineAsyncComponent(() => import('/@/components/CommonAdvice/index.vue')); // 常用意见
@@ -517,17 +474,14 @@ const state = reactive<any>({
 	},
   groupName:'', //坐席组名称
 });
+
 const useTelStatusStore = useTelStatus();
-const { telStatusInfo } = storeToRefs(useTelStatusStore);
+const { telStatusInfo } = storeToRefs(useTelStatusStore); // 电话状态
 const appConfigStore = useAppConfig();
-const { AppConfigInfo } = storeToRefs(appConfigStore);
-const dutyFormRef = ref<RefType>(); //签入
-const restFormRef = ref<RefType>(); //小休
-const transferFormRef = ref<RefType>(); // 转接
-const outboundFormRef = ref<RefType>(); //外呼
-const dialogRestRef = ref<RefType>(); // 小休申请弹窗
-const metingFormRef = ref<RefType>(); // 三方会议表单
-const router = useRouter();
+const { AppConfigInfo } = storeToRefs(appConfigStore); // 系统配置信息
+const storesUserInfo = useUserInfo();
+const { userInfos } = storeToRefs(storesUserInfo); // 用户信息
+
 
 // 开始计时
 const startTime = debounce(() => {
@@ -734,27 +688,16 @@ const onControlClick = (val: string) => {
 			if (!auth('public:seat:transfer')) ElMessage.error('抱歉,您没有转接权限!');
 			else onTransfer();
 			break;
-		case 'conference': //三方会议
-			if (!auth('public:seat:meeting')) ElMessage.error('抱歉,您没有三方会议权限!');
-			else onConference();
-			break;
-		case 'conferenceEnd': //结束三方会议
-			if (!auth('public:seat:meeting')) ElMessage.error('抱歉,您没有结束三方会议权限!');
-			else onConferenceEnd();
-			break;
-		case 'outbound': //呼叫
+		case 'outbound': //外呼
 			if (!auth('public:seat:outbound')) ElMessage.error('抱歉,您没有呼叫权限!');
 			else onOutbound();
 			break;
-		case 'evaluate': //评价
-			if (!auth('public:seat:evaluate')) ElMessage.error('抱歉,您没有评价权限!');
-			else onEvaluate();
-			break;
 		default:
 			break;
 	}
 };
 //签入
+const dutyFormRef = ref<RefType>();
 const onDutyFn = async () => {
 	dutyFormRef.value?.resetFields();
 	// 获取所有分机列表(未签入的)
@@ -818,6 +761,7 @@ const onHangup = () => {
 		.catch(() => {});
 };
 // 小休
+const restFormRef = ref<RefType>(); //小休表单
 const onRest = async () => {
 	if (AppConfigInfo.value.IsRestApproval) {
 		// 如果小休需要审核
@@ -908,6 +852,7 @@ const clickOnRest = (formEl: FormInstance | undefined) => {
 	});
 };
 // 设置抽屉
+const dialogRestRef = ref<RefType>(); // 小休申请弹窗
 const mouseup = () => {
 	state.transform = dialogRestRef.value.dialogContentRef.$el.style.transform;
 };
@@ -1008,6 +953,7 @@ const unTalkingDeal = () => {
 		.catch(() => {});
 };
 // 打开转接弹窗
+const transferFormRef = ref<RefType>(); // 转接表单
 const onTransfer = () => {
 	//  重置表单
 	transferFormRef.value?.resetFields();
@@ -1040,43 +986,8 @@ const onConference = () => {
       })
       .catch(() => {});
 };
-const onMetingSubmit = (formEl: FormInstance | undefined) => {
-	if (!formEl) return;
-	formEl.validate((valid: boolean) => {
-		if (!valid) return;
-		state.loading = true;
-		setTimeout(() => {
-			VoiceInterfaceObject.StartMeeting(state.metingForm.metingId, state.metingForm.phoneNo);
-			state.metingDialogVisible = false;
-			state.loading = false;
-		}, 300);
-	});
-};
-// 确定要结束三方会议
-const onConferenceEnd = () => {
-	ElMessageBox.confirm(`确定确定要结束三方会议,是否继续?`, '提示', {
-		confirmButtonText: '确认',
-		cancelButtonText: '取消',
-		type: 'warning',
-		draggable: true,
-		cancelButtonClass: 'default-button',
-		autofocus: false,
-	})
-		.then(() => {
-			// // 设置三方会议状态
-			// useTelStatusStore.setMetTing(false);
-			// // 设置话机状态 取消静音修改为通话状态
-			// useTelStatusStore.setPhoneControlState(TelStates.onCall);
-			// // 循环挂断
-			// for (let item of telStatusInfo.value.onCallArr) {
-			// 	hangupApi(item)
-			// 		.then(() => {})
-			// 		.catch(() => {});
-			// }
-		})
-		.catch(() => {});
-};
 // 外呼
+const outboundFormRef = ref<RefType>(); //外呼
 const onOutbound = () => {
 	//  重置表单
 	outboundFormRef.value?.resetFields();
@@ -1098,22 +1009,6 @@ const clickOnOutbound = (formEl: FormInstance | undefined) => {
 		}, 300);
 	});
 };
-
-// 评价
-const onEvaluate = () => {
-	ElMessageBox.confirm(`确定确定要开始评价,是否继续?`, '提示', {
-		confirmButtonText: '确认',
-		cancelButtonText: '取消',
-		type: 'warning',
-		draggable: true,
-		cancelButtonClass: 'default-button',
-		autofocus: false,
-	})
-		.then(() => {
-			state.loading = true;
-		})
-		.catch(() => {});
-};
 // 监听电话状态变化
 watch(
 	() => telStatusInfo.value.phoneControlState,
@@ -1218,17 +1113,17 @@ onMounted(() => {
 		// 有分机号
 		initWebsocket(); // 初始化websocket
 	}
-	mittBus.on('startTalkTime', () => {
+	mittBus.on('startTalkTime', () => { // 开始计时
 		startTime();
 	});
-	mittBus.on('endTalkTime', () => {
+	mittBus.on('endTalkTime', () => { // 结束计时
 		removeTimer();
 	});
 });
 onBeforeMount(() => {
-	mittBus.off('startTalkTime');
-	mittBus.off('endTalkTime');
-	signalR.leaveGroup('CallCenter');
+	mittBus.off('startTalkTime'); // 移除监听
+	mittBus.off('endTalkTime'); // 移除监听
+	signalR.leaveGroup('CallCenter'); // 离开分组
 });
 </script>
 

+ 16 - 4
src/layout/navMenu/subItem.vue

@@ -1,15 +1,15 @@
 <template>
 	<template v-for="val in chils">
 		<!-- 默认样式 -->
-		<!-- <el-sub-menu :index="val.path" :key="val.path" v-if="val.children && val.children.length > 0">
+		<el-sub-menu :index="val.path" :key="val.path" v-if="val.children && val.children.length > 0 && isMobile">
 			<template #title>
 				<SvgIcon :name="val.meta.icon" />
 				<span>{{ val.meta.title }}</span>
 			</template>
 			<sub-item :chil="val.children" />
-		</el-sub-menu> -->
+		</el-sub-menu>
 		<!-- pop展示第三级菜单 -->
-		<sub-three-item v-if="val.children && val.children.length > 0" :key="val.path" :chil="val.children">
+		<sub-three-item v-else-if="val.children && val.children.length > 0 && !isMobile" :key="val.path" :chil="val.children">
 			<template #header>
 				<SvgIcon :name="val.meta.icon" />
 				<span>{{ val.meta.title }}</span>
@@ -33,9 +33,10 @@
 </template>
 
 <script setup lang="ts" name="navMenuSubItem">
-import { defineAsyncComponent, computed } from 'vue';
+import {defineAsyncComponent, computed, onBeforeMount, ref} from 'vue';
 import { useRouter } from 'vue-router';
 import { verifyUrl } from '/@/utils/toolsValidate';
+import mittBus from '/@/utils/mitt';
 // 引入组件
 const SubThreeItem = defineAsyncComponent(() => import('/@/layout/navMenu/subThreeItem.vue'));
 // 定义父组件传过来的值
@@ -46,6 +47,7 @@ const props = defineProps({
 	},
 });
 const router = useRouter();
+const clientWidth = ref<RefType>(0);
 // 获取父级菜单数据
 const chils = computed(() => {
 	return <any>props.chil;
@@ -57,4 +59,14 @@ const onALinkClick = (val: any) => {
 	if (verifyUrl(val.meta.isLink)) window.open(val.meta.isLink);
 	else window.open(`${origin}${pathname}#${val.meta.isLink}`);
 };
+const isMobile = computed(() => {
+  // 判断是否是手机端
+  return clientWidth.value <= 1000;
+})
+// 页面加载前
+onBeforeMount(() => {
+  mittBus.on('layoutMobileResize', (res: any) => {
+    clientWidth.value = res.clientWidth;
+  });
+});
 </script>

+ 1 - 2
src/layout/routerView/link.vue

@@ -2,7 +2,7 @@
 	<div class="layout-padding layout-link-container">
 		<div class="layout-padding-auto layout-padding-view">
 			<div class="layout-link-warp">
-				<i class="layout-link-icon iconfont icon-untaxing"></i>
+        <i class="layout-link-icon iconfont icon-xingqiu"/>
 				<div class="layout-link-msg">页面 "{{ state.currentRouteMeta.title }}" 已在新窗口中打开</div>
 				<el-button class="mt30" round @click="onGotoFullPage">
 					<i class="iconfont icon-line"></i>
@@ -63,7 +63,6 @@ watch(
 			position: relative;
 			font-size: 100px;
 			color: var(--el-color-primary);
-
 			&::after {
 				content: '';
 				position: absolute;

+ 52 - 59
src/router/backEnd.ts

@@ -4,17 +4,17 @@ import pinia from '/@/stores/index';
 import { useUserInfo } from '/@/stores/userInfo';
 import { useAppConfig } from '/@/stores/appConfig';
 import { useRequestOldRoutes } from '/@/stores/requestOldRoutes';
-import { Local, Cookie} from '/@/utils/storage';
+import { Local, Cookie } from '/@/utils/storage';
 import { NextLoading } from '/@/utils/loading';
 import { dynamicRoutes, notFoundAndNoPower } from '/@/router/route';
 import { formatFlatteningRoutes, formatTwoStageRoutes, router } from '/@/router/index';
 import { useRoutesList } from '/@/stores/routesList';
 import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
 import { getMenu } from '/@/api/login/user';
-import { removeDuplicate } from '/@/utils/arrayOperation';
+import { removeNullAndDuplicates } from '/@/utils/arrayOperation';
 import other from '/@/utils/other';
-import {pwdCheck} from '/@/api/login';
-import {getSettingByCode} from "/@/api/system/parameter";
+import { pwdCheck } from '/@/api/login';
+import { getSettingByCode } from '/@/api/system/parameter';
 const layoutModules: any = import.meta.glob('../layout/routerView/*.{vue,tsx}');
 const viewsModules: any = import.meta.glob('../views/**/*.{vue,tsx}');
 // 后端控制路由
@@ -29,71 +29,63 @@ const dynamicViewsModules: Record<string, Function> = Object.assign({}, { ...lay
 // 菜单格式化
 const formatRouter = (arr: Array<any>): Array<any> => {
 	if (!arr) return [];
-	const newArr: any = [];
-	arr.forEach((v: any) => {
+	return arr.map((v: any) => {
+		const isDynamic = v.path.indexOf('/:') > -1;
 		v.name = v.ruleName;
-		v.meta = {};
-		v.meta.title = v.pageName;
-		v.meta.icon = v.icon;
-		v.meta.isHide = v.isHide;
-		v.meta.isKeepAlive = v.isKeepAlive;
-		v.meta.isAffix = v.isAffix;
-		v.meta.isLink = v.link;
-		v.meta.isIframe = v.isIframe;
-		if (v.path.indexOf('/:') > -1) {
-			v.meta['isDynamic'] = true;
-			v.meta['isDynamicPath'] = v.path;
-		}
-		newArr.push({ ...v });
+		v.meta = {
+			title: v.pageName,
+			icon: v.icon,
+			isHide: v.isHide,
+			isKeepAlive: v.isKeepAlive,
+			isAffix: v.isAffix,
+			isLink: v.link,
+			isIframe: v.isIframe,
+			...(isDynamic && { isDynamic, isDynamicPath: v.path }),
+		};
 		if (v.children?.length) {
-			formatRouter(v.children)
-		}
-	});
-	return newArr;
-}
-// 数组去重和去空
-const removeNull = (arr: any): Array<any> => {
-	const newArr: any = [];
-	arr.forEach((v: any) => {
-		if (v) {
-			newArr.push(v);
+			v.children = formatRouter(v.children);
 		}
+		return v;
 	});
-	return removeDuplicate(newArr);
-}
+};
 // 获取系统配置
-const getAppConfigFn = async ()=> {
+const getSettingValue = async (code: string, isNumber: boolean = false) => {
 	try {
-		const IsRestApproval  =await  getSettingByCode('IsRestApproval'); //查询电话控件小休是否要进行审批
-		const IsRestApprovalValue = IsRestApproval.result?.settingValue.join('|') ?? false;
-		const IsRestApprovalValueBoolean = IsRestApprovalValue === 'true';
-
-		const IsAutoTalkingDeal = await getSettingByCode('IsAutoTalkingDeal'); //查询呼叫中心是否自动事后处理
-		const IsAutoTalkingDealValue = IsAutoTalkingDeal.result?.settingValue.join('|') ?? false;
-		const IsAutoTalkingDealValueBoolean = IsAutoTalkingDealValue === 'true';
-
-		const TalkingDealTime = await getSettingByCode('TalkingDealTime'); //查询自动事后处理时间
-		const TalkingDealTimeValue = TalkingDealTime.result?.settingValue.join('|') ?? 0;
-		let TalkingDealTimeValueNumber: number = Number(TalkingDealTimeValue);
-
-		console.log(`是否开启小休审批${IsRestApprovalValueBoolean},是否自动事后处理${IsAutoTalkingDealValueBoolean},自动事后处理时间${TalkingDealTimeValueNumber}秒`)
+		const setting = await getSettingByCode(code);
+		const value = setting.result?.settingValue.join('|') ?? (isNumber ? '0' : 'false');
+		return isNumber ? Number(value) : value === 'true';
+	} catch (e) {
+		console.log(e);
+		return isNumber ? 0 : false;
+	}
+};
+const getAppConfigFn = async () => {
+	try {
+		const [IsRestApprovalValueBoolean, IsAutoTalkingDealValueBoolean, TalkingDealTimeValueNumber] = await Promise.all([
+			getSettingValue('IsRestApproval'),
+			getSettingValue('IsAutoTalkingDeal'),
+			getSettingValue('TalkingDealTime', true),
+		]);
+		console.log(
+			`是否开启小休审批${IsRestApprovalValueBoolean},是否自动事后处理${IsAutoTalkingDealValueBoolean},自动事后处理时间${TalkingDealTimeValueNumber}秒`
+		);
 		useAppConfig().setAppConfigInfo({
-			IsRestApproval:IsRestApprovalValueBoolean,
-			IsAutoTalkingDeal:IsAutoTalkingDealValueBoolean,
-			TalkingDealTime:TalkingDealTimeValueNumber
+			IsRestApproval: IsRestApprovalValueBoolean,
+			IsAutoTalkingDeal: IsAutoTalkingDealValueBoolean,
+			TalkingDealTime: TalkingDealTimeValueNumber,
 		});
-	}catch (e) {
-		console.log(e)
+	} catch (e) {
+		console.log(e);
 	}
-}
+};
 // 检查是否修改过密码 如果没有修改 跳转到修改密码页面
 const checkPwd = (): void => {
 	pwdCheck().then((res: any) => {
 		if (!res.result) {
 			router.replace('/resetPwd');
 		}
-	})
-}
+	});
+};
 
 /**
  * 后端控制路由:初始化方法,防止刷新时路由丢失
@@ -111,7 +103,8 @@ export async function initBackEndControlRoutes() {
 	if (!Cookie.get('token')) return false;
 
 	let resRouter = null;
-	if (Local.get('requestOldRoutes')) { //获取到缓存
+	if (Local.get('requestOldRoutes')) {
+		//获取到缓存
 		resRouter = Local.get('requestOldRoutes');
 		// 触发初始化用户信息 pinia
 		const authBtnList = Local.get('authBtn') ?? [];
@@ -122,7 +115,7 @@ export async function initBackEndControlRoutes() {
 	} else {
 		// 获取路由菜单数据
 		const res: any = await getBackEndControlRoutes();
-		const buttons = res.result?.buttons ?? [] // 权限按钮列表
+		const buttons = res.result?.buttons ?? []; // 权限按钮列表
 		// 无登录权限时,添加判断
 		// https://gitee.com/lyt-top/vue-next-admin/issues/I64HVO
 		let routerList = res.result?.menus ?? [];
@@ -136,9 +129,9 @@ export async function initBackEndControlRoutes() {
 		// 获取系统配置
 		await getAppConfigFn();
 		// 触发初始化用户信息 pinia
-		await useUserInfo().setUserInfos(removeNull(buttons));
+		await useUserInfo().setUserInfos(removeNullAndDuplicates(buttons));
 		// 存入缓存
-		Local.set('authBtn', removeNull(buttons));
+		Local.set('authBtn', removeNullAndDuplicates(buttons));
 	}
 	// 检查是否修改过密码
 	checkPwd();
@@ -212,7 +205,7 @@ export function getBackEndControlRoutes() {
  * @description 路径:/src/views/system/menu/component/Menu-add.vue
  */
 export function setBackEndControlRefreshRoutes() {
-	Local.remove('requestOldRoutes')
+	Local.remove('requestOldRoutes');
 	getBackEndControlRoutes();
 	window.location.reload();
 }

+ 13 - 0
src/theme/common/transition.scss

@@ -92,3 +92,16 @@
 		opacity: 0;
 	}
 }
+/* 左右左 link.vue
+------------------------------- */
+@keyframes toRight {
+	0% {
+		left: -5px;
+	}
+	50% {
+		left: 100%;
+	}
+	100% {
+		left: -5px;
+	}
+}

+ 9 - 1
src/utils/arrayOperation.ts

@@ -66,4 +66,12 @@ export function removeDuplicate(arr: EmptyArrayType, attr?: string): Array<any>
 		}
 	}
 }
-
+/**
+ * @description 数组去重并去除 null、undefined
+ * @param arr 数组内容
+ * @param attr 数组对象去重时,根据对象的某个属性去重
+ * @returns {Array<any>} 返回去重后的数组
+ */
+export function removeNullAndDuplicates(arr: EmptyArrayType,attr?: string): any[] {
+	return removeDuplicate(arr.filter(v => v !== null && v !== undefined && v !== ''),attr);
+}

+ 9 - 1
src/views/business/order/accept/repeatOrderDetail.vue

@@ -265,6 +265,7 @@ import { useRoute, useRouter } from 'vue-router';
 import { orderDetail } from '/@/api/business/order';
 import { formatDate } from '/@/utils/formatTime';
 import { verifyNumberCnUppercase } from '/@/utils/toolsValidate';
+import { ElMessage } from 'element-plus';
 
 // 引入组件
 const OrderExpandDetail = defineAsyncComponent(() => import('/@/views/business/order/components/Order-expand-detail.vue')); // 扩展信息
@@ -354,7 +355,14 @@ const showDuplicateInf = () => {
 // 	console.log(val);
 // };
 onMounted(() => {
-	if (route.params.id) getDetail(route.params.id);
+	if (!route.params.id){
+		ElMessage({
+			message: '工单id不能为空',
+			type: 'error',
+		});
+		return;
+	}
+	getDetail(route.params.id);
 });
 </script>
 <style lang="scss" scoped>

+ 2 - 2
src/views/home/index.vue

@@ -460,10 +460,10 @@ const linkList = ()=>{
       router.push('/business/return/backlog')
       break;
     case '4': // 发布待办
-      router.push('/business/followUp/backlog')
+      router.push('/business/release')
       break;
     case '5': // 回访待办
-      router.push('/business/followUp')
+      router.push('/business/followUp/backlog')
       break;
   }
 }

+ 12 - 9
src/views/system/menu/component/Menu-add.vue

@@ -174,7 +174,7 @@ import { FormInstance } from 'element-plus';
 import { addMenu, getMenuList } from '/@/api/system/menu';
 
 // 引入组件
-const IconSelector = defineAsyncComponent(() => import('/@/components/IconSelector/index.vue'));  // 图标选择器
+const IconSelector = defineAsyncComponent(() => import('/@/components/IconSelector/index.vue')); // 图标选择器
 
 // 定义子组件向父组件传值/事件
 const emit = defineEmits(['updateList']);
@@ -230,15 +230,18 @@ const state = reactive<any>({
 		},
 	],
 });
-// 获取全部菜单
+// 格式化菜单数据并排除按钮
 const getMenuData = (routes: any) => {
-	const arr: any = [];
-	routes.map((val: any) => {
-		val['title'] = val.pageName;
-		arr.push({ ...val });
-		if (val.children) getMenuData(val.children);
-	});
-	return arr;
+  if (!routes) return [];
+  return routes.map((route: any) => {
+    const { pageName: title, children, ...rest } = route;
+    let filteredChildren = children ? children.filter((child: any) => child.menuType !== 3) : [];
+    return {
+      ...rest,
+      title,
+      children: getMenuData(filteredChildren),
+    };
+  });
 };
 // 打开弹窗
 const openDialog = () => {

+ 12 - 9
src/views/system/menu/component/Menu-edit.vue

@@ -174,7 +174,7 @@ import { auth } from '/@/utils/authFunction';
 import { updateMenu, getMenuList, getMenuById } from '/@/api/system/menu';
 
 // 引入组件
-const IconSelector = defineAsyncComponent(() => import('/@/components/IconSelector/index.vue'));  // 图标选择器
+const IconSelector = defineAsyncComponent(() => import('/@/components/IconSelector/index.vue')); // 图标选择器
 
 // 定义子组件向父组件传值/事件
 const emit = defineEmits(['updateList']);
@@ -230,15 +230,18 @@ const state = reactive<any>({
 		},
 	],
 });
-// 获取全部菜单
+// 格式化菜单数据并排除按钮
 const getMenuData = (routes: any) => {
-	const arr: any = [];
-	routes.map((val: any) => {
-		val['title'] = val.pageName;
-		arr.push({ ...val });
-		if (val.children) getMenuData(val.children);
-	});
-	return arr;
+  if (!routes) return [];
+  return routes.map((route: any) => {
+    const { pageName: title, children, ...rest } = route;
+    let filteredChildren = children ? children.filter((child: any) => child.menuType !== 3) : [];
+    return {
+      ...rest,
+      title,
+      children: getMenuData(filteredChildren),
+    };
+  });
 };
 // 打开弹窗
 const openDialog = async (row: any) => {