From 6adcfd9f9b5b9684911e7b8a198fa10ea8c20cad Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Wed, 14 Sep 2022 18:31:20 +0800 Subject: [PATCH] =?UTF-8?q?=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/scripts/ConstConfig.js | 4 +- src/views/trainingManage/editCondition.vue | 58 ++++--------- src/views/trainingManage/expression.vue | 88 +++++++++++++++----- src/views/trainingManage/expressionValue.vue | 38 +++++++-- 4 files changed, 117 insertions(+), 71 deletions(-) diff --git a/src/scripts/ConstConfig.js b/src/scripts/ConstConfig.js index 5a37e5da9..0e9e545b2 100644 --- a/src/scripts/ConstConfig.js +++ b/src/scripts/ConstConfig.js @@ -291,7 +291,9 @@ export default { { label: '站台', value: 'StationStand' }, // Stand { label: '车站', value: 'Station' }, {label:'进路', value:'Route'}, - { label: '列车', value: 'Train' } + { label: '列车', value: 'Train' }, + { label: '自动闭塞', value: 'StationDirectionAuto' }, + { label: '半自动闭塞', value: 'StationDirectionSemi' } ] } }; diff --git a/src/views/trainingManage/editCondition.vue b/src/views/trainingManage/editCondition.vue index 73b25d2db..649d4f706 100644 --- a/src/views/trainingManage/editCondition.vue +++ b/src/views/trainingManage/editCondition.vue @@ -47,11 +47,6 @@ export default { ExpressionValue, Expression }, - provide() { - return { - optionObj: this.optionObj - }; - }, props: { materialsList: { type: Array, @@ -68,44 +63,7 @@ export default { tableData: [], activeIndexPath: '', rowIndex: 0, - conditionKey: '', - optionObj: { - boolean: [ - { label: '是', value: true }, - { label: '否', value: false } - ], - RunLevel: [ - { label: 'cbtc级别', value: 'CBTC' }, - { label: '点式通信', value: 'ITC' }, - { label: '联锁级', value: 'IL' } - ], - SignalAspect: [ - {label:'红', value:1}, - {label:'绿', value:2}, - {label:'黄', value:3}, - {label:'黄红', value:4}, - {label:'绿绿', value:5}, - {label:'绿黄', value:6}, - {label:'黄黄', value:7}, - {label:'黄闪黄', value:8}, - {label:'白红', value:9}, - {label:'蓝', value:10}, - {label:'白', value:11}, - {label:'红闪', value:12} - ], - SwitchIndication: [// 道岔位置定位、反位 N-定位 R-反位 NO-无(失表) EX-挤叉 - { label: '定位', value: 'N' }, - { label: '反位', value: 'R' }, - { label: '失表', value: 'NO' }, - { label: '挤叉', value: 'EX' } - ], - DriveMode: [ - { label: '自动驾驶模式', value: 'AM' }, - { label: '人工驾驶模式', value: 'CM' }, - { label: '限制人工驾驶模式', value: 'RM' }, - { label: '非限制人工驾驶模式', value: 'NRM' } - ] - } + conditionKey: '' }; }, computed: { @@ -135,6 +93,9 @@ export default { typeObj[ii.value] = ii.label; }); const list = []; + const autoList = ['ASSIST', 'CHANGE_DIRECTION', 'PICK_ASSIST', 'DEPART_ASSIST']; // 自动闭塞 + const SemiList = ['OCCLUSION', 'RECOVERY', 'ACCIDENT']; // 半自动闭塞 + const allList = [...autoList, ...SemiList]; Object.values(this.mapDevice).forEach(item => { if (typeObj[item._type]) { list.push({ @@ -143,6 +104,17 @@ export default { _type: item._type }); } + if (item._type == 'SignalButton' && allList.includes(item.type)) { + let isAuto = true; + if (SemiList.includes(item.type)) { + isAuto = false; + } + list.push({ + code: item.code, + name: `${item.name}(${isAuto ? '自动闭塞' : '半自动闭塞'})`, + _type: `${isAuto ? 'StationDirectionAuto' : 'StationDirectionSemi'}` + }); + } }); this.getRouteList.forEach(item => { list.push({ diff --git a/src/views/trainingManage/expression.vue b/src/views/trainingManage/expression.vue index 90a721381..37c334761 100644 --- a/src/views/trainingManage/expression.vue +++ b/src/views/trainingManage/expression.vue @@ -12,7 +12,7 @@
- + + + + + - + 激活 - +
- + + -
+
激活
- +
@@ -92,7 +102,6 @@ import ConstConfig from '@/scripts/ConstConfig'; export default { name: 'Expression', components:{}, - inject: ['optionObj'], props: { getDeviceList: { type: Array, @@ -111,6 +120,7 @@ export default { return { indexPath: '', field: '', + deviceType: '', formModel: { t: 'E', t1: 'S', @@ -138,15 +148,12 @@ export default { return item.value == 'V'; }); }, - deviceType() { - let type = ''; - const findObj = this.getDeviceList.find(item => { - return item.code == this.formModel.elementCode; + filterDeviceList() { + let list = []; + list = this.getDeviceList.filter(item => { + return item._type == this.deviceType; }); - if (findObj) { - type = findObj._type || ''; - } - return type; + return list; }, getSectionList() { // 区段列表 let list = []; @@ -180,6 +187,22 @@ export default { } return attr; }, + optionObj() { + const obj = { + boolean: [ + { label: '是', value: true }, + { label: '否', value: false } + ] + }; + this.materialsList.forEach(item => { + item.materials.forEach(every => { + if (every.valueList) { + obj[every.type] = every.valueList; + } + }); + }); + return obj; + }, rules() { const crules = { t: [ @@ -234,21 +257,35 @@ export default { if (this.field && this.showDevice) { const model = this.$store.state.menuOperation.selected; let code = model.code; - if (model._type == 'SignalButton') { + if (model._type == 'SignalButton' && model.signalCode) { code = model.signalCode; } - const findObj = this.getDeviceList.find(item => { + let list = this.getDeviceList; + if (this.field == 'v') { + list = this.getSectionList; + } + const findObj = list.find(item => { return item.code == code; }); if (findObj) { this.formModel[this.field] = findObj.code; } + if (this.deviceType != this.getDeviceType()) { + this.deviceType = this.getDeviceType(); + this.formModel.filedName = ''; + this.formModel.v = ''; + } this.field = ''; } } }, created() {}, methods: { + changeDeviceType() { + this.formModel.elementCode = ''; + this.formModel.filedName = ''; + this.formModel.v = ''; + }, hover(field) { this.field = field == this.field ? '' : field; this.$emit('hover', field); @@ -331,6 +368,17 @@ export default { this.formModel.t2 = 'V'; } } + this.deviceType = this.getDeviceType(); + }, + getDeviceType() { + let type = ''; + const findObj = this.getDeviceList.find(item => { + return item.code == this.formModel.elementCode; + }); + if (findObj) { + type = findObj._type || ''; + } + return type; }, clearFromData() { this.$refs.formModel.resetFields(); diff --git a/src/views/trainingManage/expressionValue.vue b/src/views/trainingManage/expressionValue.vue index 42f160f97..beafc3d5b 100644 --- a/src/views/trainingManage/expressionValue.vue +++ b/src/views/trainingManage/expressionValue.vue @@ -45,7 +45,6 @@ import ConstConfig from '@/scripts/ConstConfig'; export default { name: 'ExpressionValue', components:{}, - inject: ['optionObj'], props: { valueObj: { type: Object, @@ -91,6 +90,22 @@ export default { return arr.includes(item.value); }); }, + optionObj() { + const obj = { + boolean: [ + { label: '是', value: true }, + { label: '否', value: false } + ] + }; + this.materialsList.forEach(item => { + item.materials.forEach(every => { + if (every.valueList) { + obj[every.type] = every.valueList; + } + }); + }); + return obj; + }, valueTypeList() { let list = []; Object.values(this.optionObj).forEach(item => { @@ -106,12 +121,21 @@ export default { let value = obj.valuables[1].v; const type = this.getValueType(obj.valuables[0]); if (type) { - const list = this.optionObj[type] || []; - const findObj = list.find(item => { - return item.value == value; - }); - if (findObj) { - value = findObj.label; + if (type != 'Section') { + const list = this.optionObj[type] || []; + const findObj = list.find(item => { + return item.value == value; + }); + if (findObj) { + value = findObj.label; + } + } else { + const findObj = this.getDeviceList.find(item => { + return item.code == value; + }); + if (findObj) { + value = findObj.name; + } } } return value;