IB 应答器 放开关联信号机

This commit is contained in:
fan 2021-08-05 16:33:31 +08:00
parent fd7df04cc5
commit 9e6cb0788d
2 changed files with 39 additions and 39 deletions

View File

@ -34,11 +34,11 @@ export default {
sectionList: {
type: Array,
required: true
},
signalList: {
},
signalList: {
type: Array,
required: true
},
},
responderList: {
type: Array,
required: true
@ -49,8 +49,8 @@ export default {
addModel: {
type: '',
name: '',
sectionCode: '',
signalCode: ''
sectionCode: '',
signalCode: ''
},
rules: {
name: [
@ -61,20 +61,20 @@ export default {
],
sectionCode: [
{ required: true, message: '请关联物理区段', trigger: 'blur' }
],
signalCode: [
],
signalCode: [
{ required: true, message: '请关联信号机', trigger: 'blur' }
]
]
}
};
},
computed: {
isSectionButtonType() {
return this.field == 'RelSectionCode';
},
isSignalButtonType() {
},
isSignalButtonType() {
return this.field == 'RelSignalCode';
},
},
createForm() {
const form = {
labelWidth: '110px',
@ -84,8 +84,8 @@ export default {
item: [
{ prop: 'name', label: '应答器名称', type: 'input' },
{ prop: 'type', label: `应答器类型`, type: 'select', optionLabel: 'name&&value', optionValue: 'value', options: this.responderTypeList },
{ prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList, buttonType: 'RelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType },
{ prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, buttonType: 'RelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType },
{ prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList, buttonType: 'RelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType },
{ prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, buttonType: 'RelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType }
]
}
}
@ -101,10 +101,10 @@ export default {
this.addModel[prop] = selected.code;
},
create() {
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.sectionCode);
const length = section.points.length;
const x = (section.points[length - 1].x + section.points[0].x) / 2;
const y = (section.points[length - 1].y + section.points[0].y) / 2;
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.sectionCode);
const length = section.points.length;
const x = (section.points[length - 1].x + section.points[0].x) / 2;
const y = (section.points[length - 1].y + section.points[0].y) / 2;
const model = utils.buildModelBySection(section, {x, y}, this.addModel, this.responderList);
this.$refs.createForm.resetForm();
this.$emit('updateMapModel', model);

View File

@ -37,11 +37,11 @@ export default {
sectionList: {
type: Array,
required: true
},
signalList: {
type: Array,
required: true
},
},
signalList: {
type: Array,
required: true
},
responderList: {
type: Array,
required: true
@ -69,8 +69,8 @@ export default {
},
offset: 0,
sectionCode: '',
stationCode: '',
signalCode: ''
stationCode: '',
signalCode: ''
},
rules: {
code: [
@ -93,10 +93,10 @@ export default {
],
sectionCode: [
{ required: true, message: '请关联物理区段', trigger: 'blur' }
],
signalCode: [
],
signalCode: [
{ required: true, message: '请关联信号机', trigger: 'blur' }
],
],
'position.x': [
{ required: true, message: '请输入应答器坐标x', trigger: 'blur' }
],
@ -113,10 +113,10 @@ export default {
};
},
computed: {
isSectionButtonType() {
isSectionButtonType() {
return this.field == 'RelModelSectionCode';
},
isSignalButtonType() {
},
isSignalButtonType() {
return this.field == 'RelModelSignalCode';
},
form() {
@ -144,9 +144,9 @@ export default {
{ prop: 'textOffset.y', firstLevel: 'textOffset', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', disabled: false }
] },
{ prop:'textRotate', label: '文字旋转', type: 'number' },
{ prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList, buttonType: 'RelModelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType },
this.editModel.type === 'VB'? { prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, buttonType: 'RelModelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType } :'',
{ prop: 'stationCode', label: '关联集中站' + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList }
{ prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList, buttonType: 'RelModelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType },
this.editModel.type === 'VB' || this.editModel.type === 'IB' ? { prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, buttonType: 'RelModelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType } : '',
{ prop: 'stationCode', label: '关联集中站' + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList }
]
},
map: {
@ -160,14 +160,14 @@ export default {
}
},
methods: {
hover(field) {
hover(field) {
this.$emit('hover', field);
},
setModelProp(selected, prop) {
this.editModel[prop] = selected.code;
},
},
setModelProp(selected, prop) {
this.editModel[prop] = selected.code;
},
setModel(selected) {
if (!selected.signalCode) selected.signalCode = '';
if (!selected.signalCode) selected.signalCode = '';
this.editModel = deepAssign(this.editModel, selected);
},
deviceChange(code) {