画面调整
This commit is contained in:
parent
551ebe9fc7
commit
32ea838b58
@ -2,6 +2,7 @@ import ValidateHandler from './newValidateHandler';
|
||||
import store from '@/store/index';
|
||||
import { getLocalStorage } from '@/utils/auth';
|
||||
import { sendCommandNew } from '@/api/jmap/training';
|
||||
import router from '@/router/index';
|
||||
|
||||
class Handler {
|
||||
constructor() {
|
||||
@ -35,40 +36,50 @@ class Handler {
|
||||
}
|
||||
|
||||
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) => {
|
||||
// const command = CommandHandler.getCommand(cmdType, wholeParam);
|
||||
// if (command.isError) {
|
||||
// reject(command);
|
||||
// this.storeOperation(operation);
|
||||
// const rtn = { valid: false, response: null };
|
||||
// rtn.valid = ValidateHandler.validate(this.getTrainingMode(), operation);
|
||||
// if (!rtn.valid ) {
|
||||
// this.pop();
|
||||
// reject();
|
||||
// } else {
|
||||
// CommandHandler.execute(command.id, command.get()).then(response => {
|
||||
// resolve(response);
|
||||
// }).catch(error => {
|
||||
// reject(error);
|
||||
// });
|
||||
// if (operation.cancel === true) {
|
||||
// this.clear();
|
||||
// } else {
|
||||
// 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 () {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { setLocalStorage } from '@/utils/auth';
|
||||
import { addTrainingNew } from '../../api/jmap/training';
|
||||
import NewHandler from '@/scripts/cmdPlugin/newHandler';
|
||||
import { ScriptMode } from '@/scripts/ConstDic';
|
||||
import store from '@/store/index';
|
||||
@ -148,30 +147,19 @@ const training = {
|
||||
},
|
||||
next: ({ commit, state }, operate) => {
|
||||
setLocalStorage('nextNew', JSON.stringify(operate));
|
||||
return new Promise((resolve, reject) => {
|
||||
store.dispatch('training/setOperate', operate);
|
||||
if (state.trainingDetail && !state.trainingSwitch) {
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() === 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' });
|
||||
return;
|
||||
store.dispatch('training/setOperate', operate);
|
||||
if (state.trainingDetail && !state.trainingSwitch) {
|
||||
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() === 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' });
|
||||
} else {
|
||||
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 => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -23,13 +23,13 @@ export function handlerUrl() {
|
||||
let OSS_URL;
|
||||
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://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://114.116.51.125/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.90: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.37:9000'; // 卫志宏
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
|
@ -55,12 +55,39 @@ export default {
|
||||
const logicData = {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData};
|
||||
const repaint = this.$store.state.map.initJlmapLoadedCount === 1;
|
||||
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 deviceList = [];
|
||||
for (const key in this.mapDevice) {
|
||||
list.push(this.mapDevice[key]);
|
||||
deviceList.push(key);
|
||||
}
|
||||
this.$jlmap.updateShowStation(list);
|
||||
this.$store.dispatch('map/setPictureDeviceMap', picture.deviceMap);
|
||||
this.$jlmap.updatePicture(deviceList);
|
||||
this.$jlmap.updateTransform(picture.scaling, picture.origin);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -186,7 +186,6 @@ export default {
|
||||
}
|
||||
this.terminalList = [];
|
||||
[...this.commonTerminal, ...this.terminalMap[currentType]].forEach(item => {
|
||||
console.log(this.itemMap, item);
|
||||
if (item.roleList.includes(this.roles) && (!item.functionItem || this.itemMap[item.functionItem])) {
|
||||
this.terminalList.push(item);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user