From 0489cf2fd3941f24c290ceefd16f5063567f516b Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 30 Oct 2019 11:18:41 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=9A/api/map/{skinCode}/train?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/jmap/map.js | 8 - .../batong_01/menus/dialog/trainControl.vue | 708 ++++++----- .../batong_01/menus/dialog/trainCreate.vue | 275 ++--- .../beijing_01/menus/dialog/trainCreate.vue | 276 ++--- .../chengdu_03/menus/dialog/trainControl.vue | 444 ++++--- .../chengdu_03/menus/dialog/trainCreate.vue | 212 ++-- .../menus/dialog/trainCreateNumber.vue | 304 ++--- .../menus/dialog/trainDeleteNumber.vue | 296 ++--- .../menus/dialog/trainDetailInfo.vue | 1 - .../menus/dialog/trainEditNumber.vue | 220 ++-- .../menus/dialog/trainMoveNumber.vue | 332 ++--- .../fuzhou_01/menus/dialog/trainControl.vue | 737 ++++++------ .../fuzhou_01/menus/dialog/trainCreate.vue | 213 ++-- .../fuzhou_01/menus/dialog/trainSwitch.vue | 218 ++-- src/store/modules/map.js | 1064 ++++++++--------- src/utils/loaddata.js | 108 +- src/views/lesson/trainingrecord/index.vue | 128 +- .../lesson/trainingrecord/manage/index.vue | 176 +-- 18 files changed, 2845 insertions(+), 2875 deletions(-) diff --git a/src/api/jmap/map.js b/src/api/jmap/map.js index d119c6220..470baf5f1 100644 --- a/src/api/jmap/map.js +++ b/src/api/jmap/map.js @@ -49,14 +49,6 @@ export function getPublishMapDetailById(id) { }); } -/** 获取发布地图列车列表*/ -export function getPublishTrainList(skinCode) { - return request({ - url: `/api/map/${skinCode}/train`, - method: 'get' - }); -} - /** 获取发布地图列表*/ export function listPublishMap(params) { return request({ diff --git a/src/jmap/theme/batong_01/menus/dialog/trainControl.vue b/src/jmap/theme/batong_01/menus/dialog/trainControl.vue index 14842059e..4337f3708 100644 --- a/src/jmap/theme/batong_01/menus/dialog/trainControl.vue +++ b/src/jmap/theme/batong_01/menus/dialog/trainControl.vue @@ -82,383 +82,375 @@ diff --git a/src/jmap/theme/batong_01/menus/dialog/trainCreate.vue b/src/jmap/theme/batong_01/menus/dialog/trainCreate.vue index 755bc5736..b21f55dc9 100644 --- a/src/jmap/theme/batong_01/menus/dialog/trainCreate.vue +++ b/src/jmap/theme/batong_01/menus/dialog/trainCreate.vue @@ -1,155 +1,160 @@ \ No newline at end of file +}; + diff --git a/src/jmap/theme/beijing_01/menus/dialog/trainCreate.vue b/src/jmap/theme/beijing_01/menus/dialog/trainCreate.vue index 8d1c70e2d..c201c17f7 100644 --- a/src/jmap/theme/beijing_01/menus/dialog/trainCreate.vue +++ b/src/jmap/theme/beijing_01/menus/dialog/trainCreate.vue @@ -1,151 +1,155 @@ \ No newline at end of file +}; + diff --git a/src/jmap/theme/chengdu_03/menus/dialog/trainControl.vue b/src/jmap/theme/chengdu_03/menus/dialog/trainControl.vue index 5e1fc5612..e4e95d303 100644 --- a/src/jmap/theme/chengdu_03/menus/dialog/trainControl.vue +++ b/src/jmap/theme/chengdu_03/menus/dialog/trainControl.vue @@ -97,241 +97,233 @@ diff --git a/src/views/jointTraining/index.vue b/src/views/jointTraining/index.vue index 81fee4a96..8d8a2aef2 100644 --- a/src/views/jointTraining/index.vue +++ b/src/views/jointTraining/index.vue @@ -37,7 +37,7 @@ import IbpPlate from '@/views/ibp/index'; import { mapGetters } from 'vuex'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { checkLoginLine } from '@/api/login'; -import { loadMapData } from '@/utils/loaddata'; +import { loadMapDataById } from '@/utils/loaddata'; import { getUserRoles, deljointTrainRoom } from '@/api/chat'; import { runDiagramOver, getSimulationInfo } from '@/api/simulation'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; @@ -46,345 +46,345 @@ import ibpData from '@/ibp/constant/ibpData'; import { Message } from 'element-ui'; export default { - name: 'JointTrainingDraft', - components: { - MapSystemDraft, - MenuDemonJoint, - MenuDemonSchema, - JoinFaultChoose, - JoinRunPlanLoad, - JoinRunPlanView, - menuSystemTime, - Jl3dDrive, - IbpPlate - }, - data() { - return { - trainingObj: {}, - checkLine: null, - timeDemonNum: 0, - offset: 10, - mouseNum: 1, - ierval: null, - mouseNumTime: 0, - mapBox: null, - mapBoxP: null, - userRole: '', - deviceCode: '', - group: '', - mapId: '', - skinCode: '', - simulationShow: false, - drivingShow: false, - ibpShow: false, - panelShow: true, - ibpPart: '' - }; - }, - computed: { - ...mapGetters([ - 'canvasWidth', - 'canvasHeight' - ]), - ...mapGetters('map', [ - 'map' - ]), - ...mapGetters('training', [ - 'offsetStationCode' - ]), - ...mapGetters('config', [ - 'canvasId' - ]), - width() { - return this.$store.state.app.width; - }, - height() { - return this.$store.state.app.height; - }, - right() { - return this.$store.state.config.width / 2 - 55; - } - }, - watch: { - '$store.state.config.menuBarLoadedCount': function (val) { - this.setPosition(); - }, - '$store.state.map.mapViewLoadedCount': function (val) { - this.mapBoxP = document.getElementById(this.canvasId).children[0]; - this.mapBox = document.getElementsByTagName('canvas'); - }, - '$store.state.socket.permissionOver': function () { - this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), { - confirmButtonText: this.$t('global.confirm'), - showClose: false, - callback: async (action) => { - await this.$store.dispatch('training/over'); - await runDiagramOver(this.group); - await deljointTrainRoom(this.group); - await this.$router.push({ path: `/trainingPlatform/detail/${this.subSystem}`, query: {mapId: this.mapId} }); - } - }); - }, - '$store.state.socket.jointRoomInfo': function (val) { // 综合演练房间信息 - if (val.creatorId) { - this.handleRoomInfo(val); - } - }, - '$store.state.socket.chatContentList': function (val) { // 综合演练被踢出房间 - if (val.type === 'userRoomKickOut'&&val.oneself) { - this.$router.push({ path: `/` }); - this.messageInfo(this.$t('tip.beKickedOut'), 'warning'); - } - }, - '$store.state.app.windowSizeCount': function() { - this.setWindowSize(); - }, - $route() { - this.$nextTick(() => { - this.initLoadData(); - }); - } - }, - async created() { - this.group = this.$route.query.group; - this.mapId = this.$route.query.mapId; - this.skinCode = this.$route.query.skinCode; - this.subSystem = this.$route.query.subSystem; - Message.closeAll(); - }, - async mounted() { - await this.setWindowSize(); - await this.initLoadData(); - }, - async beforeDestroy() { - await this.clearAllTimer(); - await this.$store.dispatch('training/end', null); - await this.$store.dispatch('training/reset'); - await this.$store.dispatch('map/mapClear'); - await this.$store.dispatch('training/setGroup', ''); - Message.closeAll(); - }, - methods: { - mousemove(e) { - this.mouseNum = 1; - }, - handleRoomInfo(data) { - if (data.state == '03') { // 退出房间 - this.$router.push({ path: `/` }); - // this.clearSubscribe(); - } else if (data.state == '01') { // 进入准备中 - const query = { group: this.group }; - this.$router.push({ path: `/trainroom`, query: query }); - // this.clearSubscribe(); - } - this.$store.dispatch('socket/setJointRoomInfo'); // 清空房间信息 - }, - // 清除检查在线定时器 - clearAllTimer() { - if (this.ierval) { - clearTimeout(this.ierval); - this.ierval = null; - } + name: 'JointTrainingDraft', + components: { + MapSystemDraft, + MenuDemonJoint, + MenuDemonSchema, + JoinFaultChoose, + JoinRunPlanLoad, + JoinRunPlanView, + menuSystemTime, + Jl3dDrive, + IbpPlate + }, + data() { + return { + trainingObj: {}, + checkLine: null, + timeDemonNum: 0, + offset: 10, + mouseNum: 1, + ierval: null, + mouseNumTime: 0, + mapBox: null, + mapBoxP: null, + userRole: '', + deviceCode: '', + group: '', + mapId: '', + skinCode: '', + simulationShow: false, + drivingShow: false, + ibpShow: false, + panelShow: true, + ibpPart: '' + }; + }, + computed: { + ...mapGetters([ + 'canvasWidth', + 'canvasHeight' + ]), + ...mapGetters('map', [ + 'map' + ]), + ...mapGetters('training', [ + 'offsetStationCode' + ]), + ...mapGetters('config', [ + 'canvasId' + ]), + width() { + return this.$store.state.app.width; + }, + height() { + return this.$store.state.app.height; + }, + right() { + return this.$store.state.config.width / 2 - 55; + } + }, + watch: { + '$store.state.config.menuBarLoadedCount': function (val) { + this.setPosition(); + }, + '$store.state.map.mapViewLoadedCount': function (val) { + this.mapBoxP = document.getElementById(this.canvasId).children[0]; + this.mapBox = document.getElementsByTagName('canvas'); + }, + '$store.state.socket.permissionOver': function () { + this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), { + confirmButtonText: this.$t('global.confirm'), + showClose: false, + callback: async (action) => { + await this.$store.dispatch('training/over'); + await runDiagramOver(this.group); + await deljointTrainRoom(this.group); + await this.$router.push({ path: `/trainingPlatform/detail/${this.subSystem}`, query: {mapId: this.mapId} }); + } + }); + }, + '$store.state.socket.jointRoomInfo': function (val) { // 综合演练房间信息 + if (val.creatorId) { + this.handleRoomInfo(val); + } + }, + '$store.state.socket.chatContentList': function (val) { // 综合演练被踢出房间 + if (val.type === 'userRoomKickOut' && val.oneself) { + this.$router.push({ path: `/` }); + this.messageInfo(this.$t('tip.beKickedOut'), 'warning'); + } + }, + '$store.state.app.windowSizeCount': function() { + this.setWindowSize(); + }, + $route() { + this.$nextTick(() => { + this.initLoadData(); + }); + } + }, + async created() { + this.group = this.$route.query.group; + this.mapId = this.$route.query.mapId; + this.skinCode = this.$route.query.skinCode; + this.subSystem = this.$route.query.subSystem; + Message.closeAll(); + }, + async mounted() { + await this.setWindowSize(); + await this.initLoadData(); + }, + async beforeDestroy() { + await this.clearAllTimer(); + await this.$store.dispatch('training/end', null); + await this.$store.dispatch('training/reset'); + await this.$store.dispatch('map/mapClear'); + await this.$store.dispatch('training/setGroup', ''); + Message.closeAll(); + }, + methods: { + mousemove(e) { + this.mouseNum = 1; + }, + handleRoomInfo(data) { + if (data.state == '03') { // 退出房间 + this.$router.push({ path: `/` }); + // this.clearSubscribe(); + } else if (data.state == '01') { // 进入准备中 + const query = { group: this.group }; + this.$router.push({ path: `/trainroom`, query: query }); + // this.clearSubscribe(); + } + this.$store.dispatch('socket/setJointRoomInfo'); // 清空房间信息 + }, + // 清除检查在线定时器 + clearAllTimer() { + if (this.ierval) { + clearTimeout(this.ierval); + this.ierval = null; + } - if (this.checkLine) { - clearTimeout(this.checkLine); - this.checkLine = null; - } - }, - // 设置检查在线定时器 - checkLoginLineTimer() { - if (this.checkLine) { - clearTimeout(this.checkLine); - } + if (this.checkLine) { + clearTimeout(this.checkLine); + this.checkLine = null; + } + }, + // 设置检查在线定时器 + checkLoginLineTimer() { + if (this.checkLine) { + clearTimeout(this.checkLine); + } - this.checkLine = setInterval(() => { - checkLoginLine(); - }, 5000 * 60); - }, - // 设置手标显示状态 - checkMouseStatusTimer() { - if (this.ierval) { - clearTimeout(this.ierval); - } + this.checkLine = setInterval(() => { + checkLoginLine(); + }, 5000 * 60); + }, + // 设置手标显示状态 + checkMouseStatusTimer() { + if (this.ierval) { + clearTimeout(this.ierval); + } - this.ierval = setInterval(() => { - if (this.mouseNum) { - this.mouseNum = 0; - this.mouseNumTime = 0; - } else { - this.mouseNumTime += 1; - } - if (this.mapBox) { - if (this.mouseNumTime >= 15) { - for (let i = 0; i < this.mapBox.length; i++) { - this.mapBox[i].style.cursor = 'none'; - } - } else { - for (let i = 0; i < this.mapBox.length; i++) { - this.mapBox[i].style.cursor = ''; - } - } - } - }, 1000); - }, - // 设置菜单和工具栏位置 - setPosition() { - this.$nextTick(() => { - let offset = 10; - const menuBar = document.getElementById('menuBar'); - const menuTool = document.getElementById('menuTool'); + this.ierval = setInterval(() => { + if (this.mouseNum) { + this.mouseNum = 0; + this.mouseNumTime = 0; + } else { + this.mouseNumTime += 1; + } + if (this.mapBox) { + if (this.mouseNumTime >= 15) { + for (let i = 0; i < this.mapBox.length; i++) { + this.mapBox[i].style.cursor = 'none'; + } + } else { + for (let i = 0; i < this.mapBox.length; i++) { + this.mapBox[i].style.cursor = ''; + } + } + } + }, 1000); + }, + // 设置菜单和工具栏位置 + setPosition() { + this.$nextTick(() => { + let offset = 10; + const menuBar = document.getElementById('menuBar'); + const menuTool = document.getElementById('menuTool'); - if (menuBar) { - offset += (menuBar.offsetHeight || 0); - } + if (menuBar) { + offset += (menuBar.offsetHeight || 0); + } - if (menuTool) { - offset += (menuTool.offsetHeight || 0); - } + if (menuTool) { + offset += (menuTool.offsetHeight || 0); + } - if (this.offset != offset) { - this.offset = offset; - } - }); - }, - // 结束加载状态 - endViewLoading(isSuccess) { - if (!isSuccess) { - this.$store.dispatch('map/mapClear'); - } + if (this.offset != offset) { + this.offset = offset; + } + }); + }, + // 结束加载状态 + endViewLoading(isSuccess) { + if (!isSuccess) { + this.$store.dispatch('map/mapClear'); + } - this.$nextTick(() => { - EventBus.$emit('viewLoading', false); - }); - }, - // 加载地图数据 - initLoadData() { - const width = document.documentElement.clientWidth; - const height = document.documentElement.clientHeight + 200; - this.$store.dispatch('config/resize', { width, height }); + this.$nextTick(() => { + EventBus.$emit('viewLoading', false); + }); + }, + // 加载地图数据 + initLoadData() { + const width = document.documentElement.clientWidth; + const height = document.documentElement.clientHeight + 200; + this.$store.dispatch('config/resize', { width, height }); - try { - this.loadSimulationInfo(); - this.initLoadDemonData(); - this.checkLoginLineTimer(); - this.checkMouseStatusTimer(); - } catch (error) { - this.$messageBox( this.$t('error.initializationFailed') + error.message); - this.endViewLoading(); - } - }, - async loadSimulationInfo() { - const resp = await getSimulationInfo(this.group); - if (resp && resp.code == 200) { - this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); - this.questId = Number(resp.data.questId) || 0; - } - }, - async getUserRole() { - const res = await getUserRoles(this.group); - this.userRole = res.data.userRole; - this.deviceCode = res.data.deviceCode; - this.ibpPart = res.data.ibpPart; - if (this.userRole === 'IBP') { - this.showIbp(this.deviceCode); - } else { - this.hideIbp(); - } - return res; - }, - // 仿真系统 - async initLoadDemonData() { - this.$store.dispatch('training/end', TrainingMode.NORMAL); - this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // 默认为正常模式 + try { + this.loadSimulationInfo(); + this.initLoadDemonData(); + this.checkLoginLineTimer(); + this.checkMouseStatusTimer(); + } catch (error) { + this.$messageBox( this.$t('error.initializationFailed') + error.message); + this.endViewLoading(); + } + }, + async loadSimulationInfo() { + const resp = await getSimulationInfo(this.group); + if (resp && resp.code == 200) { + this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); + this.questId = Number(resp.data.questId) || 0; + } + }, + async getUserRole() { + const res = await getUserRoles(this.group); + this.userRole = res.data.userRole; + this.deviceCode = res.data.deviceCode; + this.ibpPart = res.data.ibpPart; + if (this.userRole === 'IBP') { + this.showIbp(this.deviceCode); + } else { + this.hideIbp(); + } + return res; + }, + // 仿真系统 + async initLoadDemonData() { + this.$store.dispatch('training/end', TrainingMode.NORMAL); + this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // 默认为正常模式 - if (this.skinCode) { - // 01 现地 02 行调 '' 观众 - const resp = await this.getUserRole(); - if (resp && resp.code == 200) { - // Admin 管理员 Instructor 教员 Dispatcher 行调 Attendant 车站 Audience 观众 Driver 司机 Repair 通号 IBP:IBP盘 - this.userRole = resp.data.userRole; - switch (this.userRole) { - case 'Admin': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Admin'); this.hideIbp(); break; - case 'Instructor': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Instructor'); this.hideIbp(); break; - case 'Dispatcher': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Dispatcher'); this.hideIbp(); break; - case 'Attendant': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'Attendant'); this.hideIbp(); break; - case 'Audience': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Audience'); this.hideIbp(); break; - case 'Driver': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Driver'); this.hideIbp(); break; - case 'Repair': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Repair'); this.hideIbp(); break; - case 'IBP': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.showIbp(resp.data.deviceCode); break; - case 'BigScreen': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BigScreen'); this.hideIbp(); break; - } - } - await this.getTrainDetail(this.skinCode); - } else { - this.endViewLoading(); - } - }, - async getTrainDetail(skinCode) { - try { - await loadMapData(skinCode); - await this.$store.dispatch('training/setMapDefaultState'); - } catch (error) { - this.$messageBox(this.$t('error.getMapDataFailed')); - this.endViewLoading(); - } - }, - back() { - this.$refs.demonMenu.back(); - }, - runPlanViewShow() { - this.$refs.runPlanView.doShow(); - }, - runPlanLoadShow() { - this.$refs.runPlanLoad.doShow(); - }, - faultChooseShow() { - this.$refs.faultChoose.doShow(); - }, - showdriving() { - this.panelShow = true; - this.drivingShow = false; - this.ibpShow =false; - }, - showIbp(deviceCode) { - this.drivingShow = false; - this.panelShow = false; - this.ibpShow = true; - if (!deviceCode || !ibpData[deviceCode]) { - Message.warning({message: this.$t('error.ibpNoDraw'), duration: 0, showClose: true, type: 'error'}); - return; - } else { - Message.closeAll(); - } - this.$refs.ibpPlate.show(deviceCode, this.ibpPart); - }, - hidepanel() { - this.panelShow = false; - this.drivingShow = true; - this.ibpShow = false; - this.$refs.Jl3dDrive.show(this.skinCode); - }, - hideIbp() { - Message.closeAll(); - this.drivingShow = false; - this.panelShow = true; - this.ibpShow = false; - this.$refs.ibpPlate.ibpDestroy(); - }, - messageInfo(message, type) { - this.$message({ - showClose: true, - message: message, - type: type - }); - }, - setWindowSize() { - this.$nextTick(() => { - this.$store.dispatch('config/resize', { width: this.width, height: this.height }); - this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode }); - }); - } - } + if (this.skinCode) { + // 01 现地 02 行调 '' 观众 + const resp = await this.getUserRole(); + if (resp && resp.code == 200) { + // Admin 管理员 Instructor 教员 Dispatcher 行调 Attendant 车站 Audience 观众 Driver 司机 Repair 通号 IBP:IBP盘 + this.userRole = resp.data.userRole; + switch (this.userRole) { + case 'Admin': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Admin'); this.hideIbp(); break; + case 'Instructor': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Instructor'); this.hideIbp(); break; + case 'Dispatcher': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Dispatcher'); this.hideIbp(); break; + case 'Attendant': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'Attendant'); this.hideIbp(); break; + case 'Audience': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Audience'); this.hideIbp(); break; + case 'Driver': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Driver'); this.hideIbp(); break; + case 'Repair': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Repair'); this.hideIbp(); break; + case 'IBP': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.showIbp(resp.data.deviceCode); break; + case 'BigScreen': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BigScreen'); this.hideIbp(); break; + } + } + await this.getTrainDetail(); + } else { + this.endViewLoading(); + } + }, + async getTrainDetail() { + try { + await loadMapDataById(this.mapId); + await this.$store.dispatch('training/setMapDefaultState'); + } catch (error) { + this.$messageBox(this.$t('error.getMapDataFailed')); + this.endViewLoading(); + } + }, + back() { + this.$refs.demonMenu.back(); + }, + runPlanViewShow() { + this.$refs.runPlanView.doShow(); + }, + runPlanLoadShow() { + this.$refs.runPlanLoad.doShow(); + }, + faultChooseShow() { + this.$refs.faultChoose.doShow(); + }, + showdriving() { + this.panelShow = true; + this.drivingShow = false; + this.ibpShow = false; + }, + showIbp(deviceCode) { + this.drivingShow = false; + this.panelShow = false; + this.ibpShow = true; + if (!deviceCode || !ibpData[deviceCode]) { + Message.warning({message: this.$t('error.ibpNoDraw'), duration: 0, showClose: true, type: 'error'}); + return; + } else { + Message.closeAll(); + } + this.$refs.ibpPlate.show(deviceCode, this.ibpPart); + }, + hidepanel() { + this.panelShow = false; + this.drivingShow = true; + this.ibpShow = false; + this.$refs.Jl3dDrive.show(this.skinCode); + }, + hideIbp() { + Message.closeAll(); + this.drivingShow = false; + this.panelShow = true; + this.ibpShow = false; + this.$refs.ibpPlate.ibpDestroy(); + }, + messageInfo(message, type) { + this.$message({ + showClose: true, + message: message, + type: type + }); + }, + setWindowSize() { + this.$nextTick(() => { + this.$store.dispatch('config/resize', { width: this.width, height: this.height }); + this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode }); + }); + } + } }; From 4918c78204f43f10b3b5f73a8df87dd61e759ce5 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 30 Oct 2019 16:50:35 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=9A/api/runPlan/draft/station/{skinCode}/bySkin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/jmap/lessondraft.js | 122 ++- src/api/runplan.js | 416 +++++----- .../beijing_01/menusPlan/createTodayPlan.vue | 233 +++--- .../chengdu_03/menusPlan/createTodayPlan.vue | 235 +++--- .../chengdu_04/menusPlan/createTodayPlan.vue | 233 +++--- .../fuzhou_01/menusPlan/createTodayPlan.vue | 233 +++--- src/views/display/menuSchema.vue | 288 +++---- src/views/jointTraining/menuSchema.vue | 219 +++--- src/views/map/runplan/chart.vue | 708 +++++++++--------- src/views/planMonitor/editTool/schedule.vue | 4 +- src/views/publish/runPlanTemplate/index.vue | 334 ++++----- 11 files changed, 1506 insertions(+), 1519 deletions(-) diff --git a/src/api/jmap/lessondraft.js b/src/api/jmap/lessondraft.js index 23b7c3322..a199cbb53 100644 --- a/src/api/jmap/lessondraft.js +++ b/src/api/jmap/lessondraft.js @@ -2,111 +2,103 @@ import request from '@/utils/request'; /** 获取课程树*/ export function getLessonTree(skinCode) { - return request({ - url: `/api/lessonDraft/${skinCode}/tree`, - method: 'get' - }); + return request({ + url: `/api/lessonDraft/${skinCode}/tree`, + method: 'get' + }); } /** 获取课程详细内容*/ export function getLessonDetail(data) { - return request({ - url: `/api/lessonDraft/${data.id}`, - method: 'get' - }); + return request({ + url: `/api/lessonDraft/${data.id}`, + method: 'get' + }); } /** 创建课程*/ export function createLesson(data) { - return request({ - url: '/api/lessonDraft', - method: 'post', - data: data - }); + return request({ + url: '/api/lessonDraft', + method: 'post', + data: data + }); } /** 从发布课程创建*/ export function createLessonFromPublish(data) { - return request({ - url: '/api/lessonDraft/createForm', - method: 'post', - data: data - }); + return request({ + url: '/api/lessonDraft/createForm', + method: 'post', + data: data + }); } /** 更新课程*/ export function updateLesson(data) { - return request({ - url: `/api/lessonDraft/${data.id}`, - method: 'put', - data: data - }); + return request({ + url: `/api/lessonDraft/${data.id}`, + method: 'put', + data: data + }); } /** 删除课程*/ export function delLesson(data) { - return request({ - url: `/api/lessonDraft/${data.id}`, - method: 'delete', - data: data - }); + return request({ + url: `/api/lessonDraft/${data.id}`, + method: 'delete', + data: data + }); } /** 创建课程章节*/ export function createLessonChapter(data) { - return request({ - url: `/api/lessonDraft/${data.lessonId}/chapter`, - method: 'post', - data: data - }); + return request({ + url: `/api/lessonDraft/${data.lessonId}/chapter`, + method: 'post', + data: data + }); } /** 更新课程章节*/ export function updateLessonChapter(data) { - return request({ - url: `/api/lessonDraft/chapter/${data.id}`, - method: 'put', - data: data - }); + return request({ + url: `/api/lessonDraft/chapter/${data.id}`, + method: 'put', + data: data + }); } /** 创建课程章节详细内容*/ export function getLessonChapterDetail(data) { - return request({ - url: `/api/lessonDraft/chapter/${data.id}`, - method: 'get' - }); + return request({ + url: `/api/lessonDraft/chapter/${data.id}`, + method: 'get' + }); } /** 发布课程*/ export function publishLesson(data) { - return request({ - url: `/api/lessonDraft/${data.id}/publish`, - method: 'post', - data: data - }); + return request({ + url: `/api/lessonDraft/${data.id}/publish`, + method: 'post', + data: data + }); } /** 课程章节拖拽排序*/ export function dragSortLessonChapter(data) { - return request({ - url: '/api/lessonDraft/dragSort', - method: 'put', - data: data - }); -} - -/** 根据lessonId获取课程名称*/ -export function getLessonNameByMapIdAndLessonId(model) { - return request({ - url: `/api/lessonDraft/${model.mapId}/${model.lessonId}`, - method: 'get' - }); + return request({ + url: '/api/lessonDraft/dragSort', + method: 'put', + data: data + }); } export function getLessonDrftList(params) { - return request({ - url: `/api/lessonDraft`, - method: 'get', - params: params - }); + return request({ + url: `/api/lessonDraft`, + method: 'get', + params: params + }); } diff --git a/src/api/runplan.js b/src/api/runplan.js index b2235dfb0..8ef1d184b 100644 --- a/src/api/runplan.js +++ b/src/api/runplan.js @@ -4,317 +4,307 @@ import request from '@/utils/request'; * 获取运行图列表 */ export function getRunPlanList() { - return request({ - url: '/api/runPlan/draft/tree', - method: 'get' - }); + return request({ + url: '/api/runPlan/draft/tree', + method: 'get' + }); } /** * 获取地图速度等级列表 */ export function getSpeedLevels(skinCode) { - return request({ - url: `/api/runPlan/draft/${skinCode}/speed`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${skinCode}/speed`, + method: 'get' + }); } /** * 新建地图速度等级列表 */ export function newSpeedLevels(data) { - return request({ - url: '/api/runPlan/draft/speed', - method: 'post', - data: data - }); + return request({ + url: '/api/runPlan/draft/speed', + method: 'post', + data: data + }); } /** * 获取运行图的车站列表 */ export function getStationList(mapId) { - return request({ - url: `/api/runPlan/draft/station/${mapId}`, - method: 'get' - }); -} - -/** - * 通过皮肤获取运行图车站列表 - */ -export function getStationListBySkinCode(skinCode) { - return request({ - url: `/api/runPlan/draft/station/${skinCode}/bySkin`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/station/${mapId}`, + method: 'get' + }); } /** * 创建运行图 */ export function newRunPlan(data) { - return request({ - url: '/api/runPlan/draft', - method: 'post', - data: data - }); + return request({ + url: '/api/runPlan/draft', + method: 'post', + data: data + }); } /** * 查询运行图获取数据 */ export function queryRunPlan(planId) { - return request({ - url: `/api/runPlan/draft/${planId}`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${planId}`, + method: 'get' + }); } // 根据skinCode查询发布运行图列表 export function queryRunPlanList(skinCode) { - return request({ - url: `/api/runPlan/template/skin/${skinCode}`, - method: 'get' - }); + return request({ + url: `/api/runPlan/template/skin/${skinCode}`, + method: 'get' + }); } // 从发布运行图创建新运行图 export function postCreatePlan(data) { - return request({ - url: `/api/runPlan/draft/createFrom/${data.templateId}`, - method: 'post', - data: data - }); + return request({ + url: `/api/runPlan/draft/createFrom/${data.templateId}`, + method: 'post', + data: data + }); } // 删除运行图 export function deleteRunPlan(planId) { - return request({ - url: `/api/runPlan/draft/${planId}`, - method: 'delete' - }); + return request({ + url: `/api/runPlan/draft/${planId}`, + method: 'delete' + }); } // 修改运行图内容 export function putRunPlanDetail(data) { - return request({ - url: `/api/runPlan/draft/${data.planId}`, - method: 'put', - data: data - }); + return request({ + url: `/api/runPlan/draft/${data.planId}`, + method: 'put', + data: data + }); } /** * 发布运行图 */ export function publishRunPlan(data) { - return request({ - url: `/api/runPlan/draft/${data.planId}/publish`, - method: 'post', - data: data - }); + return request({ + url: `/api/runPlan/draft/${data.planId}/publish`, + method: 'post', + data: data + }); } /** * 导入真实运行图 */ export function importRunPlan(data) { - return request({ - url: `/api/runPlan/draft/${data.skinCode}/prdPlan`, - method: 'post', - data: data.runPlanList - }); + return request({ + url: `/api/runPlan/draft/${data.skinCode}/prdPlan`, + method: 'post', + data: data.runPlanList + }); } /** 获取运行图停车点列表*/ export function getRunPlanStopPointList(skinCode) { - return request({ - url: `/api/runPlan/draft/stopPoint/${skinCode}`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/stopPoint/${skinCode}`, + method: 'get' + }); } /** 运行图*/ export function getRpListByMapId(mapId) { - return request({ - url: `/api/runPlan/draft/${mapId}/list`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${mapId}/list`, + method: 'get' + }); } /** 获取站间运行时间*/ export function getStationRunning(skinCode) { - return request({ - url: `/api/runPlan/draft/${skinCode}/stationRunning`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${skinCode}/stationRunning`, + method: 'get' + }); } /** 设置站间运行时间*/ export function setStationRunning(skinCode, data) { - return request({ - url: `/api/runPlan/draft/${skinCode}/stationRunning`, - method: 'put', - data: data - }); + return request({ + url: `/api/runPlan/draft/${skinCode}/stationRunning`, + method: 'put', + data: data + }); } /** 创建运行图*/ export function createEmptyPlan(data) { - return request({ - url: `/api/runPlan/draft`, - method: 'post', - data: data - }); + return request({ + url: `/api/runPlan/draft`, + method: 'post', + data: data + }); } /** 查询运行图服务号是否存在*/ export function checkServiceNumberExist({ planId, serviceNumber }) { - return request({ - url: `/api/runPlan/draft/${planId}/${serviceNumber}/service`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${planId}/${serviceNumber}/service`, + method: 'get' + }); } /** 查询交路列表*/ export function getRoutingList(planId) { - return request({ - url: `/api/runPlan/draft/${planId}/routingList`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${planId}/routingList`, + method: 'get' + }); } /** 根据交路查询交路区段列表*/ export function querySectionListByRouting({ planId, routingCode }) { - return request({ - url: `/api/runPlan/draft/${planId}/${routingCode}/routingSectionList`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${planId}/${routingCode}/routingSectionList`, + method: 'get' + }); } /** 有效性检查*/ export function planEffectiveCheck(planId) { - return request({ - url: `/api/runPlan/draft/${planId}/check`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${planId}/check`, + method: 'get' + }); } /** 增加计划*/ export function addPlanService(data) { - return request({ - url: `/api/runPlan/draft/${data.planId}/service`, - method: 'post', - data: data - }); + return request({ + url: `/api/runPlan/draft/${data.planId}/service`, + method: 'post', + data: data + }); } /** 删除计划*/ export function deletePlanService(data) { - return request({ - url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`, - method: 'delete' - }); + return request({ + url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`, + method: 'delete' + }); } /** 复制计划*/ export function duplicateService(data) { - return request({ - url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`, - method: 'post', - data: data - }); + return request({ + url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`, + method: 'post', + data: data + }); } /** 增加任务*/ export function addPlanTrip(data) { - return request({ - url: `/api/runPlan/draft/${data.planId}/${data.serviceNumber}/trip`, - method: 'post', - data: data - }); + return request({ + url: `/api/runPlan/draft/${data.planId}/${data.serviceNumber}/trip`, + method: 'post', + data: data + }); } /** 删除任务*/ export function deletePlanTrip(params) { - return request({ - url: `/api/runPlan/draft/${params.planId}/trip/${params.SDTNumber}`, - method: 'delete', - params: { deleteBefore: params.deleteBefore } - }); + return request({ + url: `/api/runPlan/draft/${params.planId}/trip/${params.SDTNumber}`, + method: 'delete', + params: { deleteBefore: params.deleteBefore } + }); } /** 修改任务*/ export function updatePlanTrip(data) { - return request({ - url: `/api/runPlan/draft/${data.planId}/trip/${data.SDTNumber}`, - method: 'put', - data: data - }); + return request({ + url: `/api/runPlan/draft/${data.planId}/trip/${data.SDTNumber}`, + method: 'put', + data: data + }); } /** 根据车次号查询交路*/ export function getRoutingBySDTNumber(params) { - return request({ - url: `/api/runPlan/draft/${params.planId}/routing`, - method: 'get', - params: { - SDTNumber: params.SDTNumber - } - }); + return request({ + url: `/api/runPlan/draft/${params.planId}/routing`, + method: 'get', + params: { + SDTNumber: params.SDTNumber + } + }); } /** 运行图仿真测试*/ export function runPlanNotify({ planId }) { - return request({ - url: `/api/runPlan/draft/${planId}/simulation`, - method: 'get' - }); + return request({ + url: `/api/runPlan/draft/${planId}/simulation`, + method: 'get' + }); } /** 获取运行计划模板列表*/ export function runPlanTemplateList(params) { - return request({ - url: '/api/runPlan/template', - method: 'get', - params: params - }); + return request({ + url: '/api/runPlan/template', + method: 'get', + params: params + }); } /** 删除运行图模板*/ export function deleteRunPlanTemplate(planId) { - return request({ - url: `/api/runPlan/template/${planId}`, - method: 'delete' - }); + return request({ + url: `/api/runPlan/template/${planId}`, + method: 'delete' + }); } /** 生成通用每日运行图*/ export function generateCommonRunPlanEveryDay(planId, params) { - return request({ - url: `/api/runPlan/template/generate/${planId}`, - method: 'post', - params - }); + return request({ + url: `/api/runPlan/template/generate/${planId}`, + method: 'post', + params + }); } /** 获取运行计划每日列表*/ export function runPlanEveryDayList(params) { - return request({ - url: '/api/runPlan/daily', - method: 'get', - params: params - }); + return request({ + url: '/api/runPlan/daily', + method: 'get', + params: params + }); } /** 删除运行图每日计划*/ export function deleteRunPlanEveryDay(planId) { - return request({ - url: `/api/runPlan/daily/${planId}`, - method: 'delete' - }); + return request({ + url: `/api/runPlan/daily/${planId}`, + method: 'delete' + }); } /** 获取地图运行图的车次号*/ @@ -327,91 +317,91 @@ export function deleteRunPlanEveryDay(planId) { /** 分页查询加载计划*/ export function getRunPlanLoadList(params) { - return request({ - url: `/api/runPlan/daily/runPlanLoad`, - method: 'get', - params: params - }); + return request({ + url: `/api/runPlan/daily/runPlanLoad`, + method: 'get', + params: params + }); } /** 创建加载计划*/ export function createRunPlanLoad(data) { - return request({ - url: `/api/runPlan/daily/runPlanLoad`, - method: 'post', - data: data - }); + return request({ + url: `/api/runPlan/daily/runPlanLoad`, + method: 'post', + data: data + }); } /** 管理创建通用加载计划*/ export function createRunPlanCommon(data) { - return request({ - url: `/api/runPlan/daily/runPlanLoad/common`, - method: 'post', - data: data - }); + return request({ + url: `/api/runPlan/daily/runPlanLoad/common`, + method: 'post', + data: data + }); } /** 删除加载计划*/ export function deleteRunPlanLoad(planId) { - return request({ - url: `/api/runPlan/daily/runPlanLoad/${planId}`, - method: 'delete' - }); + return request({ + url: `/api/runPlan/daily/runPlanLoad/${planId}`, + method: 'delete' + }); } /** 查询模板运行图数据*/ export function queryRunPlanTemplate(planId) { - return request({ - url: `/api/runPlan/template/${planId}`, - method: 'get' - }); + return request({ + url: `/api/runPlan/template/${planId}`, + method: 'get' + }); } /** 查询当日运行图数据*/ export function queryRunPlanDaily(planId) { - return request({ - url: `/api/runPlan/daily/${planId}`, - method: 'get' - }); + return request({ + url: `/api/runPlan/daily/${planId}`, + method: 'get' + }); } /** 获取模板运行图列表*/ export function listAllTempLateRunPlan() { - return request({ - url: `/api/runPlan/template/all`, - method: 'get' - }); + return request({ + url: `/api/runPlan/template/all`, + method: 'get' + }); } // 删除加载计划 export function deleteDailyRunPlanLoad(id) { - return request({ - url: `/api/runPlan/daily/runPlanLoad/${id}`, - method: 'DELETE' - }); + return request({ + url: `/api/runPlan/daily/runPlanLoad/${id}`, + method: 'DELETE' + }); } // 从加载计划创建每日计划 export function postDailyRunPlanLoadGenerate(id) { - return request({ - url: `/api/runPlan/daily/runPlanLoad/${id}/generate`, - method: 'post' - }); + return request({ + url: `/api/runPlan/daily/runPlanLoad/${id}/generate`, + method: 'post' + }); } // 加载通用排班计划 export function postSchedulingCommonGenerate(mapId) { - return request({ - url: `/api/scheduling/common/generate?mapId=${mapId}`, - method: 'post' - }); + return request({ + url: `/api/scheduling/common/generate?mapId=${mapId}`, + method: 'post' + }); } // 从加载计划创建每日计划 export function postRunPlanTemplate(data) { - return request({ - url: `/api/runPlan/template/${data.id}/copyAs/${data.skinCode}?name=${data.name}`, - method: 'post' - }); -} \ No newline at end of file + return request({ + url: `/api/runPlan/template/${data.id}/copyAs/${data.skinCode}?name=${data.name}`, + method: 'post' + }); +} diff --git a/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue b/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue index f9b4ff067..f43d889ec 100644 --- a/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue +++ b/src/jmap/theme/beijing_01/menusPlan/createTodayPlan.vue @@ -19,127 +19,128 @@ From e5c832aa00401a14a4f30f700f4f37879ad4926c Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 30 Oct 2019 17:41:29 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=9A/api/mapPrd/{skinStyle}/list=20=20=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=20=20/api/mapPrd/{mapId}/list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/management/mapprd.js | 4 +- .../lessoncategory/edit/lesson/index.vue | 2 +- src/views/lesson/trainingmanage/draft.vue | 8 +- src/views/lesson/trainingmanage/index.vue | 2 +- src/views/management/userSimulation/add.vue | 334 +++++------ src/views/package/draft/editRule.vue | 563 +++++++++--------- src/views/package/draft/ruleForm.vue | 337 ++++++----- src/views/systemGenerate/create.vue | 266 ++++----- 8 files changed, 749 insertions(+), 767 deletions(-) diff --git a/src/api/management/mapprd.js b/src/api/management/mapprd.js index 427d858ae..f47c6c664 100644 --- a/src/api/management/mapprd.js +++ b/src/api/management/mapprd.js @@ -62,9 +62,9 @@ export function deleteTrainingCategory(data) { /** * 获取地图下的产品列表 */ -export function getCommodityMapProduct(skinCode) { +export function getCommodityMapProduct(mapId) { return request({ - url: `/api/mapPrd/${skinCode}/list`, + url: `/api/mapPrd/${mapId}/list`, method: 'get' }); } diff --git a/src/views/lesson/lessoncategory/edit/lesson/index.vue b/src/views/lesson/lessoncategory/edit/lesson/index.vue index 66fa12c63..d7edfe84f 100644 --- a/src/views/lesson/lessoncategory/edit/lesson/index.vue +++ b/src/views/lesson/lessoncategory/edit/lesson/index.vue @@ -119,7 +119,7 @@ export default { } else { this.courseModel.skinCode = this.$route.query.skinCode; } - getCommodityMapProduct(this.$route.query.skinCode).then(response => { + getCommodityMapProduct(this.$route.query.mapId).then(response => { this.productList = response.data || []; this.productList = this.productList.filter(elem => { return elem.prdType != '03'; }); }); diff --git a/src/views/lesson/trainingmanage/draft.vue b/src/views/lesson/trainingmanage/draft.vue index f7c69ca6b..11ca93316 100644 --- a/src/views/lesson/trainingmanage/draft.vue +++ b/src/views/lesson/trainingmanage/draft.vue @@ -197,7 +197,7 @@ export default { } }, mounted() { - this.skinCodeChoose(this.$route.params.skinCode); + this.mapIdChoose(this.$route.query.mapId); }, methods: { show(data) { @@ -211,11 +211,11 @@ export default { this.dialogShow = false; this.loading = false; }, - skinCodeChoose(skinCode) { + mapIdChoose(mapId) { this.operateModel.prdCode = ''; this.productList = []; - if (skinCode) { - getCommodityMapProduct(skinCode).then((response) => { + if (mapId) { + getCommodityMapProduct(mapId).then((response) => { this.productList = response.data; this.productList = this.productList.filter(elem => { return elem.prdType != '03'; }); }); diff --git a/src/views/lesson/trainingmanage/index.vue b/src/views/lesson/trainingmanage/index.vue index fa7c82c12..30e01bb9b 100644 --- a/src/views/lesson/trainingmanage/index.vue +++ b/src/views/lesson/trainingmanage/index.vue @@ -172,7 +172,7 @@ export default { getSkinCodeList().then(response => { this.skinCodeList = response.data; }); - getCommodityMapProduct(this.$route.params.skinCode).then((response) => { + getCommodityMapProduct(this.$route.query.mapId).then((response) => { const productList = response.data; if (productList && productList.length > 0) { productList.forEach(elem => { diff --git a/src/views/management/userSimulation/add.vue b/src/views/management/userSimulation/add.vue index 4a6ab2348..3728527b5 100644 --- a/src/views/management/userSimulation/add.vue +++ b/src/views/management/userSimulation/add.vue @@ -15,176 +15,168 @@ import { getPublishMapList } from '@/api/jmap/map'; import { getCommodityMapProduct } from '@/api/management/mapprd'; export default { - name: 'UsersTrainingAdd', - props: { - type: { - type: String, - required: true - } - }, - data() { - return { - dialogVisible: false, - formModel: { - mapId: '', - mapPrdCode: '', - userId: '', - userName: '', - duration: '' - }, - LessonList: [], - mapPrdList: [], - UserList: [], - UserLoading: false - }; - }, - computed: { - form() { - const form = { - labelWidth: '120px', - items: [ - { prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, change: true, onChange: this.mapChange, placeholder: this.$t('rules.mapInput') }, - { prop: 'mapPrdCode', label: this.$t('system.productName'), type: 'select', required: true, options: this.mapPrdList, placeholder: this.$t('rules.productInput') }, - { prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') }, - { prop: 'duration', label: this.$t('system.trainingUseTime'), type: 'text', rightWidth: true, required: true, message: 's' } - ] - }; - return form; - }, - rules() { - const crules = { - mapId: [ - { required: true, message: this.$t('rules.mapInput'), trigger: 'change' } - ], - userName: [ - { required: true, message: this.$t('rules.chooseUser'), trigger: 'change' } - ], - mapPrdCode: [ - { required: true, message: this.$t('rules.productInput'), trigger: 'change' } - ], - duration: [ - { required: true, message: this.$t('rules.timeInput'), trigger: 'blur' } - ] - }; - return crules; - }, - title() { - return this.$t('system.createSimulationTitle'); - } - }, - mounted() { - this.initLoadPage(); - }, - methods: { - initLoadPage() { - // 加载发布课程列表 - this.LessonList.length = 0; - this.UserList.length = 0; - const param = { - pageNum: 1, - pageSize: 10 - }; - getPublishMapList(param).then(response => { - const data = response.data.list; - if (data && data.length) { - data.forEach(elem => { - this.LessonList.push({ value: elem.id, label: elem.name, skinCode: elem.skinCode }); - }); - } - }); - }, - // 搜索查询input - async querySearchAsync(queryString, cb) { - // 根据queryString 查询用户 并显示 - const results = []; - if (queryString) { - try { - const params = { - fuzzyParam: queryString - }; - const res = await getDimUserList(params); - const list = res.data; - list.forEach(item => { - const value = { - id: item.id, - value: `${item.nickname}(${item.name})${item.mobile}` - }; - results.push(value); - }); - cb(results); - } catch (error) { - console.error(error); - cb(results); - } - } else { - cb(results); - } - }, - prdSelect(item) { - this.formModel.userId = item.id; - }, - async mapChange(val) { - let skinCode = ''; - this.mapPrdList = []; - this.formModel.mapPrdCode = ''; - if (this.LessonList.length) { - this.LessonList.forEach(item => { - if (item.value == val) { - skinCode = item.skinCode; - } - }); - try { - const res = await getCommodityMapProduct(skinCode); - const data = res.data; - if (data && data.length) { - data.forEach(elem => { - this.mapPrdList.push({ value: elem.code, label: elem.name }); - }); - } - } catch (error) { - console.error(error); - } - } - }, - show(data) { - this.dialogVisible = true; - }, - doSave() { - const self = this; - this.$refs.dataform.validateForm(() => { - self.save(); - }); - }, - save() { - const self = this; - const params = { - mapId: this.formModel.mapId, - mapPrdCode: this.formModel.mapPrdCode, - userId: this.formModel.userId, - duration: parseInt(this.formModel.duration) - }; - if (params.userId) { - postSimulationStats(params).then(response => { - self.$message.success(this.$t('system.addSuccess')); - self.handleClose(); - self.$emit('reloadTable'); - }).catch(error => { - self.$message.error(this.$t('error.addFailed') + error.message); - }); - } else { - this.$message.error(this.$t('rules.chooseUser')); - } - }, - handleClose(done) { - this.formModel = { - mapId: '', - mapPrdCode: '', - userId: '', - userName: '', - duration: '' - }; - this.dialogVisible = false; - } - } + name: 'UsersTrainingAdd', + props: { + type: { + type: String, + required: true + } + }, + data() { + return { + dialogVisible: false, + formModel: { + mapId: '', + mapPrdCode: '', + userId: '', + userName: '', + duration: '' + }, + LessonList: [], + mapPrdList: [], + UserList: [], + UserLoading: false + }; + }, + computed: { + form() { + const form = { + labelWidth: '120px', + items: [ + { prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, change: true, onChange: this.mapChange, placeholder: this.$t('rules.mapInput') }, + { prop: 'mapPrdCode', label: this.$t('system.productName'), type: 'select', required: true, options: this.mapPrdList, placeholder: this.$t('rules.productInput') }, + { prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') }, + { prop: 'duration', label: this.$t('system.trainingUseTime'), type: 'text', rightWidth: true, required: true, message: 's' } + ] + }; + return form; + }, + rules() { + const crules = { + mapId: [ + { required: true, message: this.$t('rules.mapInput'), trigger: 'change' } + ], + userName: [ + { required: true, message: this.$t('rules.chooseUser'), trigger: 'change' } + ], + mapPrdCode: [ + { required: true, message: this.$t('rules.productInput'), trigger: 'change' } + ], + duration: [ + { required: true, message: this.$t('rules.timeInput'), trigger: 'blur' } + ] + }; + return crules; + }, + title() { + return this.$t('system.createSimulationTitle'); + } + }, + mounted() { + this.initLoadPage(); + }, + methods: { + initLoadPage() { + // 加载发布课程列表 + this.LessonList.length = 0; + this.UserList.length = 0; + const param = { + pageNum: 1, + pageSize: 10 + }; + getPublishMapList(param).then(response => { + const data = response.data.list; + if (data && data.length) { + data.forEach(elem => { + this.LessonList.push({ value: elem.id, label: elem.name, skinCode: elem.skinCode }); + }); + } + }); + }, + // 搜索查询input + async querySearchAsync(queryString, cb) { + // 根据queryString 查询用户 并显示 + const results = []; + if (queryString) { + try { + const params = { + fuzzyParam: queryString + }; + const res = await getDimUserList(params); + const list = res.data; + list.forEach(item => { + const value = { + id: item.id, + value: `${item.nickname}(${item.name})${item.mobile}` + }; + results.push(value); + }); + cb(results); + } catch (error) { + console.error(error); + cb(results); + } + } else { + cb(results); + } + }, + prdSelect(item) { + this.formModel.userId = item.id; + }, + async mapChange(val) { + this.mapPrdList = []; + this.formModel.mapPrdCode = ''; + try { + const res = await getCommodityMapProduct(val); + const data = res.data; + if (data && data.length) { + data.forEach(elem => { + this.mapPrdList.push({ value: elem.code, label: elem.name }); + }); + } + } catch (error) { + console.error(error); + } + }, + show(data) { + this.dialogVisible = true; + }, + doSave() { + const self = this; + this.$refs.dataform.validateForm(() => { + self.save(); + }); + }, + save() { + const self = this; + const params = { + mapId: this.formModel.mapId, + mapPrdCode: this.formModel.mapPrdCode, + userId: this.formModel.userId, + duration: parseInt(this.formModel.duration) + }; + if (params.userId) { + postSimulationStats(params).then(response => { + self.$message.success(this.$t('system.addSuccess')); + self.handleClose(); + self.$emit('reloadTable'); + }).catch(error => { + self.$message.error(this.$t('error.addFailed') + error.message); + }); + } else { + this.$message.error(this.$t('rules.chooseUser')); + } + }, + handleClose(done) { + this.formModel = { + mapId: '', + mapPrdCode: '', + userId: '', + userName: '', + duration: '' + }; + this.dialogVisible = false; + } + } }; diff --git a/src/views/package/draft/editRule.vue b/src/views/package/draft/editRule.vue index 8db0fc8f2..6742d8a69 100644 --- a/src/views/package/draft/editRule.vue +++ b/src/views/package/draft/editRule.vue @@ -10,7 +10,6 @@ diff --git a/src/views/package/draft/ruleForm.vue b/src/views/package/draft/ruleForm.vue index 2aef00498..c210cdbf2 100644 --- a/src/views/package/draft/ruleForm.vue +++ b/src/views/package/draft/ruleForm.vue @@ -70,7 +70,7 @@