diff --git a/web_src/src/components/JTChannelList.vue b/web_src/src/components/JTChannelList.vue index c8537c1f2..8c3bbcbac 100755 --- a/web_src/src/components/JTChannelList.vue +++ b/web_src/src/components/JTChannelList.vue @@ -65,18 +65,6 @@ 编辑 - 查看 - - - - - - - - - 更多功能 @@ -230,7 +218,7 @@ export default { } else { this.$message.error(res.data.msg); } - }).catch(function (e) { + }).catch((e)=> { console.error(e) this.isLoging = false; // that.$message.error("请求超时"); @@ -405,11 +393,15 @@ export default { }, // 编辑 handleEdit(row) { - if (this.isEdit()) { - this.$message.warning('请保存当前编辑项!'); - } else { - row.edit = true; - } + this.$refs.channelEdit.openDialog(row, this.deviceId, () => { + this.$refs.channelEdit.close(); + this.$message({ + showClose: true, + message: "修改成功", + type: "success", + }); + setTimeout(this.getList, 200) + }) } } }; diff --git a/web_src/src/components/dialog/jtChannelEdit.vue b/web_src/src/components/dialog/jtChannelEdit.vue index 9ff4d6099..b7fb4ee36 100755 --- a/web_src/src/components/dialog/jtChannelEdit.vue +++ b/web_src/src/components/dialog/jtChannelEdit.vue @@ -41,6 +41,7 @@ export default { showDialog: false, isLoging: false, form: {}, + row: "", deviceId: "", isEdit: false, rules: { @@ -53,26 +54,21 @@ export default { console.log(row) this.showDialog = true; this.isEdit = false; + this.form = {}; if (row) { this.isEdit = true; - } - this.form = {}; - this.deviceId = deviceId; - this.listChangeCallback = callback; - if (row != null) { this.form = row; } + this.deviceId = deviceId; + this.listChangeCallback = callback; }, onSubmit: function () { console.log("onSubmit"); + let params = this.form this.$axios({ method: 'post', url:`/api/jt1078/terminal/channel/${this.isEdit?'update':'add'}/`, - params: { - terminalDbId: this.deviceId, - name: this.form.name, - channelId: this.form.channelId, - } + params: params }).then((res) => { console.log(res.data) if (res.data.code === 0) {