Browse Source

feat(map): update

gemercheung 1 year ago
parent
commit
978d7a7ed5

+ 3 - 3
src/app/map/App.vue

@@ -16,7 +16,7 @@
       </el-button-group>
     </div>
     <el-form-item label="所属架构:" class="filter">
-      <com-company v-model="state.deptId" />
+      <com-company v-model="state.deptId" :id="state.caseId" />
     </el-form-item>
   </div>
   <div ref="mapEl" class="map-container" v-show="currentType(0)"></div>
@@ -68,7 +68,7 @@ const current = ref(0);
 const list = ref<any>([]);
 
 const state = reactive({
-  // deptId: "",
+  deptId: "",
   caseId: params.caseId || "",
 });
 
@@ -108,7 +108,7 @@ const getDataQuest = () => {
       {
         pageNum: 1,
         pageSize: 10000,
-        caseId: state.caseId,
+        deptId: state.deptId,
       }
     );
     console.log("res.data", res);

+ 0 - 1
src/app/map/company-select/index.vue

@@ -14,7 +14,6 @@ import { useTreeSelect, Props, TreeOption } from "@/hook/treeSelect";
 import { getOrganizationTree } from "./organization";
 import { watchEffect } from "vue";
 
-
 const emit = defineEmits<{
   (e: "update:data", data: TreeOption | null): void;
   (e: "update:modelValue", value: string): void;

+ 4 - 2
src/app/map/company-select/organization.ts

@@ -5,7 +5,9 @@ import {
   editTreeitem,
   getTreeselect,
 } from "@/request";
-
+import { useUrlSearchParams } from "@vueuse/core";
+const params = useUrlSearchParams("history");
+console.log("params", params.caseId);
 const request = axios.create({
   baseURL: 'https://xj-mix3d.4dkankan.com/',
   timeout: 1000,
@@ -36,7 +38,7 @@ export type Organization = {
 };
 
 export const getOrganizationTree = async (type?: string) =>
-  (await axios.get<Organization[]>(getTreeselect, { headers: { share: 1 }, params: { type, ingoreRes: true, share: 1, } })).data;
+  (await axios.get<Organization[]>(getTreeselect, { headers: { share: 1 }, params: { type, caseId: params.caseId, ingoreRes: true, share: 1, } })).data;
 
 export const addOrganization = async (
   dept: Omit<Organization, "id">,

+ 11 - 9
src/hook/treeSelect.ts

@@ -16,6 +16,8 @@ export type Props = {
   allText?: string;
   notDefault?: boolean;
   disabled?: boolean;
+  id?: string
+
 };
 
 export type Mapper = {
@@ -29,15 +31,15 @@ const treeSelectOptionCover = <T>(
 ): TreeOption[] =>
   data.map(
     (item) =>
-      ({
-        label: (item as any)[mapping.label],
-        value: item.id,
-        level: (item as any)[mapping.level],
-        children:
-          item.children && item.children.length
-            ? treeSelectOptionCover(item.children, mapping)
-            : null,
-      } as any)
+    ({
+      label: (item as any)[mapping.label],
+      value: item.id,
+      level: (item as any)[mapping.level],
+      children:
+        item.children && item.children.length
+          ? treeSelectOptionCover(item.children, mapping)
+          : null,
+    } as any)
   );
 
 const getTreePath = (options: TreeOption[], value: string): null | string[] => {