This commit is contained in:
joylink_cuiweidong 2020-05-11 15:44:25 +08:00
commit e83551b18d
9 changed files with 305 additions and 104 deletions

View File

@ -11,6 +11,7 @@ import { selectLineCode } from './config/deviceStyle';
import { deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser';
import { deepAssign } from '@/utils/index';
import store from '@/store/index_APP_TARGET';
import Vue from 'vue';
const renderer = 'canvas';
const devicePixelRatio = 1;
@ -89,9 +90,9 @@ class Jlmap {
// 保存皮肤类型
if (map.skinVO) {
this.lineCode = map.skinVO.code;
this.$options.scaleRate = map.skinVO.scaling || 1;
this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0;
this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 0;
this.$options.scaleRate = map.scaling || 1;
this.$options.offsetX = map.origin ? map.origin.x : 0;
this.$options.offsetY = map.origin ? map.origin.y : 0;
}
// 更新视图大小
@ -160,6 +161,7 @@ class Jlmap {
const num = opts.num;
const offsetY = (opts.height - 100) / num; // 高度差
const arr = [];
const rectList = [];
let rect = '';
for (const i in this.mapDevice) {
const element = this.mapDevice[i];
@ -171,16 +173,36 @@ class Jlmap {
}
}
}
const scaleWidth = Math.floor((((opts.width - 100) * num) / rect.width) * 100) / 100;
const scaleHeight = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100;
const scale = Math.min(scaleWidth, scaleHeight);
const spliceWidth = (rect.width + 100) / num * scale;
const dx = (opts.width - spliceWidth) / 2;
for (let index = 0; index < num; index++) {
const param = { scaleRate: scale, offsetX: ((spliceWidth) * index) - dx, offsetY: -100 - (offsetY * index) };
arr.push(param);
// const scaleWidth = Math.floor((((opts.width - 200) * num) / rect.width) * 100) / 100;
// const scaleHeight = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100;
// const scale = Math.min(scaleWidth, scaleHeight);
// const spliceWidth = (rect.width + 100) / num * scale;
// const dx = (opts.width - spliceWidth) / 2;
// for (let index = 0; index < num; index++) {
// const param = { scaleRate: scale, offsetX: ((spliceWidth) * index) - dx, offsetY: -100 - (offsetY * index) };
// arr.push(param);
// }
const splitList = Vue.prototype.$theme.loadPropConvert(store.state.map.map.skinVO.code).screenSplit;
const scale = 0.3;
const maxWidth = rect.width + 30;
splitList.push(maxWidth);
for (let i = 0; i < splitList.length; i++) {
let offsetX = '';
if (i == 0) {
offsetX = -(opts.width - splitList[i] * scale) / 2;
} else {
const dx = (opts.width - (splitList[i] - splitList[i - 1]) * scale) / 2; // 居中计算偏移值
offsetX = splitList[i - 1] * scale - dx;
}
this.$painter.updateTransform1(arr, {x: dx, y: 0, width: spliceWidth, height: opts.height});
const param = { scaleRate: scale, offsetX: offsetX, offsetY: -100 - (offsetY * i) };
arr.push(param);
const rect = {x: 0, y: 0, width: Number(splitList[i]) + 10, height: opts.height};
rectList.push(rect);
}
this.$painter.updateTransform1(arr, rectList);
}
setLevelVisible(list) {

View File

@ -768,7 +768,7 @@ export default class Section extends Group {
if (this.section) {
return this.section.getBoundingRect();
} else {
return super.getBoundingRect();
return this.name.getBoundingRect();
}
}

View File

@ -3,7 +3,6 @@ class Theme {
this._code = '02';
this._mapMenu = {
'01': 'chengdu_01',
// '01': 'xian_02',
'02': 'fuzhou_01',
'03': 'beijing_01',
'04': 'chengdu_03',

View File

@ -3,6 +3,7 @@ import deviceType from '../../constant/deviceType';
class Model {
constructor() {
this.screenLine = 3;
this.screenSplit = ['5165', '10303'];
// 公共字段部分默认初始值
this['public'] = {};
this['public'][deviceType.Signal] = {

View File

@ -10,17 +10,21 @@ class TransformHandle {
this.parentLevel = painter.getParentLevel();
this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.rectList = [];
this.transform = [createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 })];
}
checkVisible(view) {
return createBoundingRect(view).intersect(this.rect); // 判断是否相交
checkVisible(view, rect) {
// return createBoundingRect(view).intersect(this.rect); // 判断是否相交
return createBoundingRect(view).intersect(rect); // 判断是否相交
}
// 视图进行缩放/平移
transformView(view) {
if (view) {
for (let i = 0; i < this.transform.length; i++) {
const rect = this.rectList[i];
if (this.checkVisible(view, rect)) {
view.transform = this.transform[i];
view.decomposeTransform(); // 修改 transform 后同步位置
const propConvert = Vue.prototype.$theme.loadPropConvert(store.state.map.map.skinVO.code);
@ -28,7 +32,10 @@ class TransformHandle {
view.hide();
return;
}
if (this.checkVisible(view)) { view.show(); return; } else { view.hide(); }
view.show(); return;
}
// console.log(view, rect);
// if (this.checkVisible(view, rect)) { view.show(); return; } else { view.hide(); }
}
view.dirty(); // 更新
}
@ -45,12 +52,14 @@ class TransformHandle {
}
// 更新偏移量
updateTransform(list, opts) {
this.rect = { x: opts.x, y: opts.y, width: opts.width, height: opts.height };
updateTransform(list, rectList) {
// this.rect = { x: opts.x, y: opts.y, width: opts.width, height: opts.height };
this.rectList = rectList;
this.transform = [];
list.forEach(item => {
this.transform.push(createTransform(item));
});
console.log(this.transform, this.rectList, '------');
this.transformAll();
}

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://192.168.3.41:9000'; // 张赛

View File

@ -0,0 +1,230 @@
<template>
<div v-show="dialogVisible">
<el-dialog v-dialogDrag title="请确认联锁配置项" :visible.sync="dialogVisible" fullscreen :before-close="handleClose" center :close-on-click-modal="false" :z-index="2000">
<div style="overflow-y: scroll;" :style="{height: height+ 'px'}">
<el-card style="margin-top: 10px">
<div slot="header" style="font-weight: bold;text-align: center;">
<span>联锁配置项</span>
</div>
<el-table :data="roadData" style="width: 100%;">
<el-table-column prop="configKey" label="key" />
<el-table-column prop="configValue" label="value">
<template slot-scope="scope">
<div v-if="scope.row.type === 'input'">
<div v-if="!scope.row.focus" style="width: 100%;cursor: pointer;" @click="changeFocus(scope.row, '1')">{{ scope.row.configValue }}</div>
<el-input v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100%" @blur="changeFocus(scope.row, '0')" />
</div>
<div v-else-if="scope.row.type === 'number'">
<div v-if="!scope.row.focus" style="width: 100%;cursor: pointer" @click="changeFocus(scope.row, '1')">{{ scope.row.configValue }}</div>
<el-input-number v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100px;" :min="0" controls-position="right" @blur="changeFocus(scope.row, '0')" />
</div>
<div v-else-if="scope.row.type === 'boolean'">
<el-radio v-model="scope.row.configValue" :label="trueValue"></el-radio>
<el-radio v-model="scope.row.configValue" :label="falseValue"></el-radio>
</div>
<div v-else-if="scope.row.type === 'select'">
<el-select v-model="scope.row.configValue" size="mini" style="width: 80px;">
<el-option
v-for="item in scope.row.options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
</el-table-column>
<el-table-column prop="remark" label="描述" />
</el-table>
</el-card>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="loading" @click="save">{{ $t('global.confirm') }}</el-button>
<el-button :loading="loading" @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { saveMap, generateCI } from '@/api/jmap/mapdraft';
export default {
name: 'Config',
components: {
// EditConfig
},
props: {
type: {
type: String,
default() {
return '';
}
}
},
data() {
return {
loading: false,
dialogVisible: false,
index: 0,
trueValue: true,
falseValue: false,
id: '',
height: 800,
initData: {
signalApproachOnlyOne: false,
signalApproachOnlyNpSwitch: false,
routeNameUseEndOppositeSignalName: false,
generateTbRoute: false,
tbRouteNameUseEndOppositeSignalName: false,
routeSignalAlwaysGreen: false,
routeApartByOverlap: false,
overlapOnlySwitch: false,
overlapSwitchNpOnly: false,
overlapSignalOppositeSwitchNpOnly: false,
overlapOnlyOneSwitch: false,
generateCycle: false,
overlapSettingByTrigger: false,
overlapReleaseTime: 45,
routeReleaseTime: 60
},
roadData: [],
focus: false,
booleanList: ['lockFirst', 'switchSingleHandle', 'signalApproachOnlyOne', 'signalApproachOnlyNpSwitch',
'routeNameUseEndOppositeSignalName', 'generateTbRoute', 'tbRouteNameUseEndOppositeSignalName', 'routeSignalAlwaysGreen',
'routeApartByOverlap', 'overlapOnlySwitch', 'overlapSwitchNpOnly', 'overlapSignalOppositeSwitchNpOnly', 'overlapOnlyOneSwitch', 'generateCycle', 'overlapSettingByTrigger'],
selectList: ['upDirection'],
numberList: ['overlapReleaseTime', 'routeReleaseTime'],
optionsMap: {
upDirection: [{label: 'right', value: 'right'}, {label: 'left', value: 'left'}]
},
remarkMap: {
lockFirst: '是否先锁闭——办理过程直接先锁闭区段',
upDirection: '上行方向',
switchSingleHandle: '道岔区段状态改变按单个道岔处理',
signalApproachOnlyOne: '信号机接近区段是否只取最近的一个',
signalApproachOnlyNpSwitch: ' 信号机接近区段是否仅考虑定位道岔',
routeNameUseEndOppositeSignalName: '进路名称是否使用终端信号机同区段反向信号机名称命名,否则使用终端信号机命名',
generateTbRoute: '是否生成折返进路',
tbRouteNameUseEndOppositeSignalName: '折返进路名称是否使用终端信号机反向信号机名称',
routeSignalAlwaysGreen: '进路始端防护信号机是否总是绿灯,否则根据进路中有无反位道岔生成绿灯或黄灯',
routeApartByOverlap: '多个延续保护路径生成多条进路,否则生成一条进路',
overlapOnlySwitch:'延续保护是否只构建道岔',
overlapOnlyOneSwitch: '延续保护构建是否只考虑一个道岔计轴',
overlapSwitchNpOnly: '延续保护道岔是否只构建定位道岔',
overlapSignalOppositeSwitchNpOnly: '延续保护道岔在防护信号机与所属区段方向相反时,是否只构建定位道岔',
overlapReleaseTime: '默认延续保护解锁时间',
routeReleaseTime: '默认进路解锁时间',
generateCycle: '是否生成自动折返',
overlapSettingByTrigger: '延续保护的建立方式:是-通过触发建立,否-随进路建立'
}
};
},
computed: {
},
methods: {
async show() {
this.dialogVisible = true;
this.height = document.documentElement.clientHeight - 180;
const map = this.$store.state.map.map;
this.getList(map.generateConfig);
},
changeFocus(row, flag) {
if (flag === '0') {
this.$set(row, 'focus', false);
} else {
this.$set(row, 'focus', true);
}
},
async getList(data) {
try {
if (data) {
const keys = Object.keys(data);
this.roadData = [];
keys.forEach(key => {
let type = 'input';
let options = [];
if (this.booleanList.indexOf(key) >= 0) {
type = 'boolean';
} else if (this.selectList.indexOf(key) >= 0) {
type = 'select';
options = this.optionsMap[key];
} else if (this.numberList.indexOf(key) >= 0) {
type = 'number';
} else {
type = 'input';
}
const param = {
configKey: key,
configValue: data[key],
type: type,
options: options,
remark: this.remarkMap[key]
};
this.roadData.push(param);
});
} else {
this.roadData = [];
}
} catch (error) {
console.log(error);
}
},
handleClose(done) {
if (done) {
done();
} else {
this.dialogVisible = false;
}
},
addModel() {
this.$refs.addConfig.show();
},
editModel(item, index) {
this.$refs.editConfig.show(item);
this.index = index;
},
save() {
this.loading = true;
const map = this.$store.state.map.map;
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
const param = {};
this.roadData.forEach(item => {
param[item.configKey] = item.configValue;
});
saveMap(Object.assign(map, {generateConfig: param, mapId: this.$route.params.mapId})).then(response => {
this.dialogVisible = false;
this.loading = false;
this.$confirm('生成联锁关系会删除旧的联锁关系,是否继续生成', {
confirmButtonText: '继续',
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
generateCI(this.$route.params.mapId).then(resp => {
this.$message.success('生成并保存联锁关系成功!');
}).catch(()=> {
this.$message.error('生成并保存联锁关系失败!');
});
});
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('map.updateFailed'));
});
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.icon_font{
font-size: 18px;
margin-left: 15px;
cursor: pointer;
}
.flex_box{
display: flex;
justify-content: flex-start;
align-items: center;
}
</style>

View File

@ -45,6 +45,8 @@
ref="configMap"
@handleSelectPhysicalView="handleSelectPhysicalView"
/>
<ci-config ref="ciConfig" />
</div>
</div>
</transition>
@ -57,7 +59,7 @@ import JlmapVisual from '@/views/newMap/jlmapNew/index';
import MapOperate from './mapoperate/index';
import { EventBus } from '@/scripts/event-bus';
import { mapGetters } from 'vuex';
import { } from '@/api/jmap/mapdraft';
import CiConfig from './ciConfig';
import ConfigMap from './configMap';
@ -69,7 +71,8 @@ export default {
JlmapVisual,
MapOperate,
DataRelation,
ConfigMap
ConfigMap,
CiConfig
},
data() {
return {
@ -154,19 +157,18 @@ export default {
type: 'warning'
}).then(() => {
const map = this.$store.state.map.map;
console.log(map, '======');
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
const param = {
mapId: this.$route.params.mapId,
skinVO: {
code: this.$store.state.map.map.skinVO.code,
name: this.$store.state.map.map.skinVO.name,
name: this.$store.state.map.map.skinVO.name
},
origin: {
x: this.updtModel.origin.x,
y: this.updtModel.origin.y
x: this.updtModel.origin.x || map.origin.x,
y: this.updtModel.origin.y || map.origin.y
},
scaling: this.updtModel.scaling
}
};
saveMap(Object.assign(map, param)).then(response => {
this.$message.success(this.$t('map.updateSuccessfully'));
@ -235,18 +237,7 @@ export default {
}
},
generateCIEvent() {
this.$confirm('生成联锁关系会删除旧的联锁关系,是否继续生成', {
confirmButtonText: '继续',
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
generateCI(this.$route.params.mapId).then(resp => {
this.$message.success('生成并保存联锁关系成功!');
}).catch(()=> {
this.$message.error('生成并保存联锁关系失败!');
});
});
this.$refs.ciConfig.show();
},
handleSelectControlPage (model) {
if (this.$refs.mapOperate) {

View File

@ -19,41 +19,8 @@
<el-input-number v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100px;" :min="0" controls-position="right" @blur="changeFocus(scope.row, '0')" />
</div>
<div v-else-if="scope.row.type === 'boolean'">
<el-checkbox v-model="scope.row.configValue">{{ scope.row.configValue }}</el-checkbox>
</div>
<div v-else-if="scope.row.type === 'select'">
<el-select v-model="scope.row.configValue" size="mini" style="width: 80px;">
<el-option
v-for="item in scope.row.options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
</el-table-column>
<el-table-column prop="remark" label="描述" />
</el-table>
</el-card>
<el-card style="margin-top: 10px">
<div slot="header" style="font-weight: bold;text-align: center;">
<span>联锁配置项</span>
</div>
<el-table :data="roadData" style="width: 100%;">
<el-table-column prop="configKey" label="key" />
<el-table-column prop="configValue" label="value">
<template slot-scope="scope">
<div v-if="scope.row.type === 'input'">
<div v-if="!scope.row.focus" style="width: 100%;cursor: pointer;" @click="changeFocus(scope.row, '1')">{{ scope.row.configValue }}</div>
<el-input v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100%" @blur="changeFocus(scope.row, '0')" />
</div>
<div v-else-if="scope.row.type === 'number'">
<div v-if="!scope.row.focus" style="width: 100%;cursor: pointer" @click="changeFocus(scope.row, '1')">{{ scope.row.configValue }}</div>
<el-input-number v-if="scope.row.focus" v-model="scope.row.configValue" size="mini" style="width: 100px;" :min="0" controls-position="right" @blur="changeFocus(scope.row, '0')" />
</div>
<div v-else-if="scope.row.type === 'boolean'">
<el-checkbox v-model="scope.row.configValue">{{ scope.row.configValue }}</el-checkbox>
<el-radio v-model="scope.row.configValue" :label="true"></el-radio>
<el-radio v-model="scope.row.configValue" :label="false"></el-radio>
</div>
<div v-else-if="scope.row.type === 'select'">
<el-select v-model="scope.row.configValue" size="mini" style="width: 80px;">
@ -81,7 +48,6 @@
<script>
import { getRealLineConfigList, putRealLineConfig } from '@/api/management/mapline';
// import EditConfig from './editConfig';
export default {
name: 'Config',
components: {
@ -104,34 +70,17 @@ export default {
height: 800,
roadData: [],
focus: false,
booleanList: ['lockFirst', 'switchSingleHandle', 'signalApproachOnlyOne', 'signalApproachOnlyNpSwitch',
'routeNameUseEndOppositeSignalName', 'generateTbRoute', 'tbRouteNameUseEndOppositeSignalName', 'routeSignalAlwaysGreen',
'routeApartByOverlap', 'overlapOnlySwitch', 'overlapSwitchNpOnly', 'overlapSignalOppositeSwitchNpOnly', 'overlapOnlyOneSwitch', 'generateCycle', 'overlapSettingByTrigger'],
booleanList: ['lockFirst', 'switchSingleHandle'],
selectList: ['upDirection'],
generalConfig: ['lockFirst', 'switchSingleHandle', 'upDirection'],
numberList: ['overlapReleaseTime', 'routeReleaseTime'],
numberList: [],
optionsMap: {
upDirection: [{label: 'right', value: 'right'}, {label: 'left', value: 'left'}]
},
remarkMap: {
lockFirst: '是否先锁闭——办理过程直接先锁闭区段',
upDirection: '上行方向',
switchSingleHandle: '道岔区段状态改变按单个道岔处理',
signalApproachOnlyOne: '信号机接近区段是否只取最近的一个',
signalApproachOnlyNpSwitch: ' 信号机接近区段是否仅考虑定位道岔',
routeNameUseEndOppositeSignalName: '进路名称是否使用终端信号机同区段反向信号机名称命名,否则使用终端信号机命名',
generateTbRoute: '是否生成折返进路',
tbRouteNameUseEndOppositeSignalName: '折返进路名称是否使用终端信号机反向信号机名称',
routeSignalAlwaysGreen: '进路始端防护信号机是否总是绿灯,否则根据进路中有无反位道岔生成绿灯或黄灯',
routeApartByOverlap: '多个延续保护路径生成多条进路,否则生成一条进路',
overlapOnlySwitch:'延续保护是否只构建道岔',
overlapOnlyOneSwitch: '延续保护构建是否只考虑一个道岔计轴',
overlapSwitchNpOnly: '延续保护道岔是否只构建定位道岔',
overlapSignalOppositeSwitchNpOnly: '延续保护道岔在防护信号机与所属区段方向相反时,是否只构建定位道岔',
overlapReleaseTime: '默认延续保护解锁时间',
routeReleaseTime: '默认进路解锁时间',
generateCycle: '是否生成自动折返',
overlapSettingByTrigger: '延续保护的建立方式true-通过触发建立false-随进路建立'
switchSingleHandle: '道岔区段状态改变按单个道岔处理'
}
};
},