指令字典 复刻指令代码调整
This commit is contained in:
parent
2b51f077fc
commit
994433a3ba
@ -183,6 +183,7 @@
|
||||
:placeholder="item.placeholder"
|
||||
:disabled="item.disabled"
|
||||
multiple
|
||||
@change="((val)=>{deviceChange(val, item)})"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in item.options"
|
||||
|
@ -32,7 +32,6 @@ export default {
|
||||
dialogVisible: false,
|
||||
formModel: {
|
||||
fromCode: '',
|
||||
fromName: '',
|
||||
targetIds: '',
|
||||
deviceType: []
|
||||
},
|
||||
@ -44,8 +43,9 @@ export default {
|
||||
const form = {
|
||||
labelWidth: '100px',
|
||||
items: [
|
||||
{ prop: 'fromName', label: '源线路', type: 'text', disabled: true },
|
||||
{ prop: 'targetIds', label:'拷贝线路', type: 'select', options: this.targetList, multiple: true },
|
||||
// type: 'text', disabled: 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 }
|
||||
]
|
||||
};
|
||||
@ -53,7 +53,7 @@ export default {
|
||||
},
|
||||
rules() {
|
||||
return {
|
||||
fromName: [
|
||||
fromCode: [
|
||||
{ required: true, message: '请选择拷贝源线路', trigger: 'blur' }
|
||||
],
|
||||
targetIds: [
|
||||
@ -63,19 +63,14 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow(lineCode) {
|
||||
doShow() {
|
||||
this.dialogVisible = true;
|
||||
if (lineCode) {
|
||||
this.targetList = [];
|
||||
this.taskStatusList.forEach(item => {
|
||||
if (item.value != lineCode) {
|
||||
this.targetList.push(item);
|
||||
} else {
|
||||
this.formModel.fromCode = item.value;
|
||||
this.formModel.fromName = item.label;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.targetList = [];
|
||||
this.originList = [];
|
||||
this.taskStatusList.forEach(item => {
|
||||
this.targetList.push(item);
|
||||
this.originList.push(item);
|
||||
});
|
||||
},
|
||||
doSave() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
@ -93,6 +88,28 @@ export default {
|
||||
handleClose() {
|
||||
this.$refs.dataform.resetForm();
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -126,9 +126,7 @@ export default {
|
||||
{ text: this.$t('global.add'), handler: this.handleAdd },
|
||||
{ text: '复刻', handler: this.handleCopyAll }
|
||||
]
|
||||
},
|
||||
|
||||
currentModel: {}
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
@ -201,8 +199,8 @@ export default {
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const param = row;
|
||||
createCommand(param).then(response => {
|
||||
// const param = row;
|
||||
createCommand(row).then(response => {
|
||||
this.$message.success('复制指令成功!');
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
@ -212,13 +210,15 @@ export default {
|
||||
},
|
||||
// 复制线路到其他线路 操作
|
||||
handleCopyAll() {
|
||||
this.$refs.copyParam.doShow(this.lineCode);
|
||||
// this.lineCode = this.taskStatusList[0].value;
|
||||
// this.lineCode
|
||||
this.$refs.copyParam.doShow();
|
||||
},
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
},
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user