diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue b/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue index 47f2706..8a96236 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue @@ -54,7 +54,7 @@
@@ -88,7 +88,7 @@ icon="el-icon-plus" type="primary" @click="addModule()" - v-if="index + 1 == formInfo.channelId.length" + v-if="index + 1 == formInfo.list.length" >
@@ -165,7 +165,6 @@ export default { methods: { //判断 getdataform(val) { - console.log(val); this.getLine(); this.getChannel(); if (val == null) { @@ -175,7 +174,7 @@ export default { cmdId: '', equipName: '', sim: '', - channelId: [ + list: [ { id: '', alias: '', @@ -187,16 +186,16 @@ export default { }, //通道号值改变 changeHandle(){ - this.filterOption = this.channelOptions.filter(val => !this.formInfo.channelId.some(item => item.id === val.id)) + this.filterOption = this.channelOptions.filter(val => !this.formInfo.list.some(item => item.id === val.id)) }, //新增一行 addModule() { //新增一行 - this.formInfo.channelId.push({ + this.formInfo.list.push({ id: '', alias: "", }); - this.filterOption = this.channelOptions.filter(val => !this.formInfo.channelId.some(item => item.id === val.id)) + this.filterOption = this.channelOptions.filter(val => !this.formInfo.list.some(item => item.id === val.id)) this.$nextTick(() => { console.log(this.$refs.channelBoxref); if (this.$refs.channelBoxref) { @@ -208,14 +207,19 @@ export default { //删除一行 deleteModule(item, index) { console.log(item, index); - const itemList = this.formInfo.channelId.indexOf(item); + const itemList = this.formInfo.list.indexOf(item); if (itemList !== -1) { - this.formInfo.channelId.splice(index, 1); + this.formInfo.list.splice(index, 1); } - this.filterOption = this.channelOptions.filter(val => !this.formInfo.channelId.some(item => item.id === val.id)) + this.filterOption = this.channelOptions.filter(val => !this.formInfo.list.some(item => item.id === val.id)) }, // 保存确定操作 submitForm() { + const newListLength = new Set(this.formInfo.list.map(item=>item.id)).size; + const listLength = this.formInfo.list.length; + if(listLength > newListLength){ + return this.$message.error("通道不能重复"); + } this.$refs.formgrapInfo.validate((valid) => { if (valid) { if (this.photoDialogTitle == "新增") { @@ -225,7 +229,7 @@ export default { // cmdId: this.formInfo.cmdId, // equipName: this.formInfo.equipName, // sim: this.formInfo.sim, - // channelId: this.formInfo.channelId, + // list: this.formInfo.list, // displayName: this.formInfo.cmdId, // }; this.$set(this.formInfo,'displayName',this.formInfo.cmdId) @@ -312,7 +316,7 @@ export default { .then((res) => { this.channelOptions = res.data.list; this.filterOption = res.data.list; - this.formInfo.channelId[0].id = this.filterOption[0].id; + this.formInfo.list[0].id = this.filterOption[0].id; }) .catch((err) => {}); },