调整组件间传递事件

This commit is contained in:
zyy 2020-07-14 17:16:49 +08:00
parent 77b02b947e
commit fbf4cd7652
13 changed files with 32 additions and 106 deletions

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -444,33 +444,6 @@ export default {
if (signalPositionX < min && signalPositionX > max) {
tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')未在其关联的区段' + section.name + '(' + section.code + ')里');
}
// if (signal.right) {
// const rightSection = this.$store.getters['map/getDeviceByCode'](section.rightSectionCode);
// if (rightSection && rightSection.points[0].x != section.points[section.points.length - 1].x) {
// const max = Math.max(section.points[section.points.length - 1].x, section.points[0].x);
// const min = Math.min(section.points[section.points.length - 1].x, section.points[0].x);
// if (signalPositionX < min && signalPositionX > max) {
// tipInfoList.push('' + signal.name + '(' + signal.code + ')' + section.name + '(' + section.code + ')');
// }
// } else {
// if (signalPositionX > section.points[section.points.length - 1].x && signalPositionX < section.points[0].x) {
// tipInfoList.push('' + signal.name + '(' + signal.code + ')' + section.name + '(' + section.code + ')');
// }
// }
// } else {
// const leftSection = this.$store.getters['map/getDeviceByCode'](section.leftSectionCode);
// if (leftSection && leftSection.points[leftSection.points.length - 1].x != section.points[0].x) {
// const max = Math.max(section.points[section.points.length - 1].x, section.points[0].x);
// const min = Math.min(section.points[section.points.length - 1].x, section.points[0].x);
// if (signalPositionX < min && signalPositionX > max) {
// tipInfoList.push('' + signal.name + '(' + signal.code + ')' + section.name + '(' + section.code + ')');
// }
// } else {
// if (signalPositionX < section.points[0].x && signalPositionX > section.points[section.points.length - 1].x) {
// tipInfoList.push('' + signal.name + '(' + signal.code + ')' + section.name + '(' + section.code + ')');
// }
// }
// }
} else {
tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')所关联的区段不存在');
}
@ -572,10 +545,6 @@ export default {
backRoute() {
this.$router.push({ path: `/design/usermap/home` });
},
// // vuex map
addOrUpdateMapModel(obj) {
this.$store.dispatch('map/updateMapDevices', obj);
},
updateMapModel(models) {
this.$store.dispatch('map/updateMapDevices', models);
},

View File

@ -7,14 +7,12 @@
{{ $t('map.mapName') }}
<b>{{ mapInfo.name }}</b>
</span>
<el-button v-if="isSave" type="text" style="float: right; padding: 3px 0" :disabled="mapSaveing" @click="saveMapEvent">{{ $t('map.save') }}</el-button>
<el-button v-if="isSave" type="text" style="float: right; padding: 3px 0" :disabled="$attrs.mapSaveing" @click="saveMapEvent">{{ $t('map.save') }}</el-button>
<el-dropdown style="float: right; padding: 3px 0; margin-right: 5px;" trigger="click">
<span class="el-dropdown-link">
数据操作
</span>
<span class="el-dropdown-link">数据操作</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><span style="display:block;" :disabled="mapSaveing" @click="verifyMapEvent">{{ $t('map.dataVerification') }}</span></el-dropdown-item>
<el-dropdown-item><span style="display:block;" :disabled="mapSaveing" @click="generateCIEvent">生成联锁</span></el-dropdown-item>
<el-dropdown-item><span style="display:block;" :disabled="$attrs.mapSaveing" @click="verifyMapEvent">{{ $t('map.dataVerification') }}</span></el-dropdown-item>
<el-dropdown-item><span style="display:block;" :disabled="$attrs.mapSaveing" @click="generateCIEvent">生成联锁</span></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" style="float: right; padding: 3px 0; margin-right: 5px;" @click="dataRelation">{{ $t('map.advanced') }}</el-button>
@ -25,9 +23,8 @@
<component
:is="each.menus"
:ref="each.name"
:selected="selected"
@updateMapModel="updateMapModel"
@setCenter="setCenter"
v-bind="$attrs"
v-on="$listeners"
@deviceSelect="deviceSelect"
/>
</el-tab-pane>
@ -105,8 +102,7 @@ export default {
mapInfo: {
type: Object,
default: function() { return {name: this.$t('map.pleaseSelectMap')}; }
},
mapSaveing: [Boolean]
}
},
data() {
return {
@ -213,12 +209,6 @@ export default {
},
generateCIEvent() {
this.$emit('generateCIEvent');
},
updateMapModel(obj) {
this.$emit('updateMapModel', obj);
},
setCenter(code) {
this.$emit('setCenter', code);
}
}
};

View File

@ -75,8 +75,8 @@ class Model {
this.sectionCode = '';
this.guideShow = false;
this.buttonShow = false;
this.position = { x: 0, y: 0 };
this.positionPoint = { x: 0, y: 0 };
this.position = { x: 0, y: 0 }; // 信号机坐标
this.positionPoint = { x: 0, y: 0 }; // 信号机偏移坐标
this.buttonPosition = { x: 0, y: 0 };
this.guidePosition = { x: 0, y: 0 };
this.interlockStationCode = '';

View File

@ -186,7 +186,7 @@ export default {
}
}
});
this.$emit('updateMapModel', models, 'five');
this.$emit('updateMapModel', models);
if (this.tipInfoList.length) {
this.$emit('tipInfoHandle', this.tipInfoList);
} else {
@ -203,7 +203,7 @@ export default {
model.trainPosType = this.formModel.trainPosType;
models.push(model);
});
this.$emit('updateMapModel', models, 'five');
this.$emit('updateMapModel', models);
this.$refs.formModel && this.$refs.formModel.resetFields(); //
}
});
@ -263,7 +263,7 @@ export default {
this.getSetRoadList(models, direction, section);
}
}
this.$emit('updateMapModel', models, 'five');
this.$emit('updateMapModel', models);
this.$message.success('数据构建成功!');
this.$refs.roadModel && this.$refs.roadModel.resetFields(); //
});
@ -276,7 +276,7 @@ export default {
model.belongStation = stationStand.stationCode;
models.push(model);
});
this.$emit('updateMapModel', models, 'five');
this.$emit('updateMapModel', models);
this.$message.success('数据构建成功!');
},
setLogicOffset() {
@ -308,7 +308,7 @@ export default {
}
}
});
this.$emit('updateMapModel', models, 'five');
this.$emit('updateMapModel', models);
this.$message.success('数据构建成功!');
}
}

View File

@ -229,7 +229,7 @@ export default {
});
if (flag) {
models.push(startModel);
this.$emit('updateMapModel', models, 'second');
this.$emit('updateMapModel', models);
this.createModel.modelList = [];
}
},
@ -247,7 +247,7 @@ export default {
leftSection.rightSectionCode = model.code;
models.push(model);
models.push(leftSection);
this.$emit('updateMapModel', models, 'second');
this.$emit('updateMapModel', models);
},
associatedCreate(model) { //
if (!(this.createModel.leftSectionCode && this.createModel.rightSectionCode)) {
@ -281,7 +281,7 @@ export default {
models.push(model);
models.push(startModel);
models.push(endModel);
this.$emit('updateMapModel', models, 'second');
this.$emit('updateMapModel', models);
} else {
this.$messageBox('画图顺序应左往右绘制, 请求重新定义左右关联区段');
this.createModel.rightSectionCode = '';
@ -301,7 +301,7 @@ export default {
{ x: this.createModel.startPoint.x, y: this.createModel.startPoint.y },
{ x: this.createModel.startPoint.x + this.createModel.length, y: this.createModel.startPoint.y }
];
this.$emit('updateMapModel', model, 'second');
this.$emit('updateMapModel', model);
} else if (this.createModel.type === '02') {
this.associatedCreate(model);
} else if (this.createModel.type === '03') {

View File

@ -20,7 +20,7 @@
:switch-and-phy-sical-section-list="switchAndPhySicalSectionList"
:section-list="sectionList"
@hover="hover"
@updateMapModel="updateMapModel"
v-on="$listeners"
/>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.splitMerge')" name="three" :lazy="lazy">
@ -33,18 +33,18 @@
:section-list="sectionList"
:physical-section-list="PhysicalSectionList"
@hover="hover"
@updateMapModel="updateMapModel"
v-on="$listeners"
/>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.logicBlock')" name="four" :lazy="lazy">
<logic-block ref="logicBlock" :edit-model="editModel" @updateMapModel="updateMapModel" />
<logic-block ref="logicBlock" :edit-model="editModel" v-on="$listeners" />
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchSettings')" name="five" :lazy="lazy">
<batch-settings
ref="batchSettings"
:field="field"
@hover="hover"
@updateMapModel="updateMapModel"
v-on="$listeners"
@tipInfoHandle="tipInfoHandle"
/>
</el-tab-pane>
@ -655,10 +655,6 @@ export default {
}
return null;
},
updateMapModel(models, tap) {
this.activeName = tap || 'first';
this.$emit('updateMapModel', models);
},
//
deleteObj() {
let models = [];

View File

@ -188,7 +188,7 @@ export default {
logicSection.namePosition = { x: 0, y: this.distanceY };
models.push(logicSection);
});
this.$emit('updateMapModel', models, 'four');
this.$emit('updateMapModel', models);
}
}
};

View File

@ -205,7 +205,7 @@ export default {
models.push(deepAssign(selected, { _dispose: true }));
JSON.stringify(leftAssociatedSection) !== '{}' && models.push(leftAssociatedSection);
JSON.stringify(rightAssociatedSection) !== '{}' && models.push(rightAssociatedSection);
this.$emit('updateMapModel', models, 'three'); //
this.$emit('updateMapModel', models); //
}
}
});
@ -249,14 +249,14 @@ export default {
models.push(model);
const associatedSectionList = this.handleMergeSectionAssociated(model);
models = [...models, ...associatedSectionList];
this.$emit('updateMapModel', models, 'three');
this.$emit('updateMapModel', models);
}
if (lsection.points[0].x === rsection.points[rsection.points.length - 1].x && lsection.points[0].y === rsection.points[rsection.points.length - 1].y) {
this.handleRealLocationRelationships(model, lsection, rsection);
models.push(model);
const associatedSectionList = this.handleMergeSectionAssociated(model);
models = [...models, ...associatedSectionList];
this.$emit('updateMapModel', models, 'three');
this.$emit('updateMapModel', models);
}
}
}

View File

@ -14,7 +14,7 @@
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
<create-signal ref="createSignal" :field="field" @signalSectionCode="signalSectionCode" @updateMapModel="updateMapModel" />
<create-signal ref="createSignal" :field="field" @signalSectionCode="signalSectionCode" v-on="$listeners" />
</el-tab-pane>
<el-tab-pane class="view-control" label="批量操作" name="three" :lazy="lazy">
<el-collapse v-model="collapseActive" accordion style="margin-left: 20px">
@ -376,9 +376,6 @@ export default {
this.$emit('deviceSelect', '');
}
},
updateMapModel(model) {
this.$emit('updateMapModel', model);
},
//
edit() {
this.$refs['dataform'].validate((valid) => {

View File

@ -1,13 +1,13 @@
<template>
<el-tabs v-model="activeName" class="card">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
<switch-model ref="switchModel" @updateMapModel="updateMapModel" @setCenter="setCenter" />
<switch-model ref="switchModel" v-on="$listeners" @setCenter="setCenter" />
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
<create-switch ref="createSwitch" @updateMapModel="updateMapModel" />
<create-switch ref="createSwitch" v-on="$listeners" />
</el-tab-pane>
<el-tab-pane class="view-control" label="生成道岔计轴区段" name="three" :lazy="lazy">
<create-axle ref="createAxle" :field="field" @updateMapModel="updateMapModel" @hover="hover" />
<create-axle ref="createAxle" :field="field" v-on="$listeners" @hover="hover" />
</el-tab-pane>
</el-tabs>
</template>
@ -94,9 +94,6 @@ export default {
});
return flag;
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
},
deleteObj() {
this.$refs.switchModel.deleteObj();
},

View File

@ -118,7 +118,6 @@ export default {
this.$refs['form'].validate((valid) => {
if (valid) {
const list = [];
switch (this.mode) {
case '01':
list.push({

View File

@ -93,25 +93,6 @@ export default {
create(list) {
this.$emit('updateMapModel', list);
},
//
edit(elem) {
// this.$refs['form'].validate((valid) => {
// if (valid) {
// this.$emit('addOrUpdateMapModel', this.buildEditModel());
// }
// });
},
buildEditModel() {
// const model = {
// _type: 'Train',
// code: this.editModel.code,
// safeDistance: this.editModel.safeDistance,
// maxSafeDistance: this.editModel.maxSafeDistance,
// modelCode: this.editModel.modelCode,
// groupNumber: this.editModel.groupNumber
// };
// return model;
},
newTrainMode() {
if (Object.keys(this.$store.state.map.map || {}).length) {
this.$refs.trainMode.doShow({}, 'ADD');
@ -138,9 +119,6 @@ export default {
this.$refs.trainMode.operateTrainModel({ model, type: 'DEL' });
}
});
},
handleEdit(index, row) {
},
handleDelete(index, row) {
const train = this.$store.getters['map/getDeviceByCode'](row.code);