8
0
duy преди 9 месеца
родител
ревизия
4b9018868d
променени са 3 файла, в които са добавени 126 реда и са изтрити 13 реда
  1. 1 1
      src/views/desk/archive.vue
  2. 43 4
      src/views/desk/wbs/archieveComponent/rightConfig.vue
  3. 82 8
      src/views/desk/wbs/entry-config.vue

+ 1 - 1
src/views/desk/archive.vue

@@ -558,7 +558,7 @@ const getArchiveTreeDetail = async (param) => {
         } else {
             formModel.value.expDataType = [];
         }
-        if (data.majorDataType.length > 0) {
+        if (data.majorDataType) {
             let arr = data.majorDataType.split(",");
             const numberArray = Array.from(arr, Number);
             formModel.value.majorDataType = numberArray;

+ 43 - 4
src/views/desk/wbs/archieveComponent/rightConfig.vue

@@ -113,8 +113,12 @@
                     </hc-card>
                 </div>
             </div>
+            <!-- 工程文件入口配置 -->
             <div v-if="tabsKey === '2'">
-                <entryConfig :rightData="rightData"></entryConfig>
+                <entryConfig
+                    :rightData="rightData"
+                    :wbsId="treeSelectId"
+                ></entryConfig>
             </div>
         </hc-tab-card>
         <!-- 设置最高层级 -->
@@ -220,6 +224,7 @@ const treeIdChange = (val) => {
 const testTreeIdChange = (val) => {
     treeSelectId.value = val;
     getSecondTreeData(val);
+    getRightData(val);
     if (publictreeValue.value) {
         publictreeValue.value = "";
     }
@@ -402,8 +407,41 @@ const configtree = ref(null);
 const configVisible = ref(false);
 const configInfo = ref({});
 const checkedKeys = ref([]);
-const configCheckChange = () => {};
-const changeConfig = () => {};
+const configCheckChange = (_, { checkedNodes }) => {
+    let array = checkedNodes;
+    for (let index = 1; index < array.length; index++) {
+        const element = array[index];
+        if (element.iswbsNode !== array[0].iswbsNode) {
+            //取消勾选
+            configtree.value.treeRef.setChecked(data.id, false, false);
+            window.$message({
+                message: "非wbs节点不能和wbs节点一起设置规则",
+                type: "warning",
+            });
+            return;
+        }
+    }
+};
+const changeConfig = async () => {
+    let keys = configtree.value.treeRef.getCheckedKeys();
+    let nodes = configtree.value.treeRef.getCheckedNodes();
+    console.log(nodes);
+    const { code, msg } = await archiveApi.updateArchiveAutoRule({
+        archiveAutoType: 2, //最高1  分类2  独立3
+        archiveAutoGroupId: configInfo.value.data.archiveAutoGroupId,
+        selectNodeIds: keys.join(","), //鼠标选择的节点ID(只要鼠标选择的节点,选择节点的下级子节点那种不要),逗号拼接
+        iswbsNode: nodes[0].iswbsNode, //是否是wbs节点
+        projectId: 0, //   系统级为0  项目级为项目id
+    });
+
+    if (code == 200) {
+        window.$message({
+            type: "success",
+            message: msg,
+        });
+        configVisible.value = false;
+    }
+};
 
 //工程文件入口配置
 const rightData = ref([]);
@@ -413,7 +451,8 @@ const getRightData = async (id) => {
         wbsId: id,
     });
     if (code == 200) {
-        rightData.value = data;
+        rightData.value = getArrValue(data);
+        console.log(rightData.value, " rightData.value");
     }
 };
 </script>

+ 82 - 8
src/views/desk/wbs/entry-config.vue

@@ -20,13 +20,13 @@
         v-model="pushfileTap"
         @close="pushFileClose"
     >
-        <div style="width: 100%; overflow-x: auto" v-loading="rightTreeLoading">
+        <div style="width: 100%; overflow-x: auto">
             <hc-data-tree
                 :h-props="dialogProps"
                 show-checkbox
                 :datas="dialogData"
                 tree-key="id"
-                ref="treeRef"
+                ref="entryTreeRef"
             >
             </hc-data-tree>
         </div>
@@ -37,24 +37,36 @@
     </hc-dialog>
 </template>
 <script setup>
+import { getArrValue } from "js-fast-way";
 import { ref, watch } from "vue";
 import archiveApi from "~api/desk/archiveTree";
 
 const props = defineProps({
     rightData: {
-        type: Object,
+        type: Array,
         default: () => [],
     },
+    wbsId: {
+        type: String,
+        default: "",
+    },
 });
 const rightData = ref(props.rightData);
+const wbsId = ref(props.wbsId);
 
 watch(
-    () => props.rightData,
-    (data) => {
+    () => [props.rightData, props.wbsId],
+    ([data, wid]) => {
         rightData.value = data;
+        wbsId.value = wid;
     },
     { immediate: true, deep: true }
 );
+const pushfileTap = ref(false);
+//监听显示
+watch(pushfileTap, (val) => {
+    if (val) getDialogData();
+});
 //数据格式
 const rightprops = ref({ label: "title" });
 
@@ -63,10 +75,72 @@ const rightPushTree = () => {
 };
 
 // 入口配置弹窗
-const pushfileTap = ref(false);
+
 const pushFileClose = () => {};
-const treeRef = ref(null);
+const entryTreeRef = ref(null);
 const dialogProps = ref({ label: "title" });
 const dialogData = ref([]);
-const saveFile = () => {};
+const getDialogData = async () => {
+    const { data, code } = await archiveApi.archiveTreetree({
+        type: 2,
+    });
+    if (code == 200) {
+        dialogData.value = getArrValue(data);
+        saixuan(dialogData.value);
+        console.log(checkXuan.value);
+        entryTreeRef.value.treeRef.setCheckedKeys(checkXuan.value);
+    }
+};
+//设置选中
+const checkXuan = ref([]);
+const saixuan = (da) => {
+    //赛选
+    if (da.length > 0) {
+        let tag = true;
+        da.forEach((val) => {
+            if (val.isDisplayTree == 1 && val.hasChildren) {
+                let ks = saixuan(val.children);
+                if (ks) {
+                    checkXuan.value.push(val.id);
+                }
+            } else if (val.isDisplayTree == 1 && !val.hasChildren) {
+                checkXuan.value.push(val.id);
+            } else {
+                tag = false;
+            }
+        });
+        return tag;
+    }
+};
+//保存入口配置
+const saveFile = async () => {
+    //保存按钮
+    let zi = entryTreeRef.value.treeRef.getCheckedKeys(); //返回选中子节点的key
+    let fu = entryTreeRef.value.treeRef.getHalfCheckedKeys(); //返回选中子节点的父节点的key
+    let arr = [...zi, ...fu];
+    if (arr.length > 0) {
+        let ids = "";
+        arr.forEach((val, key) => {
+            ids += val;
+            if (key != arr.length - 1) {
+                ids += ",";
+            }
+        });
+        const { code } = await archiveApi.submitDisplayConfigTree({ ids });
+
+        if (code == 200) {
+            window.$message({
+                type: "success",
+                message: "设置成功",
+            });
+
+            pushfileTap.value = false;
+        }
+    } else {
+        window.$message({
+            type: "error",
+            message: "请先设置配置文件",
+        });
+    }
+};
 </script>