指令字典 复刻指令代码调整

This commit is contained in:
joylink_cuiweidong 2020-11-11 17:52:08 +08:00
parent 2b51f077fc
commit 994433a3ba
3 changed files with 41 additions and 23 deletions

View File

@ -183,6 +183,7 @@
:placeholder="item.placeholder" :placeholder="item.placeholder"
:disabled="item.disabled" :disabled="item.disabled"
multiple multiple
@change="((val)=>{deviceChange(val, item)})"
> >
<el-option <el-option
v-for="option in item.options" v-for="option in item.options"

View File

@ -32,7 +32,6 @@ export default {
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
fromCode: '', fromCode: '',
fromName: '',
targetIds: '', targetIds: '',
deviceType: [] deviceType: []
}, },
@ -44,8 +43,9 @@ export default {
const form = { const form = {
labelWidth: '100px', labelWidth: '100px',
items: [ items: [
{ prop: 'fromName', label: '源线路', type: 'text', disabled: true }, // type: 'text', disabled: true
{ prop: 'targetIds', label:'拷贝线路', type: 'select', options: this.targetList, multiple: true }, { prop: 'fromCode', label: '源线路', type: 'select', options: this.originList, change:true, onChange:this.originChange},
{ prop: 'targetIds', label:'拷贝线路', type: 'select', options: this.targetList, multiple: true, deviceChange: this.targetChange },
{ prop: 'deviceType', label: '操作对象', type: 'select', options: this.deviceTypeList, multiple: true } { prop: 'deviceType', label: '操作对象', type: 'select', options: this.deviceTypeList, multiple: true }
] ]
}; };
@ -53,7 +53,7 @@ export default {
}, },
rules() { rules() {
return { return {
fromName: [ fromCode: [
{ required: true, message: '请选择拷贝源线路', trigger: 'blur' } { required: true, message: '请选择拷贝源线路', trigger: 'blur' }
], ],
targetIds: [ targetIds: [
@ -63,19 +63,14 @@ export default {
} }
}, },
methods: { methods: {
doShow(lineCode) { doShow() {
this.dialogVisible = true; this.dialogVisible = true;
if (lineCode) {
this.targetList = []; this.targetList = [];
this.originList = [];
this.taskStatusList.forEach(item => { this.taskStatusList.forEach(item => {
if (item.value != lineCode) {
this.targetList.push(item); this.targetList.push(item);
} else { this.originList.push(item);
this.formModel.fromCode = item.value;
this.formModel.fromName = item.label;
}
}); });
}
}, },
doSave() { doSave() {
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
@ -93,6 +88,28 @@ export default {
handleClose() { handleClose() {
this.$refs.dataform.resetForm(); this.$refs.dataform.resetForm();
this.dialogVisible = false; this.dialogVisible = false;
},
originChange(fromCode) {
this.formModel.fromCode = fromCode;
this.formModel.targetIds = '';
this.targetList = this.targetList.map(each=>{
if (each.value == fromCode) {
each.disabled = true;
} else {
each.disabled = false;
}
return each;
});
},
targetChange(targetIds) {
this.originList = this.originList.map(each=>{
if (targetIds.includes(each.value)) {
each.disabled = true;
} else {
each.disabled = false;
}
return each;
});
} }
} }
}; };

View File

@ -126,9 +126,7 @@ export default {
{ text: this.$t('global.add'), handler: this.handleAdd }, { text: this.$t('global.add'), handler: this.handleAdd },
{ text: '复刻', handler: this.handleCopyAll } { text: '复刻', handler: this.handleCopyAll }
] ]
}, }
currentModel: {}
}; };
}, },
mounted () { mounted () {
@ -201,8 +199,8 @@ export default {
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
const param = row; // const param = row;
createCommand(param).then(response => { createCommand(row).then(response => {
this.$message.success('复制指令成功!'); this.$message.success('复制指令成功!');
}).catch(error => { }).catch(error => {
console.log(error); console.log(error);
@ -212,13 +210,15 @@ export default {
}, },
// 线线 // 线线
handleCopyAll() { handleCopyAll() {
this.$refs.copyParam.doShow(this.lineCode); // this.lineCode = this.taskStatusList[0].value;
// this.lineCode
this.$refs.copyParam.doShow();
}, },
reloadTable() { reloadTable() {
this.queryList.reload(); this.queryList.reload();
}, },
convertField(list, status) { convertField(list, status) {
console.log(list, typeof list, status); // console.log(list, typeof list, status);
if (list && list.length > 0) { return list.find(each=>{ return status == each.value; }).label; } if (list && list.length > 0) { return list.find(each=>{ return status == each.value; }).label; }
} }
} }