增加通道编辑以及通道重置功能

This commit is contained in:
648540858
2024-07-15 17:39:47 +08:00
parent 92c6a10083
commit d9c0d0637c
8 changed files with 119 additions and 40 deletions

View File

@@ -1,14 +1,14 @@
<template>
<div id="ChannelEdit" v-loading="locading" style="width: 100%">
<div v-if="!form.gbId" class="page-header">
<div v-if="form.gbId" class="page-header">
<div class="page-title">
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="showDevice" ></el-button>
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
<el-divider direction="vertical"></el-divider>
编辑通道
</div>
<div class="page-header-btn">
<div style="display: inline;">
<el-button icon="el-icon-close" size="mini" style="font-size: 20px; color: #000;" type="text" @click="showDevice" ></el-button>
<el-button icon="el-icon-close" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
</div>
</div>
</div>
@@ -208,6 +208,7 @@
<div style="float: right;">
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button @click="close">取消</el-button>
<el-button v-if="form.gbDeviceDbId" @click="reset">重置</el-button>
</div>
</div>
@@ -221,7 +222,7 @@ import channelCode from './dialog/channelCode'
export default {
name: "channelEdit",
props: [ 'id',],
props: [ 'id', 'closeEdit'],
components: {
channelCode,
},
@@ -237,12 +238,51 @@ export default {
},
methods: {
onSubmit: function () {
this.form.gbDownloadSpeed = this.form.gbDownloadSpeedArray.join("/")
this.$axios({
method: 'post',
url: "/api/common/channel/update",
data: this.form
}).then((res) => {
if (res.data.code === 0) {
this.$message.success("保存成功");
this.close()
}
}).catch((error) => {
console.error(error)
}).finally(()=>[
this.locading = false
])
},
close: function () {
this.closeEdit()
},
showDevice: function () {
reset: function () {
this.$confirm("确定重置为默认内容?", '提示', {
dangerouslyUseHTMLString: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios({
method: 'post',
url: "/api/common/channel/reset",
params: {
id: this.form.gbId
}
}).then((res) => {
if (res.data.code === 0) {
this.$message.success("重置成功 已保存");
this.getCommonChannel()
}
}).catch((error) => {
console.error(error)
}).finally(()=>[
this.locading = false
])
}).catch(() => {
});
},
test: function () {

View File

@@ -161,7 +161,7 @@
</el-pagination>
</el-main>
</el-container>
<channel-edit v-if="editId" :id="editId"></channel-edit>
<channel-edit v-if="editId" :id="editId" :closeEdit="closeEdit"></channel-edit>
<!--设备列表-->
</div>
@@ -549,7 +549,13 @@ export default {
// 编辑
handleEdit(row) {
this.editId = row.id
},
// 结束编辑
closeEdit: function (){
this.editId = null
this.getDeviceChannelList()
}
}
};
</script>