Browse Source

删除和协议列表

zhulizhen1111 4 years ago
parent
commit
3408649db0

+ 16 - 13
src/components/config_point/toolLibrary/settingDialog.vue

@@ -30,12 +30,9 @@
         <template slot-scope="scope">
           <el-button @click="handleEdit(scope.$index, scope.row)">编辑
           </el-button>
-          <!-- <el-popconfirm
-            title="这是一段内容确定删除吗?"
-            @onConfirm="handleDelete(scope.$index, scope.row)"
-          > -->
-            <el-button slot="reference" type="danger" >删除</el-button>
-          <!-- </el-popconfirm> -->
+         
+            <el-button @click="handleDelete(scope.$index, scope.row)" slot="reference" type="danger" >删除</el-button>
+       
         </template>
       </el-table-column>
     </el-table>
@@ -233,13 +230,19 @@
         }
       },
       handleDelete(index, row) {
-        console.log(row)
-        let params = {
-          idList:row.id
-        }
-        deleteProtocol(params,res=>{
-
-        })
+         this.$confirm("删除后无法恢复,是否需要删除?", "提示", {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }).then(() => {
+            console.log(row)
+            let params = [row.Id]
+            deleteProtocol(params,res=>{
+               this.getTxOption()
+            })
+          }).catch(() => {
+            this.$message("取消删除")
+          })
       },
       handleChangeProtocolType(val) {
       },

+ 37 - 30
src/views/point/config_point/edit_origin/dialog.vue

@@ -129,34 +129,35 @@
         ProtocolInfo: "",//自定义协议信息
         txOptions:[],
         options: [
-          {
-            value: 'modbus-tcp',
-            label: 'Modbus TCP'
-          }, {
-            value: 'bacnet-ip',
-            label: 'BACNet IP'
-          }, {
-            value: 'opc',
-            label: 'OPC'
-          }, {
-            value: 'knx',
-          label: 'KNX'
-        }, {
-          value: 'mqtt',
-          label: 'MQTT'
-        }, {
-          value: 'amqp',
-          label: 'AMQP'
-        }, {
-          value: 'lora',
-          label: 'LoRa'
-        }, {
-          value: 'ems-collect',
-          label: 'ems-collect'
-        }, {
-          value: 'common',
-          label: '其他'
-        }],
+        //   {
+        //     value: 'modbus-tcp',
+        //     label: 'Modbus TCP'
+        //   }, {
+        //     value: 'bacnet-ip',
+        //     label: 'BACNet IP'
+        //   }, {
+        //     value: 'opc',
+        //     label: 'OPC'
+        //   }, {
+        //     value: 'knx',
+        //   label: 'KNX'
+        // }, {
+        //   value: 'mqtt',
+        //   label: 'MQTT'
+        // }, {
+        //   value: 'amqp',
+        //   label: 'AMQP'
+        // }, {
+        //   value: 'lora',
+        //   label: 'LoRa'
+        // }, {
+        //   value: 'ems-collect',
+        //   label: 'ems-collect'
+        // }, {
+        //   value: 'common',
+        //   label: '其他'
+        // }
+        ],
         netOptons: [
           {
             value: 'zhilian',
@@ -190,7 +191,13 @@
         }
         queryProtocalList(data,res=>{
           console.log(res)
-          this.options = res.Content
+          let data = res.Content
+          data.forEach(el=>{
+             this.options.push({
+              label:el,
+              value:el
+            })
+          })
         })
       },
       getTxOption(){
@@ -217,7 +224,7 @@
         if (obj) {
           this.getDataSouse(obj)
         }
-        //this.getProtocalList()
+        this.getProtocalList()
       },
       changeItem(ip, port) {
         this.formData.ProtocolInfo.Ip = ip