瀏覽代碼

服务编辑-添加注释

zhongxiaoyu 3 年之前
父節點
當前提交
af7bd58588
共有 1 個文件被更改,包括 15 次插入3 次删除
  1. 15 3
      src/views/systemSettings/views/serviceManagement/serviceEdit.vue

+ 15 - 3
src/views/systemSettings/views/serviceManagement/serviceEdit.vue

@@ -1,6 +1,6 @@
 <!--
  * @Date: 2022-03-24 09:55:13
- * @LastEditTime: 2022-04-29 16:36:44
+ * @LastEditTime: 2022-04-29 17:15:20
  * @LastEditors: your name
  * @Description: 服务管理-编辑服务
  * have a nice day!
@@ -520,6 +520,7 @@ export default {
     }
   },
   computed: {
+    // 获取各关联项的标题、键名、操作方法等
     dataInMap() {
       return function (type, keyType) {
         if (type === null) {
@@ -547,11 +548,13 @@ export default {
     checkedProcessList() {
       return this.processList.filter(item => this.checkedProcessKeys.includes(item.processName))
     },
+    // 从协议列表中根据协议ID获取协议名称
     outputTargetProtocolName() {
       return function (protocolID) {
         return this.protocolList.find(protocol => protocol.protocolID === protocolID).protocolName
       }
     },
+    // 从目标数据列表中根据目标数据ID获取目标数据名称
     outputTargetDataName() {
       return function (targetdataID) {
         return this.targetList.find(target => target.targetdataID === targetdataID).tdataName
@@ -559,6 +562,7 @@ export default {
     }
   },
   methods: {
+    // 服务信息保存
     async btnSaveClickHandler() {
       this.$refs['serviceForm'].validate(valid => {
         if (!valid) return
@@ -569,6 +573,7 @@ export default {
       await this.updateService()
       this.queryAll()
     },
+    // 关联编辑-显示弹框
     showOperateDialog(type) {
       if (['node', 'source', 'process'].includes(type)) {
         this.tempCheckedKeys = [...this.dataInMap(type, 'checked')]
@@ -582,6 +587,7 @@ export default {
       })
       this.showOperateDialog(type)
     },
+    // 关联编辑-提交
     async checkedSubmitHandler() {
       const addKeys = this.tempCheckedKeys.filter(
         key => !this.dataInMap(this.operateDialogType, 'checked').includes(key)
@@ -600,11 +606,12 @@ export default {
         this.$message.error(error)
       }
     },
+    // 服务输出项新增/编辑
     async outputSubmitHandler() {
       const outputTarget = {
         ...this.outputForm
       }
-      if (outputTarget.serviceOutputID) {
+      if (typeof outputTarget.serviceOutputID !== 'undefined') {
         await this.updateServiceOutput('update', outputTarget)
       } else {
         await this.updateServiceOutput('create', outputTarget)
@@ -612,16 +619,19 @@ export default {
       await this.queryAll()
       this.hideOperateDialog()
     },
+    // 关联编辑-隐藏弹框
     hideOperateDialog() {
       if (this.operateDialogType === 'output') {
         this.$refs['outputForm'].resetFields()
       }
       this.operateDialogType = null
     },
+    // 关联删除-显示弹框
     showDeleteDialog(obj, type) {
       this.delObj = obj
       this.deleteDialogType = type
     },
+    // 关联删除-提交
     async deleteSubmitHandler() {
       const message = await this.dataInMap(this.deleteDialogType, 'operate')(
         'delete',
@@ -629,10 +639,12 @@ export default {
       )
       this.$message.success(message ?? '成功')
       await this.queryAll()
-      this.deleteDialogType = null
+      this.hideDeleteDialog()
     },
+    // 关联删除-隐藏弹框
     hideDeleteDialog() {
       this.deleteDialogType = null
+      this.delObj = {}
     }
   }
 }