tangning 1 天之前
父節點
當前提交
69a9ee06aa

+ 11 - 7
src/App.vue

@@ -10,7 +10,7 @@
 <script setup lang="ts">
 import Locale from "@/config/locale.vue";
 import { setToken } from "@/store/user";
-import { sceneType, show } from "@/store/case";
+import { getPackageData, show, httpData } from "@/store/case";
 import { strToParams } from "@/util";
 import { ElMessageBox } from "element-plus";
 import { browser } from "@/util/browser.ts";
@@ -19,12 +19,16 @@ console.log("params", params);
 if (params.token) {
   setToken(params.token);
 }
-if(params.power){
-  sceneType.value = params.power;
-}
-if(params.show){
-  show.value = params.show == 'true' ? true : false;
-}
+// if(params.power){
+//   sceneType.value = params.power;
+// }
+// debugger;
+getPackageData({}).then();
+
+show.value = true
+// if(params.show){
+//   show.value = params.show == 'true' ? true : false;
+// }
 let version = browser.isGreaterThan('108.0.0')
 if(!version){
   window.location.href = './browser.html'

+ 3 - 1
src/request/config.ts

@@ -27,6 +27,7 @@ import {
   userReg,
   newFileupload,
   getByTree,
+  packageData,
 } from "./urls";
 
 // 不需要登录就能请求的接口
@@ -39,9 +40,10 @@ export const notLoginUrls = [
   getCompanyList,
   fireDetailByPsw,
   getAttachListByPsw,
-  getByTree,
+  // getByTree,
   addUserOrUpdate,
   userFileInfo,
+  packageData,
 ];
 // 需要用表单提交的数据
 export const fromUrls: string[] = [];

+ 20 - 17
src/request/index.ts

@@ -62,19 +62,19 @@ axios.interceptors.request.use(async (config) => {
   let pageType = PageParams.show == 'true' ? 'view' : 'edit';
   const { token, userId } = getAuth();
   const route = router.currentRoute.value;
-  let caseId = router.currentRoute.value?.params?.caseId
-  if (!token && !~notLoginUrls.indexOf(config.url)) {
-    console.log('用户未登录', caseId);
-    router.replace({ name: RouteName.login});
-    // let redirect = encodeURIComponent(`${window.location.href}`);
-    // window.location.href = window.location.origin + "/#/login?redirect=" + redirect;
-    throw "用户未登录";
-  }
-  config.headers.token = token;
-  config.headers['caseid'] = caseId;
-  // config.headers['Location'] = 'http://survey.4dkankan.com/';
-  config.headers['page-type'] = pageType;
-  config.headers.userid = userId;
+  // let caseId = router.currentRoute.value?.params?.caseId
+  // if (!token && !~notLoginUrls.indexOf(config.url)) {
+  //   console.log('用户未登录', caseId);
+  //   router.replace({ name: RouteName.login});
+  //   // let redirect = encodeURIComponent(`${window.location.href}`);
+  //   // window.location.href = window.location.origin + "/#/login?redirect=" + redirect;
+  //   throw "用户未登录";
+  // }
+  // config.headers.token = token;
+  // config.headers['caseid'] = caseId;
+  // // config.headers['Location'] = 'http://survey.4dkankan.com/';
+  // config.headers['page-type'] = pageType;
+  // config.headers.userid = userId;
 
   if (~GetUrls.indexOf(config.url)) {
     config.method = "GET";
@@ -115,6 +115,9 @@ axios.interceptors.request.use(async (config) => {
 
 const responseInterceptor = (res: AxiosResponse<any, any>) => {
   closeLoading();
+  if(res.config.url === "/package/data.json"){
+    return res.data; 
+  }
   let caseId = router.currentRoute.value?.params?.caseId
   let errMsg = res.data.msg || res.data.message;
   if (res.data.code === 40110) {
@@ -159,7 +162,7 @@ const responseInterceptor = (res: AxiosResponse<any, any>) => {
       return
     }else if(!successCode.includes(res.data.code) && res.config?.responseType != "blob") {
     let errMsg = res.data.msg || res.data.message;
-    openErrorMsg(errMsg);
+    // openErrorMsg(errMsg);
 
     if (
       ~unAuthCode.indexOf(res.data.code) ||
@@ -183,9 +186,9 @@ axios.interceptors.response.use(responseInterceptor, (error) => {
   if (error.response && error.response.data) {
     return responseInterceptor(error.response);
   } else {
-    openErrorMsg(
-      typeof error === "string" ? error : "请求失败,服务端发生了点小故障!"
-    );
+    // openErrorMsg(
+    //   typeof error === "string" ? error : "请求失败,服务端发生了点小故障!"
+    // );
     return Promise.reject(error);
   }
 });

+ 1 - 0
src/request/urls.ts

@@ -172,6 +172,7 @@ export const fireDetailByPsw = "/fusion/web/fireProject/getDetailWithoutAuth"; /
 /** ------------------------------------------ */
 
 // case相关
+export const packageData = "/package/data.json";
 export const caseInfo = "/fusion/case/getInfo";
 export const caseInquestInfo = "/fusion/caseInquestInfo/info";
 export const caseFileTypes = "/fusion/caseFilesType/allList";

+ 85 - 58
src/store/case.ts

@@ -52,7 +52,9 @@ import {
   caseTabulationList,
   caseOverviewList,
   caseOverviewExport,
+  packageData,
 } from "@/request";
+import { strToParams, isEmpty, appendParamsToUrl } from "@/util";
 import { router } from "@/router";
 import { ModelScene, QuoteScene, Scene, SceneType } from "./scene";
 import { user } from "@/store/user";
@@ -74,6 +76,9 @@ export const treeList = ref([]);
 export const show = ref(false);
 export const Extract = ref(false);
 export const sceneList = ref([]);
+let httpdatas = localStorage.getItem("httpData") 
+let httpdatass = httpdatas && JSON.parse(httpdatas) || {}
+export const httpData = ref(httpdatass);
 export const caseInfoData = ref({
   caseTitle: '',
 });
@@ -91,10 +96,10 @@ export const getAiByImage = async (params) =>
   (await axios.post<string>(getByImage, params)).data;
 
 export const getFloorList = async (caseId) =>
-  (await axios.get<string>(getFloor+caseId, {})).data;
+  (await axiosGet<string>(getFloor+caseId, {})).data;
 
 export const getCaseSharePWD = async (params: { caseId: number }) =>
-  (await axios.get<string>(getCasePsw, { params })).data;
+  (await axiosGet<string>(getCasePsw, { params })).data;
 
 export const addByMediaLiBrary = async (params) =>{
   const newUrl = params.uploadIds?.length ? addByMediaLibrarys : addByMediaLibrary
@@ -109,49 +114,56 @@ export const AddsaveOrUpdate = async (params) =>
   (await axios.post<string>(saveOrUpdate, params)).data;
 
 export const getcaseInDate = async (params) =>
-  (await axios.get<string>(criminalInfo, {params})).data;
-  // (await axios.get<string>(info, { params:params })).data;
+  (await axiosGet<string>(criminalInfo, {params})).data;
+  // (await axiosGet<string>(info, { params:params })).data;
 
   export const getcaseMap = async (params) =>
-    (await axios.get<string>(getMapConfig, {params})).data;
-    // (await axios.get<string>(info, { params:params })).data;
+    (await axiosGet<string>(getMapConfig, {params})).data;
+    // (await axiosGet<string>(info, { params:params })).data;
+
+  export const getPackageData = async (params) =>{
+    let myData = (await axiosGet<string>(packageData, { params }))
+    httpData.value = myData
+    console.log(myData,'httpData')
+    localStorage.setItem('httpData', JSON.stringify(myData))
+  };
+    // (await axiosGet<string>(info, { params:params })).data;
 
     
 export const getSceneListData = async (params) =>
-  (await axios.get<string>(getSceneList, { params })).data;
-  // (await axios.get<string>(info, { params:params })).data;
-
-export const getCaseInfo = async (caseId) => {
-  caseInfoData.value =  (await axios.get<Case>(caseInfo, { params: { caseId } })).data
-  if(!caseInfoData.value || !caseInfoData.value.viewAuth){
-      return ElMessageBox.alert("您没有访问权限", "提示", {
-        confirmButtonText: "我知道了",
-        type: "warning",
-        showClose: false
-      }).then(async () => {
-        router.replace({ name: RouteName.login});
-        // window.open(window.location.origin + "/admin/#/statistics/scene");
-      });
-    ;
-  }
-  if(!caseInfoData.value.editAuth && !show.value){
-    show.value = true;
-    return ElMessageBox.alert("您没有编辑权限", "提示", {
-      confirmButtonText: "去查看",
-      type: "warning",
-      showClose: false
-    }).then(async () => {
-      window.open(window.location.origin + "/mix3d/?show=true#/abstract/" + caseId)
-      // router.replace({ name: RouteName.login});
-      // window.open(window.location.origin + "/admin/#/statistics/scene");
-    });
-  }
-  return caseInfoData.value;
+  (await axiosGet<string>(getSceneList, { params })).data;
+  // (await axiosGet<string>(info, { params:params })).data;
+
+export const getCaseInfo = async (caseId: string) => {
+  caseInfoData.value = (await axiosGet<Case>(caseInfo, { params: { caseId } })).data
+  
+  // if (!caseInfoData.value || !caseInfoData.value.viewAuth) {
+  //   return ElMessageBox.alert("您没有访问权限", "提示", {
+  //     confirmButtonText: "我知道了",
+  //     type: "warning",
+  //     showClose: false
+  //   }).then(async () => {
+  //     router.replace({ name: RouteName.login })
+  //   })
+  // }
+  
+  // if (!caseInfoData.value.editAuth && !show.value) {
+  //   show.value = true
+  //   return ElMessageBox.alert("您没有编辑权限", "提示", {
+  //     confirmButtonText: "去查看",
+  //     type: "warning",
+  //     showClose: false
+  //   }).then(async () => {
+  //     window.open(window.location.origin + "/mix3d/?show=true#/abstract/" + caseId)
+  //   })
+  // }
+  
+  return caseInfoData.value
 }
   
 
 export const getCaseInquestInfo = async (caseId: number) =>
-  (await axios.get(newCaseInfo, { params: { caseId } })).data;
+  (await axiosGet(newCaseInfo, { params: { caseId } })).data;
 
 export const casesaveOrUpDate = async (params) =>
   (await axios.post<string>(casesaveOrUpdate, params)).data;
@@ -162,9 +174,9 @@ export const overviewAdd = async (params) =>
 export const TabulationAdd = async (params) =>
   (await axios.post<string>(caseTabulationAdd, params)).data;
 export const getcaseByCaseId = async (caseId) =>
-  (await axios.get(getByCaseId, { params: { caseId } })).data;
+  (await axiosGet(getByCaseId, { params: { caseId } })).data;
 export const caseOverview = async (caseId) =>
-  (await axios.get('/fusion/caseOverview/getByCaseId', { params: { caseId } })).data;
+  (await axiosGet('/fusion/caseOverview/getByCaseId', { params: { caseId } })).data;
 
 export const caseOverviewDel = async ({tabulationId, overviewId, type}) =>
   (await axios.post(type=='方位图'?'/fusion/caseTabulation/del':'/fusion/caseOverview/del', { tabulationId, overviewId } )).data;
@@ -180,12 +192,12 @@ export const getCaseSceneList = async (caseId: number, refresh = false): Promise
   if (!refresh && sceneList.value.length) {
       return sceneList.value;
   }
-  let mylist = (await axios.get(caseSceneList, { params: { caseId, } })).data;
+  let mylist = (await axiosGet(caseSceneList, { params: { caseId, } })).data;
   sceneList.value = mylist.filter(item => item.type != 3);
   return sceneList.value;
 };
 export const getCaseList = async (params): Promise<Scene[]> => {
-  return (await axios.get(caseNewList, {params})).data;
+  return (await axiosGet(caseNewList, {params})).data;
 };
 export const getCaseFusionList = async (params): Promise<Scene[]> => {
   return (await axios.post(caseFusionList, params)).data;
@@ -201,7 +213,7 @@ export const getupdateFileType = async (params): Promise<Scene[]> => {
 };
 
 export const getDictFileLists = async (type: number): Promise<Scene[]> => {
-  return (await axios.get(getDictFileList, { params: { type: type } })).data;
+  return (await axiosGet(getDictFileList, { params: { type: type } })).data;
 };
 export const delDictFileLists = async (id: number): Promise<Scene[]> => {
   return (await axios.post(delDictFileList, { id })).data;
@@ -209,11 +221,12 @@ export const delDictFileLists = async (id: number): Promise<Scene[]> => {
 
 
 export const getcaseLists = async (caseId: number): Promise<Scene[]> => {
-  return (await axios.get(isdyrh, { params: { caseId } })).data;
+  return (await axiosGet(isdyrh, { params: { caseId } })).data;
 };
 
 export const updateByTreeFileLists = async (caseId = router.currentRoute.value?.params?.caseId): Promise<Scene[]> => {
-  let list = (await axios.get(getByTree, { params: { caseId:caseId } })).data
+  console.log('updateByTreeFileLists1');
+  let list = (await axiosGet(getByTree, { params: { caseId:caseId } })).data
   // function getTreeList(lists: any[]) {
   //   return lists.map(item => {
   //     return {
@@ -223,6 +236,7 @@ export const updateByTreeFileLists = async (caseId = router.currentRoute.value?.
   //     }
   //   })
   // }
+  console.log(list, 'updateByTreeFileLists');
   treeList.value = list;
   return list;
 };
@@ -242,7 +256,7 @@ export const updateSelectByTreeFileLists = async (): Promise<Scene[]> => {
       }
     })
   }
-  return getTreeList((await axios.get(getByTree, { params: { caseId: '' } })).data)
+  return getTreeList((await axiosGet(getByTree, { params: { caseId: '' } })).data)
 };
 export const caseImgList = (caseId: number, orderBy: string | null) =>
   axios.post(caseApiList, { orderBy: orderBy || "", caseId });
@@ -266,14 +280,14 @@ export const getByTreeFileLists = async () => {
 };
 
 export const getCaseInquestInfoOld = (caseId: number) =>
-  axios.get(caseInquestInfoOld, { params: { inquestFileId: caseId } });
+  axiosGet(caseInquestInfoOld, { params: { inquestFileId: caseId } });
 
 export const saveCaseInquestInfo = (params) =>
   axios.post(caseInquestOpt, params
   );
 
 export const exportCaseInquestInfo = (caseId: number) =>
-  axios.get(caseInquestExport, {
+  axiosGet(caseInquestExport, {
     params: { inquestFileId: caseId, ingoreRes: true },
     responseType: "blob",
   });
@@ -341,20 +355,20 @@ export const saveCaseImgTagData = (params: any) =>
   axios.post(saveCaseImgTag, { ...params });
 
 export const getCaseImgTagData = (caseId: number) =>
-  axios.get(getCaseImgTag, { params: { caseId } });
+  axiosGet(getCaseImgTag, { params: { caseId } });
 
 export const getSceneListHasAi = (caseId: number) =>
-  axios.get(sceneListHasAi, { params: { caseId } });
+  axiosGet(sceneListHasAi, { params: { caseId } });
 
 export const getTipsList = (key) =>
-  axios.get(getTips, { params: { 
+  axiosGet(getTips, { params: { 
     basic: 'y',
     key,
     location: '113.05,22.61',
    } });
 
 export const getTipsNames = (name) =>
-  axios.get(getTipsName, { params: { name } });
+  axiosGet(getTipsName, { params: { name } });
 
 export const submitMergePhotos = (data) => axios.post(ffmpegMergeImage, { ...data })
 
@@ -399,23 +413,36 @@ export const getUrlSrc = (item, caseId) => {
     5: `/mega/index.html?m=${item.num}`,
     6: `/spg.html?m=${item.num}`,
     7: `/spg.html?m=${item.num}`,
-    99: `/code/index.html?caseId=${caseId}&single#/show`,
+    // 99: `/code/index.html?caseId=${caseId}&single#/show`,
+    99: `/fusion_offline/${caseId}/env/wwww/offline.html?caseId=${caseId}&single#/show`,
   };
   let SceneEditType = {
-    0: `/spg.html?m=${item.num}&token=${token}&pure=1`,
-    1: `/spg.html?m=${item.num}&token=${token}&pure=1`,
+    0: `/swkk/${item.num}/env/wwwroot/spg.html?m=${item.num}&token=${token}&pure=1`,
+    1: `/swkk/${item.num}/env/wwwroot/spg.html?m=${item.num}&token=${token}&pure=1`,
     2: `/mega/index.html?m=${item.num}`,
     3: `/swss/index.html?m=${item.num}`,
-    4: `/spg.html?m=${item.num}&token=${token}&pure=1`,
+    4: `/swkk/${item.num}/env/wwwroot/spg.html?m=${item.num}&token=${token}&pure=1`,
     // 5: `/spg.html?m=${item.num}`,
     // 5: `index.html?caseId=${caseId}&modelId=${item.num}#sign-model`,
     5: `/mega/index.html?m=${item.num}`,
-    6: `/spg.html?m=${item.num}&token=${token}&pure=1`,
-    7: `/spg.html?m=${item.num}&token=${token}&pure=1`,
-    99: `/code/index.html?caseId=${item.fusionId || caseId}&single#/show`,
-    100: `/code/index.html?caseId=${item.fusionId || caseId}&pure=1#/show`,
+    6: `/swkk/${item.num}/env/wwwroot/spg.html?m=${item.num}&token=${token}&pure=1`,
+    7: `/swkk/${item.num}/env/wwwroot/spg.html?m=${item.num}&token=${token}&pure=1`,
+    99: `/fusion_offline/${caseId}/env/wwww/offline.html?caseId=${item.fusionId || caseId}&single#/show`,
+    100: `/fusion_offline/${caseId}/env/wwww/offline.html?caseId=${item.fusionId || caseId}&pure=1#/show`,
   };
   
   console.log(sceneType.value, 'sceneType.value')
   return sceneType.value == 'view' ? SceneEditType[item.type]: SceneEditType[item.type];
 }
+// 设置全局请求hook
+function axiosGet(url, {params}) {
+  const route = router.currentRoute.value;
+  let caseId = router.currentRoute.value?.params?.caseId
+  let Urlkey = appendParamsToUrl(url, {...params, caseId})
+  console.log('httpData', httpData.value[Urlkey], Urlkey, params);
+  if(httpData.value[Urlkey]){
+    return Promise.resolve(httpData.value[Urlkey]);
+  }else{
+    return axios.get(url, {...params});
+  }
+}

+ 49 - 1
src/util/index.ts

@@ -524,4 +524,52 @@ export const recursiveSearch = (nodes) => {
     }
     
     return false;
-  }
+  }
+export const isEmpty = (obj) => {
+  // 先校验类型:必须是对象且非 null/数组
+  if (obj === null || typeof obj !== 'object' || Array.isArray(obj)) {
+    return false;
+  }
+  // 遍历自有可枚举属性
+  for (let key in obj) {
+    if (obj.hasOwnProperty(key)) {
+      return false; // 有属性则非空
+    }
+  }
+  return true;
+};
+/**
+ * 将 GET 参数拼接到 URL 上
+ * @param {string} url 基础 URL(可带已有参数)
+ * @param {object} params GET 参数对象(支持数组、基本类型)
+ * @returns {string} 拼接后的完整 URL
+ */
+export function appendParamsToUrl(url, params = {}) {
+  if (typeof url !== "string") throw new Error("URL 必须是字符串");
+  if (typeof params !== "object" || params === null) return url;
+
+  // 处理参数:转义 + 过滤空值 + 支持数组(如 arr=[1,2] → arr=1&arr=2)
+  const queryItems = [];
+  for (const [key, value] of Object.entries(params)) {
+    // 过滤空值(undefined/null/空字符串)
+    if (value === undefined || value === null || value === "") continue;
+
+    // 处理数组参数
+    if (Array.isArray(value)) {
+      value.forEach(item => {
+        queryItems.push(`${encodeURIComponent(key)}=${encodeURIComponent(item)}`);
+      });
+      continue;
+    }
+
+    // 普通键值对
+    queryItems.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
+  }
+
+  // 无参数则直接返回原 URL
+  if (queryItems.length === 0) return url;
+
+  const queryStr = queryItems.join("&");
+  // 判断 URL 已有 ?:有则加 &,无则加 ?
+  return `${url}${url.includes("?") ? "&" : "?"}${queryStr}`;
+}

+ 2 - 1
src/view/case/records/index.vue

@@ -820,7 +820,8 @@ const handleAI = async () => {
   // }
 };
 const handleSelect = (val, itme) => {
-  console.log("handleSelect", val, itme);
+  aiImgData.value.result = false;
+  aiImgData.value.result = ''
 }
 const initSSE = (url) => {
   // 销毁旧连接(避免重复连接)

+ 0 - 2
src/view/diversity/index.vue

@@ -110,8 +110,6 @@ async function geiList(refresh) {
   list.value = await getCaseList({
     caseId: caseId.value,
     type: 'fusion',
-    pageNum: 1,
-    pageSize: 100000,
   })||[];
   // list.value = getList.filter((item) => item.caseId);
   console.log("getCaseFusionList", list.value);

+ 2 - 2
src/view/diversity/pagging.ts

@@ -1,11 +1,11 @@
 import { usePagging } from "@/hook/pagging";
 import { SceneType, getScenePagging } from "@/store/scene";
-import { getCaseFusionList } from "@/store/case";
+import { getCaseList } from "@/store/case";
 import { computed, reactive, watch, watchEffect } from "vue";
 
 export const useScenePaggingParams = () => {
   const pagging = usePagging({
-    get: getCaseFusionList,
+    get: getCaseList,
     paramsTemlate: {
       isShare: 0,
       sceneName: "",

+ 1 - 1
src/view/layout/index.vue

@@ -85,7 +85,7 @@ const init = async () => {
   // let url = getUrlSrc({ id: 0 }, caseId.value)
   // sceneURL.value = url;
 };
-init();
+// init();
 const qpisceneList = computed(() =>
   getCaseSceneListData(caseId.value as number)
 );

+ 1 - 1
src/view/layout/slide/index.vue

@@ -57,7 +57,7 @@ function getList() {
       'sceneimg': recursiveSearch(res.find(ele => ele.filesTypeName == '三录材料').childrenList),
       'dossier': recursiveSearch(res.find(ele => ele.filesTypeName == '案件卷宗').childrenList),
     }
-    console.log('recursiveSearch', showObj)
+    console.log('recursiveSearch', showObj, res)
     routes.value = getPermissionRoutes(props.names.filter(ele => showList.includes(ele)?showObj[ele]:true));
     console.log('recursiveSearch', props.names.filter(ele => showList.includes(ele)?showObj[ele]:true))
   })

+ 1 - 1
src/view/vrmodel/index.vue

@@ -172,7 +172,7 @@ async function handleAdd() {
 }
 function handleItem(item) {
   console.log("handleItem", item);
-  if(!item.viewAuth) return ElMessage.error("您没有查看权限,请联系管理员开通");
+  // if(!item.viewAuth) return ElMessage.error("您没有查看权限,请联系管理员开通");
   sceneItem.value = item;
   sceneURL.value = getUrlSrc({...sceneItem.value, type: sceneItem.value.sceneType}, caseId.value);
   

+ 7 - 2
vite.config.ts

@@ -10,8 +10,8 @@ if (process.argv.length > 3) {
 }
 
 const dev = true;
-const url = 'http://192.168.0.125:1804';
-
+// const url = 'http://192.168.0.125:1804';
+const url = 'http://127.0.0.1:9001';
 export default defineConfig({
   define: {
     VITE_APP_APP: JSON.stringify(app),
@@ -57,6 +57,11 @@ export default defineConfig({
         changeOrigin: true,
         secure: false,
       },
+      "/package": {
+        target: url,
+        changeOrigin: true,
+        secure: false,
+      },
       "/model": {
         target: url,
         changeOrigin: true,