ソースを参照

更新权限回显

wangfumin 2 ヶ月 前
コミット
84b61c11f4

+ 3 - 1
src/request/config.ts

@@ -26,7 +26,8 @@ import {
   getCaseHasDownloadProcess,
   ffmpegMergeImage,
   addOrUpdateCaseTabulation,
-  sceneDeptShare
+  sceneDeptShare,
+  shareAuthList
 } from "./urls";
 import { recordStatus } from "./urls";
 
@@ -68,6 +69,7 @@ export const PostUrls = [
   getSceneList,
   getModelSceneList,
   sceneDeptShare,
+  shareAuthList,
   addOrUpdateCaseTabulation,
 ];
 

+ 2 - 0
src/request/urls.ts

@@ -74,6 +74,8 @@ export const genMeshSceneByCloud = "/fusion/scene/buildSceneObj";
 export const getMix3dList = "/fusion/caseFusion/pageList";
 // 场景共享到上级组织
 export const sceneDeptShare = "/fusion/sceneDeptShare/share";
+// 场景/案件共享权限回显列表
+export const shareAuthList = "/fusion/sceneDeptShare/shareAuthList";
 
 // 统计
 export const sceneStatistics = `/fusion/data/sceneGroupByDept`;

+ 33 - 1
src/view/case/newShare.vue

@@ -54,7 +54,7 @@ import { QuiskExpose } from "@/helper/mount";
 import { Organization, getOrganizationTree } from "@/store/organization";
 import { ElMessage } from "element-plus";
 import { axios } from "@/request";
-import { sceneDeptShare } from "@/request/urls";
+import { sceneDeptShare, shareAuthList } from "@/request/urls";
 
 const props = defineProps<{ caseId: number, projectName?: string }>();
 
@@ -129,6 +129,38 @@ defineExpose<QuiskExpose>({
 });
 
 onMounted(async () => {
+  // 预取组织树
+  organTrees.value = await getOrganizationTree("1");
+  // 预取案件共享权限并回显:deptId、isAuth、shareAuth、mapShow
+  try {
+    const res: any = await axios.post(shareAuthList, { caseId: props.caseId });
+    const raw = res?.data ?? null;
+    const item = Array.isArray(raw) ? raw[0] : raw;
+    if (item) {
+      if (item.deptId != null) {
+        selectedParentId.value = String(item.deptId || "");
+      }
+      if (item.isAuth != null) {
+        const mapAuth: Record<number, "none" | "read" | "edit"> = {
+          0: "none",
+          1: "read",
+          2: "edit",
+        };
+        orgSharePerm.value = mapAuth[Number(item.isAuth)] ?? "none";
+      }
+      if (item.shareAuth != null) {
+        viewScope.value = Number(item.shareAuth) === 1 ? "public" : "login";
+      }
+      if (item.mapShow != null) {
+        visibleInDashboard.value = Number(item.mapShow) === 1;
+      }
+    }
+  } catch (e) {
+    // 忽略错误,保持默认值
+  }
+});
+
+onMounted(async () => {
   const trees = await getOrganizationTree("1");
   const changeStatus = (trees: Organization[], fDisabled: boolean = false) =>
     trees.map((item) => ({

+ 21 - 1
src/view/case/sceneShare.vue

@@ -29,7 +29,7 @@ import { computed, onMounted, ref } from 'vue';
 import { Organization, getOrganizationTree } from '@/store/organization';
 import { QuiskExpose } from '@/helper/mount';
 import { axios } from '@/request';
-import { sceneDeptShare } from '@/request/urls';
+import { sceneDeptShare, shareAuthList } from '@/request/urls';
 
 const props = defineProps<{ num?: string; isObj?: number; caseId?: number }>();
 
@@ -88,6 +88,26 @@ defineExpose<QuiskExpose>({
 onMounted(async () => {
   // 仅加载组织树,前端不做禁用控制,后端负责校验
   organTrees.value = await getOrganizationTree('1');
+  // 预取已设置的共享权限并回显(支持 num/isObj 或 caseId)
+  try {
+    const params: any = props.caseId
+      ? { caseId: props.caseId }
+      : { num: props.num, isObj: props.isObj };
+    const res: any = await axios.post(shareAuthList, params);
+    const raw = res?.data ?? null;
+    const item = Array.isArray(raw) ? raw[0] : raw;
+    if (item) {
+      // 回显部门与权限值(默认取第一条)
+      if (item.deptId != null) {
+        selectedParentId.value = String(item.deptId || '');
+      }
+      if (item.isAuth != null) {
+        isAuth.value = Number(item.isAuth);
+      }
+    }
+  } catch (e) {
+    // 忽略错误,保持默认值
+  }
 });
 </script>
 

+ 1 - 1
src/view/case/share.vue

@@ -38,7 +38,7 @@ const oldRandCode = ref("");
 const shareLink = computed(() => {
   const base = location.origin;
   const p = md5(randCode.value || "");
-  if(base.indexOf("localhost") == -1){
+  if(base.indexOf("localhost") !== -1){
     return `${base}/#/fireDetails/${props.caseId}?editOrShow=edit&fromRoute=fire&share=1&p=${p}`;
   } else {
     return `${base}/fire/#/fireDetails/${props.caseId}?editOrShow=edit&fromRoute=fire&share=1&p=${p}`;