调整组件间传递事件

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; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // 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.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.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -444,33 +444,6 @@ export default {
if (signalPositionX < min && signalPositionX > max) { if (signalPositionX < min && signalPositionX > max) {
tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')未在其关联的区段' + section.name + '(' + section.code + ')里'); 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 { } else {
tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')所关联的区段不存在'); tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')所关联的区段不存在');
} }
@ -572,10 +545,6 @@ export default {
backRoute() { backRoute() {
this.$router.push({ path: `/design/usermap/home` }); this.$router.push({ path: `/design/usermap/home` });
}, },
// // vuex map
addOrUpdateMapModel(obj) {
this.$store.dispatch('map/updateMapDevices', obj);
},
updateMapModel(models) { updateMapModel(models) {
this.$store.dispatch('map/updateMapDevices', models); this.$store.dispatch('map/updateMapDevices', models);
}, },

View File

@ -7,14 +7,12 @@
{{ $t('map.mapName') }} {{ $t('map.mapName') }}
<b>{{ mapInfo.name }}</b> <b>{{ mapInfo.name }}</b>
</span> </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"> <el-dropdown style="float: right; padding: 3px 0; margin-right: 5px;" trigger="click">
<span class="el-dropdown-link"> <span class="el-dropdown-link">数据操作</span>
数据操作
</span>
<el-dropdown-menu slot="dropdown"> <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="$attrs.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="generateCIEvent">生成联锁</span></el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button type="text" style="float: right; padding: 3px 0; margin-right: 5px;" @click="dataRelation">{{ $t('map.advanced') }}</el-button> <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 <component
:is="each.menus" :is="each.menus"
:ref="each.name" :ref="each.name"
:selected="selected" v-bind="$attrs"
@updateMapModel="updateMapModel" v-on="$listeners"
@setCenter="setCenter"
@deviceSelect="deviceSelect" @deviceSelect="deviceSelect"
/> />
</el-tab-pane> </el-tab-pane>
@ -105,8 +102,7 @@ export default {
mapInfo: { mapInfo: {
type: Object, type: Object,
default: function() { return {name: this.$t('map.pleaseSelectMap')}; } default: function() { return {name: this.$t('map.pleaseSelectMap')}; }
}, }
mapSaveing: [Boolean]
}, },
data() { data() {
return { return {
@ -213,12 +209,6 @@ export default {
}, },
generateCIEvent() { generateCIEvent() {
this.$emit('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.sectionCode = '';
this.guideShow = false; this.guideShow = false;
this.buttonShow = false; this.buttonShow = false;
this.position = { x: 0, y: 0 }; this.position = { x: 0, y: 0 }; // 信号机坐标
this.positionPoint = { x: 0, y: 0 }; this.positionPoint = { x: 0, y: 0 }; // 信号机偏移坐标
this.buttonPosition = { x: 0, y: 0 }; this.buttonPosition = { x: 0, y: 0 };
this.guidePosition = { x: 0, y: 0 }; this.guidePosition = { x: 0, y: 0 };
this.interlockStationCode = ''; this.interlockStationCode = '';

View File

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

View File

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

View File

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

View File

@ -188,7 +188,7 @@ export default {
logicSection.namePosition = { x: 0, y: this.distanceY }; logicSection.namePosition = { x: 0, y: this.distanceY };
models.push(logicSection); 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 })); models.push(deepAssign(selected, { _dispose: true }));
JSON.stringify(leftAssociatedSection) !== '{}' && models.push(leftAssociatedSection); JSON.stringify(leftAssociatedSection) !== '{}' && models.push(leftAssociatedSection);
JSON.stringify(rightAssociatedSection) !== '{}' && models.push(rightAssociatedSection); JSON.stringify(rightAssociatedSection) !== '{}' && models.push(rightAssociatedSection);
this.$emit('updateMapModel', models, 'three'); // this.$emit('updateMapModel', models); //
} }
} }
}); });
@ -249,14 +249,14 @@ export default {
models.push(model); models.push(model);
const associatedSectionList = this.handleMergeSectionAssociated(model); const associatedSectionList = this.handleMergeSectionAssociated(model);
models = [...models, ...associatedSectionList]; 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) { 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); this.handleRealLocationRelationships(model, lsection, rsection);
models.push(model); models.push(model);
const associatedSectionList = this.handleMergeSectionAssociated(model); const associatedSectionList = this.handleMergeSectionAssociated(model);
models = [...models, ...associatedSectionList]; models = [...models, ...associatedSectionList];
this.$emit('updateMapModel', models, 'three'); this.$emit('updateMapModel', models);
} }
} }
} }

View File

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

View File

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

View File

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

View File

@ -93,25 +93,6 @@ export default {
create(list) { create(list) {
this.$emit('updateMapModel', 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() { newTrainMode() {
if (Object.keys(this.$store.state.map.map || {}).length) { if (Object.keys(this.$store.state.map.map || {}).length) {
this.$refs.trainMode.doShow({}, 'ADD'); this.$refs.trainMode.doShow({}, 'ADD');
@ -138,9 +119,6 @@ export default {
this.$refs.trainMode.operateTrainModel({ model, type: 'DEL' }); this.$refs.trainMode.operateTrainModel({ model, type: 'DEL' });
} }
}); });
},
handleEdit(index, row) {
}, },
handleDelete(index, row) { handleDelete(index, row) {
const train = this.$store.getters['map/getDeviceByCode'](row.code); const train = this.$store.getters['map/getDeviceByCode'](row.code);