修改大小写

This commit is contained in:
ival 2019-11-18 14:46:57 +08:00
parent 3cffd163ad
commit a80b010bfa

View File

@ -1,67 +0,0 @@
import store from '@/store';
import router from '@/router';
import OperateHandler from '@/scripts/plugin/OperateHandler';
import { sendCommand } from '@/api/jmap/training';
import { OperationEvent } from '@/scripts/ConstDic';
import { getConverter } from '@/scripts/plugin/Converter/manager';
var OperateConverter = function () { };
OperateConverter.prototype = {
/** 转换 操作 为 指令 */
convert: function (operate) {
if (operate.send) {
let command = null;
const converter = getConverter(OperateHandler.operates);
if (converter) {
command = converter.convert(OperateHandler.operates);
}
if (command && command.error) {
// 命令错误,可以回退或清空(暂用回退)
OperateHandler.operates.pop();
store.dispatch('training/setTempStep', null);
command = null;
} else if (command && command.over) {
// 清空操作组
OperateHandler.cleanOperates();
store.dispatch('menuOperation/setButtonOperation', null);
}
return command;
} else if (operate.operation === OperationEvent.Command.cancel.menu.operation || operate.over) {
// 取消操作,清空操作组
OperateHandler.cleanOperates();
}
return null;
},
sendToServer: function (command) {
const group = router.currentRoute.query.group;
return new Promise((resolve, reject) => {
sendCommand(group, command).then((response) => {
resolve(response);
}).catch(error => {
reject(error);
});
});
},
/** 转换操作 为 指令并发送 */
convertAndSend: function (operate) {
return new Promise((resolve, reject) => {
const command = this.convert(operate);
if (command) {
this.sendToServer(command).then(response => {
resolve(response);
}).catch(error => {
reject(error);
});
} else {
resolve();
}
});
}
};
export default new OperateConverter();