画面调整

This commit is contained in:
fan 2022-11-03 16:27:38 +08:00
parent 551ebe9fc7
commit 32ea838b58
5 changed files with 83 additions and 58 deletions

View File

@ -2,6 +2,7 @@ import ValidateHandler from './newValidateHandler';
import store from '@/store/index'; import store from '@/store/index';
import { getLocalStorage } from '@/utils/auth'; import { getLocalStorage } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training'; import { sendCommandNew } from '@/api/jmap/training';
import router from '@/router/index';
class Handler { class Handler {
constructor() { constructor() {
@ -35,40 +36,50 @@ class Handler {
} }
handle(operation) { handle(operation) {
return new Promise((resolve, reject) => {
this.storeOperation(operation);
const rtn = { valid: false, response: null };
rtn.valid = ValidateHandler.validate(this.getTrainingMode(), operation);
if (!rtn.valid ) {
this.pop();
reject();
} else {
if (operation.cancel === true) {
this.clear();
} else {
if (operation.cmdType.value) {
rtn.cmdType = operation.cmdType.value;
rtn.params = this.getWholeParam();
}
}
resolve(rtn);
}
});
}
execute(cmdType, wholeParam) {
// return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
// const command = CommandHandler.getCommand(cmdType, wholeParam); // this.storeOperation(operation);
// if (command.isError) { // const rtn = { valid: false, response: null };
// reject(command); // rtn.valid = ValidateHandler.validate(this.getTrainingMode(), operation);
// if (!rtn.valid ) {
// this.pop();
// reject();
// } else { // } else {
// CommandHandler.execute(command.id, command.get()).then(response => { // if (operation.cancel === true) {
// resolve(response); // this.clear();
// }).catch(error => { // } else {
// reject(error); // if (operation.cmdType.value) {
// }); // rtn.cmdType = operation.cmdType.value;
// rtn.params = this.getWholeParam();
// }
// }
// resolve(rtn);
// } // }
// }); // });
// return sendCommandNew() this.storeOperation(operation);
const result = { valid: false };
result.valid = ValidateHandler.validate(this.getTrainingMode(), operation);
if (!result.valid) {
this.pop();
} else {
if (operation.cancel === true) {
this.clear();
} else if (operation.cmdType.value) {
result.cmdType = operation.cmdType.value;
result.params = this.getWholeParam();
}
}
return result;
}
execute(cmdType, wholeParam) {
const group = router.currentRoute.query.group;
return new Promise((resolve, reject) => {
sendCommandNew(group, cmdType, wholeParam).then(response => {
resolve(response);
}).catch(error => {
reject(error);
});
});
} }
getTrainingMode () { getTrainingMode () {

View File

@ -1,5 +1,4 @@
import { setLocalStorage } from '@/utils/auth'; import { setLocalStorage } from '@/utils/auth';
import { addTrainingNew } from '../../api/jmap/training';
import NewHandler from '@/scripts/cmdPlugin/newHandler'; import NewHandler from '@/scripts/cmdPlugin/newHandler';
import { ScriptMode } from '@/scripts/ConstDic'; import { ScriptMode } from '@/scripts/ConstDic';
import store from '@/store/index'; import store from '@/store/index';
@ -148,30 +147,19 @@ const training = {
}, },
next: ({ commit, state }, operate) => { next: ({ commit, state }, operate) => {
setLocalStorage('nextNew', JSON.stringify(operate)); setLocalStorage('nextNew', JSON.stringify(operate));
return new Promise((resolve, reject) => { store.dispatch('training/setOperate', operate);
store.dispatch('training/setOperate', operate); if (state.trainingDetail && !state.trainingSwitch) {
if (state.trainingDetail && !state.trainingSwitch) { commit('setOperateErrMsg', { errMsg: LangStorage.getLang() === 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' });
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() === 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' }); } else {
return; const result = NewHandler.handle(operate);
if (state.trainingSwitch && state.trainingDetail.type === 'SINGLE' && (state.teachMode === ScriptMode.TEACH || state.teachMode === ScriptMode.PRACTICE)) {
const msg = result && result.valid ? {errMsg: LangStorage.getLang() == 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green'} : {errMsg: LangStorage.getLang() == 'en' ? 'operation mistake!' : '操作错误!', color: 'red'};
commit('setOperateErrMsg', msg);
} else {
commit('setTrainingOperate', operate);
} }
NewHandler.handle(operate).then(rtn => { return result;
if (state.trainingSwitch && state.trainingDetail.type === 'SINGLE') { }
if (state.teachMode === ScriptMode.TEACH || state.teachMode === ScriptMode.PRACTICE) {
if (rtn && rtn.valid) {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? "Correct operation! That's great!" : '操作正确!真棒!', color: 'green' });
} else {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() == 'en' ? 'operation mistake!' : '操作错误!', color: 'red' });
}
}
} else {
commit('setTrainingOperate', operate);
}
resolve(rtn);
}).catch(error => {
console.error(error);
reject(error);
});
});
} }
} }
}; };

View File

@ -23,13 +23,13 @@ export function handlerUrl() {
let OSS_URL; let OSS_URL;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// 开发分支 // 开发分支
// BASE_API = 'http://192.168.3.233/rtss-server'; BASE_API = 'http://192.168.3.233/rtss-server';
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://114.116.51.125/jlcloud'; // BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://192.168.3.90:9000'; // 周寅 // BASE_API = 'http://192.168.3.90:9000'; // 周寅
// BASE_API = 'http://192.168.3.94:9000'; // 旭强 // BASE_API = 'http://192.168.3.94:9000'; // 旭强
BASE_API = 'http://192.168.3.15:9000'; // 张赛 // BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬 // BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏 // BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -55,12 +55,39 @@ export default {
const logicData = {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData}; const logicData = {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData};
const repaint = this.$store.state.map.initJlmapLoadedCount === 1; const repaint = this.$store.state.map.initJlmapLoadedCount === 1;
this.$jlmap.setMap(this.mapData, this.mapDevice, logicData, repaint); this.$jlmap.setMap(this.mapData, this.mapDevice, logicData, repaint);
this.$jlmap.amendDevice([...this.sectionList, ...this.signalList, ...this.trainWindowList]); if (this.mapData && this.mapData.pictureList) {
const picture = this.mapData.pictureList.find(picture => picture.type === 'dispatchWork');
if (picture) {
this.handlerPictureShow(picture);
} else {
this.$jlmap.amendDevice([...this.sectionList, ...this.signalList, ...this.trainWindowList]);
const list = [];
for (const key in this.mapDevice) {
list.push(this.mapDevice[key]);
}
this.$jlmap.updateShowStation(list);
}
} else {
this.$jlmap.amendDevice([...this.sectionList, ...this.signalList, ...this.trainWindowList]);
const list = [];
for (const key in this.mapDevice) {
list.push(this.mapDevice[key]);
}
this.$jlmap.updateShowStation(list);
}
},
//
handlerPictureShow(picture) {
const list = []; const list = [];
const deviceList = [];
for (const key in this.mapDevice) { for (const key in this.mapDevice) {
list.push(this.mapDevice[key]); list.push(this.mapDevice[key]);
deviceList.push(key);
} }
this.$jlmap.updateShowStation(list); this.$jlmap.updateShowStation(list);
this.$store.dispatch('map/setPictureDeviceMap', picture.deviceMap);
this.$jlmap.updatePicture(deviceList);
this.$jlmap.updateTransform(picture.scaling, picture.origin);
} }
} }
}; };

View File

@ -186,7 +186,6 @@ export default {
} }
this.terminalList = []; this.terminalList = [];
[...this.commonTerminal, ...this.terminalMap[currentType]].forEach(item => { [...this.commonTerminal, ...this.terminalMap[currentType]].forEach(item => {
console.log(this.itemMap, item);
if (item.roleList.includes(this.roles) && (!item.functionItem || this.itemMap[item.functionItem])) { if (item.roleList.includes(this.roles) && (!item.functionItem || this.itemMap[item.functionItem])) {
this.terminalList.push(item); this.terminalList.push(item);
} }