-
+
@@ -8,7 +8,7 @@
import { getToken, getUserIdKey } from '@/utils/auth';
-import { getSessionStorage } from '@/utils/auth';
-import { loginInfo, ProjectIcon } from '@/scripts/ProjectConfig';
+import { getSessionStorage, setSessionStorage } from '@/utils/auth';
+import { loginInfo } from '@/scripts/ProjectConfig';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import LoadingImg from '@/assets/loading.gif';
import AppLoading from '@/assets/appLoading.png';
@@ -31,6 +31,9 @@ import { openIndexedDB } from '@/utils/indexedDb';
import Favicon from '@/assets/icon/favicon.png';
import DeomonList from '@/views/demonstration/deomonList/index';
import Qcode from '@/layout/components/Qcode.vue';
+import {removeToken} from './utils/auth';
+import { getFrontProjectConfigByLogin} from '@/api/projectConfig';
+import { handlerUrl } from '@/utils/baseUrl';
export default {
name: 'App',
@@ -46,10 +49,16 @@ export default {
loadingImg: LoadingImg,
appLoading: AppLoading,
loading: false,
+ jlFavicon: Favicon,
project: '',
- jlFavicon: Favicon
+ loadingComponent: false
};
},
+ computed: {
+ needLoading() {
+ return this.$route.path !== '/authorization';
+ }
+ },
watch: {
'$store.state.socket.beLogoutCount': async function(val) {
if (this.$store.state.socket.loggedOutMsg.token === getToken()) {
@@ -57,8 +66,9 @@ export default {
this.$alert(this.$t('tip.logoutTips'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
callback: action => {
+ removeToken();
this.$store.dispatch('exit').then(resp => {
- this.$router.push({path: loginInfo[getSessionStorage('project')].loginPath});
+ this.$router.push({path: loginInfo[this.$store.state.projectConfig.markKey].loginPath});
});
}
});
@@ -76,17 +86,20 @@ export default {
if (val.path == '/display/demon' && val.query.client == 'diagramEdit') { // 运行图编制
this.loading = false;
}
- }
- },
- created() {
- this.project = getSessionStorage('project');
- if (this.project) {
- document.querySelector("link[rel*='icon']").href = loginInfo[this.project].linkIcon || ProjectIcon[this.project];
+ if (this.$route.query.project || this.$route.path === '/login' || this.$route.path === '/') {
+ setSessionStorage('project', this.$route.query.project || 'login');
+ }
+ this.project = getSessionStorage('project');
+ if (this.project !== this.$store.state.projectConfig.markKey) {
+ this.initFrontProjectConfig();
+ }
+ },
+ '$store.state.projectConfig.markKey': function(val) {
+ if (val) { this.loadingComponent = true; }
}
},
mounted() {
this.prohibitSystemContextMenu();
-
window.addEventListener('beforeunload', async e => {
if (!this.$route.query.noPreLogout) {
await this.$store.dispatch('preLogout');
@@ -109,6 +122,22 @@ export default {
this.$store.dispatch('subscribe_un', {});
},
methods: {
+ initFrontProjectConfig() {
+ getFrontProjectConfigByLogin(this.project).then(resp => {
+ const urlData = handlerUrl();
+ const { baseApiUrl, baseSite, ossUrl, loginProLogo, browserTitle} = resp.data.viewSetting;
+ this.$store.dispatch('setBaseUrl', baseApiUrl || urlData.BASE_API);
+ this.$store.dispatch('setBaseSite', baseSite || urlData.BASE_SITE);
+ this.$store.dispatch('setOssUrl', ossUrl || urlData.OSS_URL);
+ this.$store.dispatch('projectConfig/setMarkKey', resp.data.markKey);
+ this.$store.dispatch('projectConfig/setProjectCode', resp.data.project);
+ this.$store.dispatch('projectConfig/setViewSetting', resp.data.viewSetting);
+ document.title = browserTitle;
+ if (loginProLogo) {
+ document.querySelector("link[rel*='icon']").href = (ossUrl || urlData.OSS_URL) + '/logo/' + loginProLogo;
+ }
+ }).catch(e => this.$message.error('获取配置数据失败!'));
+ },
quickEntry() {
this.$refs.deomonList.doShow();
},
diff --git a/src/api/trainingManage.js b/src/api/trainingManage.js
index cb9a3a719..81cb57a4c 100644
--- a/src/api/trainingManage.js
+++ b/src/api/trainingManage.js
@@ -32,6 +32,14 @@ export function updateTraining(data) {
data
});
}
+/** 更新实训标签 */
+export function updateTrainingLabel(data) {
+ return request({
+ url: `/api/v2/training/published/update/label`,
+ method: 'put',
+ data
+ });
+}
/** 查询步骤列表 */
export function getTrainingStepList(trainingId) {
return request({
diff --git a/src/api/trainingPlatform.js b/src/api/trainingPlatform.js
index 842b033cc..906be28c8 100644
--- a/src/api/trainingPlatform.js
+++ b/src/api/trainingPlatform.js
@@ -146,3 +146,50 @@ export function updateMapFunctionSubset(data) {
data
});
}
+/** 根据模板生成地图功能 */
+export function generateMapFunctionByTemplate(data) {
+ return request({
+ url: `/api/mapFunction/generate/from/template`,
+ method: 'post',
+ data
+ });
+}
+/** 创建模板线路功能 */
+export function createTemplateMapFunction(data) {
+ return request({
+ url: `/api/mapFunction/template`,
+ method: 'post',
+ data
+ });
+}
+/** 修改模板线路功能 */
+export function updateTemplateMapFunction(data) {
+ return request({
+ url: `/api/mapFunction/template/${data.id}`,
+ method: 'put',
+ data
+ });
+}
+/** 删除模板线路功能 */
+export function deleteTemplateMapFunction(id) {
+ return request({
+ url: `/api/mapFunction/template/${id}`,
+ method: 'delete'
+ });
+}
+/** 查询模板线路功能列表 */
+export function queryTemplateMapFunctionList(params) {
+ return request({
+ url: `/api/mapFunction/template/list`,
+ method: 'get',
+ params
+ });
+}
+/** 分页查询模板线路功能列表 */
+export function queryTemplateMapFunPaged(params) {
+ return request({
+ url: `/api/mapFunction/template/paged`,
+ method: 'get',
+ params
+ });
+}
diff --git a/src/assets/sim_id.jpg b/src/assets/sim_id.jpg
new file mode 100644
index 000000000..b52345748
Binary files /dev/null and b/src/assets/sim_id.jpg differ
diff --git a/src/i18n/langs/en/login.js b/src/i18n/langs/en/login.js
index c241f5567..e082e8152 100644
--- a/src/i18n/langs/en/login.js
+++ b/src/i18n/langs/en/login.js
@@ -18,5 +18,7 @@ export default {
getLoginQrCode: 'Failed to get login qr code, please refresh and try again',
language: 'Language',
clickSwitchLanguage: 'Click switch language',
- accountName: 'Account name'
+ accountName: 'Account name',
+ registerAccount: 'Register account',
+ forgetPassword: 'Forget password?'
};
diff --git a/src/i18n/langs/zh/login.js b/src/i18n/langs/zh/login.js
index fc3fdbcd7..864a59201 100644
--- a/src/i18n/langs/zh/login.js
+++ b/src/i18n/langs/zh/login.js
@@ -18,5 +18,7 @@ export default {
getLoginQrCode: '获取登录二维码失败,请刷新重试',
language: '语言',
clickSwitchLanguage: '点击切换语言',
- accountName: '账户名'
+ accountName: '账户名',
+ registerAccount: '注册账号',
+ forgetPassword: '忘记密码?'
};
diff --git a/src/jmapNew/constant/nccGraphRender.js b/src/jmapNew/constant/nccGraphRender.js
new file mode 100644
index 000000000..8e9b0d48c
--- /dev/null
+++ b/src/jmapNew/constant/nccGraphRender.js
@@ -0,0 +1,25 @@
+import nccGraphType from './nccGraphType';
+
+const nccGraphRender = {};
+
+/** RunLine渲染配置 */
+nccGraphRender[nccGraphType.RunLine] = {
+ _type: nccGraphType.RunLine,
+ zlevel: 1
+};
+/** NccStation渲染配置 */
+nccGraphRender[nccGraphType.NccStation] = {
+ _type: nccGraphType.NccStation,
+ zlevel: 1
+};
+/** NccTrain渲染配置 */
+nccGraphRender[nccGraphType.NccTrain] = {
+ _type: nccGraphType.NccTrain,
+ zlevel: 1
+};
+/** StationCircle渲染配置 */
+nccGraphRender[nccGraphType.StationCircle] = {
+ _type: nccGraphType.StationCircle,
+ zlevel: 1
+};
+export default nccGraphRender;
diff --git a/src/jmapNew/constant/nccGraphType.js b/src/jmapNew/constant/nccGraphType.js
new file mode 100644
index 000000000..c7a51d84f
--- /dev/null
+++ b/src/jmapNew/constant/nccGraphType.js
@@ -0,0 +1,8 @@
+const nccGraphType = {
+ RunLine: 'RunLine',
+ NccStation: 'NccStation',
+ NccTrain: 'NccTrain',
+ StationCircle: 'StationCircle'
+};
+
+export default nccGraphType;
diff --git a/src/jmapNew/constant/pathsvg.js b/src/jmapNew/constant/pathsvg.js
index 6a0d73674..fe4197cde 100644
--- a/src/jmapNew/constant/pathsvg.js
+++ b/src/jmapNew/constant/pathsvg.js
@@ -11,15 +11,27 @@ const map = {
ControlSwitch: {
width: 90,
path: 'M6.429,40.85H0V15.05H51.429L64.286,0H77.143L90,15.05V31L79,43H64.286L51.429,30.1h-30V40.85H12.857V30.1H6.429V40.85ZM60,17.2l4.286-4.3H77.143l4.286,4.3V27.95l-4.286,4.3H64.286L60,27.95V17.2Z'
+ },
+ TransferSign: {
+ width: 1024,
+ path: 'M366.592 302.592c41.984-31.744 92.16-48.128 144.384-48.128 132.608 0 240.64 109.056 247.296 245.248l-26.112-27.136c-9.728-9.728-25.088-9.728-34.304 0s-9.728 26.112 0 35.84l64 66.56c5.12 5.632 11.776 7.68 18.944 7.168 6.656 0.512 13.824-2.048 18.944-7.168l64-66.56c9.728-9.728 9.728-26.112 0-35.84s-25.088-9.728-34.304 0l-26.624 27.648c-6.656-161.792-134.656-291.84-291.328-291.84-61.44 0-119.808 19.456-169.472 56.832-28.672 21.504-53.248 48.128-73.216 78.848-2.56 4.096-3.584 8.192-3.584 12.8 0 7.168 3.584 14.336 9.728 18.944 10.24 7.168 23.552 4.096 30.208-6.144 15.872-26.112 36.864-48.64 61.44-67.072z m144.896 514.56c61.44 0 119.808-19.456 169.472-56.832 28.672-21.504 53.248-48.128 73.216-78.848 2.56-4.096 3.584-8.192 3.584-12.8 0-7.168-3.584-14.336-9.728-18.944-10.24-7.168-23.552-4.096-30.208 6.144-16.896 26.112-37.888 48.64-61.952 67.072-42.496 31.744-92.16 48.128-144.384 48.128-132.096 0-240.64-109.056-247.296-245.76l25.6 27.136c9.728 9.728 25.088 9.728 34.304 0s9.728-26.112 0-35.84l-64-66.56c-5.12-5.632-11.776-7.68-18.944-7.168-6.656-0.512-13.824 2.048-18.944 7.168l-64 66.56c-9.728 9.728-9.728 26.112 0 35.84s25.088 9.728 34.304 0l26.624-27.648c7.68 162.304 135.68 292.352 292.352 292.352z'
+ },
+ NccTrainBody: {
+ width: 195,
+ path: 'M21.7305 69.7461H181.789C184.211 69.7461 186.164 67.793 186.164 65.3711L194.289 5.11719C194.289 2.69531 192.336 0.742188 189.914 0.742188H59.6797C33.1367 0.742188 0.792966 22.2656 0.792966 48.8086C0.792966 58.8672 16.125 69.7461 21.7305 69.7461Z'
+ // path: 'M24.6484 134.746H184.707C187.129 134.746 189.082 132.793 189.082 130.371L197.207 70.1172C197.207 67.6953 195.254 65.7422 192.832 65.7422H62.5977C36.0547 65.7422 3.71094 87.2656 3.71094 113.809C3.71094 123.867 19.043 134.746 24.6484 134.746Z'
+ // path: 'M62.6442 298H480.377C486.697 298 491.795 293.669 491.795 288.299L513 154.701C513 149.331 507.903 145 501.582 145H161.687C92.413 145 7.99999 192.723 7.99999 251.576C7.99999 273.879 48.0146 298 62.6442 298Z'
+ // path: 'M -23.77657 -22.3304 C -69.33338 -9.394520000000002 -108.70345 6.915939999999999 -97.45486 19.851829999999996 C -86.20626999999999 32.78771 -83.95655 26.600989999999996 -83.95655 26.600989999999996 L 85.89722 26.600989999999996 L 99.39553000000001 -22.33039 C 99.39553000000001 -22.33039 21.780230000000003 -35.26627 -23.776569999999992 -22.33039 z'
+ // path: 'M 897.8 689.9 L 78.3 689.9 C 65.89999999999999 689.9 55.9 679.9 55.9 667.5 L 14.3 359 C 14.3 346.6 24.3 336.6 36.7 336.6 L 703.5 336.6 C 839.4 336.6 1005 446.8 1005 582.7 C 1005 634.2 926.5 689.9000000000001 897.8 689.9000000000001 z'
+ // path: 'M897.8 689.9H78.3c-12.4 0-22.4-10-22.4-22.4L14.3 359c0-12.4 10-22.4 22.4-22.4h666.8c135.9 0 301.5 110.2 301.5 246.1 0 51.5-78.5 107.2-107.2 107.2z'
}
};
-
+// M 897.8 689.9 L 78.3 689.9 C 65.89999999999999 689.9 55.9 679.9 55.9 667.5 L 14.3 359 C 14.3 346.6 24.3 336.6 36.7 336.6 L 703.5 336.6 C 839.4 336.6 1005 446.8 1005 582.7 C 1005 634.2 926.5 689.9000000000001 897.8 689.9000000000001 z
export default function createPathSvg(model) {
const svg = path.createFromString(map[model._subType].path, {
- shape: {
- zlevel: model.zlevel,
- z: model.z
- },
+ zlevel: model.zlevel,
+ z: model.z,
+ shape: {},
style: {
fill: model.fill
}
@@ -27,5 +39,8 @@ export default function createPathSvg(model) {
const scaleX = model.width / map[model._subType].width;
svg.scale = [scaleX, scaleX];
svg.position = [model.x, model.y];
+ if (model.rotation) {
+ svg.rotation = model.rotation;
+ }
return svg;
}
diff --git a/src/jmapNew/constant/systemGraphRender.js b/src/jmapNew/constant/systemGraphRender.js
deleted file mode 100644
index f50ddf19a..000000000
--- a/src/jmapNew/constant/systemGraphRender.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import systemGraphType from './systemGraphType';
-
-const systemGraphRender = {};
-
-/** Line渲染配置*/
-systemGraphRender[systemGraphType.Line] = {
- _type: systemGraphType.Line,
- zlevel: 1
-};
-
-/** Text渲染配置*/
-systemGraphRender[systemGraphType.Text] = {
- _type: systemGraphType.Text,
- zlevel: 1
-};
-
-export default systemGraphRender;
diff --git a/src/jmapNew/constant/systemGraphType.js b/src/jmapNew/constant/systemGraphType.js
deleted file mode 100644
index df98413a2..000000000
--- a/src/jmapNew/constant/systemGraphType.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const systemGraphType = {
- Line: 'Line',
- Text: 'Text',
- Rect: 'Rect',
- Arrow: 'Arrow'
-};
-
-export default systemGraphType;
diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js
index dd6ec8207..eefb82d23 100644
--- a/src/jmapNew/map.js
+++ b/src/jmapNew/map.js
@@ -507,6 +507,32 @@ class Jlmap {
}
}
}
+ clearNccTrain() {
+ for (const key in this.mapDevice) {
+ if (this.mapDevice[key]._type === 'NccTrain') {
+ this.$painter.delete(this.mapDevice[key]);
+ }
+ }
+ }
+ updateNccTrain(list) {
+ list.forEach(item => {
+ let oDevice = null;
+ if (this.mapDevice[item.groupNum]) {
+ oDevice = this.mapDevice[item.groupNum];
+ Object.assign(oDevice, item);
+ } else {
+ oDevice = deviceFactory('NccTrain', item, this.showConfig);
+ this.mapDevice[item.groupNum] = oDevice;
+ }
+ if (!item.showTrainDiagram) {
+ this.$painter.delete(oDevice);
+ delete this.mapDevice[item.groupNum];
+ } else {
+ this.$painter.updateNccTrain(oDevice);
+ }
+ });
+
+ }
update(list = [], fetch = true) {
this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
@@ -536,6 +562,7 @@ class Jlmap {
}
} else if (elem.deviceType == 'OVERLAP') {
const overlapRoute = this.mapDevice[elem.code];
+ if (!overlapRoute || !overlapRoute.pathList || overlapRoute.pathList[0]) { return; }
const model = this.mapDevice[overlapRoute.pathList[0].sectionList[0]];
if (overlapRoute.pathList[0].right) {
overlapRoute['points'] = { x: model.points[0].x, y: model.points[0].y };
@@ -674,7 +701,7 @@ class Jlmap {
store.commit('map/updateActiveTrainList', elem);
} else if (elem.deviceType === 'STAND') {
store.dispatch('map/updateStationStand', elem);
- const psdDevice = this.mapDevice[this.mapDevice[elem.code].psdCode];
+ const psdDevice = this.mapDevice[(this.mapDevice[elem.code] || {}).psdCode];
if (psdDevice) {
psdDevice.fault = elem.fault;
this.$painter.update(psdDevice);
diff --git a/src/jmapNew/mouseController.js b/src/jmapNew/mouseController.js
index 08c2dd787..6e19b761b 100644
--- a/src/jmapNew/mouseController.js
+++ b/src/jmapNew/mouseController.js
@@ -1,4 +1,5 @@
import deviceType from './constant/deviceType';
+import nccGraphType from './constant/nccGraphType';
import Eventful from 'zrender/src/mixin/Eventful';
import * as eventTool from 'zrender/src/core/event';
import store from '@/store/index';
@@ -10,7 +11,8 @@ class EventModel {
let view = e.target;
while (view) {
- if (Object.values(deviceType).includes(view._type)) {
+ const types = {...deviceType, ...nccGraphType};
+ if (Object.values(types).includes(view._type)) {
this.deviceCode = view._code;
this.deviceType = view._type;
this.eventTarget = view;
diff --git a/src/jmapNew/painter.js b/src/jmapNew/painter.js
index 271c5f914..3a1ac641d 100644
--- a/src/jmapNew/painter.js
+++ b/src/jmapNew/painter.js
@@ -2,7 +2,7 @@ import * as zrUtil from 'zrender/src/core/util';
// import * as vector from 'zrender/src/core/vector';
import Group from 'zrender/src/container/Group';
import deviceType from './constant/deviceType';
-import systemGraphType from './constant/systemGraphType';
+import nccGraphType from './constant/nccGraphType';
import transitionDeviceStatus from './constant/stateTransition';
// import shapefactory from './shape/factory';
import Graphic from './shape';
@@ -43,7 +43,7 @@ class Painter {
// 添加子级图层
zrUtil.each([
...Object.values(deviceType),
- ...Object.values(systemGraphType)], (type) => {
+ ...Object.values(nccGraphType)], (type) => {
const level = new Group({ name: `__${type}__` });
this.mapInstanceLevel[type] = level;
this.parentLevel.add(level);
@@ -155,13 +155,17 @@ class Painter {
trainDevice.instance && this.mapInstanceLevel[deviceType.Train].remove(trainDevice.instance);
trainDevice.instance = null;
trainDevice.zrOptions = this.$jmap.$options;
- this.add(trainDevice);
+ curModel.sectionModel && curModel.sectionModel.instance && this.add(trainDevice);
});
if (this.screenFlag) {
this.$transformHandleScreen.transformView(device.instance);
}
}
+ updateNccTrain(device) {
+ this.delete(device);
+ this.add(device);
+ }
/** 画面更新 */
updatePicture(device) {
if (device) {
diff --git a/src/jmapNew/parser/index.js b/src/jmapNew/parser/index.js
index f97d19690..e06e3269e 100644
--- a/src/jmapNew/parser/index.js
+++ b/src/jmapNew/parser/index.js
@@ -1,15 +1,15 @@
import * as parserGraph from './parser-graph.js';
-import * as parserSystemGraph from './parser-systemGraph.js';
+import * as parserNccGraph from './parser-nccGraph.js';
export const ParserType = {
Graph: { name: '绘图', value: 'Graph' },
- systemGraph: { name: '系统绘图', value: 'systemGraph' }
+ nccGraph: { name: '系统绘图', value: 'NccGraph' }
};
export function parserFactory(type) {
switch (type) {
case ParserType.Graph.value : return parserGraph;
- case ParserType.systemGraph.value: return parserSystemGraph;
+ case ParserType.nccGraph.value: return parserNccGraph;
}
return parserGraph;
diff --git a/src/jmapNew/parser/parser-nccGraph.js b/src/jmapNew/parser/parser-nccGraph.js
new file mode 100644
index 000000000..0a71b8801
--- /dev/null
+++ b/src/jmapNew/parser/parser-nccGraph.js
@@ -0,0 +1,86 @@
+import * as zrUtil from 'zrender/src/core/util';
+import nccGraphType from '../constant/nccGraphType';
+import nccGraphRender from '../constant/nccGraphRender';
+import Vue from 'vue';
+import { deepClone } from '@/utils/index';
+
+export function deviceFactory(type, elem, showConfig) {
+ return {...nccGraphRender[type], ...elem, ...showConfig};
+}
+
+export function createDevice(type, elem, propConvert, showConfig) {
+ const device = deviceFactory(type, Object.assign(elem, { _type: type } ), showConfig);
+ return propConvert ? propConvert.initPrivateProps(device) : device;
+}
+
+export function parser(nccData, skinCode, showConfig) {
+ const nccDevice = {};
+ const runPositionData = {};
+ const propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
+ if (nccData) {
+ zrUtil.each(nccData.nccStationList || [], elem => {
+ nccDevice[elem.code] = createDevice(nccGraphType.NccStation, elem, propConvert, showConfig);
+ if (elem.stationCode) {
+ runPositionData[elem.stationCode] = handleRunPositionData(elem, nccData.runLineList);
+ }
+ }, this);
+
+ zrUtil.each(nccData.runLineList || [], elem => {
+ nccDevice[elem.code] = createDevice(nccGraphType.RunLine, elem, propConvert, showConfig);
+ }, this);
+
+ zrUtil.each(nccData.stationCircleList || [], elem => {
+ nccDevice[elem.code] = createDevice(nccGraphType.StationCircle, elem, propConvert, showConfig);
+ }, this);
+
+ }
+ return { nccDevice, runPositionData };
+}
+function handleRunPositionData(nccStation, runLineList) {
+ const positionData = [];
+ nccStation.lineNames.forEach(lineName => {
+ const runLine = runLineList.find(elem => elem.lineName === lineName);
+ if (runLine) {
+ const pointIndex = runLine.points.findIndex(point => point.x === nccStation.position.x && point.y === nccStation.position.y);
+ positionData.push({runLineCode: runLine.code, pointIndex: pointIndex});
+ }
+ });
+ return positionData;
+}
+
+// 同步绘制数据到原始数据
+export function updateForList(model, state, lstName) {
+ if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[], stationCircleList: [], displayConfig: {} }; }
+ const list = state.nccData[lstName];
+ if (list && list instanceof Array) {
+ const i = list.findIndex(elem => elem.code == model.code );
+ if (i < 0) {
+ list.push(deepClone(model)); // 新增
+ } else {
+ if (model._dispose) {
+ list.splice(i, 1);
+ } else {
+ list.splice(i, 1, deepClone(model));
+ }
+ }
+ state.nccData[lstName] = [...list];
+ } else {
+ state.nccData[lstName] = [model];
+ }
+ state.map.nccData = JSON.stringify(state.nccData);
+}
+export function updateDisplayConfig(state, config) {
+ if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[], stationCircleList: [], displayConfig: {} }; }
+ state.nccData.displayConfig = config;
+ state.map.nccData = JSON.stringify(state.nccData);
+}
+
+export function updateMapData(state, model) {
+ if (state.map && model) {
+ switch (model._type) {
+ case nccGraphType.RunLine: updateForList(model, state, 'runLineList'); break;
+ case nccGraphType.NccStation: updateForList(model, state, 'nccStationList'); break;
+ case nccGraphType.StationCircle: updateForList(model, state, 'stationCircleList'); break;
+ }
+ }
+}
diff --git a/src/jmapNew/parser/parser-systemGraph.js b/src/jmapNew/parser/parser-systemGraph.js
deleted file mode 100644
index 3b49fcbce..000000000
--- a/src/jmapNew/parser/parser-systemGraph.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import * as zrUtil from 'zrender/src/core/util';
-import systemGraphType from '../constant/systemGraphType';
-import systemGraphRender from '../constant/systemGraphRender';
-import Vue from 'vue';
-import { deepClone } from '@/utils/index';
-
-export function deviceFactory(type, elem, showConfig) {
- return {...systemGraphRender[type], ...elem, ...showConfig};
-}
-
-export function createDevice(type, elem, propConvert, showConfig) {
- const device = deviceFactory(type, Object.assign(elem, { _type: type } ), showConfig);
- return propConvert ? propConvert.initPrivateProps(device) : device;
-}
-
-export function parser(data, skinCode, showConfig) {
- var mapDevice = {};
- var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
- if (data) {
- zrUtil.each(data.lineList || [], elem => {
- mapDevice[elem.code] = createDevice(systemGraphType.Line, elem, propConvert, showConfig);
- }, this);
-
- zrUtil.each(data.textList || [], elem => {
- mapDevice[elem.code] = createDevice(systemGraphType.Text, elem, propConvert, showConfig);
- }, this);
-
- zrUtil.each(data.rectList || [], elem => {
- mapDevice[elem.code] = createDevice(systemGraphType.Rect, elem, propConvert, showConfig);
- }, this);
-
- }
-
- return mapDevice;
-}
-
-// 同步绘制数据到原始数据
-export function updateForList(model, state, lstName) {
- const list = state.map[lstName];
- if (list && list instanceof Array) {
- const i = list.findIndex(elem => elem.code == model.code );
- if (i < 0) {
- list.push(deepClone(model)); // 新增
- } else {
- if (model._dispose) {
- list.splice(i, 1);
- } else {
- list.splice(i, 1, deepClone(model));
- }
- }
- state.map[lstName] = [...list];
- } else {
- state.map[lstName] = [model];
- }
-}
-
-export function updateMapData(state, model) {
- if (state.map && model) {
- switch (model._type) {
- case systemGraphType.Line: updateForList(model, state, 'lineList'); break;
- case systemGraphType.Text: updateForList(model, state, 'textList'); break;
- case systemGraphType.Rect: updateForList(model, state, 'rectList'); break;
- }
- }
-}
diff --git a/src/jmapNew/shape/graph/Station/index.js b/src/jmapNew/shape/graph/Station/index.js
index 17c0e364c..2035ad1ea 100644
--- a/src/jmapNew/shape/graph/Station/index.js
+++ b/src/jmapNew/shape/graph/Station/index.js
@@ -169,7 +169,7 @@ export default class Station extends Group {
return item.includes('lineCode=16');
});
const pic = store.state.map.picture;
- if ((queryCtc && model.createControlMode) || (pic == 'trafficTerminal' && queryCtcLineCode)) {
+ if ((queryCtc || (pic == 'trafficTerminal' && queryCtcLineCode)) && model.createControlMode) {
this.createCtcControlMode();
} else if (this.style.Station.StationControl.special) {
if (model.visible && model.createControlMode) { // model.createControlMode 控制模式
diff --git a/src/jmapNew/shape/graph/Train/index.js b/src/jmapNew/shape/graph/Train/index.js
index a042d87c0..a021a6769 100644
--- a/src/jmapNew/shape/graph/Train/index.js
+++ b/src/jmapNew/shape/graph/Train/index.js
@@ -180,7 +180,7 @@ export default class Train extends Group {
}
if (style.Train.directionArrow.hasArrow) { // 列车运行上下方箭头(eg:宁波yi)
const arrowPoint = { x: 0, y: 0 };
- if (model.trainWindowModel) {
+ if (model.trainWindowModel && model.trainWindowModel.instance) {
arrowPoint.x = model.trainWindowModel.instance.computedPoint.x;
arrowPoint.y = model.right ? model.trainWindowModel.instance.computedPoint.y + style.Train.directionArrow.distanceBottom : model.trainWindowModel.instance.computedPoint.y - style.Train.directionArrow.distanceTop;
}
diff --git a/src/jmapNew/shape/index.js b/src/jmapNew/shape/index.js
index 007863479..e9adb0c3a 100644
--- a/src/jmapNew/shape/index.js
+++ b/src/jmapNew/shape/index.js
@@ -1,10 +1,10 @@
import graphMapShape from './graph';
-import systemGraphShape from './systemGraph';
+import nccGraphShape from './nccGraph';
export default {
__Shape: {
...graphMapShape,
- // ...systemGraphShape
+ ...nccGraphShape
},
getBuilder(type) {
const ShapeClazz = this.__Shape[type];
diff --git a/src/jmapNew/shape/nccGraph/NccStation/Transfer.js b/src/jmapNew/shape/nccGraph/NccStation/Transfer.js
new file mode 100644
index 000000000..bef1d535b
--- /dev/null
+++ b/src/jmapNew/shape/nccGraph/NccStation/Transfer.js
@@ -0,0 +1,22 @@
+import Group from 'zrender/src/container/Group';
+import createPathSvg from '../../../constant/pathsvg';
+
+export default class Transfer extends Group {
+ constructor(model) {
+ super();
+ this.model = model;
+ this.zlevel = model.zlevel;
+ this.z = model.z;
+ this._subType = model._subType;
+ this.create();
+ }
+ create() {
+ this.path = createPathSvg(this.model);
+ this.add(this.path);
+ }
+ setControlColor(color) {
+ this.path.setStyle({fill: color});
+ }
+ recover() {
+ }
+}
diff --git a/src/jmapNew/shape/nccGraph/NccStation/index.js b/src/jmapNew/shape/nccGraph/NccStation/index.js
new file mode 100644
index 000000000..bcc80f045
--- /dev/null
+++ b/src/jmapNew/shape/nccGraph/NccStation/index.js
@@ -0,0 +1,89 @@
+import Circle from 'zrender/src/graphic/shape/Circle';
+import Text from 'zrender/src/graphic/Text';
+import Group from 'zrender/src/container/Group';
+import BoundingRect from 'zrender/src/core/BoundingRect';
+import Transfer from './Transfer';
+
+export default class NccStation extends Group {
+ constructor(model, {style, lineCode}) {
+ super();
+ this._code = model.code;
+ this.stationCode = model.stationCode;
+ this._type = model._type;
+ this.name = model.name;
+ this.zlevel = model.zlevel;
+ this.model = model;
+ this.style = style;
+ this.z = 6;
+ this.lineCode = lineCode;
+ this.create();
+ this.setState(model);
+ }
+
+ create() {
+ const model = this.model;
+ if (!model.position) { return; }
+ this.stationMain = new Circle({
+ zlevel: this.zlevel,
+ z: this.z,
+ shape: {
+ cx: model.position.x,
+ cy: model.position.y,
+ r: model.radius
+ },
+ style: {
+ fill: model.fillColor,
+ lineWidth: model.lineWidth,
+ stroke: model.lineColor
+ }
+ });
+ this.stationName = new Text({
+ zlevel: this.zlevel,
+ z: this.z + 1,
+ style: {
+ x: model.position.x + model.snOffset.x,
+ y: model.position.y + model.snOffset.y,
+ text: model.name,
+ fontFamily: this.style.fontFamily,
+ fontSize: Number(model.font),
+ textFill: model.fontColor,
+ textAlign: 'middle'
+ }
+ });
+ if (model.isTransfer) {
+ this.transferSign = new Transfer({
+ zlevel: this.zlevel,
+ z: this.z + 2,
+ x: model.position.x - model.radius,
+ y: model.position.y - model.radius,
+ _subType: 'TransferSign',
+ width: model.radius * 2,
+ fill: '#f00'
+ });
+ this.add(this.transferSign);
+ this.add(this.transferSign);
+ }
+ this.add(this.stationMain);
+ this.add(this.stationName);
+ }
+
+ setState(model) {
+ }
+ getBoundingRect() {
+ if (this.stationMain) {
+ return this.stationMain.getBoundingRect().clone();
+ } else {
+ return new BoundingRect(0, 0, 0, 0);
+ }
+ }
+
+ setShowStation(stationCode) {
+
+ }
+ screenShow() {
+
+ }
+ getAnchorPoint() {
+ return this.model.position;
+ }
+}
diff --git a/src/jmapNew/shape/nccGraph/NccTrain/index.js b/src/jmapNew/shape/nccGraph/NccTrain/index.js
new file mode 100644
index 000000000..4ce2af87d
--- /dev/null
+++ b/src/jmapNew/shape/nccGraph/NccTrain/index.js
@@ -0,0 +1,116 @@
+import Group from 'zrender/src/container/Group';
+import BoundingRect from 'zrender/src/core/BoundingRect';
+import createPathSvg from '../../../constant/pathsvg';
+import store from '@/store/index';
+
+export default class NccTrain extends Group {
+ constructor(model, {style, lineCode}) {
+ super();
+ this._code = model.groupNum;
+ this._type = model._type;
+ this.name = model.groupNum;
+ this.zlevel = model.zlevel;
+ this.model = model;
+ this.style = style;
+ this.z = 6;
+ this.lineCode = lineCode;
+ this.point = [];
+ this.create();
+ this.setState(model);
+ }
+
+ create() {
+ const model = this.model;
+ if (!model.startStationCode || !model.targetStationCode) {
+ return;
+ }
+ const nccRunPositionData = store.state.map.nccRunPositionData;
+ const startPositions = nccRunPositionData[model.startStationCode];
+ const endPositions = nccRunPositionData[model.targetStationCode];
+ let runLineCode = '';
+ let pointIndexs = [];
+ let runLinePoints = [];
+ startPositions.forEach(item =>{
+ const position = endPositions.find(el => el.runLineCode === item.runLineCode);
+ if (position) {
+ runLineCode = position.runLineCode;
+ pointIndexs = [item.pointIndex, position.pointIndex];
+ }
+ });
+ if (runLineCode) {
+ const runLine = store.getters['map/getNccDeviceByCode'](runLineCode);
+ runLinePoints = runLine.points;
+ }
+ let px = 0;
+ let py = 0;
+ let angle = 0;
+ if (pointIndexs.length && Math.abs(pointIndexs[0] - pointIndexs[1]) > 1) {
+ let stateI = pointIndexs[0];
+ const endI = pointIndexs[1];
+ const step = Math.sign( endI - stateI);
+ const lengthList = [];
+ let totalLength = 0;
+ while (stateI !== endI) {
+ const p1 = runLinePoints[stateI];
+ const p2 = runLinePoints[stateI + step];
+ const length = Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
+ lengthList.push(length);
+ totalLength += length;
+ stateI += step;
+ }
+ const complateLength = totalLength * model.stationComplateRatio;
+ let nowIndex = 0;
+ let nowLength = complateLength;
+ while (nowLength > lengthList[nowIndex]) {
+ nowLength -= lengthList[nowIndex];
+ nowIndex++;
+ }
+ const startP = runLinePoints[pointIndexs[0] + nowIndex * step];
+ const endP = runLinePoints[pointIndexs[0] + (nowIndex + 1) * step];
+ const nowRatio = nowLength / lengthList[nowIndex];
+ px = startP.x + Math.round(nowRatio * (endP.x - startP.x));
+ py = startP.y + Math.round(nowRatio * (endP.y - startP.y));
+ angle = Math.atan2(startP.y - endP.y, startP.x - endP.x);
+ angle = -angle;
+ } else if (pointIndexs.length) {
+ const startP = runLinePoints[pointIndexs[0]];
+ const endP = runLinePoints[pointIndexs[1]];
+ px = startP.x + Math.round(model.stationComplateRatio * (endP.x - startP.x));
+ py = startP.y + Math.round(model.stationComplateRatio * (endP.y - startP.y));
+ angle = Math.atan2( startP.y - endP.y, startP.x - endP.x);
+ angle = -angle;
+ }
+ const trainWidth = 10;
+ const offset = -6;
+ const cosN = Math.cos(angle);
+ const sinN = Math.sin(angle);
+ this.tranBody = createPathSvg({
+ zlevel: this.zlevel,
+ z: this.z + 5,
+ x: px - (cosN * trainWidth / 2) + sinN * offset,
+ y: py + (sinN * trainWidth / 2) + cosN * offset,
+ _subType: 'NccTrainBody',
+ width: trainWidth,
+ fill: '#CF6CC9',
+ rotation: angle
+ });
+ this.point = [px + Math.sin(angle) * offset, py + Math.cos(angle) * offset];
+ this.add(this.tranBody);
+ }
+
+ setState(model) {
+ }
+ getBoundingRect() {
+ return new BoundingRect(this.point[0], this.point[1], 0, 0);
+ }
+
+ setShowStation(stationCode) {
+
+ }
+ screenShow() {
+
+ }
+ getAnchorPoint() {
+ return this.model.position;
+ }
+}
diff --git a/src/jmapNew/shape/nccGraph/RunLine/index.js b/src/jmapNew/shape/nccGraph/RunLine/index.js
new file mode 100644
index 000000000..49fbb7f26
--- /dev/null
+++ b/src/jmapNew/shape/nccGraph/RunLine/index.js
@@ -0,0 +1,152 @@
+import Group from 'zrender/src/container/Group';
+import Polyline from 'zrender/src/graphic/shape/Polyline';
+import Sector from 'zrender/src/graphic/shape/Sector';
+import Text from 'zrender/src/graphic/Text';
+
+export default class RunLine extends Group {
+ constructor(model, {style}) {
+ super();
+ this._code = model.code;
+ this._type = model._type;
+ this.zlevel = model.zlevel;
+ this.z = 0;
+ this.model = model;
+ this.backgroundColor = style.backgroundColor;
+ this.style = style;
+ this.create();
+ this.setState(model);
+ }
+ isRightAngle(x1, y1, x2, y2, x3, y3) {
+ const distance12 = (x2 - x1) ** 2 + (y2 - y1) ** 2;
+ const distance13 = (x3 - x1) ** 2 + (y3 - y1) ** 2;
+ const distance23 = (x3 - x2) ** 2 + (y3 - y2) ** 2;
+ if (distance12 >= distance13 && distance12 >= distance23) {
+ return distance12 === distance13 + distance23;
+ } else if (distance13 >= distance12 && distance13 >= distance23) {
+ return distance13 === distance12 + distance23;
+ } else {
+ return distance23 === distance12 + distance13;
+ }
+ }
+ create() {
+ const model = this.model;
+ const roundPointIndexList = [];
+ if (model && model.points && model.points.length > 1) {
+ const points = [];
+ const modelPoints = model.points;
+ const length = modelPoints.length;
+ for (let i = 0; i < length; i++) {
+ points.push([modelPoints[i].x, modelPoints[i].y]);
+ if (i > 0 && i < length - 1) {
+ const isRight = this.isRightAngle(modelPoints[i - 1].x, modelPoints[i - 1].y, modelPoints[i].x, modelPoints[i].y, modelPoints[i + 1].x, modelPoints[i + 1].y );
+ isRight && roundPointIndexList.push(i);
+ }
+ }
+ this.segment = new Polyline({
+ zlevel: this.zlevel,
+ z:this.z,
+ shape: {
+ points:points
+ },
+ style: {
+ lineWidth: model.width,
+ stroke: model.lineColor
+ }
+ });
+ this.add(this.segment);
+ }
+ if (model && model.name) {
+ const startPoint = model.points[0];
+ const endPoint = model.points[model.points.length - 1];
+ this.startName = new Text({
+ zlevel: this.zlevel,
+ z: this.z + 1,
+ style: {
+ x: startPoint.x + model.offsetStart.x,
+ y: startPoint.y + model.offsetStart.y,
+ text: model.name,
+ fontFamily: this.style.fontFamily,
+ fontSize: Number(model.nameFont),
+ textFill: model.nameColor,
+ textAlign: 'middle',
+ textBackgroundColor: model.textBackgroundColor,
+ textPadding: 5,
+ textBorderRadius: 5
+ }
+ });
+ this.endName = new Text({
+ zlevel: this.zlevel,
+ z: this.z + 1,
+ style: {
+ x: endPoint.x + model.offsetEnd.x,
+ y: endPoint.y + model.offsetEnd.y,
+ text: model.name,
+ fontFamily: this.style.fontFamily,
+ fontSize: Number(model.nameFont),
+ textFill: model.nameColor,
+ textAlign: 'middle',
+ textBackgroundColor: model.textBackgroundColor,
+ textPadding: 5,
+ textBorderRadius: 5
+ }
+ });
+ this.add(this.startName);
+ this.add(this.endName);
+ }
+ if (roundPointIndexList.length) {
+ roundPointIndexList.forEach(pointIndex => {
+ const simpx = model.points[pointIndex - 1].x + model.points[pointIndex + 1].x - model.points[pointIndex].x;
+ const simpy = model.points[pointIndex - 1].y + model.points[pointIndex + 1].y - model.points[pointIndex].y;
+ const preAngle = Math.atan2(model.points[pointIndex - 1].y - simpy, model.points[pointIndex - 1].x - simpx );
+ const nextAngle = Math.atan2(model.points[pointIndex + 1].y - simpy, model.points[pointIndex + 1].x - simpx);
+ const startAngle = Math.min(preAngle, nextAngle);
+ const endAngle = Math.max(preAngle, nextAngle);
+ const embellishSector1 = new Sector({
+ zlevel: this.zlevel,
+ z: this.z + 1,
+ shape: {
+ cx: model.points[pointIndex].x + Math.sign(simpx - model.points[pointIndex].x) * model.width,
+ cy: model.points[pointIndex].y + Math.sign(simpy - model.points[pointIndex].y) * model.width,
+ r: model.width / 2 * 3 * Math.sqrt(2),
+ r0: model.width / 2 * 3,
+ startAngle: startAngle,
+ endAngle:endAngle,
+ clockwise: !(endAngle - startAngle > Math.PI)
+ },
+ style: {
+ fill: this.backgroundColor
+ }
+ });
+ const embellishSector2 = new Sector({
+ zlevel: this.zlevel,
+ z: this.z + 1,
+ shape: {
+ cx: model.points[pointIndex].x + Math.sign(simpx - model.points[pointIndex].x) * model.width,
+ cy: model.points[pointIndex].y + Math.sign(simpy - model.points[pointIndex].y) * model.width,
+ r: model.width,
+ r0: model.width / 2,
+ startAngle: startAngle,
+ endAngle: endAngle,
+ clockwise: !(endAngle - startAngle > Math.PI)
+ },
+ style: {
+ fill: model.lineColor
+ }
+ });
+ this.add(embellishSector1);
+ this.add(embellishSector2);
+ });
+ }
+ }
+
+ setState(model) {
+ }
+ getAnchorPoint() {
+ if (this.segment) {
+ const rect = this.segment.getBoundingRect();
+ return {x:rect.x, y:rect.y};
+ } else {
+ return {x:0, y:0};
+ }
+ }
+}
diff --git a/src/jmapNew/shape/nccGraph/StationCircle/index.js b/src/jmapNew/shape/nccGraph/StationCircle/index.js
new file mode 100644
index 000000000..e104c6a60
--- /dev/null
+++ b/src/jmapNew/shape/nccGraph/StationCircle/index.js
@@ -0,0 +1,48 @@
+import Group from 'zrender/src/container/Group';
+import Rect from 'zrender/src/graphic/shape/Rect';
+
+export default class StationCircle extends Group {
+ constructor(model, {style}) {
+ super();
+ this._code = model.code;
+ this._type = model._type;
+ this.zlevel = model.zlevel;
+ this.z = 9;
+ this.model = model;
+ this.style = style;
+ this.create();
+ this.setState(model);
+ }
+ create() {
+ const model = this.model;
+ if (!model.position) { return; }
+ this.rectBody = new Rect({
+ zlevel: this.zlevel,
+ z: this.z,
+ shape: {
+ r: [model.r],
+ x: model.position.x,
+ y: model.position.y,
+ width: model.width,
+ height: model.height
+ },
+ style: {
+ fill: model.fillColor,
+ stroke: model.lineColor,
+ lineWidth: model.lineWidth
+ }
+ });
+ this.add(this.rectBody);
+ }
+
+ setState(model) {
+ }
+ getAnchorPoint() {
+ if (this.rectBody) {
+ const rect = this.rectBody.getBoundingRect();
+ return {x:rect.x, y:rect.y};
+ } else {
+ return {x:this.model.position.x, y:this.model.position.y};
+ }
+ }
+}
diff --git a/src/jmapNew/shape/nccGraph/index.js b/src/jmapNew/shape/nccGraph/index.js
new file mode 100644
index 000000000..d25a5f8a7
--- /dev/null
+++ b/src/jmapNew/shape/nccGraph/index.js
@@ -0,0 +1,14 @@
+import nccGraphType from '../../constant/nccGraphType';
+
+import NccStation from './NccStation';
+import RunLine from './RunLine';
+import NccTrain from './NccTrain';
+import StationCircle from './StationCircle';
+/** 图库*/
+const mapShape = {};
+mapShape[nccGraphType.NccStation] = NccStation;
+mapShape[nccGraphType.RunLine] = RunLine;
+mapShape[nccGraphType.NccTrain] = NccTrain;
+mapShape[nccGraphType.StationCircle] = StationCircle;
+
+export default mapShape;
diff --git a/src/jmapNew/shape/systemGraph/Arrow/index.js b/src/jmapNew/shape/systemGraph/Arrow/index.js
deleted file mode 100644
index f9ce4b30d..000000000
--- a/src/jmapNew/shape/systemGraph/Arrow/index.js
+++ /dev/null
@@ -1,61 +0,0 @@
-import Group from 'zrender/src/container/Group';
-import Polygon from 'zrender/src/graphic/shape/Polygon';
-
-export default class Arrow extends Group {
- constructor(model, {style}) {
- super();
- this._code = model.code;
- this._type = model._type;
- this.zlevel = model.zlevel;
- this.z = 0;
- this.model = model;
- // this.style = style;
- this.isShowShape = true;
- this.create();
- this.setState(model);
- }
-
- create() {
- const model = this.model;
- this.arrow = new Polygon({
- zlevel: this.zlevel,
- z: this.z,
- origin: [model.position.x, model.position.y],
- rotation: -Math.PI / 180 * Number(model.rotate),
- shape: {
- points: [
- [model.position.x, model.position.y],
- [model.position.x + model.triangleLength, model.position.y - model.triangleHeight / 2],
- [model.position.x + model.triangleLength, model.position.y - model.lineWidth / 2],
- [model.position.x + model.length, model.position.y - model.lineWidth / 2],
- [model.position.x + model.length, model.position.y + model.lineWidth / 2],
- [model.position.x + model.triangleLength, model.position.y + model.lineWidth / 2],
- [model.position.x + model.triangleLength, model.position.y + model.triangleHeight / 2]
- ]
- },
- style: {
- fill: model.color
- }
- });
- this.add(this.arrow);
- }
-
- setState(model) {
- if (!this.isShowShape) return;
- }
-
- setShowStation(stationCode) {
- if (!stationCode || this.model.stationCode === stationCode) {
- this.show();
- this.isShowShape = true;
- this.setState(this.model);
- } else {
- this.hide();
- this.isShowShape = false;
- }
- }
- getAnchorPoint() {
- const rect = this.arrow.getBoundingRect();
- return { x:rect.x, y:rect.y };
- }
-}
diff --git a/src/jmapNew/shape/systemGraph/Line/index.js b/src/jmapNew/shape/systemGraph/Line/index.js
deleted file mode 100644
index 066448e02..000000000
--- a/src/jmapNew/shape/systemGraph/Line/index.js
+++ /dev/null
@@ -1,137 +0,0 @@
-import Group from 'zrender/src/container/Group';
-import Polyline from 'zrender/src/graphic/shape/Polyline';
-import Circle from 'zrender/src/graphic/shape/Circle';
-
-export default class Line2 extends Group {
- constructor(model, {style}) {
- super();
- this._code = model.code;
- this._type = model._type;
- this.zlevel = model.zlevel;
- this.z = 0;
- this.model = model;
- this.style = style.Line;
- this.isShowShape = true;
- this.create();
- this.setState(model);
- }
-
- create() {
- const model = this.model;
- if (model && model.points.length > 1) {
- const points = [];
- const vicePoints = [];
- const modelPoints = model.points;
- const length = modelPoints.length;
- const path = window.location.href;
- if (model.type === '03' && !path.includes('/map/draw')) {
- for (let i = 0; i < length; i++) {
- points.push([modelPoints[i].x + 10, modelPoints[i].y]);
- }
- this.segment = new Polyline({
- zlevel: this.zlevel,
- z:this.z,
- shape: {
- points:points
- },
- style: {
- lineWidth: model.width,
- stroke: model.lineColor || this.style.lineColor
- }
- });
- this.add(this.segment);
- for (let i = 0; i < length; i++) {
- vicePoints.push([modelPoints[i].x - model.offsetX, modelPoints[i].y + model.offsetY]);
- }
- this.viceSegment = new Polyline({
- zlevel: this.zlevel,
- z:this.z,
- shape: {
- points:vicePoints
- },
- style: {
- lineWidth: model.width,
- stroke: model.lineColor || this.style.lineColor
- }
- });
- this.add(this.viceSegment);
- } else {
- for (let i = 0; i < length; i++) {
- points.push([modelPoints[i].x, modelPoints[i].y]);
- }
- this.segment = new Polyline({
- zlevel: this.zlevel,
- z:this.z,
- shape: {
- points:points
- },
- style: {
- lineWidth: model.width,
- stroke: model.lineColor || this.style.lineColor
- }
- });
- this.add(this.segment);
- }
-
- if (model.pointShow) {
- let cx = model.points[0].x;
- let cy = model.points[0].y;
- if (model.directionPoint == 'right') {
- cx = model.points[model.points.length - 1].x;
- cy = model.points[model.points.length - 1].y;
- }
- this.mapCircle = new Circle({
- zlevel: model.zlevel,
- z: model.z,
- shape: {
- cx: cx,
- cy: cy,
- r: model.radiusWidth
- },
- style: {
- fill: model.lineColor || this.style.lineColor
- }
- });
- this.add(this.mapCircle);
- }
- }
- }
-
- setLineType(type) {
- switch (type) {
- case '01': break;
- case '02':
- this.segment && this.segment.setStyle('lineDash', this.style.lineDash || [4]);
- break;
- case '03':
- this.segment && this.segment.setStyle('lineDash', this.style.lineDash || [4]);
- this.viceSegment && this.viceSegment.setStyle('lineDash', this.style.lineDash || [4]);
- break;
- }
- }
-
- setState(model) {
- if (!this.isShowShape) return;
- this.setLineType(model.type);
- }
- setShowStation(stationCode) {
- if (!stationCode || this.model.stationCode === stationCode) {
- this.segment && this.segment.show();
- this.viceSegment && this.viceSegment.show();
- this.isShowShape = true;
- this.setState(this.model);
- } else {
- this.segment && this.segment.hide();
- this.viceSegment && this.viceSegment.hide();
- this.isShowShape = false;
- }
- }
- getAnchorPoint() {
- if (this.segment) {
- const rect = this.segment.getBoundingRect();
- return {x:rect.x, y:rect.y};
- } else {
- return {x:0, y:0};
- }
- }
-}
diff --git a/src/jmapNew/shape/systemGraph/Rect/index.js b/src/jmapNew/shape/systemGraph/Rect/index.js
deleted file mode 100644
index 41edfaf09..000000000
--- a/src/jmapNew/shape/systemGraph/Rect/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import Rect from 'zrender/src/graphic/shape/Rect';
-import Group from 'zrender/src/container/Group';
-import BoundingRect from 'zrender/src/core/BoundingRect';
-
-export default class Rect2 extends Group {
- constructor(model, {style, lineCode}) {
- super();
- this._code = model.code;
- this._type = model._type;
- this.name = model.code;
- this.zlevel = model.zlevel;
- this.model = model;
- this.style = style;
- this.z = 6;
- this.lineCode = lineCode;
- this.isShowShape = true;
- this.create();
- this.setState(model);
- }
-
- create() {
- var model = this.model;
-
- this.rectModel = new Rect({
- zlevel: this.zlevel,
- z: this.z,
- shape: {
- x: model.position.x,
- y: model.position.y,
- width: model.width,
- height: model.height
- },
- style: {
- fill: model.fillColor,
- lineWidth: model.lineWidth,
- stroke: model.lineColor
- }
- });
- this.add(this.rectModel);
- }
-
- setState(model) {
- if (!this.isShowShape) return;
- }
- getBoundingRect() {
- if (this.rectModel) {
- return this.rectModel.getBoundingRect().clone();
- } else {
- return new BoundingRect(this.model.position.x, this.model.position.y, 0, 0);
- }
- }
-
- setShowStation(stationCode) {
-
- }
- screenShow() {
-
- }
- getAnchorPoint() {
- return this.model.position;
- }
-}
diff --git a/src/jmapNew/shape/systemGraph/Text/index.js b/src/jmapNew/shape/systemGraph/Text/index.js
deleted file mode 100644
index 1504e7315..000000000
--- a/src/jmapNew/shape/systemGraph/Text/index.js
+++ /dev/null
@@ -1,82 +0,0 @@
-import Text from 'zrender/src/graphic/Text';
-import Group from 'zrender/src/container/Group';
-import BoundingRect from 'zrender/src/core/BoundingRect';
-
-export default class Text2 extends Group {
- constructor(model, {style, lineCode}) {
- super();
- this._code = model.code;
- this._type = model._type;
- this.name = model.code;
- this.zlevel = model.zlevel;
- this.model = model;
- this.style = style;
- this.z = 6;
- this.lineCode = lineCode;
- this.isBigScreen = false;
- this.create();
- this.setState(model);
- }
-
- create() {
- var model = this.model;
- var [direction, content] = model.content.split('::');
- if (direction == 'V') {
- content = content.split('').join('\n');
- } else if (direction != 'H') {
- content = model.content;
- }
-
- this.text = new Text({
- zlevel: this.zlevel,
- z: this.z,
- style: {
- x: model.position.x,
- y: model.position.y,
- text: content,
- fontFamily: this.style.fontFamily,
- fontSize: Number(model.font),
- textFill: model.fontColor,
- textAlign: 'middle'
- }
- });
- this.add(this.text);
- }
-
- setState(model) {
- if (this.isBigScreen) { this.screenShow(); }
- }
- getBoundingRect() {
- if (this.text) {
- return this.text.getBoundingRect().clone();
- } else {
- return new BoundingRect(this.model.position.x, this.model.position.y, 0, 0);
- }
- }
-
- setShowStation(stationCode) {
- if (!stationCode || this.model.stationCode === stationCode) {
- this.eachChild(item => {
- item.show();
- });
- this.isShowShape = true;
- this.setState(this.model);
- } else {
- this.eachChild(item => {
- item.hide();
- });
- this.isShowShape = false;
- }
- }
- screenShow() {
- this.isBigScreen = true;
- if (this.lineCode == '06') { // 宁波线路隐藏
- this.text && this.text.hide();
- } else {
- this.text && this.text.show();
- }
- }
- getAnchorPoint() {
- return this.model.position;
- }
-}
diff --git a/src/jmapNew/shape/systemGraph/index.js b/src/jmapNew/shape/systemGraph/index.js
deleted file mode 100644
index 69ea2220e..000000000
--- a/src/jmapNew/shape/systemGraph/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import systemGraphType from '../../constant/systemGraphType';
-
-import Line from './Line/index.js';
-import Text2 from './Text/index.js';
-import Rect2 from './Rect/index.js';
-import Arrow from './Arrow/index.js';
-
-/** 图库*/
-const mapShape = {};
-mapShape[systemGraphType.Line] = Line;
-mapShape[systemGraphType.Text] = Text2;
-mapShape[systemGraphType.Rect] = Rect2;
-mapShape[systemGraphType.Arrow] = Arrow;
-
-export default mapShape;
diff --git a/src/jmapNew/theme/chengdu_01/menus/menuBar.vue b/src/jmapNew/theme/chengdu_01/menus/menuBar.vue
index 3efb5f524..8eff247f6 100644
--- a/src/jmapNew/theme/chengdu_01/menus/menuBar.vue
+++ b/src/jmapNew/theme/chengdu_01/menus/menuBar.vue
@@ -72,7 +72,7 @@ import { mapGetters } from 'vuex';
import { TrainingMode } from '@/scripts/ConstDic';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { State2SimulationMap } from '@/scripts/cmdPlugin/Config';
-// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
+
import SystemLogin from './menuDialog/systemLogin';
import SystemLogout from './menuDialog/systemLogout';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
diff --git a/src/jmapNew/theme/chengdu_01/menus/menuSection.vue b/src/jmapNew/theme/chengdu_01/menus/menuSection.vue
index af230d5b0..a19530d0a 100644
--- a/src/jmapNew/theme/chengdu_01/menus/menuSection.vue
+++ b/src/jmapNew/theme/chengdu_01/menus/menuSection.vue
@@ -23,7 +23,7 @@ import { mapGetters } from 'vuex';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
-// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
+
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import LoadSpareTrain from '@/jmapNew/theme/components/menus/dialog/loadSpareTrain';
import { judgeStationControl } from '@/jmapNew/theme/components/utils/menuJudge.js';
diff --git a/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue b/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue
index 03f9ea685..1b6b4383c 100644
--- a/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue
+++ b/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue
@@ -16,7 +16,6 @@ import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
-// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { judgeStationControl } from '@/jmapNew/theme/components/utils/menuJudge.js';
diff --git a/src/jmapNew/theme/chengdu_01/menus/menuStationStand.vue b/src/jmapNew/theme/chengdu_01/menus/menuStationStand.vue
index 0448cc45f..65b78c9ce 100644
--- a/src/jmapNew/theme/chengdu_01/menus/menuStationStand.vue
+++ b/src/jmapNew/theme/chengdu_01/menus/menuStationStand.vue
@@ -16,7 +16,7 @@ import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
-// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
+
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { judgeStationControl } from '@/jmapNew/theme/components/utils/menuJudge.js';
diff --git a/src/jmapNew/theme/chengdu_01/menus/menuSwitch.vue b/src/jmapNew/theme/chengdu_01/menus/menuSwitch.vue
index f9d15ffc0..17c9cf380 100644
--- a/src/jmapNew/theme/chengdu_01/menus/menuSwitch.vue
+++ b/src/jmapNew/theme/chengdu_01/menus/menuSwitch.vue
@@ -21,7 +21,7 @@ import CancelMouseState from '@/mixin/CancelMouseState';
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
-// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
+
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { judgeStationControl } from '@/jmapNew/theme/components/utils/menuJudge.js';
diff --git a/src/jmapNew/theme/chengdu_01/menus/menuTrain.vue b/src/jmapNew/theme/chengdu_01/menus/menuTrain.vue
index 6ec4d1da9..da98b209e 100644
--- a/src/jmapNew/theme/chengdu_01/menus/menuTrain.vue
+++ b/src/jmapNew/theme/chengdu_01/menus/menuTrain.vue
@@ -14,8 +14,6 @@ import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault';
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
-// import CMD from '@/scripts/cmdPlugin/CommandEnum';
-// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import CancelMouseState from '@/mixin/CancelMouseState';
import SpeedLimit from '@/jmapNew/theme/components/menus/dialog/trainSpeedLimit';
import { menuOperate, commitOperate, commitTrainSend } from '@/jmapNew/theme/components/utils/menuOperate';
diff --git a/src/jmapNew/theme/chengdu_03/menus/dispatchWorkMenu.vue b/src/jmapNew/theme/chengdu_03/menus/dispatchWorkMenu.vue
index e3fda315d..ed43be196 100644
--- a/src/jmapNew/theme/chengdu_03/menus/dispatchWorkMenu.vue
+++ b/src/jmapNew/theme/chengdu_03/menus/dispatchWorkMenu.vue
@@ -58,7 +58,16 @@ export default {
mounted() {
this.$nextTick(() => {
this.$store.dispatch('config/updateMenuBar');
+ const _that = this;
+ window.onclick = function (e) {
+ if (!_that.$store.state.training.trainingStart) {
+ _that.$refs.menuBar && _that.$refs.menuBar.blankClickClose();
+ }
+ };
});
+ },
+ beforeDestroy() {
+ window.onclick = function (e) {};
}
};
diff --git a/src/jmapNew/theme/chengdu_03/menus/dispatchWorkMenuBar.vue b/src/jmapNew/theme/chengdu_03/menus/dispatchWorkMenuBar.vue
index 74c576be1..93aff0a39 100644
--- a/src/jmapNew/theme/chengdu_03/menus/dispatchWorkMenuBar.vue
+++ b/src/jmapNew/theme/chengdu_03/menus/dispatchWorkMenuBar.vue
@@ -372,6 +372,9 @@ export default {
this.$refs.helpAbout.doShow(operate);
}
});
+ },
+ blankClickClose() {
+ this.$refs.menuBar.doClose();
}
}
};
diff --git a/src/jmapNew/theme/chengdu_03/menus/localWorkMenu.vue b/src/jmapNew/theme/chengdu_03/menus/localWorkMenu.vue
index b3cb3a4df..f20200129 100644
--- a/src/jmapNew/theme/chengdu_03/menus/localWorkMenu.vue
+++ b/src/jmapNew/theme/chengdu_03/menus/localWorkMenu.vue
@@ -33,7 +33,16 @@ export default {
mounted() {
this.$nextTick(() => {
this.$store.dispatch('config/updateMenuBar');
+ const _that = this;
+ window.onclick = function (e) {
+ if (!_that.$store.state.training.trainingStart) {
+ _that.$refs.menuBar && _that.$refs.menuBar.blankClickClose();
+ }
+ };
});
+ },
+ beforeDestroy() {
+ window.onclick = function (e) {};
}
};
diff --git a/src/jmapNew/theme/chengdu_03/menus/localWorkMenuBar.vue b/src/jmapNew/theme/chengdu_03/menus/localWorkMenuBar.vue
index f6ecdebcf..34190d805 100644
--- a/src/jmapNew/theme/chengdu_03/menus/localWorkMenuBar.vue
+++ b/src/jmapNew/theme/chengdu_03/menus/localWorkMenuBar.vue
@@ -328,6 +328,9 @@ export default {
this.$refs.helpAbout.doShow(operate);
}
});
+ },
+ blankClickClose() {
+ this.$refs.menuBar.doClose();
}
}
};
diff --git a/src/jmapNew/theme/chengdu_03/menus/menuButton.vue b/src/jmapNew/theme/chengdu_03/menus/menuButton.vue
index 110f27288..88a7971fe 100644
--- a/src/jmapNew/theme/chengdu_03/menus/menuButton.vue
+++ b/src/jmapNew/theme/chengdu_03/menus/menuButton.vue
@@ -111,7 +111,7 @@
-
+
diff --git a/src/views/newMap/display/exam/examPanel.vue b/src/views/newMap/display/exam/examPanel.vue
index aefdee3dd..de048c977 100644
--- a/src/views/newMap/display/exam/examPanel.vue
+++ b/src/views/newMap/display/exam/examPanel.vue
@@ -94,6 +94,7 @@ export default {
const postData = {
puId: questionInfo.puId,
pqId: questionInfo.questionId,
+ group: this.$route.query.group,
type: 2,
subType: data.subType,
trainAnswerDetail: {
@@ -104,7 +105,7 @@ export default {
submitAnswer(postData).then(resp => {
this.$set(this.questionStateList[1], this.currentQuestionIndex, true);
- console.log(this.questionStateList, '----------------------------');
+ this.$store.dispatch('trainingNew/trainingEnd');
}).catch(() => {
this.$message.error('记录数据失败!');
});
diff --git a/src/views/newMap/display/exam/selectExam.vue b/src/views/newMap/display/exam/selectExam.vue
index cd39b7a07..5f8247928 100644
--- a/src/views/newMap/display/exam/selectExam.vue
+++ b/src/views/newMap/display/exam/selectExam.vue
@@ -86,6 +86,13 @@ export default {
});
},
start(row) {
+ if (this.$store.state.trainingNew.trainingSwitch) {
+ this.$message.error('请先结束当前实训后再加载新的考试!');
+ return;
+ }
+ if (this.$store.state.trainingNew.trainingDetail) {
+ this.$store.dispatch('trainingNew/setTrainingDetail', null);
+ }
generateExam(row.id)
.then(resp => {
getUserExamInfo(resp.data.id).then(res => {
diff --git a/src/views/newMap/display/exam/theoryQuestion.vue b/src/views/newMap/display/exam/theoryQuestion.vue
index 588558962..91a90283a 100644
--- a/src/views/newMap/display/exam/theoryQuestion.vue
+++ b/src/views/newMap/display/exam/theoryQuestion.vue
@@ -107,6 +107,7 @@ export default {
const data = {
puId: this.puId,
pqId: this.questionId,
+ group: this.$route.query.group,
type: 1,
subType: this.type,
answer: this.type === 2 ? this.questionData.answer : [this.questionData.answer]
diff --git a/src/views/newMap/display/index.vue b/src/views/newMap/display/index.vue
index 03ce0b51f..f4a5a05ce 100644
--- a/src/views/newMap/display/index.vue
+++ b/src/views/newMap/display/index.vue
@@ -13,6 +13,7 @@
+
+
diff --git a/src/views/newMap/display/simulationMenu/simulationMenu.vue b/src/views/newMap/display/simulationMenu/simulationMenu.vue
index fdfd2bc95..52de8e999 100644
--- a/src/views/newMap/display/simulationMenu/simulationMenu.vue
+++ b/src/views/newMap/display/simulationMenu/simulationMenu.vue
@@ -17,11 +17,10 @@
-
+