Эх сурвалжийг харах

reactor:491 短信中心:新增查询条件

zhangchong 2 долоо хоног өмнө
parent
commit
59d07e74b9

+ 1 - 1
.env.development

@@ -3,7 +3,7 @@ VITE_MODE_NAME=development
 # 防止部署多套系统到同一域名不同目录时,变量共用的问题 设置不同的前缀
 VITE_STORAGE_NAME=dev
 # 业务系统基础请求地址
-VITE_API_URL=http://110.188.24.28:50100
+VITE_API_URL=http://110.188.24.28:50200
 # 业务系统socket请求地址
 VITE_API_SOCKET_URL=http://110.188.24.28:50100/hubs/hotline
 # 业务系统文件上传上传请求地址

+ 22 - 9
src/components/ProcessAudit/ZGSSPProcess.vue

@@ -709,6 +709,7 @@ import { orderPrevious, workflowNextSteps, workflowNextStepsByOrder, workflowNex
 import { useAppConfig } from '@/stores/appConfig';
 import { VTreeDrop } from '@wsfe/vue-tree';
 import { removeDuplicate } from '@/utils/arrayOperation';
+import { fileDownloadByUrl } from '@/api/public/file';
 
 // 引入组件
 const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
@@ -1003,10 +1004,7 @@ const orgSummaryToEnd = computed(() => {
 });
 // 部门流转到归档
 const orgToEnd = computed(() => {
-	return (
-		currentParams.value.currentStepBusinessType === 2 &&
-		selectNext.value.key === 'end'
-	);
+	return currentParams.value.currentStepBusinessType === 2 && selectNext.value.key === 'end';
 });
 // 判断当前工单是 随手拍电气焊作业申报 并且是部门办理时 并且当前节点是普通节点 并且选择的下一节点是汇总或者归档
 const orgDQH = computed(() => {
@@ -1028,9 +1026,9 @@ const orgAQYH = computed(() => {
 			(selectNext.value.stepType === 3 || selectNext.value.key === 'end') &&
 			isAQYHOrder) ||
 		(currentParams.value.counterSignType === null &&
-		currentParams.value.currentStepBusinessType === 2 &&
-		currentParams.value.currentStepType === 0 &&
-		(selectNext.value.stepType === 3 || selectNext.value.key === 'end') &&
+			currentParams.value.currentStepBusinessType === 2 &&
+			currentParams.value.currentStepType === 0 &&
+			(selectNext.value.stepType === 3 || selectNext.value.key === 'end') &&
 			isAQYHOrder)
 	);
 });
@@ -1123,7 +1121,8 @@ const selectNextStep = (val: any) => {
 		orgOneToEnd.value ||
 		orgToOrg.value ||
 		orgToOrgSummary.value ||
-		orgSummaryToEnd.value || orgToEnd.value;
+		orgSummaryToEnd.value ||
+		orgToEnd.value;
 
 	if (seatToOrgOne.value || paidanToOrgOne.value) {
 		// 话务部到一级部门 派单组到一级部门 默认选中主协办
@@ -1591,7 +1590,21 @@ const otherReasonRequired = computed(() => {
 // 打开文件
 const openFile = (file: any) => {
 	console.log(file);
-	window.open(import.meta.env.VITE_API_UPLOAD_URL + file.path);
+	/*	window.open(import.meta.env.VITE_API_UPLOAD_URL + file.path);*/
+	fileDownloadByUrl({
+		Source: 'hotline',
+		Id: file.id,
+	}).then((res: any) => {
+		let blob: Blob = new Blob([res.data], { type: res.data.type }); // 创建blob 设置blob文件类型 data 设置为后端返回的文件(例如mp3,jpeg) type:这里设置后端返回的类型 为 mp3
+		let down: HTMLAnchorElement = document.createElement('a'); // 创建A标签
+		let href: string = window.URL.createObjectURL(blob); // 创建下载的链接
+		down.href = href; // 下载地址
+		down.download = file.fileName; // 下载文件名
+		document.body.appendChild(down);
+		down.click(); // 模拟点击A标签
+		document.body.removeChild(down); // 下载完成移除元素
+		window.URL.revokeObjectURL(href); // 释放blob对象
+	});
 };
 // 办理
 const handleFiles = ref<EmptyArrayType>([]); // 流程附件

+ 41 - 20
src/directive/authDirective.ts

@@ -9,6 +9,12 @@ import { nextTick } from 'vue';
  * @directive 多个权限验证,满足一个则显示(v-auths="[xxx,xxx]")
  * @directive 多个权限验证,全部满足则显示(v-auth-all="[xxx,xxx]")
  */
+
+// 判断数组 A 是否完全包含 B
+function hasAllPermissions(required: string[], actual: string[]) {
+	if (!Array.isArray(required) || required.length === 0) return false;
+	return required.every((perm) => actual.includes(perm));
+}
 export function authDirective(app: App) {
 	// 单个权限验证(v-auth="xxx")
 	app.directive('auth', {
@@ -24,33 +30,48 @@ export function authDirective(app: App) {
 					}
 				}
 			}).then();
-		}
+		},
 	});
 	// 多个权限验证,满足一个则显示(v-auths="[xxx,xxx]")
 	app.directive('auths', {
 		mounted(el, binding) {
-			if (!binding.value) {
-				el.parentNode && el.parentNode.removeChild(el);
-			}
-			let flag = false;
 			const stores = useUserInfo();
-			stores.userInfos.authBtnList?.map((val: string) => {
-				binding.value.map((v: string) => {
-					if (val === v) flag = true;
-				});
-			});
-			if (!flag) el.parentNode.removeChild(el);
+			nextTick(() => {
+				const requiredPerms = binding.value;
+				// 若未传入权限数组,直接隐藏
+				if (!Array.isArray(requiredPerms) || requiredPerms.length === 0) {
+					el.parentNode?.contains(el) && el.parentNode.removeChild(el);
+					return;
+				}
+				const userPerms = stores.userInfos.authBtnList || [];
+				// 是否拥有其中一个权限
+				const hasOne = requiredPerms.some((perm: string) => userPerms.includes(perm));
+				if (!hasOne) {
+					el.parentNode?.contains(el) && el.parentNode.removeChild(el);
+				}
+			}).then();
 		},
 	});
+
+
 	// 多个权限验证,全部满足则显示(v-auth-all="[xxx,xxx]")
 	app.directive('auth-all', {
 		mounted(el, binding) {
-			if (!binding.value) {
-				el.parentNode && el.parentNode.removeChild(el);
-			}
-			const stores = useUserInfo();
-			const flag = judgementSameArr(binding.value, stores.userInfos.authBtnList);
-			if (!flag) el.parentNode.removeChild(el);
-		},
-	});
-}
+			nextTick(() => {
+				const required = binding.value;
+				if (!Array.isArray(required) || required.length === 0) {
+					el.parentNode?.contains(el) && el.parentNode.removeChild(el);
+					return;
+				}
+
+				const stores = useUserInfo();
+				const userPerms = stores.userInfos.authBtnList || [];
+
+				const hasAll = hasAllPermissions(required, userPerms);
+				if (!hasAll) {
+					el.parentNode?.contains(el) && el.parentNode.removeChild(el);
+				}
+			});
+		}
+	})
+}

+ 4 - 1
src/directive/index.ts

@@ -1,7 +1,8 @@
 import type { App } from 'vue';
 import { authDirective } from '@/directive/authDirective';
-import { wavesDirective, lazyImgDirective,inputTrimDirective } from '@/directive/customDirective';
+import { wavesDirective, lazyImgDirective, inputTrimDirective } from '@/directive/customDirective';
 import { horizontalScroll } from '@/directive/tableScorll';
+import { permissionDirective } from '@/directive/permissionAuth';
 
 /**
  * 导出指令方法:v-xxx
@@ -14,6 +15,8 @@ import { horizontalScroll } from '@/directive/tableScorll';
 export function directive(app: App) {
 	// 用户权限指令
 	authDirective(app);
+	// 用户权限指令
+	permissionDirective(app);
 	// 按钮波浪指令
 	wavesDirective(app);
 	// 图片懒加载指令

+ 56 - 0
src/directive/permissionAuth.ts

@@ -0,0 +1,56 @@
+import { App, nextTick } from 'vue';
+import { useUserInfo } from '@/stores/userInfo';
+
+// 判断数组 A 是否完全包含 B
+function hasAllPermissions(required: string[], actual: string[]) {
+	return required.every((perm) => actual.includes(perm));
+}
+
+// 判断数组 A 是否有任意一个包含 B
+function hasAnyPermission(required: string[], actual: string[]) {
+	return required.some((perm) => actual.includes(perm));
+}
+
+/**
+ * 用户权限指令
+ * @directive 1. 单个权限判断(v-permission="'edit'")
+ * @directive 2. 任意权限判断(v-permission="['edit', 'create']")
+ * @directive 3. 全部权限判断(v-permission="{ all: ['edit', 'create'] }")
+ * @directive 4. 任意权限判断(v-permission="{ any: ['edit', 'create'] }")
+ */
+export function permissionDirective(app: App) {
+	app.directive('permission', {
+		mounted(el, binding) {
+			nextTick(() => {
+				const stores = useUserInfo();
+				const userPerms = stores.userInfos.authBtnList || [];
+
+				let hasPermission = false;
+
+				const required = binding.value;
+
+				// 1. 如果是单个权限(string 类型)
+				if (typeof required === 'string') {
+					hasPermission = userPerms.includes(required);
+				}
+				// 2. 如果是任意一个权限(数组)
+				else if (Array.isArray(required)) {
+					hasPermission = hasAnyPermission(required, userPerms);
+				}
+				// 3. 如果是必须全有权限(对象形式)
+				else if (typeof required === 'object') {
+					if (required.any) {
+						hasPermission = hasAnyPermission(required.any, userPerms);
+					} else if (required.all) {
+						hasPermission = hasAllPermissions(required.all, userPerms);
+					}
+				}
+
+				// 没有权限时,移除该元素
+				if (!hasPermission) {
+					el.parentNode?.contains(el) && el.parentNode.removeChild(el);
+				}
+			}).then();
+		},
+	});
+}

+ 1 - 1
src/utils/tools.ts

@@ -496,7 +496,7 @@ export function trimCompat(input: string | number | null) {
  * */
 export function exportAssignment(ids: string[]) {
 	return new Promise((resolve, reject) => {
-		ElMessageBox.confirm(`工单已留痕,禁止泄露工单信息,否则将依法依规追究责任。您确定导出选中的工单交办单?`, '提示', {
+		ElMessageBox.confirm(`导出已留痕,禁止泄露工单信息,否则将依法依规追究责任。您确定导出选中的工单交办单?`, '提示', {
 			confirmButtonText: '确认',
 			cancelButtonText: '取消',
 			type: 'warning',