拍照装置-通道

master
13703816893 2 years ago
parent ed964513ae
commit 048d268538

@ -54,7 +54,7 @@
<div class="addchannel" ref="channelBoxref"> <div class="addchannel" ref="channelBoxref">
<div <div
class="channelBoxadd" class="channelBoxadd"
v-for="(val, index) in formInfo.channelId" v-for="(val, index) in formInfo.list"
:key="index" :key="index"
> >
<el-form-item label="通道号:"> <el-form-item label="通道号:">
@ -88,7 +88,7 @@
icon="el-icon-plus" icon="el-icon-plus"
type="primary" type="primary"
@click="addModule()" @click="addModule()"
v-if="index + 1 == formInfo.channelId.length" v-if="index + 1 == formInfo.list.length"
></el-button> ></el-button>
</div> </div>
</div> </div>
@ -165,7 +165,6 @@ export default {
methods: { methods: {
// //
getdataform(val) { getdataform(val) {
console.log(val);
this.getLine(); this.getLine();
this.getChannel(); this.getChannel();
if (val == null) { if (val == null) {
@ -175,7 +174,7 @@ export default {
cmdId: '', cmdId: '',
equipName: '', equipName: '',
sim: '', sim: '',
channelId: [ list: [
{ {
id: '', id: '',
alias: '', alias: '',
@ -187,16 +186,16 @@ export default {
}, },
// //
changeHandle(){ 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() { addModule() {
// //
this.formInfo.channelId.push({ this.formInfo.list.push({
id: '', id: '',
alias: "", 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(() => { this.$nextTick(() => {
console.log(this.$refs.channelBoxref); console.log(this.$refs.channelBoxref);
if (this.$refs.channelBoxref) { if (this.$refs.channelBoxref) {
@ -208,14 +207,19 @@ export default {
// //
deleteModule(item, index) { deleteModule(item, index) {
console.log(item, index); console.log(item, index);
const itemList = this.formInfo.channelId.indexOf(item); const itemList = this.formInfo.list.indexOf(item);
if (itemList !== -1) { 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() { 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) => { this.$refs.formgrapInfo.validate((valid) => {
if (valid) { if (valid) {
if (this.photoDialogTitle == "新增") { if (this.photoDialogTitle == "新增") {
@ -225,7 +229,7 @@ export default {
// cmdId: this.formInfo.cmdId, // cmdId: this.formInfo.cmdId,
// equipName: this.formInfo.equipName, // equipName: this.formInfo.equipName,
// sim: this.formInfo.sim, // sim: this.formInfo.sim,
// channelId: this.formInfo.channelId, // list: this.formInfo.list,
// displayName: this.formInfo.cmdId, // displayName: this.formInfo.cmdId,
// }; // };
this.$set(this.formInfo,'displayName',this.formInfo.cmdId) this.$set(this.formInfo,'displayName',this.formInfo.cmdId)
@ -312,7 +316,7 @@ export default {
.then((res) => { .then((res) => {
this.channelOptions = res.data.list; this.channelOptions = res.data.list;
this.filterOption = 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) => {}); .catch((err) => {});
}, },

Loading…
Cancel
Save