This commit is contained in:
zyy 2020-11-10 13:42:45 +08:00
commit 488a452bce
3 changed files with 35 additions and 46 deletions

View File

@ -4,18 +4,18 @@
export function traverseLineElements(currentType, elementTypeList, model, style, obj) {
const currentTypeList = currentType.elemnetType;
currentTypeList.forEach(element => {
const ClassName = elementTypeList[element];
if (ClassName) {
obj[element] = new ClassName({
zlevel: model.zlevel,
z: 1 + currentType[element].z,
style: style,
modelData:model
});
obj.add(obj[element]);
} else {
console.error(`not find class name: ${ClassName}`);
}
const ClassName = elementTypeList[element];
if (ClassName) {
obj[element] = new ClassName({
zlevel: model.zlevel,
z: 1 + currentType[element].z,
style: style,
modelData:model
});
obj.add(obj[element]);
} else {
console.error(`not find class name: ${ClassName}`);
}
});
}
// 遍历后端返回的状态控制的绘图

View File

@ -19,6 +19,12 @@ export default {
default() {
return [];
}
},
deviceTypeList:{
type: Array,
default() {
return [];
}
}
},
data() {
@ -30,9 +36,7 @@ export default {
targetIds: '',
deviceType: []
},
deviceTypeList: [],
targetList: [],
lineCode: ''
targetList: []
};
},
computed: {
@ -58,36 +62,17 @@ export default {
};
}
},
watch: {
taskStatusList(list) {
this.targetList = [];
list.forEach(item => {
if (item.value != this.lineCode) {
this.targetList.push(item);
}
});
}
},
created() {
this.deviceTypeList = [];
this.$ConstSelect.deviceTypeList.forEach(item => {
this.deviceTypeList.push(item);
});
},
methods: {
doShow(lineCode) {
this.dialogVisible = true;
if (lineCode) {
this.lineCode = lineCode;
this.targetList = [];
this.taskStatusList.forEach(item => {
item.value = item.code;
item.label = item.name;
if (item.code != lineCode) {
if (item.value != lineCode) {
this.targetList.push(item);
} else {
this.formModel.fromCode = item.code;
this.formModel.fromName = item.name;
this.formModel.fromCode = item.value;
this.formModel.fromName = item.label;
}
});
}

View File

@ -2,7 +2,7 @@
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<show-condition ref="showCondition" />
<copy-param ref="copyParam" :task-status-list="taskStatusList" />
<copy-param ref="copyParam" :task-status-list="taskStatusList" :device-type-list="deviceTypeList" />
</div>
</template>
@ -22,6 +22,7 @@ export default {
data() {
return {
taskStatusList: [],
deviceTypeList:[],
operateList: [],
pagerConfig: {
pageSize: 'pageSize',
@ -57,14 +58,14 @@ export default {
title: this.$t('system.lineCode'), // 线
prop: 'lineCode',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.lineCode, this.taskStatusList, ['code', 'name']); },
columnValue: (row) => { return this.convertField(this.taskStatusList, row.lineCode); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.simulationRole'), // 仿
prop: 'simulationRole',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.simulationRole, this.$ConstSelect.simulationRole, ['value', 'label']); },
columnValue: (row) => { return this.convertField(this.$ConstSelect.simulationRole, row.simulationRole); },
tagType: (row) => { return 'success'; }
},
{
@ -78,14 +79,14 @@ export default {
title: this.$t('system.deviceType'), //
prop: 'operateObject',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.operateObject, this.$ConstSelect.deviceTypeList, ['value', 'label']); },
columnValue: (row) => { return this.convertField( this.deviceTypeList, row.operateObject); },
tagType: (row) => { return ''; }
},
{
title: this.$t('system.instructionType'), //
prop: 'operate',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.operate, Object.values(CommandEnum[row.operateObject]), ['value', 'label']); },
columnValue: (row) => { return this.convertField(Object.values(CommandEnum[row.operateObject]), row.operate); },
tagType: (row) => { return ''; }
},
{
@ -130,7 +131,6 @@ export default {
currentModel: {}
};
},
mounted () {
this.loadInitData();
},
@ -140,13 +140,14 @@ export default {
this.taskStatusList = [];
this.mapList = [];
const list = await getLineCodeList();
this.taskStatusList = list.data;
list.data.forEach(elem => {
this.queryForm.queryObject.lineCode.config.data.push({ value: elem.code, label: elem.name });
this.taskStatusList.push({ value: elem.code, label: elem.name });
});
this.queryForm.queryObject.lineCode.config.data = this.taskStatusList;
this.$ConstSelect.deviceTypeList.forEach(elem => {
this.queryForm.queryObject.operateObject.config.data.push(elem);
this.deviceTypeList.push(elem);
});
this.queryForm.queryObject.operateObject.config.data = this.deviceTypeList;
} catch (error) {
console.log(error);
}
@ -218,6 +219,9 @@ export default {
},
reloadTable() {
this.queryList.reload();
},
convertField(list, status) {
return list.find(each=>{ return status === each.value; }).label;
}
}
};