8
0
duy 9 месяцев назад
Родитель
Сommit
9a96ce89b2
1 измененных файлов с 14 добавлено и 3 удалено
  1. 14 3
      src/views/desk/wbs/tree-node-edit.vue

+ 14 - 3
src/views/desk/wbs/tree-node-edit.vue

@@ -268,6 +268,7 @@ const nodeTypelist = ref(props.nodeType);
 const majorDataType = ref(props.majorType);
 const testProps = ref(props.treeProps);
 const modalTitle = ref(props.title);
+const orString = ref("");
 
 //监听数据
 watch(
@@ -283,6 +284,7 @@ watch(
     ],
     ([node, type, wid, nodeType, majorType, treeProps, title]) => {
         formModel.value = node;
+        orString.value = node.className;
         nodeDetail.value = node;
         wbsType.value = type;
         wbsId.value = wid;
@@ -296,10 +298,11 @@ watch(
 );
 
 //监听显示
-watch(isShow, (val) => {
+watch(isShow, async (val) => {
     if (val) {
         getDataInfo();
-        geStandardTypeOptions();
+        await geStandardTypeOptions();
+        changeStandType(formModel.value.className);
     } else {
         emit("close");
     }
@@ -487,8 +490,12 @@ const geStandardTypeOptions = async () => {
 };
 //单元名称
 const unitOptions = ref([]);
+
 const changeStandType = async (val) => {
-    formModel.value.unitName = "";
+    if (val !== orString.value) {
+        formModel.value.unitName = "";
+    }
+
     let parentId = "";
     standardTypeOptions.value.forEach((item) => {
         if (item.value == val) {
@@ -497,6 +504,10 @@ const changeStandType = async (val) => {
     });
     const { data } = await getChildList({ current: 1, size: 10000, parentId });
     unitOptions.value = data;
+    unitOptions.value = unitOptions.value.filter((item) => item.dictKey != -1);
+    unitOptions.value.forEach((ele) => {
+        ele.dictKey = Number(ele.dictKey);
+    });
 };
 </script>