From f62fc8bbb37aebb402f3636aa3b658a2a1b5ce3e Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Tue, 10 Nov 2020 11:07:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E4=BB=A4=E5=AD=97=E5=85=B8=E7=94=9F?= =?UTF-8?q?=E6=88=90=20=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/shape/utils/ShapeStatusCovert.js | 24 ++++++------- .../system/commandDictionary/copyParam.vue | 35 ++++++------------- src/views/system/commandDictionary/index.vue | 22 +++++++----- 3 files changed, 35 insertions(+), 46 deletions(-) diff --git a/src/jmapNew/shape/utils/ShapeStatusCovert.js b/src/jmapNew/shape/utils/ShapeStatusCovert.js index afedfc490..5682e7202 100644 --- a/src/jmapNew/shape/utils/ShapeStatusCovert.js +++ b/src/jmapNew/shape/utils/ShapeStatusCovert.js @@ -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}`); + } }); } // 遍历后端返回的状态控制的绘图 diff --git a/src/views/system/commandDictionary/copyParam.vue b/src/views/system/commandDictionary/copyParam.vue index 1d6bd21c0..7ced5e307 100644 --- a/src/views/system/commandDictionary/copyParam.vue +++ b/src/views/system/commandDictionary/copyParam.vue @@ -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; } }); } diff --git a/src/views/system/commandDictionary/index.vue b/src/views/system/commandDictionary/index.vue index b164868ba..3406cbb34 100644 --- a/src/views/system/commandDictionary/index.vue +++ b/src/views/system/commandDictionary/index.vue @@ -2,7 +2,7 @@
- +
@@ -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; } } };