Browse Source

共有私有节点参数弹框完成

zhangh 2 năm trước cách đây
mục cha
commit
4cabede329
3 tập tin đã thay đổi với 173 bổ sung73 xóa
  1. 41 14
      src/views/manager/projectinfo/tree.vue
  2. 130 57
      src/views/manager/wbsinfo/edit.vue
  3. 2 2
      vue.config.js

+ 41 - 14
src/views/manager/projectinfo/tree.vue

@@ -1111,15 +1111,15 @@
           >
             <template slot-scope="scope">
               <el-select
-                v-model="scope.row.name"
+                v-model="scope.row.k"
                 placeholder="请选择"
                 class="w-100p"
               >
                 <el-option
                   v-for="item in namelist"
-                  :key="item.id"
+                  :key="item.k"
                   :label="item.name"
-                  :value="item.id"
+                  :value="item.k"
                 ></el-option>
               </el-select>
             </template>
@@ -1130,7 +1130,7 @@
             label="参数值设置"
           >
             <template slot-scope="scope">
-              <el-input v-model="scope.row.value"></el-input>
+              <el-input v-model="scope.row.v"></el-input>
             </template>
           </el-table-column>
           <el-table-column
@@ -1139,7 +1139,7 @@
             label="描述"
           >
             <template slot-scope="scope">
-              <el-input v-model="scope.row.describe"></el-input>
+              <el-input v-model="scope.row.remark"></el-input>
             </template>
           </el-table-column>
           <el-table-column
@@ -1152,7 +1152,7 @@
                 type="text"
                 size="small"
                 class="text-icon-danger"
-                @click="delNodeInfo(scope.$index, scope.row)"
+                @click="delNodeInfoss(scope.$index)"
               >删除</el-button>
             </template>
           </el-table-column>
@@ -1165,7 +1165,7 @@
         <el-button @click="nodeInfoVisible = false">取 消</el-button>
         <el-button
           type="primary"
-          @click="nodeInfoSave"
+          @click="nodeInfoSave()"
         >保 存</el-button>
       </span>
     </el-dialog>
@@ -1230,7 +1230,7 @@
                 type="text"
                 size="small"
                 class="text-icon-danger"
-                @click="delNodeInfo(scope.$index, scope.row)"
+                @click="delNodeInfo(scope.$index)"
               >删除</el-button>
             </template>
           </el-table-column>
@@ -2085,27 +2085,55 @@ export default {
 
     //#region 节点参数
     nodeInfo (data) {//节点参数按钮
-      console.log(data);
       this.keymap()
       this.jiedianId = data.primaryKeyId
       this.parameters(data.primaryKeyId)
       this.nodeInfoVisible = true;
     },
     addNodeInfoTable () {//添加节点参数数据
-      this.nodeInfoTable.unshift({ name: '', value: '', describe: '' })
+      this.nodeInfoTable.unshift({ k: '', v: '', remark: '', wbsId: this.jiedianId })
     },
     delNodeInfo (key) {//设置参数名称中的删除按钮
       this.namelists.splice(key, 1)
     },
+    delNodeInfoss (key) {//节点参数
+      this.nodeInfoTable.splice(key, 1)
+    },
     setNodeParameters () {//打开设置节点参数弹框按钮
       this.infoNameVisible = true
       this.namelists = [...this.namelist]
     },
     async setParameterName () {//设置参数名称中添加节点参数按钮
-      this.namelists.unshift({ name: '', remark: '', k: '', type: 0, wbsId: this.jiedianId })
+      // wbsId: this.jiedianId 
+      this.namelists.unshift({ name: '', remark: '', k: '', type: 0, })
     },
-    nodeInfoSave () {//节点参数弹框保存按钮
-
+    async nodeInfoSave () {//节点参数弹框保存按钮
+      if (this.nodeInfoTable) {
+        let tag = true
+        this.nodeInfoTable.forEach(val => {
+          if (!val.k | !val.v) {
+            return tag = false
+          }
+        })
+        if (tag) {
+          await this.saveOrUpdateBatch(this.nodeInfoTable)
+          this.nodeInfoVisible = false
+          this.$message({
+            type: "success",
+            message: "设置参数节点成功!"
+          })
+        } else {
+          this.$message({
+            type: "error",
+            message: "请填写所有的参数名称和参数值!"
+          })
+        }
+      } else {
+        this.$message({
+          type: "error",
+          message: "请先设置参数节点!"
+        })
+      }
     },
     async addParameterName () {//设置参数名称中的保存按钮
       if (this.namelists) {
@@ -2116,7 +2144,6 @@ export default {
           }
         })
         if (tag) {
-          console.log({ wps: this.namelists });
           await this.saveOrUpdateBatch(this.namelists) //保存设置参数
           this.infoNameVisible = false
           this.keymap()

+ 130 - 57
src/views/manager/wbsinfo/edit.vue

@@ -1093,7 +1093,7 @@
           type="text"
           icon="el-icon-s-operation"
           class="right-btn"
-          @click="infoNameVisible = true"
+          @click="setNodeParameters()"
         ></el-button>
         <div class="flexEnd">
           <i
@@ -1115,15 +1115,15 @@
           >
             <template slot-scope="scope">
               <el-select
-                v-model="scope.row.name"
+                v-model="scope.row.k"
                 placeholder="请选择"
                 class="w-100p"
               >
                 <el-option
                   v-for="item in namelist"
-                  :key="item.id"
-                  :label="item.dictValue"
-                  :value="item.dictKey"
+                  :key="item.k"
+                  :label="item.name"
+                  :value="item.k"
                 ></el-option>
               </el-select>
             </template>
@@ -1134,7 +1134,7 @@
             label="参数值设置"
           >
             <template slot-scope="scope">
-              <el-input v-model="scope.row.value"></el-input>
+              <el-input v-model="scope.row.v"></el-input>
             </template>
           </el-table-column>
           <el-table-column
@@ -1143,7 +1143,7 @@
             label="描述"
           >
             <template slot-scope="scope">
-              <el-input v-model="scope.row.describe"></el-input>
+              <el-input v-model="scope.row.remark"></el-input>
             </template>
           </el-table-column>
           <el-table-column
@@ -1156,7 +1156,7 @@
                 type="text"
                 size="small"
                 class="text-icon-danger"
-                @click="delNodeInfo(scope.$index)"
+                @click="delNodeInfoss(scope.$index)"
               >删除</el-button>
             </template>
           </el-table-column>
@@ -1169,7 +1169,7 @@
         <el-button @click="nodeInfoVisible = false">取 消</el-button>
         <el-button
           type="primary"
-          @click="nodeInfoSave"
+          @click="nodeInfoSave()"
         >保 存</el-button>
       </span>
     </el-dialog>
@@ -1179,11 +1179,19 @@
       :visible.sync="infoNameVisible"
       width="800px"
       append-to-body
+      class="jiedian"
       :close-on-click-modal="false"
     >
       <div>
+        <div class="flexEnd">
+          <i
+            class="el-icon-circle-plus marbottom10"
+            @click="setParameterName()"
+            style="font-size:24px;color:rgb(37, 193, 99);cursor: pointer;"
+          ></i>
+        </div>
         <el-table
-          :data="namelist"
+          :data="namelists"
           border
           style="width: 100%"
           height="400"
@@ -1194,12 +1202,7 @@
             label="参数名称"
           >
             <template slot-scope="scope">
-              <template v-if="scope.row.isEdit">
-                <el-input v-model="scope.row.name"></el-input>
-              </template>
-              <template v-else>
-                {{scope.row.name}}
-              </template>
+              <el-input v-model="scope.row.name"></el-input>
             </template>
           </el-table-column>
           <el-table-column
@@ -1208,12 +1211,7 @@
             label="参数值KEY"
           >
             <template slot-scope="scope">
-              <template v-if="scope.row.isEdit">
-                <el-input v-model="scope.row.key"></el-input>
-              </template>
-              <template v-else>
-                {{scope.row.key}}
-              </template>
+              <el-input v-model="scope.row.k"></el-input>
             </template>
           </el-table-column>
           <el-table-column
@@ -1222,12 +1220,7 @@
             label="描述"
           >
             <template slot-scope="scope">
-              <template v-if="scope.row.isEdit">
-                <el-input v-model="scope.row.describe"></el-input>
-              </template>
-              <template v-else>
-                {{scope.row.describe}}
-              </template>
+              <el-input v-model="scope.row.remark"></el-input>
             </template>
           </el-table-column>
           <el-table-column
@@ -1236,23 +1229,11 @@
             align="center"
           >
             <template slot-scope="scope">
-              <el-button
-                type="text"
-                size="small"
-                v-show="scope.row.isEdit"
-                @click="saveNodeInfoHandle(scope.$index, scope.row)"
-              >保存</el-button>
-              <el-button
-                type="text"
-                size="small"
-                v-show="!scope.row.isEdit"
-                @click="editNodeInfo(scope.$index, scope.row)"
-              >编辑</el-button>
               <el-button
                 type="text"
                 size="small"
                 class="text-icon-danger"
-                @click="delNodeInfo(scope.$index, scope.row)"
+                @click="delNodeInfo(scope.$index)"
               >删除</el-button>
             </template>
           </el-table-column>
@@ -1262,7 +1243,8 @@
         slot="footer"
         class="dialog-footer"
       >
-        <el-button @click="infoNameVisible = false">关 闭</el-button>
+        <el-button @click="addParameterName()">保 存</el-button>
+        <el-button @click="closeParameter()">关 闭</el-button>
       </span>
     </el-dialog>
 
@@ -1273,7 +1255,7 @@
 import ManualSorting from '@/components/WbsTree/ManualSorting'
 import {
   getLazytree, getDetail, update, selectByNodeTable, getAlltree,
-  saveFormAndElement, selectFormElements, removeTableById, findWbsTreeSameLevel, wbsTreeSort, findWbsTreeTableSameLevel, wbsTreeTableSort,
+  saveFormAndElement, selectFormElements, removeTableById, findWbsTreeSameLevel, wbsTreeSort, findWbsTreeTableSameLevel, wbsTreeTableSort, parameters, saveOrUpdateBatch, keymap,
   importWbsTree, exportTemplate, remove as removeTreeNode
 } from "@/api/manager/wbstree";
 import {
@@ -1285,6 +1267,7 @@ import { mapGetters } from "vuex";
 export default {
   data () {
     return {
+      jiedianId: '',
       excelSortTag: false,
       excelSortTag2: false,
       sortTag2: false,
@@ -1359,7 +1342,7 @@ export default {
       nodeInfoVisible: false,
       nodeInfoTable: [],
       namelist: [],
-
+      namelists: [],
       infoNameVisible: false,
     };
   },
@@ -1396,9 +1379,6 @@ export default {
     editSort () {//修改排序
       this.wbsTreeSort()
     },
-    addNodeInfoTable () {//添加节点参数数据
-      this.nodeInfoTable.unshift({ name: '', value: '', describe: '' })
-    },
     async wbsTreeSort () {//修改排序
       const { data: res } = await wbsTreeSort(this.sort)
       console.log(res);
@@ -1537,6 +1517,7 @@ export default {
     },
 
     setLeftType (type, data, node) {
+      this.jiedianId = data.id
       if (type == 4 || type == 5) {
         this.leftType = type;
       }
@@ -1924,16 +1905,6 @@ export default {
       //console.log(file)
       this.upFile = file;
     },
-
-    nodeInfo () { //打开节点参数弹框
-      this.nodeInfoVisible = true;
-    },
-    nodeInfoSave () {//节点参数弹框保存按钮
-
-    },
-    delNodeInfo (index) {//节点参数弹框中删除按钮
-      this.nodeInfoTable.splice(index, 1)
-    },
     downloadTmp () {
       getTemplate().then((res) => {
         //console.log(res)
@@ -2115,6 +2086,108 @@ export default {
       return data.title.indexOf(value) !== -1;
     },
     //#endregion
+
+    //#region 节点参数
+    nodeInfo (data) {//节点参数按钮
+      this.keymap()
+      this.jiedianId = data.id
+      this.parameters(data.id)
+      this.nodeInfoVisible = true;
+    },
+    addNodeInfoTable () {//添加节点参数数据
+      this.nodeInfoTable.unshift({ k: '', v: '', remark: '', wbsId: this.jiedianId })
+    },
+    delNodeInfo (key) {//设置参数名称中的删除按钮
+      this.namelists.splice(key, 1)
+    },
+    delNodeInfoss (key) {//节点参数
+      this.nodeInfoTable.splice(key, 1)
+    },
+    setNodeParameters () {//打开设置节点参数弹框按钮
+      this.infoNameVisible = true
+      this.namelists = [...this.namelist]
+    },
+    async setParameterName () {//设置参数名称中添加节点参数按钮
+      // wbsId: this.jiedianId 
+      this.namelists.unshift({ name: '', remark: '', k: '', type: 0, })
+    },
+    async nodeInfoSave () {//节点参数弹框保存按钮
+      if (this.nodeInfoTable) {
+        let tag = true
+        this.nodeInfoTable.forEach(val => {
+          if (!val.k | !val.v) {
+            return tag = false
+          }
+        })
+        if (tag) {
+          await this.saveOrUpdateBatch(this.nodeInfoTable)
+          this.nodeInfoVisible = false
+          this.$message({
+            type: "success",
+            message: "设置参数节点成功!"
+          })
+        } else {
+          this.$message({
+            type: "error",
+            message: "请填写所有的参数名称和参数值!"
+          })
+        }
+      } else {
+        this.$message({
+          type: "error",
+          message: "请先设置参数节点!"
+        })
+      }
+    },
+    async addParameterName () {//设置参数名称中的保存按钮
+      if (this.namelists) {
+        let tag = true
+        this.namelists.forEach(val => {
+          if (!val.name || !val.k) {
+            return tag = false
+          }
+        })
+        if (tag) {
+          await this.saveOrUpdateBatch(this.namelists) //保存设置参数
+          this.infoNameVisible = false
+          this.keymap()
+        } else {
+          this.$message({
+            type: "error",
+            message: "请填写所有的参数名称和参数值KEY!"
+          })
+        }
+      } else {
+        this.$message({
+          type: "error",
+          message: "请设置参数"
+        })
+      }
+    },
+    closeParameter () {//设置参数名称,关闭按钮
+      this.namelists = []
+      this.infoNameVisible = false
+    },
+    async parameters (wbsId) {//获取接待你参数列表
+      const { data: res } = await parameters({ wbsId })
+      console.log(res);
+      if (res.code == 200) {
+        this.nodeInfoTable = res.data
+      }
+    },
+    async saveOrUpdateBatch (da) {//保存
+      const { data: res } = await saveOrUpdateBatch(da)
+      console.log(res);
+    },
+    async keymap () {//节点参数枚举
+      const { data: res } = await keymap()
+      console.log(res);
+      if (res.code = 200) {
+        this.namelist = res.data
+      }
+    },
+    //#endregion
+
   },
   components: {
     ManualSorting,

+ 2 - 2
vue.config.js

@@ -27,8 +27,8 @@ module.exports = {
             '/api': {
                 //本地服务接口地址
                 // target: 'http://localhost',
-                // target: 'http://192.168.4.6',
-                target: 'http://47.110.251.215:8090',
+                target: 'http://192.168.4.6',
+                // target: 'http://47.110.251.215:8090',
                 // target: 'http://192.168.4.44',
                 //远程演示服务地址,可用于直接启动项目
                 //target: 'https://saber.bladex.vip/api',