Browse Source

节点参数修改

duy 3 months ago
parent
commit
55b204f6c3

+ 222 - 216
src/views/desk/wbs/node-param-dialog.vue

@@ -3,29 +3,31 @@
         v-model="isShow"
         is-footer-center
         title=" 节点参数"
-        @close="dialogClose"
-        @save="saveElementHandle"
         widths="56rem"
         :loading="submitLoading"
+        @close="dialogClose"
+        @save="saveElementHandle"
     >
         <hc-card-item>
             <template #extra>
-                <el-button size="small" type="primary" @click="addRowClick"
-                    >新增</el-button
-                >
+                <el-button size="small" type="primary" @click="addRowClick">
+                    新增
+                </el-button>
                 <el-button
                     size="small"
                     type="warning"
-                    @click="refreshNode"
                     :loading="refreshLoad"
-                    >刷新</el-button
+                    @click="refreshNode"
                 >
+                    刷新
+                </el-button>
                 <el-button
                     size="small"
                     type="success"
                     @click="setParamNameClick"
-                    >设置参数名称</el-button
                 >
+                    设置参数名称
+                </el-button>
             </template>
 
             <hc-table
@@ -55,13 +57,13 @@
                     <hc-table-input v-model="row.remark" />
                 </template>
                 <template #action="{ row, index }">
-                    <el-link type="warning" @click="linkElement(row)"
-                        >关联元素</el-link
-                    >
+                    <el-link type="warning" @click="linkElement(row)">
+                        关联元素
+                    </el-link>
 
-                    <el-link type="danger" @click="delRowClick(index, row)"
-                        >删除</el-link
-                    >
+                    <el-link type="danger" @click="delRowClick(index, row)">
+                        删除
+                    </el-link>
                 </template>
             </hc-table>
         </hc-card-item>
@@ -70,10 +72,10 @@
             v-model="setNameShow"
             is-footer-center
             title=" 设置参数名称"
-            @close="nameClosedialogClose"
-            @save="saveNameHandle"
             widths="56rem"
             :loading="setNameLoading"
+            @close="nameClosedialogClose"
+            @save="saveNameHandle"
         >
             <hc-card-item>
                 <template #extra>
@@ -81,8 +83,9 @@
                         size="small"
                         type="primary"
                         @click="addNameRowClick"
-                        >新增</el-button
                     >
+                        新增
+                    </el-button>
                 </template>
 
                 <hc-table
@@ -100,9 +103,9 @@
                         <hc-table-input v-model="row.remark" />
                     </template>
                     <template #action="{ row, index }">
-                        <el-link type="danger" @click="delNameClick(row, index)"
-                            >删除</el-link
-                        >
+                        <el-link type="danger" @click="delNameClick(row, index)">
+                            删除
+                        </el-link>
                     </template>
                 </hc-table>
             </hc-card-item>
@@ -112,9 +115,9 @@
         <hc-dialog
             v-model="linkParamShow"
             title=" 节点参数设置-关联元素"
-            @close="linkParamdialogClose"
             widths="56rem"
             :footer="false"
+            @close="linkParamdialogClose"
         >
             <hc-card-item>
                 <hc-table
@@ -124,18 +127,20 @@
                 >
                     <template #action="{ row, index }">
                         <el-link
-                            type="primary"
                             v-if="!row.mappingId"
+                            type="primary"
                             @click="chooseClick(row, index)"
-                            >选择元素</el-link
                         >
+                            选择元素
+                        </el-link>
                         <el-link
-                            type="danger"
                             v-else
-                            @click="delLinkClick(row, index)"
+                            type="danger"
                             :loading="delLinkLoading"
-                            >删除关联</el-link
+                            @click="delLinkClick(row, index)"
                         >
+                            删除关联
+                        </el-link>
                     </template>
                 </hc-table>
             </hc-card-item>
@@ -144,17 +149,17 @@
         <hc-dialog
             v-model="chooseLinkShow"
             title=" 选择关联元素"
-            @close="linkShowClose"
             widths="56rem"
-            @save="saveLink"
             :loading="saveLoading"
+            @close="linkShowClose"
+            @save="saveLink"
         >
             <hc-card-item>
                 <hc-search-input
                     v-model="queryValue"
+                    class="mb-4"
                     @search="searchClick"
                     @clear="searchClick"
-                    class="mb-4"
                 />
                 <hc-table
                     :column="chooseLinkTableColumn"
@@ -165,349 +170,350 @@
                         <el-checkbox
                             v-model="row.checked"
                             @change="(value) => linkEleCheck(value, index)"
-                        ></el-checkbox>
+                        />
                     </template>
                 </hc-table>
             </hc-card-item>
         </hc-dialog>
     </hc-dialog>
 </template>
+
 <script setup>
-import { ref, watch } from "vue";
-import mainWbsApi from "~api/wbs/wbsforelement";
-import mainApi from "~api/wbs/tree";
-import { getArrValue } from "js-fast-way";
-import { HcDelMsg } from "hc-vue3-ui";
+import { ref, watch } from 'vue'
+import mainWbsApi from '~api/wbs/wbsforelement'
+import mainApi from '~api/wbs/tree'
+import { getArrValue } from 'js-fast-way'
+import { HcDelMsg } from 'hc-vue3-ui'
 const props = defineProps({
     nodeId: {
         type: String,
-        default: "",
+        default: '',
     },
-    porjectId: {
+    projectId: {
         type: String,
-        default: "",
+        default: '',
     },
     scopeType: {
         type: [String, Number],
-        default: "",
+        default: '',
     },
     nodeInfo: {
         type: Object,
         default: () => {},
     },
-});
+})
 //事件
-const emit = defineEmits(["close"]);
+const emit = defineEmits(['close'])
 //双向绑定
 // eslint-disable-next-line no-undef
-const isShow = defineModel("modelValue", {
+const isShow = defineModel('modelValue', {
     default: false,
-});
+})
 //监听显示
 watch(isShow, (val) => {
     if (val) {
-        getTableData();
-        getNameList();
+        getTableData()
+        getNameList()
     } else {
-        emit("close");
+        emit('close')
     }
-});
-const nodeId = ref(props.nodeId);
-const porjectId = ref(props.porjectId);
-const scopeType = ref(props.scopeType);
-const nodeInfo = ref(props.nodeInfo);
-const delIds = ref([]);
+})
+const nodeId = ref(props.nodeId)
+const projectId = ref(props.projectId)
+const scopeType = ref(props.scopeType)
+const nodeInfo = ref(props.nodeInfo)
+const delIds = ref([])
 //监听数据
 watch(
-    () => [props.nodeId, props.porjectId, props.scopeType, props.nodeInfo],
+    () => [props.nodeId, props.projectId, props.scopeType, props.nodeInfo],
     ([tid, pid, stype, ninfo]) => {
-        nodeId.value = tid;
-        porjectId.value = pid;
-        scopeType.value = stype;
-        nodeInfo.value = ninfo;
+        nodeId.value = tid
+        projectId.value = pid
+        scopeType.value = stype
+        nodeInfo.value = ninfo
     },
-    { deep: true }
-);
+    { deep: true },
+)
 //关闭弹窗
 const dialogClose = () => {
-    isShow.value = false;
-    emit("close");
-};
-const submitLoading = ref(false);
+    isShow.value = false
+    emit('close')
+}
+const submitLoading = ref(false)
 const saveElementHandle = async () => {
-    let tag = true;
+    let tag = true
     tableData.value.forEach((val) => {
         if (!val.k | !val.v) {
-            return (tag = false);
+            return (tag = false)
         }
         for (let i = 0; i < nameList.value.length; i++) {
             if (nameList.value[i].k == val.k) {
-                val.name = nameList.value[i].name;
-                return;
+                val.name = nameList.value[i].name
+                return
             }
         }
-    });
+    })
     if (tag) {
-        submitLoading.value = true;
+        submitLoading.value = true
         const { error, code, data } = await mainApi.saveOrUpdateBatch({
             scopeType: scopeType.value,
-            porjectId: porjectId.value,
+            projectId: projectId.value,
             nodeId: nodeId.value,
             wps: tableData.value,
             type: 1,
             delIds: delIds.value,
-        });
-        submitLoading.value = false;
+        })
+        submitLoading.value = false
         //判断状态
         if (!error && code === 200) {
-            window.$message.success("设置参数节点成功");
-            delIds.value = [];
-            getTableData();
+            window.$message.success('设置参数节点成功')
+            delIds.value = []
+            getTableData()
         }
     } else {
-        window.$message.warning("请填写所有的参数名称和参数值KEY");
+        window.$message.warning('请填写所有的参数名称和参数值KEY')
     }
-};
+}
 const tableColumn = [
-    { key: "name", name: "参数名称", align: "center" },
-    { key: "v", name: "参数值KEY", align: "center" },
-    { key: "remark", name: "描述", align: "center" },
-    { key: "action", name: "操作", align: "center" },
-];
-const tableLoading = ref(false);
-const tableData = ref([]);
+    { key: 'name', name: '参数名称', align: 'center' },
+    { key: 'v', name: '参数值KEY', align: 'center' },
+    { key: 'remark', name: '描述', align: 'center' },
+    { key: 'action', name: '操作', align: 'center' },
+]
+const tableLoading = ref(false)
+const tableData = ref([])
 
 const getTableData = async () => {
     let pid = nodeInfo.value.primaryKeyId
         ? nodeInfo.value.primaryKeyId
-        : nodeInfo.value.pKeyId;
-    tableLoading.value = true;
+        : nodeInfo.value.pKeyId
+    tableLoading.value = true
     const { data } = await mainApi.parameters({
-        wbsId: porjectId.value ? pid : nodeId.value,
-    });
+        wbsId: projectId.value ? pid : nodeId.value,
+    })
 
-    tableData.value = getArrValue(data);
-    tableLoading.value = false;
-};
-const nameList = ref([]);
+    tableData.value = getArrValue(data)
+    tableLoading.value = false
+}
+const nameList = ref([])
 const getNameList = async () => {
-    const { data } = await mainApi.keymap({});
+    const { data } = await mainApi.keymap({})
 
-    nameList.value = getArrValue(data);
-};
+    nameList.value = getArrValue(data)
+}
 const addRowClick = () => {
     tableData.value.unshift({
-        k: "",
-        v: "",
-        remark: "",
+        k: '',
+        v: '',
+        remark: '',
         nodeId: nodeId.value,
         type: 1,
-    });
-};
+    })
+}
 const delRowClick = (index, row) => {
-    delIds.value.push(row.id);
-    tableData.value.splice(index, 1);
-};
+    delIds.value.push(row.id)
+    tableData.value.splice(index, 1)
+}
 //设置节点参数名称
-const setNameShow = ref(false);
-const nameTableData = ref([]);
+const setNameShow = ref(false)
+const nameTableData = ref([])
 const setParamNameClick = async () => {
-    setNameShow.value = true;
-    await getNameList();
-    nameTableData.value = [...nameList.value];
-};
-const nameClosedialogClose = () => {};
-const setNameLoading = ref(false);
+    setNameShow.value = true
+    await getNameList()
+    nameTableData.value = [...nameList.value]
+}
+const nameClosedialogClose = () => {}
+const setNameLoading = ref(false)
 const saveNameHandle = async () => {
     //设置参数名称中的保存按钮
     if (nameTableData.value.length) {
-        let tag = true;
+        let tag = true
         nameTableData.value.forEach((val) => {
             if (!val.name || !val.k) {
-                return (tag = false);
+                return (tag = false)
             }
-        });
+        })
         if (tag) {
-            setNameLoading.value = true;
+            setNameLoading.value = true
             const { error, code, data } = await mainApi.saveOrUpdateBatch({
                 scopeType: scopeType.value,
                 nodeId: nodeId.value,
-                porjectId: porjectId.value,
+                projectId: projectId.value,
                 wps: nameTableData.value,
                 type: 0,
                 delIds: delIds.value,
-            });
-            setNameLoading.value = false;
+            })
+            setNameLoading.value = false
             //判断状态
             if (!error && code === 200) {
-                window.$message.success("操作成功");
-                setNameShow.value = false;
-                delIds.value = [];
-                getNameList();
-                getTableData();
+                window.$message.success('操作成功')
+                setNameShow.value = false
+                delIds.value = []
+                getNameList()
+                getTableData()
             }
         } else {
-            window.$message.warning("请填写所有的参数名称和参数值KEY");
+            window.$message.warning('请填写所有的参数名称和参数值KEY')
         }
     } else {
-        window.$message.warning("请先添加参数");
+        window.$message.warning('请先添加参数')
     }
-};
+}
 const nameTableColumn = [
-    { key: "name", name: "参数名称", align: "center" },
-    { key: "k", name: "参数值KEY", align: "center" },
-    { key: "remark", name: "描述", align: "center" },
-    { key: "action", name: "操作", align: "center" },
-];
+    { key: 'name', name: '参数名称', align: 'center' },
+    { key: 'k', name: '参数值KEY', align: 'center' },
+    { key: 'remark', name: '描述', align: 'center' },
+    { key: 'action', name: '操作', align: 'center' },
+]
 
-const nameTableLoading = ref(false);
+const nameTableLoading = ref(false)
 const addNameRowClick = () => {
     nameTableData.value.unshift({
-        name: "",
-        remark: "",
-        k: "",
+        name: '',
+        remark: '',
+        k: '',
         type: 0,
         nodeId: nodeId.value,
-    });
-};
+    })
+}
 const delNameClick = (row, index) => {
-    delIds.value.push(row.id);
-    nameTableData.value.splice(index, 1);
-};
+    delIds.value.push(row.id)
+    nameTableData.value.splice(index, 1)
+}
 
 //关联元素
 const linkTableColumn = [
-    { key: "tableName", name: "元素表名", align: "center" },
-    { key: "elementName", name: "关联元素字段", align: "center" },
+    { key: 'tableName', name: '元素表名', align: 'center' },
+    { key: 'elementName', name: '关联元素字段', align: 'center' },
 
-    { key: "action", name: "操作", align: "center" },
-];
-const linkTableData = ref([]);
-const linkTableLoading = ref(false);
-const curParam = ref({});
-const linkParamShow = ref(false);
+    { key: 'action', name: '操作', align: 'center' },
+]
+const linkTableData = ref([])
+const linkTableLoading = ref(false)
+const curParam = ref({})
+const linkParamShow = ref(false)
 const getLinkTableData = async () => {
     const { error, code, data } = await mainApi.getParamElements({
         nodeId: nodeId.value,
-        porjectId: porjectId.value,
+        projectId: projectId.value,
         paramId: curParam.value.id,
         scopeType: scopeType.value,
-    });
+    })
 
     //判断状态
     if (!error && code === 200) {
-        linkTableData.value = getArrValue(data);
+        linkTableData.value = getArrValue(data)
     }
-};
+}
 const linkElement = async (row) => {
     if (!row.id) {
-        window.$message.warning("请先保存数据,再点击关联元素");
+        window.$message.warning('请先保存数据,再点击关联元素')
     } else {
-        curParam.value = row;
-        linkParamShow.value = true;
-        getLinkTableData(row);
+        curParam.value = row
+        linkParamShow.value = true
+        getLinkTableData(row)
     }
-};
+}
 const linkParamdialogClose = () => {
-    linkParamShow.value = false;
-};
+    linkParamShow.value = false
+}
 //选择元素
-const chooseLinkShow = ref(false);
-const chooseLinkTableData = ref([]);
-const chooselinkTableLoading = ref(false);
+const chooseLinkShow = ref(false)
+const chooseLinkTableData = ref([])
+const chooselinkTableLoading = ref(false)
 const getChooseData = async (id) => {
     let pid = nodeInfo.value.primaryKeyId
         ? nodeInfo.value.primaryKeyId
-        : nodeInfo.value.pKeyId;
-    chooselinkTableLoading.value = true;
+        : nodeInfo.value.pKeyId
+    chooselinkTableLoading.value = true
     const { error, code, data } = await mainApi.selectFormElements({
-        nodeId: porjectId.value ? pid : nodeId.value,
+        nodeId: projectId.value ? pid : nodeId.value,
         id: id,
-        type: porjectId.value ? 3 : 5,
-    });
-    chooselinkTableLoading.value = false;
+        type: projectId.value ? 3 : 5,
+    })
+    chooselinkTableLoading.value = false
     //判断状态
     if (!error && code === 200) {
-        chooseLinkTableData.value = getArrValue(data);
+        chooseLinkTableData.value = getArrValue(data)
     }
-};
+}
 
-const chooseId = ref("");
+const chooseId = ref('')
 const chooseClick = (row) => {
-    chooseLinkShow.value = true;
-    chooseId.value = row.id;
-    getChooseData(row.id);
-};
+    chooseLinkShow.value = true
+    chooseId.value = row.id
+    getChooseData(row.id)
+}
 
-const linkShowClose = () => {};
+const linkShowClose = () => {}
 const chooseLinkTableColumn = [
-    { key: "eName", name: "元素名", align: "center" },
-    { key: "action", name: "操作", align: "center" },
-];
-const queryValue = ref("");
+    { key: 'eName', name: '元素名', align: 'center' },
+    { key: 'action', name: '操作', align: 'center' },
+]
+const queryValue = ref('')
 const searchClick = () => {
     if (queryValue.value.length > 0) {
         chooseLinkTableData.value = chooseLinkTableData.value.filter((ele) => {
-            return ele.eName.indexOf(queryValue.value) > -1;
-        });
+            return ele.eName.indexOf(queryValue.value) > -1
+        })
     } else {
-        getChooseData(chooseId.value);
+        getChooseData(chooseId.value)
     }
-};
+}
 const linkEleCheck = (value, index) => {
     if (value) {
         chooseLinkTableData.value.forEach((ele, i) => {
             if (i != index) {
-                ele.checked = false;
+                ele.checked = false
             }
-        });
+        })
     }
-};
-const saveLoading = ref(false);
+}
+const saveLoading = ref(false)
 const saveLink = async () => {
-    let target = {};
+    let target = {}
     chooseLinkTableData.value.forEach((ele) => {
         if (ele.checked === true) {
-            target = { elementId: ele.id, paramId: curParam.value.id };
+            target = { elementId: ele.id, paramId: curParam.value.id }
         }
-    });
-    saveLoading.value = true;
+    })
+    saveLoading.value = true
     const { error, code, data, msg } = await mainApi.specifiedParamElements(
-        target
-    );
-    saveLoading.value = false;
+        target,
+    )
+    saveLoading.value = false
     //判断状态
     if (!error && code === 200) {
-        window.$message.success(msg);
-        chooseLinkShow.value = false;
-        getLinkTableData();
+        window.$message.success(msg)
+        chooseLinkShow.value = false
+        getLinkTableData()
     }
-};
-const delLinkLoading = ref(false);
+}
+const delLinkLoading = ref(false)
 const delLinkClick = (row) => {
     HcDelMsg(async (resolve) => {
         //发起请求
-        delLinkLoading.value = true;
-        const { isRes } = await mainApi.delParamElements(row);
-        resolve(); //关闭弹窗
-        if (!isRes) return;
-        window.$message.success("删除成功");
-        getLinkTableData();
-    });
-};
+        delLinkLoading.value = true
+        const { isRes } = await mainApi.delParamElements(row)
+        resolve() //关闭弹窗
+        if (!isRes) return
+        window.$message.success('删除成功')
+        getLinkTableData()
+    })
+}
 //刷新
-const refreshLoad = ref(false);
+const refreshLoad = ref(false)
 const refreshNode = async () => {
-    refreshLoad.value = true;
+    refreshLoad.value = true
     const { error, code, data, msg } = await mainApi.refrehPram({
-        type: porjectId.value ? 1 : 0,
+        type: projectId.value ? 1 : 0,
         nodeId: nodeId.value,
-        porjectId: porjectId.value,
-    });
-    refreshLoad.value = false;
+        projectId: projectId.value,
+    })
+    refreshLoad.value = false
     //判断状态
     if (!error && code === 200) {
-        window.$message.success(msg);
+        window.$message.success(msg)
     }
-};
+}
 </script>

+ 1 - 0
src/views/project/list/independent/index.vue

@@ -380,6 +380,7 @@ const adjustExcelClick = async (row) => {
     }
     adjustExcelInfo.value = deepClone(row)
     adjustExcelLoading.value = false
+    await nextTick()
     isAdjustExcelShow.value = true
 }
 //关闭抽屉

+ 2 - 2
src/views/project/list/independent/quteElePage.vue

@@ -68,7 +68,7 @@ const props = defineProps({
         default: "1",
     },
 });
-const porjectId = ref(props.projectId);
+const projectId = ref(props.projectId);
 //监听显示
 watch(isShow, (val) => {
     if (val) {
@@ -196,7 +196,7 @@ const submitClick = async () => {
     submitLoading.value = true;
     const { error, code, data, msg } = await privateApi.projecttabInfo({
         primaryKeyIds: ids,
-        projectId: porjectId.value,
+        projectId: projectId.value,
     });
     submitLoading.value = false;
     //判断状态

+ 1 - 1
src/views/project/list/wbs-tree.vue

@@ -153,7 +153,7 @@
         <!-- 编辑公式 -->
         <HcEditFormula v-model="isEditFormulaShow" :data="editFormulaData" @finish="editFormulaFinish" />
         <!-- 节点参数设置 -->
-        <nodeParamDialog v-model="nodeParamShow" :node-id="treeItem.id" :node-info="treeItem" :porject-id="projectInfo.id" :scope-type="10" @close="nodeParamClose" />
+        <nodeParamDialog v-model="nodeParamShow" :node-id="treeItem.id" :node-info="treeItem" :project-id="projectInfo.id" :scope-type="10" @close="nodeParamClose" />
         <!-- 独立表单库 -->
         <independentPage v-model="independentShow" :project-id="projectInfo.id" :wbs-id="wbsId" :wbs-type="isType" @close="independentClose" />
         <!-- 归档文件时间 -->