Ver Fonte

修改节点信息维护

zhaoke há 3 anos atrás
pai
commit
7ba6f63a0c

+ 2 - 1
src/layout/components/Dialog/index.vue

@@ -114,7 +114,8 @@ export default {
         margin-bottom: 24px;
         width: 100%;
       }
-      .del-title {
+      .del-title,
+      .Deltitle {
         padding: 10px 0px 10px 20px;
         font-size: 16px;
         font-family: Microsoft YaHei;

+ 3 - 1
src/layout/components/OrgTree/index.vue

@@ -137,6 +137,8 @@ export default {
             background-size: cover;
             transition: all 0.3s;
             margin-left: 16px;
+            position: relative;
+            top: 2px;
             &:first-child {
               margin-right: 0;
             }
@@ -148,7 +150,7 @@ export default {
             }
           }
           .cap-edit {
-            background-image: url("../../../assets/status/ic_edit.png");
+            background-image: url("../../../assets/status/ic_edit_default.png");
             &:hover {
               background-image: url("../../../assets/status/ic_edit_hovar.png");
             }

+ 121 - 15
src/views/BasicsData/views/deployNode/deployNodeHome.vue

@@ -21,6 +21,29 @@
         </div>
       </div>
     </Dialog>
+    <!--新增/编辑-->
+    <Dialog :flag="editDialogVisible" width="508px" :show-flag="true">
+      <div class="airportInfoDialog dialog-public-background">
+        <div class="title">{{ editDialogTitle }}</div>
+        <div class="content">
+          <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="130px" class="demo-ruleForm">
+            <el-form-item label="节点名称" prop="protocolName">
+              <el-input v-model="ruleForm.protocolName" size="medium" placeholder="请输入节点名称(必填)" />
+            </el-form-item>
+            <el-form-item label="跟踪节点标识符" prop="className">
+              <el-input v-model="ruleForm.className" size="medium" placeholder="请输入跟踪节点标识符(必填)" />
+            </el-form-item>
+            <el-form-item label="跟踪节点描述" prop="filePath">
+              <el-input v-model="ruleForm.filePath" size="medium" type="textarea" :rows="3" placeholder="请输入跟踪节点描述" />
+            </el-form-item>
+          </el-form>
+        </div>
+        <div class="foot center t30">
+          <el-button size="medium" type="primary" class="r25 r26" @click="submitClickHandler()">提交</el-button>
+          <el-button size="medium" class="r26" @click="resetForm('ruleForm')">取消</el-button>
+        </div>
+      </div>
+    </Dialog>
   </div>
 </template>
 
@@ -67,8 +90,26 @@ export default {
         ]
       },
       removeDialogVisible: false,
+      editDialogVisible: false,
       rmObj: {
         protocolName: ''
+      },
+      editDialogTitle: '新增节点信息',
+      ruleForm: {
+        // 协议信息表单
+        protocolId: null,
+        protocolName: '',
+        className: '',
+        rmethodName: '',
+        smethodName: '',
+        filePath: ''
+      },
+      rules: {
+        // 协议信息表单验证
+        protocolName: [{ required: true, message: '请输入节点名称', trigger: 'blur' }],
+        className: [{ required: true, message: '请输入跟踪节点标识符', trigger: 'blur' }],
+        rmethodName: [{ required: true, message: '请输入读方法名', trigger: 'blur' }],
+        smethodName: [{ required: true, message: '请输入写方法名', trigger: 'blur' }]
       }
     }
   },
@@ -80,7 +121,10 @@ export default {
           <div class="team">
             <div class="list">
               <div class="flex info">
-                <div class="name">{data.AuthName}</div>
+                <div class="name">
+                  <span>{data.AuthName}</span>
+                  <span onClick={(e) => this.onNodeEdit(data, e)} class="cap cap-edit icon"></span>
+                </div>
                 <div class="icon">
                   <span
                     v-show={data.Type === 0 || data.Type === 1}
@@ -122,22 +166,84 @@ export default {
     },
     onNodeSub (data, e) {
       e.stopPropagation();
-      const { Type } = data;
-      const obj = {
-        AuthName: "BSM",
-        Desc: "行李源报文",
-        Type: Type + 1,
-        children: []
-      }
-      if (data.children) {
-        data.children.push(obj);
-      } else {
-        data.children = [];
-        data.children.push(obj);
-      }
+      this.editDialogTitle = '新增节点信息'
+      this.editDialogVisible = true
+      // const { Type } = data;
+      // const obj = {
+      //   AuthName: "BSM",
+      //   Desc: "行李源报文",
+      //   Type: Type + 1,
+      //   children: []
+      // }
+      // if (data.children) {
+      //   data.children.push(obj);
+      // } else {
+      //   data.children = [];
+      //   data.children.push(obj);
+      // }
     },
+    onNodeEdit (data, e) {
+      e.stopPropagation();
+      this.editDialogTitle = '编辑节点信息'
+      this.editDialogVisible = true
+    },
+    // 新增/编辑-确认
+    submitClickHandler () {
+      this.$refs['ruleForm'].validate(valid => {
+        if (valid) {
+          if (this.ruleForm.protocolId) {
+            this.addSubmit()
+          } else {
+            this.editSubmit()
+          }
+          this.resetForm('ruleForm')
+        }
+      })
+    },
+    // 重置
+    resetForm (formName) {
+      this.$refs[formName].resetFields()
+      this.editDialogVisible = false
+    },
+    // 删除-弹框
+    showRemoveDialog (item) {
+      this.rmObj = item
+      this.removeDialogVisible = true
+    },
+    // 确认删除
     removeSubmit () {
-      this.removeDialogVisible = false;
+      this.removeDialogVisible = false
+      this.$message.success('删除成功')
+    },
+    async addSubmit () {
+      try {
+        const res = await GeneralDataReception({
+          serviceId: '1',
+          dataContent: JSON.stringify(this.ruleForm)
+        })
+        if (res.code === 0) {
+          this.$message.success(res.message ?? '成功')
+        } else {
+          this.$message.error(res.message ?? '失败')
+        }
+      } catch (error) {
+        console.log('错误', error)
+      }
+    },
+    async editSubmit () {
+      try {
+        const res = await GeneralDataReception({
+          serviceId: '1',
+          dataContent: JSON.stringify(this.ruleForm)
+        })
+        if (res.code === 0) {
+          this.$message.success(res.message ?? '成功')
+        } else {
+          this.$message.error(res.message ?? '失败')
+        }
+      } catch (error) {
+        console.log('错误', error)
+      }
     }
   }
 }