ZaiZai 9 months ago
parent
commit
3fcc90c329
2 changed files with 46 additions and 47 deletions
  1. 1 1
      public/version.json
  2. 45 46
      src/layout/modules/Cascader.vue

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20241012100028"
+  "value": "20241017171039"
 }

+ 45 - 46
src/layout/modules/Cascader.vue

@@ -18,29 +18,29 @@
 </template>
 
 <script setup>
-import { onMounted, ref, watch } from "vue";
-import { useAppStore } from "~src/store";
-import { initProjectContract } from "~sto/app";
-import { isNullES } from "js-fast-way";
+import { onMounted, ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import { initProjectContract } from '~sto/app'
+import { isNullES } from 'js-fast-way'
 
 //事件
-const emit = defineEmits(["change", "send"]);
+const emit = defineEmits(['change', 'send'])
 
 //状态
-const store = useAppStore();
-const userInfo = ref(store.getUserInfo);
+const store = useAppStore()
+const userInfo = ref(store.getUserInfo)
 
 const projectProps = ref({
-    value: "id",
-    label: "projectAlias",
-    children: "contractInfoList",
-});
+    value: 'id',
+    label: 'projectAlias',
+    children: 'contractInfoList',
+})
 
 //项目合同段
-const projectContract = ref(store.projectContract);
-const projectInfo = ref(store.projectInfo);
-const contractInfo = ref(store.contractInfo);
-const contractId = ref(store.contractId);
+const projectContract = ref(store.projectContract)
+const projectInfo = ref(store.projectInfo)
+const contractInfo = ref(store.contractInfo)
+const contractId = ref(store.contractId)
 
 //监听
 watch(
@@ -52,55 +52,54 @@ watch(
         store.contractId,
     ],
     ([arr, project, contract, pid, cid]) => {
-        projectContract.value = arr;
-        projectInfo.value = project;
-        contractInfo.value = contract;
-        contractId.value = cid;
-        setSend(pid, cid);
-    }
-);
+        projectContract.value = arr
+        projectInfo.value = project
+        contractInfo.value = contract
+        contractId.value = cid
+        setSend(pid, cid)
+    },
+)
 
 //渲染完成
 onMounted(async () => {
-    await initProjectContract();
-    setSend(store.projectId, store.contractId);
-});
+    await initProjectContract()
+    setSend(store.projectId, store.contractId)
+})
 
 const setSend = (pid, cid) => {
     if (isNullES(pid) || isNullES(cid)) {
-        return;
+        return
     }
-    emit("send", {
+    emit('send', {
         projectId: pid,
         contractId: cid,
-    });
-};
+    })
+}
 
 //项目被选择
-const ElCascaderRef = ref(null);
+const ElCascaderRef = ref(null)
 const projectContractChange = (val) => {
     if (val) {
-        const Nodes = ElCascaderRef.value.getCheckedNodes();
-        const UserProjectInfo = Nodes[0].parent.data;
-        const UserContractInfo = Nodes[0].data;
+        const Nodes = ElCascaderRef.value.getCheckedNodes()
+        const UserProjectInfo = Nodes[0].parent.data
+        const UserContractInfo = Nodes[0].data
         //缓存项目数据
-        store.setProjectId(val[0]);
-        store.setContractId(val[1]);
-        store.setProjectInfo(UserProjectInfo);
-        store.setContractInfo(UserContractInfo);
+        store.setProjectId(val[0])
+        store.setContractId(val[1])
+        store.setProjectInfo(UserProjectInfo)
+        store.setContractInfo(UserContractInfo)
         //更改界面更新
-        projectInfo.value = UserProjectInfo;
-        contractInfo.value = UserContractInfo;
-        window.$message?.info("切换了项目,数据更新中");
-
-        emit("send", {
+        projectInfo.value = UserProjectInfo
+        contractInfo.value = UserContractInfo
+        window.$message?.info('切换了项目,数据更新中')
+        emit('send', {
             projectId: val[0],
             contractId: val[1],
-        });
-        emit("change");
-        window?.location?.reload(); //刷新页面
+        })
+        emit('change')
+        window?.location?.reload() //刷新页面
     }
-};
+}
 </script>
 
 <style lang="scss">