jd1A调整,信号按钮调整

This commit is contained in:
Yuan 2022-08-02 18:12:03 +08:00
parent 838559280d
commit df174615ba
5 changed files with 837 additions and 697 deletions

View File

@ -259,7 +259,7 @@ class SkinCode extends defaultStyle {
this[deviceType.SignalButton] = { this[deviceType.SignalButton] = {
shape: 'roundWithDock', shape: 'roundWithDock',
fillColor: '#808080', fillColor: '#808080',
showName: true showName: true,
} }
this[deviceType.SwitchFault] = { this[deviceType.SwitchFault] = {

View File

@ -37,6 +37,7 @@ export default class SignalButton extends Group {
this.z = 0 this.z = 0
this.model = model this.model = model
this.style = style this.style = style
this.pressed = false
// Line // Line
this.create() this.create()
this.setState(model) this.setState(model)
@ -291,7 +292,6 @@ export default class SignalButton extends Group {
} }
} }
} }
// let
// { value: 'PICK', label: '接车按钮' }, // { value: 'PICK', label: '接车按钮' },
// { value: 'SHUNT_TERMINAL', label: '调车终端按钮' }, // { value: 'SHUNT_TERMINAL', label: '调车终端按钮' },
if (!store.getters['map/checkDeviceShow'](this._code)) { if (!store.getters['map/checkDeviceShow'](this._code)) {
@ -308,5 +308,26 @@ export default class SignalButton extends Group {
} }
} }
} }
pressDown(flg, color) {
if (this.pressed === flg) return
if (this.arcShapeDock1) {
if (flg) {
this.arcShape.attr({ shape: { cy: this.arcShape.shape.cy + 2 }, z: this.z + 2, zlevel: this.zlevel })
if (color) {
this.arcShape
.animateStyle(true)
.when(0, { fill: '#69666E' })
.when(1000, { fill: color })
.when(2000, { fill: '#69666E' })
.start()
}
} else {
this.arcShape.attr({ shape: { cy: this.arcShape.shape.cy - 2 }, z: this.z + 2, zlevel: this.zlevel })
this.arcShape.stopAnimation(true)
this.recover()
}
this.pressed = flg
}
}
getAnchorPoint() {} getAnchorPoint() {}
} }

View File

@ -487,8 +487,6 @@ export default class Switch extends Group {
if (this.model.switchFaultCode) { if (this.model.switchFaultCode) {
const switchFault = this.mapDevice[this.model.switchFaultCode]; const switchFault = this.mapDevice[this.model.switchFaultCode];
if (this.style.SwitchFault.lamp.switchState) { if (this.style.SwitchFault.lamp.switchState) {
console.log(fault)
console.log(pos)
if (pos === 'N') switchFault.instance.setControlColor(this.style.SwitchFault.lamp.controlColor) if (pos === 'N') switchFault.instance.setControlColor(this.style.SwitchFault.lamp.controlColor)
else if (pos === 'R') switchFault.instance.setControlColor(this.style.SwitchFault.lamp.reverseColor) else if (pos === 'R') switchFault.instance.setControlColor(this.style.SwitchFault.lamp.reverseColor)
else if (pos === 'NO') switchFault.instance.setControlColor(this.style.SwitchFault.lamp.switchingColor) else if (pos === 'NO') switchFault.instance.setControlColor(this.style.SwitchFault.lamp.switchingColor)
@ -816,7 +814,6 @@ export default class Switch extends Group {
} }
} else { } else {
this.setSwitchFault(model); this.setSwitchFault(model);
console.log(model)
// model.pos == 'NO' || model.pos == 'EX'; // model.pos == 'NO' || model.pos == 'EX';
// N-定位 R-反位 NO-无(失表) EX-挤叉 // N-定位 R-反位 NO-无(失表) EX-挤叉

View File

@ -225,15 +225,15 @@ export default {
components: { components: {
PasswordBox, PasswordBox,
DefectiveShunting, DefectiveShunting,
NoticeInfo NoticeInfo,
}, },
props: { props: {
selected: { selected: {
type: Object, type: Object,
default: () => { default: () => {
return null return null
} },
} },
}, },
data() { data() {
return { return {
@ -264,8 +264,9 @@ export default {
buttonName: true, buttonName: true,
signalName: true, signalName: true,
switchName: true, switchName: true,
sectionName: true sectionName: true,
} },
pressedSignalButton: null,
} }
}, },
computed: { computed: {
@ -331,7 +332,7 @@ export default {
return CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE return CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE
} }
return '' return ''
} },
}, },
watch: { watch: {
'$store.state.menuOperation.buttonOperation': function(val, old) { '$store.state.menuOperation.buttonOperation': function(val, old) {
@ -370,7 +371,7 @@ export default {
const station = this.$store.getters['map/getDeviceByCode'](val) const station = this.$store.getters['map/getDeviceByCode'](val)
this.$store.getters['map/checkStationGuideMaster'](station.code, station.sGuideMasterLock, station.xGuideMasterLock) this.$store.getters['map/checkStationGuideMaster'](station.code, station.sGuideMasterLock, station.xGuideMasterLock)
} }
} },
}, },
beforeDestroy() { beforeDestroy() {
this.routeDataMap = null this.routeDataMap = null
@ -385,12 +386,12 @@ export default {
over: true, over: true,
operation: data.operation, operation: data.operation,
cmdType: data.nextCmdType, cmdType: data.nextCmdType,
param: data.param param: data.param,
} }
} else { } else {
operate = { operate = {
operationPre: data.operation, operationPre: data.operation,
operation: data.operateNext operation: data.operateNext,
} }
} }
this.trainingOperation(operate) this.trainingOperation(operate)
@ -477,7 +478,7 @@ export default {
operation: this.Station.powerUnLock.button.operation, operation: this.Station.powerUnLock.button.operation,
cmdType: CMD.Station.CMD_STATION_POWER_ON_UNLOCK, cmdType: CMD.Station.CMD_STATION_POWER_ON_UNLOCK,
code: this.$store.state.map.showCentralizedStationCode, code: this.$store.state.map.showCentralizedStationCode,
param: { stationCode: this.$store.state.map.showCentralizedStationCode } param: { stationCode: this.$store.state.map.showCentralizedStationCode },
} }
this.$store this.$store
.dispatch('training/nextNew', operate) .dispatch('training/nextNew', operate)
@ -503,7 +504,7 @@ export default {
// S // S
guideLockLeftButtonDown() { guideLockLeftButtonDown() {
const operate = { const operate = {
operation: this.Station.stationMasterLock.leftButton.operation operation: this.Station.stationMasterLock.leftButton.operation,
} }
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
@ -519,7 +520,7 @@ export default {
// X // X
guideLockRightButtonDown() { guideLockRightButtonDown() {
const operate = { const operate = {
operation: this.Station.stationMasterLock.rightButton.operation operation: this.Station.stationMasterLock.rightButton.operation,
} }
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
@ -532,17 +533,18 @@ export default {
} }
}) })
}, },
buttonDown(operation, commandTypeList) { buttonDown(operation, commandTypeList, color) {
this.clearOperate() this.clearOperate()
this.pressedSignalButton.instance.pressDown(true, color)
if (operation != this.Command.cancel.clearMbm.operation) { if (operation != this.Command.cancel.clearMbm.operation) {
const operate = { const operate = {
operation: operation operation: operation,
} }
// //
const operationList = [ const operationList = [
this.Signal.humanTrainRoute.button.operation, this.Signal.humanTrainRoute.button.operation,
this.Section.fault.button.operation, this.Section.fault.button.operation,
this.Section.defectiveShunting.button.operation this.Section.defectiveShunting.button.operation,
] ]
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
@ -563,7 +565,7 @@ export default {
// //
const operate = { const operate = {
start: true, start: true,
operation: operation operation: operation,
} }
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
@ -595,7 +597,7 @@ export default {
// OR // OR
arrangementRouteOperation(deviceList) { arrangementRouteOperation(deviceList) {
const operate = { const operate = {
operation: this.Signal.arrangementRoute.button.operation operation: this.Signal.arrangementRoute.button.operation,
} }
if (!this.routeDataMap) { if (!this.routeDataMap) {
this.handleRouteDataMap() this.handleRouteDataMap()
@ -672,8 +674,8 @@ export default {
operation: this.$store.state.menuOperation.buttonOperation, operation: this.$store.state.menuOperation.buttonOperation,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE, cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE,
param: { param: {
signalCode: model._type === 'Signal' ? model.code : model.signalCode signalCode: model._type === 'Signal' ? model.code : model.signalCode,
} },
} }
this.$store this.$store
.dispatch('training/nextNew', operate) .dispatch('training/nextNew', operate)
@ -693,7 +695,7 @@ export default {
code: model.code, code: model.code,
operation: this.Signal.guide.button.operation, operation: this.Signal.guide.button.operation,
cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE, cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE,
param: { signalCode: model.signalCode } param: { signalCode: model.signalCode },
} }
const signal = this.$store.getters['map/getDeviceByCode'](model.signalCode) const signal = this.$store.getters['map/getDeviceByCode'](model.signalCode)
// 15s // 15s
@ -711,7 +713,7 @@ export default {
code: model.code, code: model.code,
operation: this.$store.state.menuOperation.buttonOperation, operation: this.$store.state.menuOperation.buttonOperation,
val: model.code, val: model.code,
cmdType: CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE cmdType: CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE,
} }
const signal = this.$store.getters['map/getDeviceByCode'](model.signalCode || model.code) const signal = this.$store.getters['map/getDeviceByCode'](model.signalCode || model.code)
if (model._type === 'SignalButton' && model.type === 'PICK') { if (model._type === 'SignalButton' && model.type === 'PICK') {
@ -733,7 +735,7 @@ export default {
code: model.code, code: model.code,
operation: this.$store.state.menuOperation.buttonOperation, operation: this.$store.state.menuOperation.buttonOperation,
cmdType: this.cmdType, cmdType: this.cmdType,
param: { switchCode: code } param: { switchCode: code },
} }
this.sendCommand(operate) this.sendCommand(operate)
}, },
@ -770,7 +772,7 @@ export default {
code: model.code, code: model.code,
operation: buttonOperation, operation: buttonOperation,
cmdType: '', cmdType: '',
param: {} param: {},
} }
if (model._type === 'Signal' && !this.checkHasTrainButton(model)) { if (model._type === 'Signal' && !this.checkHasTrainButton(model)) {
if (buttonOperation === this.Signal.lock.button.operation) { if (buttonOperation === this.Signal.lock.button.operation) {
@ -799,7 +801,7 @@ export default {
code: model.code, code: model.code,
operation: this.guideLockRightFlag ? this.Switch.guideLock.rightButton : this.Switch.guideLock.leftButton, operation: this.guideLockRightFlag ? this.Switch.guideLock.rightButton : this.Switch.guideLock.leftButton,
nextCmdType: CMD.Switch.CMD_SWITCH_MASTER_LOCK, nextCmdType: CMD.Switch.CMD_SWITCH_MASTER_LOCK,
param: { signalCode: model.signalCode } param: { signalCode: model.signalCode },
} }
// 15s // 15s
if (signal.guideTime) { if (signal.guideTime) {
@ -817,7 +819,7 @@ export default {
code: model.code, code: model.code,
operation: this.$store.state.menuOperation.buttonOperation, operation: this.$store.state.menuOperation.buttonOperation,
cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK, cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK,
param: { sectionCode: model.code } param: { sectionCode: model.code },
} }
this.sendCommand(operate) this.sendCommand(operate)
} }
@ -826,6 +828,10 @@ export default {
selectedChange() { selectedChange() {
// //
const model = this.selected // const model = this.selected //
if (this.pressedSignalButton /* && this.pressedSignalButton.code === model.code */) {
this.pressedSignalButton.instance.pressDown(false)
this.pressedSignalButton = null
}
if ( if (
(this.$store.state.training.prdType != '01' && this.$store.state.training.prdType != '10') || (this.$store.state.training.prdType != '01' && this.$store.state.training.prdType != '10') ||
this.selected._event !== MouseEvent.Left || this.selected._event !== MouseEvent.Left ||
@ -840,7 +846,7 @@ export default {
this.Switch.locate.button.operation, this.Switch.locate.button.operation,
this.Switch.reverse.button.operation, this.Switch.reverse.button.operation,
this.Switch.block.button.operation, this.Switch.block.button.operation,
this.Switch.unblock.button.operation this.Switch.unblock.button.operation,
] ]
const signalButtonOperation = [ const signalButtonOperation = [
'LOCATE', // 'LOCATE', //
@ -849,7 +855,9 @@ export default {
'UNLOCK', // 'UNLOCK', //
'BLOCK', // 'BLOCK', //
'UNBLOCK', //, 'UNBLOCK', //,
'SECTION_FAULT_UNLOCK' // 'SECTION_FAULT_UNLOCK', //
'CANCEL', //
'HUMAN_RELEASE_ROUTE', //
] ]
if ((this.guideLockLeftFlag || this.guideLockRightFlag) && model._type === 'SignalButton' && model.type === 'GUIDE') { if ((this.guideLockLeftFlag || this.guideLockRightFlag) && model._type === 'SignalButton' && model.type === 'GUIDE') {
this.handleGuideLock(model) this.handleGuideLock(model)
@ -884,21 +892,30 @@ export default {
this.guideLockRightButtonDown() this.guideLockRightButtonDown()
} }
} else if (model._type === 'SignalButton' && signalButtonOperation.includes(model.type)) { } else if (model._type === 'SignalButton' && signalButtonOperation.includes(model.type)) {
this.pressedSignalButton = model
const { lamp } = model.instance.style.SwitchFault
// //
if (model.type === 'LOCATE') { if (model.type === 'LOCATE') {
this.buttonDown(this.Switch.locate.button.operation, ['Switch', 'SwitchFault']) this.buttonDown(this.Switch.locate.button.operation, ['Switch', 'SwitchFault'], lamp.controlColor)
} else if (model.type === 'REVERSE') { } else if (model.type === 'REVERSE') {
this.buttonDown(this.Switch.reverse.button.operation, ['Switch', 'SwitchFault']) this.buttonDown(this.Switch.reverse.button.operation, ['Switch', 'SwitchFault'], lamp.reverseColor)
} else if (model.type === 'MONOLOCK') { } else if (model.type === 'MONOLOCK') {
this.buttonDown(this.Switch.lock.button.operation, ['Switch', 'SwitchFault']) this.buttonDown(this.Switch.lock.button.operation, ['Switch', 'SwitchFault'], lamp.lockColor)
} else if (model.type === 'UNLOCK') { } else if (model.type === 'UNLOCK') {
this.buttonDown(this.Switch.unlock.button.operation, ['Switch', 'SwitchFault']) this.buttonDown(this.Switch.unlock.button.operation, ['Switch', 'SwitchFault'], lamp.controlColor)
} else if (model.type === 'BLOCK') { } else if (model.type === 'BLOCK') {
this.buttonDown(this.Switch.block.button.operation, ['Switch', 'SwitchFault']) this.buttonDown(this.Switch.block.button.operation, ['Switch', 'SwitchFault'], lamp.blockColor)
} else if (model.type === 'UNBLOCK') { } else if (model.type === 'UNBLOCK') {
this.buttonDown(this.Switch.unblock.button.operation, ['Switch', 'SwitchFault']) this.buttonDown(this.Switch.unblock.button.operation, ['Switch', 'SwitchFault'], lamp.controlColor)
} else if (model.type === 'SECTION_FAULT_UNLOCK') { } else if (model.type === 'SECTION_FAULT_UNLOCK') {
this.buttonDown(this.Section.fault.button.operation, ['Section']) //
this.buttonDown(this.Section.fault.button.operation, ['Section'], lamp.faultColor)
} else if (model.type === 'CANCEL') {
//
this.buttonDown(this.MixinCommand.totalCancel.button.operation, ['Signal', 'SignalButton'])
} else if (model.type === 'HUMAN_RELEASE_ROUTE') {
//
this.buttonDown(this.Signal.humanTrainRoute.button.operation, ['Signal', 'SignalButton'])
} }
} else if ( } else if (
(model._type === 'SignalButton' && !this.checkSignalBlock(model.signalCode)) || (model._type === 'SignalButton' && !this.checkSignalBlock(model.signalCode)) ||
@ -930,11 +947,13 @@ export default {
this.deviceList && this.deviceList &&
this.deviceList.length && this.deviceList.length &&
this.$store.dispatch('training/updateMapState', [ this.$store.dispatch('training/updateMapState', [
{ code: this.deviceList[0].code, _type: this.deviceList[0]._type, hasSelected: 0 } { code: this.deviceList[0].code, _type: this.deviceList[0]._type, hasSelected: 0 },
]) ])
this.deviceList = [] this.deviceList = []
Handler.clear() // Handler.clear() //
this.$store.dispatch('menuOperation/setButtonOperation', null) this.$store.dispatch('menuOperation/setButtonOperation', null)
// this.pressedSignalButton && this.pressedSignalButton.instance.pressDown(false)
// this.pressedSignalButton = null
}, },
assistOperateOrChange(model) { assistOperateOrChange(model) {
// mode.type== // mode.type==
@ -946,8 +965,8 @@ export default {
param: { param: {
labelEnum: model.labelEnum, labelEnum: model.labelEnum,
stationCode: model.stationCode, stationCode: model.stationCode,
pressDown: model.pressDown ? 0 : 1 // 10 pressDown: model.pressDown ? 0 : 1, // 10
} },
}, },
// //
CHANGE_DIRECTION: { CHANGE_DIRECTION: {
@ -956,8 +975,8 @@ export default {
param: { param: {
labelEnum: model.labelEnum, labelEnum: model.labelEnum,
stationCode: model.stationCode, stationCode: model.stationCode,
pressDown: model.pressDown ? 0 : 1 // 10 pressDown: model.pressDown ? 0 : 1, // 10
} },
}, },
// //
PICK_ASSIST: { PICK_ASSIST: {
@ -966,8 +985,8 @@ export default {
nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_RECEIVE_ASSIST, nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_RECEIVE_ASSIST,
param: { param: {
labelEnum: model.labelEnum, labelEnum: model.labelEnum,
stationCode: model.stationCode stationCode: model.stationCode,
} },
}, },
// //
DEPART_ASSIST: { DEPART_ASSIST: {
@ -975,8 +994,8 @@ export default {
nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_DELIVER_ASSIST, nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_DELIVER_ASSIST,
param: { param: {
labelEnum: model.labelEnum, labelEnum: model.labelEnum,
stationCode: model.stationCode stationCode: model.stationCode,
} },
}, },
// //
ACCIDENT: { ACCIDENT: {
@ -984,9 +1003,9 @@ export default {
nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_ACCIDENT, nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_ACCIDENT,
param: { param: {
labelEnum: model.labelEnum, labelEnum: model.labelEnum,
stationCode: model.stationCode stationCode: model.stationCode,
} },
} },
} }
const noPasswordModelTypeMap = { const noPasswordModelTypeMap = {
// //
@ -995,8 +1014,8 @@ export default {
nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_BLOCK, nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_BLOCK,
param: { param: {
labelEnum: model.labelEnum, labelEnum: model.labelEnum,
stationCode: model.stationCode stationCode: model.stationCode,
} },
}, },
// //
RECOVERY: { RECOVERY: {
@ -1004,9 +1023,9 @@ export default {
nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_RESTORE, nextCmdType: CMD.CTC.CTC_ASSIST_PRESS_RESTORE,
param: { param: {
labelEnum: model.labelEnum, labelEnum: model.labelEnum,
stationCode: model.stationCode stationCode: model.stationCode,
} },
} },
} }
if (noPasswordModelTypeMap[model.type]) { if (noPasswordModelTypeMap[model.type]) {
const operate = { const operate = {
@ -1014,7 +1033,7 @@ export default {
operation: noPasswordModelTypeMap[model.type].operation, operation: noPasswordModelTypeMap[model.type].operation,
code: model.code, code: model.code,
param: noPasswordModelTypeMap[model.type].param, param: noPasswordModelTypeMap[model.type].param,
cmdType: noPasswordModelTypeMap[model.type].nextCmdType cmdType: noPasswordModelTypeMap[model.type].nextCmdType,
} }
this.$store this.$store
.dispatch('training/nextNew', operate) .dispatch('training/nextNew', operate)
@ -1033,7 +1052,7 @@ export default {
const operate = { const operate = {
operation: modelTypeMap[model.type].operation, operation: modelTypeMap[model.type].operation,
code: model.code, code: model.code,
param: modelTypeMap[model.type].param param: modelTypeMap[model.type].param,
} }
this.$store this.$store
.dispatch('training/nextNew', operate) .dispatch('training/nextNew', operate)
@ -1066,8 +1085,8 @@ export default {
// console.error(error); // console.error(error);
// this.$refs.noticeInfo.doShow(); // this.$refs.noticeInfo.doShow();
// }); // });
} },
} },
} }
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -33,12 +33,12 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex'
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid'
import OperateProperty from './components/operateProperty'; import OperateProperty from './components/operateProperty'
import ConfigList from './config/list'; import ConfigList from './config/list'
import getModel from './models.js'; import getModel from './models.js'
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index'
export default { export default {
name: 'ControlLamp', name: 'ControlLamp',
@ -50,7 +50,7 @@ export default {
selected: { selected: {
type: Object, type: Object,
default: function() { default: function() {
return null; return null
} }
} }
}, },
@ -134,19 +134,33 @@ export default {
{ name: '接车箭头', value: 'PickArrow' }, { name: '接车箭头', value: 'PickArrow' },
{ name: '发车箭头', value: 'DepartArrow' } { name: '发车箭头', value: 'DepartArrow' }
], ],
hasDirectionList: ['SectionOccupied', 'AssistStatus', 'TotalAssist', 'DepartAssist', 'PickAssist', 'Recovery', 'Accident', 'Occlusion', 'PickArrow', 'DepartArrow'], hasDirectionList: [
directionList: [{label: 'X',value: 'X'},{label: 'XF',value: 'XF'},{label: 'XD',value: 'XD'}, {label:'S',value:'S'},{label:'SF',value:'SF'},{label:'SD',value: 'SD'}], 'SectionOccupied',
'AssistStatus',
'TotalAssist',
'DepartAssist',
'PickAssist',
'Recovery',
'Accident',
'Occlusion',
'PickArrow',
'DepartArrow'
],
directionList: [
{ label: 'X', value: 'X' },
{ label: 'XF', value: 'XF' },
{ label: 'XD', value: 'XD' },
{ label: 'S', value: 'S' },
{ label: 'SF', value: 'SF' },
{ label: 'SD', value: 'SD' }
],
editModel: getModel('ControlLamp'), editModel: getModel('ControlLamp'),
addModel: getModel('ControlLamp'), addModel: getModel('ControlLamp'),
field: '' field: ''
}; }
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', ['stationList', 'switchList', 'indicatorLightList']),
'stationList',
'switchList',
'indicatorLightList'
]),
form() { form() {
const form = { const form = {
labelWidth: '150px', labelWidth: '150px',
@ -158,24 +172,82 @@ export default {
draw: { draw: {
name: this.$t('map.drawData'), name: this.$t('map.drawData'),
item: [ item: [
{ prop:'type', label: this.$t('map.saidLampType'), type: 'select', optionLabel: 'name', optionValue: 'value', options: this.typeList, deviceChange: this.typeChange }, {
{ prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'code', optionValue: 'code', options: this.selectLists, deviceChange: this.deviceChange }, prop: 'type',
{ prop: 'name', label: this.$t('map.saidLampName'), type: 'input', isHidden: this.noNameTypeList.includes(this.editModel.type) }, label: this.$t('map.saidLampType'),
{ prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '140px', children: [ type: 'select',
optionLabel: 'name',
optionValue: 'value',
options: this.typeList,
deviceChange: this.typeChange
},
{
prop: 'code',
label: `${this.$t('map.code')}`,
type: 'select',
optionLabel: 'code',
optionValue: 'code',
options: this.selectLists,
deviceChange: this.deviceChange
},
{
prop: 'name',
label: this.$t('map.saidLampName'),
type: 'input',
isHidden: this.noNameTypeList.includes(this.editModel.type)
},
{
prop: 'position',
label: this.$t('map.textPoints'),
type: 'coordinate',
width: '140px',
children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' }, { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' } { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
] }, ]
},
{ prop: 'mfNum', label: '报警指示故障数量:', type: 'number', min: 0, isHidden: this.editModel.type !== 'FaultStatusGroup' }, { prop: 'mfNum', label: '报警指示故障数量:', type: 'number', min: 0, isHidden: this.editModel.type !== 'FaultStatusGroup' },
{ prop: 'pfNum', label: '电源故障数量:', type: 'number', min: 0, isHidden: this.editModel.type !== 'FaultStatusGroup' }, { prop: 'pfNum', label: '电源故障数量:', type: 'number', min: 0, isHidden: this.editModel.type !== 'FaultStatusGroup' },
{ prop: 'right', label: '朝右:', type: 'checkbox', isHidden: this.editModel.type !== 'DepartArrow' && this.editModel.type !== 'PickArrow' }, {
{ prop: 'labelEnum', label: '方向:', type: 'select', optionLabel: 'label', optionValue: 'value', options: this.directionList, isHidden: !this.hasDirectionList.includes(this.editModel.type) }, prop: 'right',
{ prop: 'switchCode', label: '所属道岔:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.switchList, isHidden: this.editModel.type !== 'SwitchFault', hover: this.hover, buttonType: 'switchSelectCode', buttonShowType: this.isButtonType }, label: '朝右:',
{ prop:'stationCode', label: '所属车站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList} type: 'checkbox',
isHidden: this.editModel.type !== 'DepartArrow' && this.editModel.type !== 'PickArrow'
},
{
prop: 'labelEnum',
label: '方向:',
type: 'select',
optionLabel: 'label',
optionValue: 'value',
options: this.directionList,
isHidden: !this.hasDirectionList.includes(this.editModel.type)
},
{
prop: 'switchCode',
label: '所属道岔:',
type: 'SelectHover',
optionLabel: 'name&&code',
optionValue: 'code',
options: this.switchList,
isHidden: this.editModel.type !== 'SwitchFault',
hover: this.hover,
buttonType: 'switchSelectCode',
buttonShowType: this.isButtonType,
},
{
prop: 'stationCode',
label: '所属车站:',
type: 'select',
optionLabel: 'name&&code',
optionValue: 'code',
options: this.stationList
}
] ]
} }
} }
}; }
return form; return form
}, },
formMake() { formMake() {
const form = { const form = {
@ -184,474 +256,505 @@ export default {
all: { all: {
name: '', name: '',
item: [ item: [
{ prop:'type', label: this.$t('map.saidLampType'), type: 'select', optionLabel: 'name', optionValue: 'value', options: this.typeList, deviceChange: this.typeChange}, {
{ prop: 'name', label: this.$t('map.saidLampName'), type: 'input', isHidden: this.noNameTypeList.includes(this.addModel.type) }, prop: 'type',
{ prop:'stationCode', label: '所属车站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, deviceChange: this.changeBelongStation}, label: this.$t('map.saidLampType'),
{ prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '140px', children: [ type: 'select',
optionLabel: 'name',
optionValue: 'value',
options: this.typeList,
deviceChange: this.typeChange
},
{
prop: 'name',
label: this.$t('map.saidLampName'),
type: 'input',
isHidden: this.noNameTypeList.includes(this.addModel.type)
},
{
prop: 'stationCode',
label: '所属车站:',
type: 'select',
optionLabel: 'name&&code',
optionValue: 'code',
options: this.stationList,
deviceChange: this.changeBelongStation
},
{
prop: 'position',
label: this.$t('map.textPoints'),
type: 'coordinate',
width: '140px',
children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' }, { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }, ]
},
{ prop: 'mfNum', label: '报警指示故障数量:', type: 'number', min: 0, isHidden: this.addModel.type !== 'FaultStatusGroup' }, { prop: 'mfNum', label: '报警指示故障数量:', type: 'number', min: 0, isHidden: this.addModel.type !== 'FaultStatusGroup' },
{ prop: 'pfNum', label: '电源故障数量:', type: 'number', min: 0, isHidden: this.addModel.type !== 'FaultStatusGroup' }, { prop: 'pfNum', label: '电源故障数量:', type: 'number', min: 0, isHidden: this.addModel.type !== 'FaultStatusGroup' },
{ prop: 'labelEnum', label: '方向:', type: 'select', optionLabel: 'label', optionValue: 'value', options: this.directionList, isHidden: !this.hasDirectionList.includes(this.addModel.type) }, {
{ prop: 'switchCode', label: '所属道岔:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.switchList, isHidden: this.addModel.type !== 'SwitchFault', hover: this.hover, buttonType: 'switchSelectCode', buttonShowType: this.isButtonType } prop: 'labelEnum',
label: '方向:',
type: 'select',
optionLabel: 'label',
optionValue: 'value',
options: this.directionList,
isHidden: !this.hasDirectionList.includes(this.addModel.type)
},
{
prop: 'switchCode',
label: '所属道岔:',
type: 'SelectHover',
optionLabel: 'name&&code',
optionValue: 'code',
options: this.switchList,
isHidden: this.addModel.type !== 'SwitchFault',
hover: this.hover,
buttonType: 'switchSelectCode',
buttonShowType: this.isButtonType,
}
] ]
} }
} }
}; }
return form; return form
}, },
rules: function() { rules: function() {
return { return {
type: [ type: [{ required: true, message: this.$t('rules.selectSaidLampType'), trigger: 'change' }],
{ required: true, message: this.$t('rules.selectSaidLampType'), trigger: 'change' } code: [{ required: true, message: this.$t('rules.pleaseSelectEncoding'), trigger: 'change' }],
], name: [{ required: true, message: this.$t('rules.enterSaidLampName'), trigger: 'blur' }],
code: [ 'position.x': [{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }],
{ required: true, message: this.$t('rules.pleaseSelectEncoding'), trigger: 'change' } 'position.y': [{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'blur' }],
], stationCode: [{ required: true, message: this.$t('rules.pleaseSelectStationCode'), trigger: 'change' }],
name: [ switchCode: [{ required: true, message: '请选择所属道岔!', trigger: 'change' }],
{ required: true, message: this.$t('rules.enterSaidLampName'), trigger: 'blur' } labelEnum: [{ required: true, message: '请选择方向!', trigger: 'change' }]
], }
'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
],
'position.y': [
{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'blur' }
],
stationCode: [
{ required: true, message: this.$t('rules.pleaseSelectStationCode'), trigger: 'change'}
],
switchCode: [
{ required: true, message: '请选择所属道岔!', trigger: 'change'}
],
labelEnum: [
{ required: true, message: '请选择方向!', trigger: 'change'}
]
};
}, },
isButtonType() { isButtonType() {
return this.field == 'switchSelectCode'; return this.field == 'switchSelectCode'
} }
}, },
watch: { watch: {
indicatorLightList(val) { indicatorLightList(val) {
this.handleIndicatorLightList(val); this.handleIndicatorLightList(val)
}, },
'editModel.type': function(val) { 'editModel.type': function(val) {
this.handleTypes(this.editModel.type); this.handleTypes(this.editModel.type)
} }
}, },
mounted() { mounted() {
this.selectLists = this.indicatorLightList; this.selectLists = this.indicatorLightList
this.handleIndicatorLightList(this.indicatorLightList); this.handleIndicatorLightList(this.indicatorLightList)
}, },
methods: { methods: {
typeChange(type) { typeChange(type) {
if (this.activeName === 'first') { if (this.activeName === 'first') {
this.$refs.dataform.resetFields(); this.$refs.dataform.resetFields()
this.editModel.type = type; this.editModel.type = type
this.editModel._type = type; this.editModel._type = type
} else { } else {
this.$refs.make.resetFields(); this.$refs.make.resetFields()
this.addModel.type = type; this.addModel.type = type
this.addModel._type = type; this.addModel._type = type
} }
}, },
hover(field) { hover(field) {
this.field = field === this.field ? '' : field; this.field = field === this.field ? '' : field
if (this.field) { if (this.field) {
this.$emit('deviceSelect', 'ControlLamp'); this.$emit('deviceSelect', 'ControlLamp')
} else { } else {
this.$emit('deviceSelect', ''); this.$emit('deviceSelect', '')
} }
}, },
clearDeviceSelect() { clearDeviceSelect() {
this.$emit('deviceSelect', ''); this.$emit('deviceSelect', '')
}, },
handleIndicatorLightList(indicatorLightList) { handleIndicatorLightList(indicatorLightList) {
this.atsControlList = []; this.atsControlList = []
this.centerCommunicationList = []; this.centerCommunicationList = []
this.chainControlList = []; this.chainControlList = []
this.intersiteControlList = []; this.intersiteControlList = []
this.leuControlList = []; this.leuControlList = []
this.localControlList = []; this.localControlList = []
this.maintainList = []; this.maintainList = []
this.powerSupplyList = []; this.powerSupplyList = []
this.noOneReturnList = []; this.noOneReturnList = []
this.faultStatusGroupList = []; this.faultStatusGroupList = []
this.modeStatusGroupList = []; this.modeStatusGroupList = []
this.lampFilamentList = []; this.lampFilamentList = []
this.returnModeGroupList = []; this.returnModeGroupList = []
this.controlSwitchList = []; this.controlSwitchList = []
this.AxleList = []; this.AxleList = []
this.SwitchFaultList = []; this.SwitchFaultList = []
this.IndicatorLightList = []; this.IndicatorLightList = []
this.SectionOccupiedList = []; this.SectionOccupiedList = []
this.AssistStatusList = []; this.AssistStatusList = []
this.TotalAssistList = []; this.TotalAssistList = []
this.DepartAssistList = []; this.DepartAssistList = []
this.PickAssistList = []; this.PickAssistList = []
this.RecoveryList = []; this.RecoveryList = []
this.AccidentList = []; this.AccidentList = []
this.OcclusionList = []; this.OcclusionList = []
this.DepartArrowList = []; this.DepartArrowList = []
this.PickArrowList = []; this.PickArrowList = []
indicatorLightList.forEach(item => { indicatorLightList.forEach(item => {
switch (item._type) { switch (item._type) {
case 'AtsControl': case 'AtsControl':
this.atsControlList.push(item); this.atsControlList.push(item)
break; break
case 'CenterCommunication': case 'CenterCommunication':
this.centerCommunicationList.push(item); this.centerCommunicationList.push(item)
break; break
case 'ChainControl': case 'ChainControl':
this.chainControlList.push(item); this.chainControlList.push(item)
break; break
case 'IntersiteControl': case 'IntersiteControl':
this.intersiteControlList.push(item); this.intersiteControlList.push(item)
break; break
case 'LeuControl': case 'LeuControl':
this.leuControlList.push(item); this.leuControlList.push(item)
break; break
case 'LocalControl': case 'LocalControl':
this.localControlList.push(item); this.localControlList.push(item)
break; break
case 'Maintain': case 'Maintain':
this.maintainList.push(item); this.maintainList.push(item)
break; break
case 'PowerSupply': case 'PowerSupply':
this.powerSupplyList.push(item); this.powerSupplyList.push(item)
break; break
case 'NoOneReturn': case 'NoOneReturn':
this.noOneReturnList.push(item); this.noOneReturnList.push(item)
break; break
case 'MaintenanceLamps': case 'MaintenanceLamps':
this.maintenanceLampList.push(item); this.maintenanceLampList.push(item)
break; break
case 'ZcCommunication': case 'ZcCommunication':
this.zcCommunicationList.push(item); this.zcCommunicationList.push(item)
break; break
case 'FaultStatusGroup': case 'FaultStatusGroup':
this.faultStatusGroupList.push(item); this.faultStatusGroupList.push(item)
break; break
case 'ModeStatusGroup': case 'ModeStatusGroup':
this.modeStatusGroupList.push(item); this.modeStatusGroupList.push(item)
break; break
case 'LampFilament': case 'LampFilament':
this.lampFilamentList.push(item); this.lampFilamentList.push(item)
break; break
case 'ReturnModeGroup': case 'ReturnModeGroup':
this.returnModeGroupList.push(item); this.returnModeGroupList.push(item)
break; break
case 'ControlSwitch': case 'ControlSwitch':
this.controlSwitchList.push(item); this.controlSwitchList.push(item)
break; break
case 'Axle': case 'Axle':
this.AxleList.push(item); this.AxleList.push(item)
break; break
case 'SwitchFault': case 'SwitchFault':
this.SwitchFaultList.push(item); this.SwitchFaultList.push(item)
break; break
case 'IndicatorLight': case 'IndicatorLight':
this.IndicatorLightList.push(item); this.IndicatorLightList.push(item)
break; break
case 'SectionOccupied': case 'SectionOccupied':
this.SectionOccupiedList.push(item); this.SectionOccupiedList.push(item)
break; break
case 'AssistStatus': case 'AssistStatus':
this.AssistStatusList.push(item); this.AssistStatusList.push(item)
break; break
case 'TotalAssist': case 'TotalAssist':
this.TotalAssistList.push(item); this.TotalAssistList.push(item)
break; break
case 'DepartAssist': case 'DepartAssist':
this.DepartAssistList.push(item); this.DepartAssistList.push(item)
break; break
case 'PickAssist': case 'PickAssist':
this.PickAssistList.push(item); this.PickAssistList.push(item)
break; break
case 'Recovery': case 'Recovery':
this.RecoveryList.push(item); this.RecoveryList.push(item)
break; break
case 'Accident': case 'Accident':
this.AccidentList.push(item); this.AccidentList.push(item)
break; break
case 'Occlusion': case 'Occlusion':
this.OcclusionList.push(item); this.OcclusionList.push(item)
break; break
case 'PickArrow': case 'PickArrow':
this.PickArrowList.push(item); this.PickArrowList.push(item)
break; break
case 'DepartArrow': case 'DepartArrow':
this.DepartArrowList.push(item); this.DepartArrowList.push(item)
break; break
} }
}); })
}, },
handleTypes(type) { handleTypes(type) {
switch (type) { switch (type) {
case 'AtsControl': case 'AtsControl':
this.selectLists = this.atsControlList; this.selectLists = this.atsControlList
break; break
case 'CenterCommunication': case 'CenterCommunication':
this.selectLists = this.centerCommunicationList; this.selectLists = this.centerCommunicationList
break; break
case 'ChainControl': case 'ChainControl':
this.selectLists = this.chainControlList; this.selectLists = this.chainControlList
break; break
case 'IntersiteControl': case 'IntersiteControl':
this.selectLists = this.intersiteControlList; this.selectLists = this.intersiteControlList
break; break
case 'LeuControl': case 'LeuControl':
this.selectLists = this.leuControlList; this.selectLists = this.leuControlList
break; break
case 'LocalControl': case 'LocalControl':
this.selectLists = this.localControlList; this.selectLists = this.localControlList
break; break
case 'Maintain': case 'Maintain':
this.selectLists = this.maintainList; this.selectLists = this.maintainList
break; break
case 'PowerSupply': case 'PowerSupply':
this.selectLists = this.powerSupplyList; this.selectLists = this.powerSupplyList
break; break
case 'NoOneReturn': case 'NoOneReturn':
this.selectLists = this.noOneReturnList; this.selectLists = this.noOneReturnList
break; break
case 'MaintenanceLamps': case 'MaintenanceLamps':
this.selectLists = this.maintenanceLampList; this.selectLists = this.maintenanceLampList
break; break
case 'ZcCommunication': case 'ZcCommunication':
this.selectLists = this.zcCommunicationList; this.selectLists = this.zcCommunicationList
break; break
case 'FaultStatusGroup': case 'FaultStatusGroup':
this.selectLists = this.faultStatusGroupList; this.selectLists = this.faultStatusGroupList
break; break
case 'ModeStatusGroup': case 'ModeStatusGroup':
this.selectLists = this.modeStatusGroupList; this.selectLists = this.modeStatusGroupList
break; break
case 'LampFilament': case 'LampFilament':
this.selectLists = this.lampFilamentList; this.selectLists = this.lampFilamentList
break; break
case 'ReturnModeGroup': case 'ReturnModeGroup':
this.selectLists = this.returnModeGroupList; this.selectLists = this.returnModeGroupList
break; break
case 'ControlSwitch': case 'ControlSwitch':
this.selectLists = this.controlSwitchList; this.selectLists = this.controlSwitchList
break; break
case 'Axle': case 'Axle':
this.selectLists = this.AxleList; this.selectLists = this.AxleList
break; break
case 'SwitchFault': case 'SwitchFault':
this.selectLists = this.SwitchFaultList; this.selectLists = this.SwitchFaultList
break; break
case 'IndicatorLight': case 'IndicatorLight':
this.selectLists = this.IndicatorLightList; this.selectLists = this.IndicatorLightList
break; break
case 'SectionOccupied': case 'SectionOccupied':
this.selectLists = this.SectionOccupiedList; this.selectLists = this.SectionOccupiedList
break; break
case 'AssistStatus': case 'AssistStatus':
this.selectLists = this.AssistStatusList; this.selectLists = this.AssistStatusList
break; break
case 'TotalAssist': case 'TotalAssist':
this.selectLists = this.TotalAssistList; this.selectLists = this.TotalAssistList
break; break
case 'DepartAssist': case 'DepartAssist':
this.selectLists = this.DepartAssistList; this.selectLists = this.DepartAssistList
break; break
case 'PickAssist': case 'PickAssist':
this.selectLists = this.PickAssistList; this.selectLists = this.PickAssistList
break; break
case 'Recovery': case 'Recovery':
this.selectLists = this.RecoveryList; this.selectLists = this.RecoveryList
break; break
case 'Accident': case 'Accident':
this.selectLists = this.AccidentList; this.selectLists = this.AccidentList
break; break
case 'Occlusion': case 'Occlusion':
this.selectLists = this.OcclusionList; this.selectLists = this.OcclusionList
break; break
case 'PickArrow': case 'PickArrow':
this.selectLists = this.PickArrowList; this.selectLists = this.PickArrowList
break; break
case 'DepartArrow': case 'DepartArrow':
this.selectLists = this.DepartArrowList; this.selectLists = this.DepartArrowList
break; break
default: default:
this.selectLists = this.intersiteControlList; this.selectLists = this.intersiteControlList
break; break
} }
}, },
deviceChange(code) { deviceChange(code) {
this.$emit('setCenter', code); this.$emit('setCenter', code)
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code))
}, },
deviceSelect(selected) { deviceSelect(selected) {
console.log(selected, '======');
if (this.field.toUpperCase() === 'switchSelectCode'.toUpperCase() && selected._type.toUpperCase() === 'Switch'.toUpperCase()) { if (this.field.toUpperCase() === 'switchSelectCode'.toUpperCase() && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
if (this.activeName === 'first') { if (this.activeName === 'first') {
this.editModel.switchCode = selected.code; this.editModel.switchCode.push(selected.code)
} else { } else {
this.addModel.switchCode = selected.code; this.addModel.switchCode.push(selected.code)
} }
} else if (selected && this.controlLampTypeList.includes(selected._type)) { } else if (selected && this.controlLampTypeList.includes(selected._type)) {
this.$refs.dataform && this.$refs.dataform.resetFields(); this.$refs.dataform && this.$refs.dataform.resetFields()
this.$refs.make && this.$refs.make.resetFields(); this.$refs.make && this.$refs.make.resetFields()
this.activeName = 'first'; this.activeName = 'first'
this.editModel = deepAssign(this.editModel, selected); if (typeof selected.switchCode === 'string') selected.switchCode = [selected.switchCode]
this.editModel.type = selected._type; this.editModel = deepAssign(this.editModel, selected)
this.editModel.type = selected._type
} }
}, },
getIdPrefix(type) { getIdPrefix(type) {
let idPrefix = ''; let idPrefix = ''
switch (type) { switch (type) {
case 'AtsControl': case 'AtsControl':
idPrefix = 'ats'; idPrefix = 'ats'
break; break
case 'CenterCommunication': case 'CenterCommunication':
idPrefix = 'centerC'; idPrefix = 'centerC'
break; break
case 'ChainControl': case 'ChainControl':
idPrefix = 'chain'; idPrefix = 'chain'
break; break
case 'IntersiteControl': case 'IntersiteControl':
idPrefix = 'intersite'; idPrefix = 'intersite'
break; break
case 'LeuControl': case 'LeuControl':
idPrefix = 'leu'; idPrefix = 'leu'
break; break
case 'LocalControl': case 'LocalControl':
idPrefix = 'local'; idPrefix = 'local'
break; break
case 'Maintain': case 'Maintain':
idPrefix = 'maintain'; idPrefix = 'maintain'
break; break
case 'PowerSupply': case 'PowerSupply':
idPrefix = 'power'; idPrefix = 'power'
break; break
case 'NoOneReturn': case 'NoOneReturn':
idPrefix = 'noOne'; idPrefix = 'noOne'
break; break
case 'MaintenanceLamps': case 'MaintenanceLamps':
idPrefix = 'mLamp'; idPrefix = 'mLamp'
break; break
case 'ZcCommunication': case 'ZcCommunication':
idPrefix = 'zcC'; idPrefix = 'zcC'
break; break
case 'FaultStatusGroup': case 'FaultStatusGroup':
idPrefix = 'faultSG'; idPrefix = 'faultSG'
break; break
case 'ModeStatusGroup': case 'ModeStatusGroup':
idPrefix = 'modeSG'; idPrefix = 'modeSG'
break; break
case 'LampFilament': case 'LampFilament':
idPrefix = 'lampF'; idPrefix = 'lampF'
break; break
case 'ReturnModeGroup': case 'ReturnModeGroup':
idPrefix = 'returnMG'; idPrefix = 'returnMG'
break; break
case 'ControlSwitch': case 'ControlSwitch':
idPrefix = 'controlS'; idPrefix = 'controlS'
break; break
case 'Axle': case 'Axle':
idPrefix = 'axle'; idPrefix = 'axle'
break; break
case 'IndicatorLight': case 'IndicatorLight':
idPrefix = 'indicator'; idPrefix = 'indicator'
break; break
// case 'SwitchFault': // case 'SwitchFault':
// idPrefix = ''; // idPrefix = '';
// break; // break;
case 'SectionOccupied': case 'SectionOccupied':
idPrefix = 'sectionOcc'; idPrefix = 'sectionOcc'
break; break
case 'AssistStatus': case 'AssistStatus':
idPrefix = 'assistStatus'; idPrefix = 'assistStatus'
break; break
case 'TotalAssist': case 'TotalAssist':
idPrefix = 'totalAssist'; idPrefix = 'totalAssist'
break; break
case 'DepartAssist': case 'DepartAssist':
idPrefix = 'departAssist'; idPrefix = 'departAssist'
break; break
case 'PickAssist': case 'PickAssist':
idPrefix = 'pickAssist'; idPrefix = 'pickAssist'
break; break
case 'Recovery': case 'Recovery':
idPrefix = 'recovery'; idPrefix = 'recovery'
break; break
case 'Accident': case 'Accident':
idPrefix = 'accident'; idPrefix = 'accident'
break; break
case 'Occlusion': case 'Occlusion':
idPrefix = 'occlusion'; idPrefix = 'occlusion'
break; break
case 'PickArrow': case 'PickArrow':
idPrefix = 'pickArrow'; idPrefix = 'pickArrow'
break; break
case 'DepartArrow': case 'DepartArrow':
idPrefix = 'departArrow'; idPrefix = 'departArrow'
break; break
} }
return idPrefix; return idPrefix
}, },
handleDelete() { handleDelete() {
this.$confirm('您是否确定一键删除无用数据?', this.$t('tip.hint'), { this.$confirm('您是否确定一键删除无用数据?', this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { })
const models = []; .then(() => {
const models = []
this.indicatorLightList.forEach(item => { this.indicatorLightList.forEach(item => {
const model = this.$store.getters['map/getDeviceByCode'](item.stationCode); const model = this.$store.getters['map/getDeviceByCode'](item.stationCode)
if (!model) { if (!model) {
models.push(deepAssign(item, { _dispose: true })); models.push(deepAssign(item, { _dispose: true }))
} }
}); })
models.length && this.$emit('updateMapModel', models); models.length && this.$emit('updateMapModel', models)
this.$message.success('删除成功!'); this.$message.success('删除成功!')
}).catch(() => { })
this.$message.info('删除失败'); .catch(() => {
}); this.$message.info('删除失败')
})
}, },
changeBelongStation(code) { changeBelongStation(code) {
if (code) { if (code) {
this.stationList.forEach(item => { this.stationList.forEach(item => {
if (item.code === code) { if (item.code === code) {
this.addModel.position.x = item.position.x; this.addModel.position.x = item.position.x
this.addModel.position.y = item.position.y + 50; this.addModel.position.y = item.position.y + 50
} }
}); })
} }
}, },
// //
create() { create() {
this.$refs.make.validate((valid) => { this.$refs.make.validate(valid => {
if (valid) { if (valid) {
const model = deepAssign(this.addModel, {code:getUID(this.getIdPrefix(this.addModel.type), this.selectLists)}); const model = deepAssign(this.addModel, { code: getUID(this.getIdPrefix(this.addModel.type), this.selectLists) })
this.$emit('updateMapModel', model); this.$emit('updateMapModel', model)
this.$refs.make.resetForm(); this.$refs.make.resetForm()
this.$refs.dataform.resetFields(); this.$refs.dataform.resetFields()
} }
}); })
}, },
updateMapModel(data) { updateMapModel(data) {
this.$emit('updateMapModel', data); this.$emit('updateMapModel', data)
this.field = ''; this.field = ''
}, },
deleteObj() { deleteObj() {
this.$refs.dataform.deleteObj(); this.$refs.dataform.deleteObj()
}, },
// //
edit() { edit() {
this.$refs.dataform.edit(); this.$refs.dataform.edit()
}
} }
} }
};
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import 'src/styles/mixin.scss';
.card { .card {
height: 100%; height: 100%;
} }
@ -675,6 +778,6 @@ export default {
} }
.map-draft-group { .map-draft-group {
color: #3E44BE; color: #3e44be;
} }
</style> </style>