瀏覽代碼

修改bug

bill 1 年之前
父節點
當前提交
5efa2f26a1

+ 11 - 10
src/app/fire/view/dispatch/header.vue

@@ -66,7 +66,7 @@
 <script lang="ts" setup>
 import { FirePagging } from "./pagging";
 import comCompany from "@/components/company-select/index.vue";
-import { genCascaderValue, getCode, getRaw } from "@/helper/cascader";
+import { genCascaderValue, getCode, getRaw, getValue } from "@/helper/cascader";
 import { reason, place, fireStatuOptions } from "@/app/fire/constant/fire";
 import comHead from "@/components/head/index.vue";
 import { computed, ref, watchEffect } from "vue";
@@ -77,15 +77,16 @@ const head = computed(() => [
   { name: props.isTeached ? "教学平台" : "火调管理", value: "2" },
 ]);
 
-const projectSite = ref<string[]>([UN_REQ_NUM.toString()]);
+const projectSite = genCascaderValue(
+  computed(() => props.pagging.state.query),
+  "projectSite",
+  UN_REQ_NUM.toString()
+);
 watchEffect(() => {
-  props.pagging.state.query.projectSiteCode = getCode(place, getRaw(projectSite.value));
+  props.pagging.state.query.projectSiteCode = getCode(place, getRaw(projectSite.value!));
 });
-watchEffect(() => {
-  if (!props.pagging.state.query.projectSiteCode) {
-    projectSite.value = [UN_REQ_NUM.toString()];
-  }
-});
-
-const fireReason = genCascaderValue(ref(props.pagging.state.query), "fireReason");
+const fireReason = genCascaderValue(
+  computed(() => props.pagging.state.query),
+  "fireReason"
+);
 </script>

+ 1 - 1
src/app/fire/view/dispatch/pagging.ts

@@ -49,7 +49,7 @@ export const useFirePagging = () => {
     () => {
       pagging.state.query = params[isTeached.value ? 0 : 1];
     },
-    { flush: "post" }
+    { flush: "sync" }
   );
 
   return { pagging, isTeached };

+ 9 - 7
src/components/company-select/index.vue

@@ -22,18 +22,20 @@ const emit = defineEmits<{
 }>();
 const props = defineProps<Props>();
 
-const state = useTreeSelect(props, getOrganizationTree, {
-  label: "name",
-  level: "level",
-});
+const state = useTreeSelect(
+  props,
+  getOrganizationTree,
+  (val) => emit("update:modelValue", val),
+  {
+    label: "name",
+    level: "level",
+  }
+);
 
 watchEffect(() => {
   emit("update:data", state.currentOption);
 });
 watchEffect(() => {
-  emit("update:modelValue", state.value);
-});
-watchEffect(() => {
   emit("update:label", state.label);
 });
 watchEffect(() => {

+ 1 - 1
src/constant/caseFile.ts

@@ -4,7 +4,7 @@ export const FileDrawType = 1;
 export const DrawFormats = [".jpg", ".jpeg", ".png"];
 export const OtherFormats = [".pdf", ".jpeg", ".doc", ".docx", ".jpg", ".png"];
 export const BoardTypeDesc = {
-  [BoardType.scene]: "现场图",
+  [BoardType.scene]: "户型图",
   [BoardType.map]: "方位图",
 };
 export const DrawFormatDesc = "jpg、png等格式的文件";

+ 9 - 3
src/helper/cascader.ts

@@ -14,11 +14,17 @@ export const genCascaderValue = <
   T extends Ref<{ [key in K]: string }>
 >(
   target: T,
-  key: K
+  key: K,
+  def?: string
 ) =>
   computed({
-    get: () => target.value[key] && target.value[key].split(">"),
-    set: (val) => (target.value[key] = val.join(">")),
+    get: () =>
+      target.value[key]
+        ? target.value[key].split(">")
+        : def
+        ? [def]
+        : undefined,
+    set: (val) => (target.value[key] = val!.join(">")),
   });
 
 export const getCode = (options: CascaderOptions, raw: string) => {

+ 15 - 21
src/hook/treeSelect.ts

@@ -76,6 +76,7 @@ const allOption: TreeOption = { label: "全部", value: "" };
 export const useTreeSelect = <T>(
   props: Props,
   request: () => Promise<Item<T>[]>,
+  update: (val: string) => void,
   mapping: Mapper = { label: "name", level: "level" }
 ) => {
   // 原始数据
@@ -86,44 +87,37 @@ export const useTreeSelect = <T>(
     return props.hideAll ? dataOptions : [allOption, ...dataOptions];
   });
 
-  const value = ref<string>("");
-
-  watchEffect(
-    () => {
-      if (props.modelValue != value.value) {
-        value.value = props.modelValue;
-      }
-    },
-    { flush: "post" }
-  );
-
   // 级联控件续高亮value
   const path = computed({
-    get: () => getTreePath(options.value, value.value)!,
+    get: () => getTreePath(options.value, props.modelValue)!,
     set: (path) => {
-      value.value = path ? path[path.length - 1] : "";
+      update(path ? path[path.length - 1] : "");
     },
   });
   const currentOption = computed(() =>
-    getTreeSelect(options.value, value.value)
+    getTreeSelect(options.value, props.modelValue)
   );
 
   const label = computed(
     () =>
-      options.value.find((option) => option.value === value.value)?.label || ""
+      options.value.find((option) => option.value === props.modelValue)
+        ?.label || ""
   );
 
-  watchEffect(() => {
-    if (!props.notDefault && !value.value && options.value.length) {
-      value.value = options.value[0].value;
-    }
-  });
+  watch(
+    () => props.modelValue,
+    () => {
+      if (!props.notDefault && !props.modelValue && options.value.length) {
+        update(options.value[0].value);
+      }
+    },
+    { immediate: true }
+  );
 
   request().then((data) => (optionsRaw.value = data as any));
 
   return reactive({
     label,
-    value,
     path,
     options,
     raw: optionsRaw,

+ 3 - 1
src/store/system.ts

@@ -19,7 +19,9 @@ export type LoginProps = {
 export const title = ref(appConstant.title);
 export const desc = ref(appConstant.desc);
 
-watchEffect(() => (document.title = title.value + " | " + desc.value));
+watchEffect(
+  () => (document.title = title.value + (desc.value ? " | " + desc.value : ""))
+);
 
 const refreshUserInfo = async (data: any) => {
   user.value.info = data;

+ 9 - 3
src/view/case/addScenes.vue

@@ -33,7 +33,7 @@ import VRModelList from "@/view/vrmodel/list.vue";
 import { Scene } from "@/store/scene";
 import { CaseScenes } from "@/store/case";
 import { useScenePaggingParams } from "@/view/vrmodel/pagging";
-import { onMounted, ref, watchEffect } from "vue";
+import { onMounted, ref, watch, watchEffect } from "vue";
 import {
   getCaseSceneList,
   getCaseScenes,
@@ -48,8 +48,14 @@ const params = useScenePaggingParams();
 const caseScenes = ref<CaseScenes>(getCaseScenes([]));
 const tableRef = ref<InstanceType<typeof ElTable>>();
 
-params.pagging.state.query.status = 2;
-params.pagging.state.query.caseId = props.caseId;
+watch(
+  () => params.pagging.state.query,
+  () => {
+    params.pagging.state.query.status = 2;
+    params.pagging.state.query.caseId = props.caseId;
+  },
+  { immediate: true, deep: true }
+);
 // 复选框同步
 watchEffect(() => {
   if (!tableRef.value) return;

+ 1 - 1
src/view/case/draw/slider.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="df-slide-content">
-    <h3>户型图</h3>
+    <h3>{{ BoardTypeDesc[type] }}</h3>
     <div class="def-image-set">
       <el-button type="primary" @click="emit('trackImage')" ghost>
         设置{{ BoardTypeDesc[type] }}</el-button

+ 15 - 15
src/view/case/help.ts

@@ -39,7 +39,7 @@ export const getFuseCodeLink = (caseId: number, query?: boolean) => {
 
 export const getSWKKSyncLink = async (caseId: number) => {
   const scenes = await getCaseSceneList(caseId);
-  const supportTypes = [SceneType.SWKK, SceneType.SWKJ];
+  const supportTypes = [SceneType.SWKK, SceneType.SWKJ, SceneType.SWSSMX];
   const kkScenes = scenes.filter((scene) =>
     supportTypes.includes(scene.type)
   ) as QuoteScene[];
@@ -97,7 +97,7 @@ export const getQuery = (
   single: boolean = false
 ) =>
   `${getFuseCodeLink(caseId, true)}${share ? "&share=1" : ""}${
-    single ? "single=1" : ""
+    single ? "&single=1" : ""
   }#show/summary`;
 
 // 查看
@@ -151,19 +151,19 @@ export const fuseIframeHandler = (iframe: HTMLIFrameElement) => {
   }, 100);
 
   const stopWatch = watchEffect((onCleanup) => {
-    if (currentType.value === FuseImageType.LASER) {
-      const $iframe = getSceneIframe(iframe)!;
-      const target = $iframe.contentWindow!.document.head;
-      const $style = document.createElement("style");
-      $style.type = "text/css";
-      var textNode = document.createTextNode(`
-        .mode-tab > .model-mode-tab.strengthen {
-          display: none
-        }
-      `);
-      $style.appendChild(textNode);
-      target.appendChild($style);
-    }
+    // if (currentType.value === FuseImageType.LASER) {
+    //   const $iframe = getSceneIframe(iframe)!;
+    //   const target = $iframe.contentWindow!.document.head;
+    //   const $style = document.createElement("style");
+    //   $style.type = "text/css";
+    //   var textNode = document.createTextNode(`
+    //     .mode-tab > .model-mode-tab.strengthen {
+    //       display: none
+    //     }
+    //   `);
+    //   $style.appendChild(textNode);
+    //   target.appendChild($style);
+    // }
   });
 
   return () => {

+ 4 - 2
src/view/vrmodel/modelContent.vue

@@ -113,8 +113,10 @@ const { percentage, upload: uploadCheck, fileList, file, removeFile } = useUploa
   maxSize: ModelMaxSize,
   formats: ModelSupportFormats,
   upload: async (file, onPercentage) => {
-    await uploadModelScene(file, onPercentage);
-    props.pagging.refresh();
+    try {
+      await uploadModelScene(file, onPercentage);
+      props.pagging.refresh();
+    } catch {}
     removeFile();
   },
 });