소스 검색

元素编辑修改

duy 10 달 전
부모
커밋
10f63ad980
3개의 변경된 파일67개의 추가작업 그리고 8개의 파일을 삭제
  1. 7 0
      src/api/modules/wbs/wbsforelement.js
  2. 47 5
      src/views/desk/wbs/create-new-excel.vue
  3. 13 3
      src/views/desk/wbs/drawer-wbs.vue

+ 7 - 0
src/api/modules/wbs/wbsforelement.js

@@ -38,4 +38,11 @@ export default {
             data: form,
         });
     },
+    async getTableElements(form) {
+        return HcApi({
+            url: "/api/blade-manager/wbsTree/get-table-elements",
+            method: "get",
+            params: form,
+        });
+    },
 };

+ 47 - 5
src/views/desk/wbs/create-new-excel.vue

@@ -2,7 +2,7 @@
     <hc-dialog
         v-model="isShow"
         is-footer-center
-        title="创建新的元素表"
+        :title="modelTitle"
         @close="dialogClose"
         @save="saveFormAndElementHandle"
         widths="56rem"
@@ -14,6 +14,7 @@
             :rules="formRules"
             label-position="top"
             label-width="auto"
+            v-if="!tableId"
         >
             <el-row :gutter="60">
                 <el-col :span="12">
@@ -88,7 +89,7 @@
                     </el-button>
                 </el-tooltip>
             </template>
-            <template #extra>
+            <template #extra v-if="!tableId">
                 <el-button size="small" type="success" @click="addRowClick"
                     >新增</el-button
                 >
@@ -210,7 +211,7 @@ import { getDictionaryData } from "~src/utils/tools";
 import mainApi from "~api/wbs/wbsforelement";
 import { useAppStore } from "~src/store";
 import { HcUploadFileApi } from "hc-vue3-ui";
-import { formValidate, getArrValue, downloadBlob } from "js-fast-way";
+import { formValidate, getArrValue, downloadBlob, type } from "js-fast-way";
 const store = useAppStore();
 const userInfo = ref(store.getUserInfo);
 const props = defineProps({
@@ -230,6 +231,14 @@ const props = defineProps({
         type: Object,
         default: () => {},
     },
+    title: {
+        type: String,
+        default: "",
+    },
+    tableId: {
+        type: String,
+        default: "",
+    },
 });
 //事件
 const emit = defineEmits(["close"]);
@@ -246,21 +255,46 @@ watch(isShow, (val) => {
         emit("close");
     }
 });
+
 const ownerTypeList = ref(props.ownerTypeList);
 const tableTypelist = ref(props.tableTypelist);
 const wbsId = ref(props.wid);
 const node = ref(props.node);
+const modelTitle = ref(props.title);
+const tableId = ref(props.tableId);
 //监听数据
 watch(
-    () => [props.ownerTypeList, props.tableTypelist, props.wid, props.node],
-    ([own, table, wbsid, nodeInfo]) => {
+    () => [
+        props.ownerTypeList,
+        props.tableTypelist,
+        props.wid,
+        props.node,
+        props.title,
+        props.tableId,
+    ],
+    ([own, table, wbsid, nodeInfo, til, tid]) => {
         ownerTypeList.value = own;
         tableTypelist.value = table;
         wbsId.value = wbsid;
         node.value = nodeInfo;
+        modelTitle.value = til;
+        tableId.value = tid;
     },
     { deep: true }
 );
+watch(
+    tableId,
+    (val) => {
+        if (val) {
+            getEditEleList();
+        } else {
+            editEleList.value = [];
+        }
+    },
+    {
+        deep: true,
+    }
+);
 //表单
 const formRef = ref(null);
 const formRules = {
@@ -297,6 +331,14 @@ const tableColumn = [
     { key: "action", name: "操作", width: 80, align: "center" },
 ];
 const editEleList = ref([]);
+const getEditEleList = async () => {
+    const { data } = await mainApi.getTableElements({
+        id: tableId.value,
+        search: "",
+        type: 1,
+    });
+    editEleList.value = getArrValue(data);
+};
 const dataTypeList = ref([]);
 const getDataTypelist = async () => {
     if (dataTypeList.value.length > 1) {

+ 13 - 3
src/views/desk/wbs/drawer-wbs.vue

@@ -141,7 +141,7 @@
                                             <el-link
                                                 type="warning"
                                                 @click="editRowClick(row)"
-                                                >修改</el-link
+                                                >编辑</el-link
                                             >
                                             <el-link
                                                 type="danger"
@@ -210,6 +210,8 @@
             :wid="dataInfo.id"
             :tableTypelist="tableTypelist"
             :ownerTypeList="ownerTypeList"
+            :title="modalTitle"
+            :tableId="tableId"
         ></createNewExcel>
         <!-- 编辑元素表信息 -->
         <editElePage
@@ -609,18 +611,24 @@ const drawerClose = () => {
     nodeInfo.value = {};
     emit("close");
 };
-
-const editRowClick = () => {};
+const tableId = ref("");
+const editRowClick = (row) => {
+    isCreateShow.value = true;
+    modalTitle.value = row.tableName + "元素编辑";
+    tableId.value = row.id;
+};
 const rowDelClick = () => {};
 
 //创建新的元素表
 const isCreateShow = ref(false);
+const modalTitle = ref("创建新的元素表");
 const createClose = () => {
     isCreateShow.value = false;
     getTableData();
 };
 const createNew = () => {
     const { id } = nodeInfo.value;
+    tableId.value = "";
     if (id) {
         isCreateShow.value = true;
     } else {
@@ -629,12 +637,14 @@ const createNew = () => {
 };
 //编辑元素表单
 const editEleShow = ref(false);
+
 const editClose = () => {
     editEleShow.value = false;
     getTableData();
 };
 const editEleClick = () => {
     const { id } = nodeInfo.value;
+
     if (id) {
         editEleShow.value = true;
     } else {