From 3da74652c52559d3d0780f1075b7707637a4795a Mon Sep 17 00:00:00 2001
From: ival <610568032@qq.com>
Date: Fri, 30 Aug 2019 09:00:36 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B4=BE=E7=8F=AD=E8=AE=A1?=
=?UTF-8?q?=E5=88=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/scheduling.js | 17 ++
src/api/simulation.js | 104 +---------
src/jmap/shape/Switch/EMouse.js | 6 +-
src/jmap/utils/parser.js | 3 -
src/views/demonstration/detail/index.vue | 69 ++++---
src/views/demonstration/list/demonList.vue | 1 -
src/views/display/demon/scheduling.vue | 223 +++++++++++++++------
src/views/display/index.vue | 17 +-
src/views/display/menuDemon.vue | 22 +-
src/views/display/menuSchema.vue | 7 +-
10 files changed, 258 insertions(+), 211 deletions(-)
create mode 100644 src/api/scheduling.js
diff --git a/src/api/scheduling.js b/src/api/scheduling.js
new file mode 100644
index 000000000..79d4312e1
--- /dev/null
+++ b/src/api/scheduling.js
@@ -0,0 +1,17 @@
+import request from '@/utils/request';
+
+export function querySecheduling(group, params) {
+ return request({
+ url: `/api/scheduling/${group}/day`,
+ method: 'get',
+ params
+ });
+}
+
+export function generateScheduling(group, params) {
+ return request({
+ url: `/api/scheduling/${group}/generate`,
+ method: 'post',
+ params
+ });
+}
diff --git a/src/api/simulation.js b/src/api/simulation.js
index 5c36b1eea..b8161a02d 100644
--- a/src/api/simulation.js
+++ b/src/api/simulation.js
@@ -160,14 +160,6 @@ export function getEveryDayRunPlanData(group) {
});
}
-/** 生成手机同步仿真二维码*/
-// export function getSimulationQrCodeUrl(group) {
-// return request({
-// url: `/api/simulation/${group}/qrCode`,
-// method: 'post'
-// });
-// }
-
/** 录制脚本仿真*/
export function scriptRecordNotify(scriptId) {
return request({
@@ -293,85 +285,6 @@ export function modifyScriptAction(group, actionId, data) {
});
}
-// /** 根据成员角色查询设备列表*/
-// export function getDevicesByRole(group, params) {
-// return request({
-// url: `/api/simulation/${group}/role/devices`,
-// method: 'get',
-// params
-// });
-// }
-// /** 获取任务录制的成员角色列表 */
-// export function getMembersByGroup(group) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/members`,
-// method: 'get'
-// });
-// }
-
-// /** 添加任务角色成员 */
-// export function postQuestMember(group, data) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/member`,
-// method: 'post',
-// data
-// });
-// }
-
-// /** 删除任务角色成员 */
-// export function deleteQuestMember(group, memberId) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/member/${memberId}`,
-// method: 'delete'
-// });
-// }
-
-// // /** 添加/修改任务角色行为 */
-// export function postMemberBehavior(group, memberId, data) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/${memberId}/behavior`,
-// method: 'post',
-// data
-// });
-// }
-// /** 删除任务角色行为 */
-// export function deleteMemberBehavior(group, memberId, behaviorId) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}`,
-// method: 'delete'
-// });
-// }
-// /** 删除任务角色行为动作 */
-// export function deleteMemberBehaviorAction(group, memberId, behaviorId, actionId) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action/${actionId}`,
-// method: 'delete'
-// });
-// }
-// /** 添加/修改任务角色行为动作 */
-// export function postMemberBehaviorAction(group, memberId, behaviorId, data) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action`,
-// method: 'post',
-// data
-// });
-// }
-// /** 添加/修改任务目标条件*/
-// export function postTargetConditionAction(group, data) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/targetCondition`,
-// method: 'post',
-// data
-// });
-// }
-// /** 删除任务目标条件*/
-// export function deleteTargetConditionAction(group, tcId) {
-// return request({
-// url: `/api/simulation/${group}/questRecord/targetCondition/${tcId}`,
-// method: 'delete'
-// });
-// }
-
/** 分页查询存在的仿真 */
export function getExistingSimulation(params) {
return request({
@@ -396,14 +309,6 @@ export function getDeviceCodeByDeviceType(group, params) {
params
});
}
-// /** 根据设备类型获取设备条件列表 */
-// export function getDeviceCoditionByDeviceType(params) {
-// return request({
-// url: `/api/simulation/deviceType/conditions`,
-// method: 'get',
-// params
-// });
-// }
/** 获取任务录制的数据 */
export function getScriptRecord(group) {
@@ -494,3 +399,12 @@ export function generateDayRunPlan(planId, group) {
method: 'post'
});
}
+
+/** 创建排班计划仿真*/
+export function schedulingNotify(params) {
+ return request({
+ url: `/api/scheduling/simulation`,
+ method: 'post',
+ params
+ });
+}
diff --git a/src/jmap/shape/Switch/EMouse.js b/src/jmap/shape/Switch/EMouse.js
index 8d5c9ba76..5ae837984 100644
--- a/src/jmap/shape/Switch/EMouse.js
+++ b/src/jmap/shape/Switch/EMouse.js
@@ -42,9 +42,9 @@ class EMouse extends Group {
// 创建道岔边框
craeteSwitchBorder() {
- const sectionA = this.device.model.sectionAInstance.instance;
- const sectionB = this.device.model.sectionBInstance.instance;
- const sectionC = this.device.model.sectionCInstance.instance;
+ const sectionA = this.getInstanceByCode(this.device.model.sectionACode);
+ const sectionB = this.getInstanceByCode(this.device.model.sectionBCode);
+ const sectionC = this.getInstanceByCode(this.device.model.sectionCCode);
const rect = this.device.getBoundingRect();
sectionA && rect.union(sectionA.getBoundingRect());
diff --git a/src/jmap/utils/parser.js b/src/jmap/utils/parser.js
index 4ecbb8788..02701778b 100644
--- a/src/jmap/utils/parser.js
+++ b/src/jmap/utils/parser.js
@@ -160,9 +160,6 @@ export function parser(data, skinCode) {
section['relSwitchCode'] = elem.code;
}
- mapDevice[elem.code]['sectionAInstance'] = cnodeSection;
- mapDevice[elem.code]['sectionBInstance'] = lnodeSection;
- mapDevice[elem.code]['sectionCInstance'] = rnodeSection;
rnodeSection['layer'] = -1;
}
}, this);
diff --git a/src/views/demonstration/detail/index.vue b/src/views/demonstration/detail/index.vue
index 10b24ee54..d793d6fdb 100644
--- a/src/views/demonstration/detail/index.vue
+++ b/src/views/demonstration/detail/index.vue
@@ -49,7 +49,7 @@ import { launchFullscreen } from '@/utils/screen';
import { queryPermissionSimulation } from '@/api/management/author';
import { postCreateRoom, getjointTraining, checkRoomExist } from '@/api/chat';
import { UrlConfig } from '@/router/index';
-import { simulationNotify } from '@/api/simulation';
+import { simulationNotify, schedulingNotify } from '@/api/simulation';
import localStore from 'storejs';
import LimitList from '@/views/components/limits/index';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
@@ -226,32 +226,37 @@ export default {
const query = { skinCode: this.courseModel.skinCode, group: this.jointGroup };
this.$router.push({ path: `/trainroom`, query: query });
},
- async start() {
- if (this.courseModel.prdType == '03') {
- try {
- this.buttonLoading = true;
- const param = {
- mapId: Number(this.mapId),
- prdCode: this.courseModel.prdCode
- };
- const res = await postCreateRoom(param);
- if (res && res.code == 200) {
- const query = { skinCode: this.courseModel.skinCode, group: res.data };
- this.$router.push({ path: `/trainroom`, query: query });
- }
- } catch (error) {
- this.buttonLoading = false;
- if (error.code == 20001) {
- this.$confirm(this.$t('tip.createRoomFailedHint'), this.$t('global.tips'), {
- confirmButtonText: this.$t('global.confirm'),
- cancelButtonText: this.$t('global.cancel'),
- type: 'warning'
- }).then(() => {}).catch(() => {});
- }
- if (error.code == 500009) {
- this.$messageBox(error.message);
- }
+ async createRoom() {
+ try {
+ this.buttonLoading = true;
+ const param = {
+ mapId: Number(this.mapId),
+ prdCode: this.courseModel.prdCode
+ };
+ const res = await postCreateRoom(param);
+ if (res && res.code == 200) {
+ const query = { skinCode: this.courseModel.skinCode, group: res.data };
+ this.$router.push({ path: `/trainroom`, query: query });
}
+ } catch (error) {
+ this.buttonLoading = false;
+ if (error.code == 20001) {
+ this.$confirm(this.$t('tip.createRoomFailedHint'), this.$t('global.tips'), {
+ confirmButtonText: this.$t('global.confirm'),
+ cancelButtonText: this.$t('global.cancel'),
+ type: 'warning'
+ }).then(() => {}).catch(() => {});
+ }
+ if (error.code == 500009) {
+ this.$messageBox(error.message);
+ }
+ }
+ },
+ async start() {
+ if (this.courseModel.prdType == '05') {
+ this.jumpScheduling();
+ } else if (this.courseModel.prdType == '03') {
+ this.createRoom();
} else {
if (this.courseModel.pmsList.length) {
this.jump();
@@ -270,6 +275,18 @@ export default {
}
}
},
+ jumpScheduling() {
+ this.buttonLoading = true;
+ const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
+ schedulingNotify(data).then(resp => {
+ const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
+ this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
+ launchFullscreen();
+ }).catch(error => {
+ this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
+ this.buttonLoading = false;
+ });
+ },
jump() {
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
this.buttonLoading = true;
diff --git a/src/views/demonstration/list/demonList.vue b/src/views/demonstration/list/demonList.vue
index f12cda4b4..dddbcdc18 100644
--- a/src/views/demonstration/list/demonList.vue
+++ b/src/views/demonstration/list/demonList.vue
@@ -113,7 +113,6 @@ export default {
}
this.$nextTick(() => {
const mapId = getSessionStorage('demonList') || null;
- console.log(mapId);
this.$refs.tree.setCurrentKey(mapId);
this.loading = false;
});
diff --git a/src/views/display/demon/scheduling.vue b/src/views/display/demon/scheduling.vue
index 9beeead96..17793bf69 100644
--- a/src/views/display/demon/scheduling.vue
+++ b/src/views/display/demon/scheduling.vue
@@ -1,110 +1,205 @@