Merge branch 'test' of git.code.tencent.com:lian-cbtc/jl-client into test

This commit is contained in:
Yuan 2022-07-08 16:43:55 +08:00
commit eb2447c69a
13 changed files with 219 additions and 73 deletions

View File

@ -14,6 +14,8 @@ export default {
/** 鼠标按下,计算当前元素距离可视区的距离*/ /** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - dialogHeaderEl.offsetLeft; const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop; const disY = e.clientY - dialogHeaderEl.offsetTop;
const oY = e.offsetY;
const bY = dialogHeaderEl.offsetHeight - e.offsetY;
/** 获取到的值带px 正则匹配替换*/ /** 获取到的值带px 正则匹配替换*/
let styL, styT; let styL, styT;
@ -32,9 +34,16 @@ export default {
document.onmousemove = function (e) { document.onmousemove = function (e) {
e.stopPropagation(); e.stopPropagation();
let cY = e.clientY;
if (cY < oY) {
cY = oY;
}
if (cY > document.body.clientHeight - bY) {
cY = document.body.clientHeight - bY;
}
/** 通过事件委托,计算移动的距离*/ /** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX; const l = e.clientX - disX;
const t = e.clientY - disY; const t = cY - disY;
/** 移动当前元素*/ /** 移动当前元素*/
dragDom.style.left = `${l + styL}px`; dragDom.style.left = `${l + styL}px`;

View File

@ -406,6 +406,30 @@ class Jlmap {
}); });
this.$painter.$transformHandle.revisibleAll(); this.$painter.$transformHandle.revisibleAll();
} }
updatePicture(list = []) {
list.forEach(item => {
const device = this.mapDevice[item.code];
const type = device._type;
const pointsDevice = ['LINE', 'POWER', 'SECTION'];
const pointDevice = ['OVERAP', 'TRAINWINDOW'];
device._dispose = item.pictureHide;
if (pointsDevice.includes(type.toUpperCase())) {
const offsetX = item.position.x - device.points[0].x;
const offsetY = item.position.y - device.points[0].y;
device.points.forEach(point => {
point.x = point.x + offsetX;
point.y = point.y + offsetY;
});
} else if (pointDevice.includes(type.toUpperCase())) {
device.point.x = item.position.x;
device.point.y = item.position.y;
} else if (type !== 'Switch') {
device.position.x = item.position.x;
device.position.y = item.position.y;
}
this.$painter.updatePicture(device);
});
}
update(list = [], fetch = true) { update(list = [], fetch = true) {
this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息

View File

@ -106,7 +106,6 @@ class MouseController extends Eventful {
this._x = e.offsetX; this._x = e.offsetX;
this._y = e.offsetY; this._y = e.offsetY;
if (e.which == 1) { if (e.which == 1) {
this._preventDefaultMouseMove && eventTool.stop(e.event); this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });

View File

@ -162,7 +162,23 @@ class Painter {
this.$transformHandleScreen.transformView(device.instance); this.$transformHandleScreen.transformView(device.instance);
} }
} }
/** 画面更新 */
updatePicture(device) {
console.log(device, 'device');
if (device) {
try {
if (device._dispose) {
this.delete(device);
} else {
device.instance && this.mapInstanceLevel[device._type].remove(device.instance);
device.instance = null;
this.add(device);
}
} catch (err) {
console.error(err);
}
}
}
/** /**
* 更新视图 * 更新视图
* @param {*} device * @param {*} device

View File

@ -350,7 +350,7 @@ export function updateMapData(state, model) {
case deviceType.Axle: updateForList(model, state, 'indicatorLightList'); break; case deviceType.Axle: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.SwitchFault: updateForList(model, state, 'indicatorLightList'); break; case deviceType.SwitchFault: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.IndicatorLight: updateForList(model, state, 'indicatorLightList'); break; case deviceType.IndicatorLight: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.PickArrow: updateForList(model, state, 'indicatorLightList');break; case deviceType.PickArrow: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.DepartArrow: updateForList(model, state, 'indicatorLightList'); break; case deviceType.DepartArrow: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Occlusion: updateForList(model, state, 'indicatorLightList'); break; case deviceType.Occlusion: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Accident: updateForList(model, state, 'indicatorLightList'); break; case deviceType.Accident: updateForList(model, state, 'indicatorLightList'); break;

View File

@ -24,12 +24,12 @@ export function handlerUrl(data) {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// const data = null; // const data = null;
// 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.233/rtss-server'; // BASE_API = 'http://192.168.3.233/rtss-server';
// BASE_API = 'http://114.116.51.125/jlcloud'; // BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://192.168.8.152:9000'; // 袁琪 // BASE_API = 'http://192.168.8.152:9000'; // 袁琪
// BASE_API = 'http://192.168.3.94:9000'; // 旭强 // BASE_API = 'http://192.168.3.94:9000'; // 旭强
// BASE_API = 'http://192.168.3.201:9000'; // 张赛 BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康 // BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏 // BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -359,6 +359,11 @@ export default {
}); });
this.readOnlyMap[item.stationCode] = item.readOnly; this.readOnlyMap[item.stationCode] = item.readOnly;
} }
if (item && item.routeSequence && item.routeSequence.deletedLineIds && item.routeSequence.deletedLineIds.length) {
item.routeSequence.deletedLineIds.forEach(elem => {
delete this.sequenceMap[elem];
});
}
if (item && item.trackView && item.trackView.trackLineMap) { if (item && item.trackView && item.trackView.trackLineMap) {
for (const key in item.trackView.trackLineMap) { for (const key in item.trackView.trackLineMap) {
if (this.standTrackSectionMap[key] && item.trackView.trackLineMap[key]) { if (this.standTrackSectionMap[key] && item.trackView.trackLineMap[key]) {

View File

@ -237,7 +237,7 @@ export default {
const path = window.location.href; const path = window.location.href;
const mouseWheelFlag = true; const mouseWheelFlag = true;
this.previewOrMapDraw = false; this.previewOrMapDraw = false;
if (path.indexOf('map/draw') !== -1 || path.indexOf('mapPreviewNew') !== -1) { if (path.indexOf('map/draw') !== -1 || path.indexOf('mapPreviewNew') !== -1 || path.indexOf('pictureDraw') !== -1) {
this.previewOrMapDraw = true; this.previewOrMapDraw = true;
} }
const prdType = this.$store.state.training.prdType; const prdType = this.$store.state.training.prdType;

View File

@ -10,9 +10,9 @@
<el-select v-model="ruleForm.picture" placeholder="请选择"> <el-select v-model="ruleForm.picture" placeholder="请选择">
<el-option <el-option
v-for="item in pictureList" v-for="item in pictureList"
:key="item" :key="item.name"
:label="item.name" :label="item.name"
:value="item" :value="item.name"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -37,7 +37,7 @@ export default {
}, },
computed: { computed: {
pictureList() { pictureList() {
return this.$store.state.map.map.pictureList; return this.$store.state.map.map ? this.$store.state.map.map.pictureList : [];
} }
}, },
methods: { methods: {
@ -45,6 +45,7 @@ export default {
this.$refs.ruleForm.validate((valid) => { this.$refs.ruleForm.validate((valid) => {
if (valid) { if (valid) {
this.$emit('pictureChanged', this.ruleForm.picture); this.$emit('pictureChanged', this.ruleForm.picture);
this.doClose();
} }
}); });
}, },

View File

@ -39,7 +39,7 @@ export default {
data() { data() {
return { return {
centerDialogVisible: false, centerDialogVisible: false,
ruleForm: { name: '', type: '', stationCode: '', deviceList: [] }, ruleForm: { name: '', type: '', stationCode: '', deviceMap: {} },
rules: { rules: {
name: [{ required: true, message: '请输入画面名称', trigger: 'blur' }], name: [{ required: true, message: '请输入画面名称', trigger: 'blur' }],
type: [{ required: true, message: '请选择画面类型', trigger: 'change' }], type: [{ required: true, message: '请选择画面类型', trigger: 'change' }],
@ -65,6 +65,7 @@ export default {
if (map && parseInt(this.$route.params.mapId)) { if (map && parseInt(this.$route.params.mapId)) {
saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(() => { saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(() => {
this.$message.success('创建画面成功!'); this.$message.success('创建画面成功!');
this.doClose();
}).catch(() => { }).catch(() => {
this.$message.error('创建画面失败!'); this.$message.error('创建画面失败!');
}); });

View File

@ -15,12 +15,17 @@
<script> <script>
import OperateProperty from './components/operateProperty'; import OperateProperty from './components/operateProperty';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { deepAssign } from '@/utils/index';
export default { export default {
name: 'Device', name: 'Device',
components: { components: {
OperateProperty OperateProperty
}, },
props: {
pictureName:{
type: String,
required: true
}
},
data() { data() {
return { return {
editModel: { editModel: {
@ -61,7 +66,7 @@ export default {
'zcList' 'zcList'
]), ]),
deviceList () { deviceList () {
return [...this.sectionList, ...this.signalList, ...this.switchList, ...this.psdList, ...this.stationStandList, ...this.stationList, ...this.trainWindowList, return [...this.sectionList, ...this.signalList, ...this.psdList, ...this.stationStandList, ...this.stationList, ...this.trainWindowList,
...this.arrowList, ...this.automaticRouteButtonList, ...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.directionRodList, ...this.espList, ...this.arrowList, ...this.automaticRouteButtonList, ...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.directionRodList, ...this.espList,
...this.indicatorLightList, ...this.lcList, ...this.lineList, ...this.outerFrameList, ...this.psdList, ...this.resourceList, ...this.responderList, ...this.indicatorLightList, ...this.lcList, ...this.lineList, ...this.outerFrameList, ...this.psdList, ...this.resourceList, ...this.responderList,
...this.signalButtonList, ...this.splitStationList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList, ...this.signalButtonList, ...this.splitStationList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList,
@ -90,27 +95,41 @@ export default {
}; };
} }
}, },
mounted() {
},
beforeDestroy() {
},
methods: { methods: {
deviceSelect(selected) { deviceSelect(selected) {
this.$refs.form && this.$refs.form.resetFields(); this.$refs.form && this.$refs.form.resetFields();
if (!this.pictureName) {
this.$message.error('请先切换画面!');
return;
}
this.picture = this.$store.state.map.map.pictureList.find(elem => elem.name == this.pictureName);
const pointsDevice = ['LINE', 'POWER', 'SECTION']; const pointsDevice = ['LINE', 'POWER', 'SECTION'];
const pointDevice = ['OVERAP', 'TRAINWINDOW']; const pointDevice = ['OVERAP', 'TRAINWINDOW'];
this.editModel.code = selected.code; this.editModel.code = selected.code;
this.editModel.name = selected.name; this.editModel.name = selected.name;
if (this.picture.deviceMap[selected.code]) {
this.editModel.position.x = this.picture.deviceMap[selected.code].position.x;
this.editModel.position.y = this.picture.deviceMap[selected.code].position.y;
} else {
if (selected && pointsDevice.includes(selected._type.toUpperCase())) { if (selected && pointsDevice.includes(selected._type.toUpperCase())) {
this.editModel.position.x = selected.points[0].x; this.editModel.position.x = selected.points[0].x;
this.editModel.position.y = selected.points[0].y; this.editModel.position.y = selected.points[0].y;
} else if (selected && pointDevice.includes(selected._type.toUpperCase())) { } else if (selected && pointDevice.includes(selected._type.toUpperCase())) {
this.editModel.position.x = selected.point.x; this.editModel.position.x = selected.point.x;
this.editModel.position.y = selected.point.y; this.editModel.position.y = selected.point.y;
} else { } else if (selected && selected._type !== 'Switch') {
this.editModel.position.x = selected.position.x; this.editModel.position.x = selected.position.x;
this.editModel.position.y = selected.position.y; this.editModel.position.y = selected.position.y;
} }
}
}, },
updateMapModel(data) { updateMapModel(data) {
this.$emit('updateMapModel', data); this.picture.deviceMap[data.code] = {...data};
this.$jlmap.updatePicture([this.picture.deviceMap[data.code]]);
}, },
clearDeviceSelect() { clearDeviceSelect() {
this.editModel = { code: '', pictureHide: false, position: {x:0, y:0} }; this.editModel = { code: '', pictureHide: false, position: {x:0, y:0} };

View File

@ -8,10 +8,12 @@
<b>{{ mapInfo.name }}</b> <b>{{ mapInfo.name }}</b>
</el-tooltip> </el-tooltip>
</div> </div>
<span>{{ pictureName }}</span> <div>{{ pictureName }}</div>
<el-button type="text" style="padding: 3px 0;float: right;" @click="createPicture">新建</el-button> <div>
<el-button type="text" style="padding: 3px 0;float: right;" @click="changePicture">切换</el-button> <el-button type="text" style="padding: 3px 0;" @click="createPicture">新建</el-button>
<el-button v-if="isSave" type="text" style="padding: 3px 0;float: right;" :disabled="!pictureName" @click="saveMapEvent">{{ $t('map.save') }}</el-button> <el-button type="text" style="padding: 3px 0;" @click="changePicture">切换</el-button>
<el-button v-if="isSave" type="text" style="padding: 3px 0;" :disabled="!pictureName" @click="saveMapEvent">{{ $t('map.save') }}</el-button>
</div>
</div> </div>
<el-tabs v-model="enabledTab" class="mapEdit" type="card"> <el-tabs v-model="enabledTab" class="mapEdit" type="card">
<el-tab-pane v-for="(each,index) in tabList" :key="index" :label="each.label" class="tab_pane_box" :name="each.name" :lazy="lazy"> <el-tab-pane v-for="(each,index) in tabList" :key="index" :label="each.label" class="tab_pane_box" :name="each.name" :lazy="lazy">
@ -19,6 +21,7 @@
:is="each.menus" :is="each.menus"
:ref="each.name" :ref="each.name"
:selected="selected" :selected="selected"
:picture-name="pictureName"
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
@deviceSelect="deviceSelect" @deviceSelect="deviceSelect"
@ -70,13 +73,11 @@ export default {
selected(val) { selected(val) {
if (this.selected) { if (this.selected) {
this.$nextTick(() => { this.$nextTick(() => {
console.log(this.$refs[this.enabledTab]);
this.$refs[this.enabledTab][0].deviceSelect(val); this.$refs[this.enabledTab][0].deviceSelect(val);
}); });
} }
} }
}, },
mounted() {},
methods: { methods: {
handleSelectControlPage(device) { handleSelectControlPage(device) {
if (this.selectDevice) { if (this.selectDevice) {
@ -99,8 +100,8 @@ export default {
changePicture() { changePicture() {
this.$emit('changePicture'); this.$emit('changePicture');
}, },
pictureChanged(picture) { pictureChanged(pictureName) {
this.pictureName = picture.name; this.pictureName = pictureName;
} }
} }
}; };
@ -148,6 +149,8 @@ export default {
height: 47px; height: 47px;
padding: 15px; padding: 15px;
display:flex; display:flex;
justify-content: space-around;
align-items: center;
} }
.mapEdit{ .mapEdit{
height: calc(100% - 47px); height: calc(100% - 47px);

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div style="height: 100%; overflow: auto;">
<div class="list-box"> <div class="list-box" style="height: calc(100% - 215px);overflow-y: auto;">
<div <div
v-for="nor in deviceList" v-for="nor in deviceList"
:key="nor.code" :key="nor.code"
@ -9,25 +9,54 @@
@mouseleave="mouseleave(nor)" @mouseleave="mouseleave(nor)"
> >
<div class="name">{{ nor.name || nor.code }}</div> <div class="name">{{ nor.name || nor.code }}</div>
<div class="close" @click="delList(nor, item.list)"><i class="el-icon-close" /></div> <div class="close" @click="delList(nor, deviceList)"><i class="el-icon-close" /></div>
</div> </div>
</div> </div>
</div></template> <div>
<el-form ref="ruleForm" :model="ruleForm" label-width="100px" size="small" class="demo-ruleForm">
<el-form-item label="设备隐藏" prop="pictureHide">
<el-checkbox v-model="ruleForm.pictureHide" />
</el-form-item>
<el-form-item label="X偏移" prop="offsetX">
<el-input-number v-model="ruleForm.offsetX" label="描述文字" />
</el-form-item>
<el-form-item label="Y偏移" prop="offsetY">
<el-input-number v-model="ruleForm.offsetY" label="描述文字" />
</el-form-item>
</el-form>
<div style="border-top: 1px #f3f1f1 solid;text-align: right;height: 50px;line-height: 50px;">
<el-button size="small" type="primary" style="margin-right: 10px;" @click="updateModels">修改</el-button>
</div>
</div>
</div>
</template>
<script> <script>
import {mapGetters} from 'vuex'; import {mapGetters} from 'vuex';
export default { export default {
name: 'MultiSelect', name: 'MultiSelect',
props: {
pictureName: {
type: String,
required: true
}
},
data() { data() {
return { return {
modelList: [], modelList: [],
deviceList: [] deviceList: [],
ruleForm: {
pictureHide: false,
offsetX: 0,
offsetY: 0
}
}; };
}, },
computed: { computed: {
...mapGetters('map', ['seclectDeviceList']) ...mapGetters('map', ['seclectDeviceList'])
}, },
mounted() {},
beforeDestroy() {},
methods: { methods: {
deviceSelect(selected) { deviceSelect(selected) {
if (selected && selected._type.toUpperCase() == 'CheckBox'.toUpperCase()) { if (selected && selected._type.toUpperCase() == 'CheckBox'.toUpperCase()) {
@ -57,6 +86,43 @@ export default {
} }
}); });
}, },
updateModels() {
const pointsDevice = ['LINE', 'POWER', 'SECTION'];
const pointDevice = ['OVERAP', 'TRAINWINDOW'];
const picture = this.$store.state.map.map.pictureList.find(elem => elem.name == this.pictureName);
const modelList = [];
this.deviceList.forEach(item => {
const device = picture.deviceMap[item.code];
if (device) {
device.position = { x: device.position.x + this.ruleForm.offsetX, y: device.position.y + this.ruleForm.offsetY };
device.pictureHide = this.ruleForm.pictureHide;
} else {
if (item && pointsDevice.includes(item._type.toUpperCase())) {
picture.deviceMap[item.code] = {
code: item.code,
pictureHide: this.ruleForm.pictureHide,
position: { x: item.points[0].x + this.ruleForm.offsetX, y: item.points[0].y + this.ruleForm.offsetY }
};
} else if (item && pointDevice.includes(item._type.toUpperCase())) {
picture.deviceMap[item.code] = {
code: item.code,
pictureHide: this.ruleForm.pictureHide,
position: { x: item.point.x + this.ruleForm.offsetX, y: item.point.y + this.ruleForm.offsetY }
};
} else if (item && item._type !== 'Switch') {
picture.deviceMap[item.code] = {
code: item.code,
pictureHide: this.ruleForm.pictureHide,
position: { x: item.position.x + this.ruleForm.offsetX, y: item.position.y + this.ruleForm.offsetY }
};
}
}
if (picture.deviceMap[item.code]) {
modelList.push(picture.deviceMap[item.code]);
}
});
this.$jlmap.updatePicture(modelList);
},
clearData() { clearData() {
} }
@ -67,7 +133,11 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.list-box { .list-box {
overflow: hidden; overflow: hidden;
.list-content { border: 1px solid #ddd;
border-radius: 5px;
padding: 10px;
margin: 5px 20px;
.list-content {
float: left; float: left;
background: #e2e2e2; background: #e2e2e2;
margin: 5px; margin: 5px;
@ -77,20 +147,19 @@ export default {
padding-left: 10px; padding-left: 10px;
padding-right: 3px; padding-right: 3px;
cursor: pointer; cursor: pointer;
&:hover {
&:hover {
background: #ccc; background: #ccc;
} }
.name { .name {
float: left; float: left;
margin-right: 20px; margin-right: 20px;
} }
.close { .close {
float: left; float: left;
width: 23px; width: 23px;
cursor: pointer; cursor: pointer;
} }
} }
} }
.title-box { .title-box {
padding-left: 10px; padding-left: 10px;