desc: 修改 订阅综合演练房间号发送判断,修改代码格式
This commit is contained in:
parent
399006e31f
commit
b20686c0fa
@ -1,257 +1,253 @@
|
||||
<template>
|
||||
<el-dialog class="beijing-01__systerm route-setting" :title="title" :visible.sync="show" width="350px"
|
||||
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
|
||||
<el-row class="header">
|
||||
<el-col :span="11"><span>车站名称</span></el-col>
|
||||
<el-col :span="11" :offset="2"><span>始端信号机</span></el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-input v-model="stationName" size="small" disabled></el-input>
|
||||
</el-col>
|
||||
<el-col :span="11" :offset="2">
|
||||
<el-input v-model="signalName" size="small" disabled></el-input>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 10px; line-height: 30px;">
|
||||
<el-col :span="11"><span>进路列表</span></el-col>
|
||||
<el-col :span="11" :offset="2">
|
||||
<el-button class="expand" @click="expandPath">展开进路预览</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table ref="table" :data="tempData" border :cell-style="tableStyle" style="width: 100%; margin-top:10px"
|
||||
size="mini" @row-click="clickEvent" height="120" highlight-current-row :show-header="false">
|
||||
<el-table-column prop="name" :id="domIdChoose" style="margin-left:30px">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-row justify="center" class="button-group">
|
||||
<el-col :span="8" :offset="4">
|
||||
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="commitDisabled"
|
||||
@click="commit">确定</el-button>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="4">
|
||||
<el-button :id="domIdCancel" @click="cancel">取 消</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- <confirm-control ref="confirmControl"></confirm-control> -->
|
||||
<notice-info ref="noticeInfo"></notice-info>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
class="beijing-01__systerm route-setting"
|
||||
:title="title"
|
||||
:visible.sync="show"
|
||||
width="350px"
|
||||
:before-close="doClose"
|
||||
:z-index="2000"
|
||||
:modal="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-row class="header">
|
||||
<el-col :span="11"><span>车站名称</span></el-col>
|
||||
<el-col :span="11" :offset="2"><span>始端信号机</span></el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-input v-model="stationName" size="small" disabled />
|
||||
</el-col>
|
||||
<el-col :span="11" :offset="2">
|
||||
<el-input v-model="signalName" size="small" disabled />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 10px; line-height: 30px;">
|
||||
<el-col :span="11"><span>进路列表</span></el-col>
|
||||
<el-col :span="11" :offset="2">
|
||||
<el-button class="expand" @click="expandPath">展开进路预览</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tempData"
|
||||
border
|
||||
:cell-style="tableStyle"
|
||||
style="width: 100%; margin-top:10px"
|
||||
size="mini"
|
||||
height="120"
|
||||
highlight-current-row
|
||||
:show-header="false"
|
||||
@row-click="clickEvent"
|
||||
>
|
||||
<el-table-column :id="domIdChoose" prop="name" style="margin-left:30px" />
|
||||
</el-table>
|
||||
<el-row justify="center" class="button-group">
|
||||
<el-col :span="8" :offset="4">
|
||||
<el-button
|
||||
:id="domIdConfirm"
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
:disabled="commitDisabled"
|
||||
@click="commit"
|
||||
>确定</el-button>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="4">
|
||||
<el-button :id="domIdCancel" @click="cancel">取 消</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- <confirm-control ref="confirmControl"></confirm-control> -->
|
||||
<notice-info ref="noticeInfo" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
|
||||
import { mouseCancelState } from '../utils/menuItemStatus';
|
||||
import ConfirmControl from './childDialog/confirmControl';
|
||||
import NoticeInfo from './childDialog/childDialog/noticeInfo'
|
||||
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
|
||||
import { mouseCancelState } from '../utils/menuItemStatus';
|
||||
// import ConfirmControl from './childDialog/confirmControl';
|
||||
import NoticeInfo from './childDialog/childDialog/noticeInfo';
|
||||
|
||||
export default {
|
||||
name: 'RouteSelection',
|
||||
components: {
|
||||
ConfirmControl,
|
||||
NoticeInfo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempData: [],
|
||||
beforeSectionList: [],
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
selected: null,
|
||||
row: null,
|
||||
operation: '',
|
||||
display: true,
|
||||
stationName: '',
|
||||
signalName: '',
|
||||
tableStyle: {
|
||||
'border-bottom': 'none',
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
show() {
|
||||
return this.dialogShow && !this.$store.state.menuOperation.break;
|
||||
},
|
||||
domIdCancel() {
|
||||
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
|
||||
},
|
||||
domIdChoose() {
|
||||
return this.dialogShow ? OperationEvent.Signal.arrangementRoute.choose.domId : '';
|
||||
},
|
||||
domIdConfirm() {
|
||||
return this.dialogShow ? OperationEvent.Signal.arrangementRoute.menu.domId : ''
|
||||
},
|
||||
title() {
|
||||
return '进路选排'
|
||||
},
|
||||
commitDisabled() {
|
||||
let disabled = true;
|
||||
if (this.row) {
|
||||
disabled = !this.row.canSetting
|
||||
}
|
||||
return disabled;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.$store.dispatch('training/tipReload');
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getProtectedSectionName(row) {
|
||||
let name = '';
|
||||
if (row &&
|
||||
export default {
|
||||
name: 'RouteSelection',
|
||||
components: {
|
||||
// ConfirmControl,
|
||||
NoticeInfo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tempData: [],
|
||||
beforeSectionList: [],
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
selected: null,
|
||||
row: null,
|
||||
operation: '',
|
||||
display: true,
|
||||
stationName: '',
|
||||
signalName: '',
|
||||
tableStyle: {
|
||||
'border-bottom': 'none'
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
show() {
|
||||
return this.dialogShow && !this.$store.state.menuOperation.break;
|
||||
},
|
||||
domIdCancel() {
|
||||
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
|
||||
},
|
||||
domIdChoose() {
|
||||
return this.dialogShow ? OperationEvent.Signal.arrangementRoute.choose.domId : '';
|
||||
},
|
||||
domIdConfirm() {
|
||||
return this.dialogShow ? OperationEvent.Signal.arrangementRoute.menu.domId : '';
|
||||
},
|
||||
title() {
|
||||
return '进路选排';
|
||||
},
|
||||
commitDisabled() {
|
||||
let disabled = true;
|
||||
if (this.row) {
|
||||
disabled = !this.row.canSetting;
|
||||
}
|
||||
return disabled;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.$store.dispatch('training/tipReload');
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getProtectedSectionName(row) {
|
||||
let name = '';
|
||||
if (row &&
|
||||
row.overlapSectionList &&
|
||||
row.overlapSectionList &&
|
||||
row.overlapSectionList.length > 0) {
|
||||
|
||||
let protect = row.overlapSectionList[0];
|
||||
name = `${protect.name}`;
|
||||
let station = this.$store.getters['map/getDeviceByCode'](protect.stationCode);
|
||||
if (station) {
|
||||
name = `${name}(${station.name})`
|
||||
}
|
||||
}
|
||||
return name;
|
||||
},
|
||||
expandPath() {
|
||||
console.log('展开进路预览');
|
||||
},
|
||||
doShow(operate, selected, tempData) {
|
||||
this.selected = selected;
|
||||
//如果不是断点激活,而是第一次显示,则需要设置初始值
|
||||
if (!this.dialogShow) {
|
||||
this.signalName = '';
|
||||
this.stationName = '';
|
||||
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) {
|
||||
this.signalName = selected.name
|
||||
let station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
|
||||
if (station) {
|
||||
this.stationName = station.name;
|
||||
}
|
||||
}
|
||||
const protect = row.overlapSectionList[0];
|
||||
name = `${protect.name}`;
|
||||
const station = this.$store.getters['map/getDeviceByCode'](protect.stationCode);
|
||||
if (station) {
|
||||
name = `${name}(${station.name})`;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
},
|
||||
expandPath() {
|
||||
console.log('展开进路预览');
|
||||
},
|
||||
doShow(operate, selected, tempData) {
|
||||
this.selected = selected;
|
||||
// 如果不是断点激活,而是第一次显示,则需要设置初始值
|
||||
if (!this.dialogShow) {
|
||||
this.signalName = '';
|
||||
this.stationName = '';
|
||||
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) {
|
||||
this.signalName = selected.name;
|
||||
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
|
||||
if (station) {
|
||||
this.stationName = station.name;
|
||||
}
|
||||
}
|
||||
|
||||
this.tempData = tempData || [];
|
||||
this.operation = operate.operation;
|
||||
}
|
||||
this.dialogShow = true;
|
||||
this.$nextTick(function () {
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
});
|
||||
},
|
||||
doClose() {
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
this.restoreBeforeDevices();
|
||||
this.$refs.table.setCurrentRow();
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
mouseCancelState(this.selected);
|
||||
},
|
||||
restoreBeforeDevices() {
|
||||
// 恢复之前选中设备
|
||||
if (this.beforeSectionList && this.beforeSectionList.length) {
|
||||
this.beforeSectionList.forEach(elem => {
|
||||
elem.cutOff = false;
|
||||
});
|
||||
}
|
||||
this.tempData = tempData || [];
|
||||
this.operation = operate.operation;
|
||||
}
|
||||
this.dialogShow = true;
|
||||
this.$nextTick(function () {
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
});
|
||||
},
|
||||
doClose() {
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
this.restoreBeforeDevices();
|
||||
this.$refs.table.setCurrentRow();
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
mouseCancelState(this.selected);
|
||||
},
|
||||
restoreBeforeDevices() {
|
||||
// 恢复之前选中设备
|
||||
if (this.beforeSectionList && this.beforeSectionList.length) {
|
||||
this.beforeSectionList.forEach(elem => {
|
||||
elem.cutOff = false;
|
||||
});
|
||||
}
|
||||
|
||||
this.$store.dispatch('training/updateMapState', [...this.beforeSectionList]);
|
||||
this.beforeSectionList = [];
|
||||
},
|
||||
clickEvent(row, event, column) {
|
||||
this.row = row;
|
||||
if (row) {
|
||||
// 恢复进路区段的切除状态
|
||||
this.restoreBeforeDevices();
|
||||
this.$store.dispatch('training/updateMapState', [...this.beforeSectionList]);
|
||||
this.beforeSectionList = [];
|
||||
},
|
||||
clickEvent(row, event, column) {
|
||||
this.row = row;
|
||||
if (row) {
|
||||
// 恢复进路区段的切除状态
|
||||
this.restoreBeforeDevices();
|
||||
|
||||
if (row.canSetting) {
|
||||
// 设置选中区段为切除状态
|
||||
if (row.containSectionList && row.containSectionList.length) {
|
||||
// 设置新选的进路区段为切除状态
|
||||
row.containSectionList.forEach(elem => {
|
||||
elem.cutOff = true;
|
||||
});
|
||||
}
|
||||
if (row.canSetting) {
|
||||
// 设置选中区段为切除状态
|
||||
if (row.containSectionList && row.containSectionList.length) {
|
||||
// 设置新选的进路区段为切除状态
|
||||
row.containSectionList.forEach(elem => {
|
||||
elem.cutOff = true;
|
||||
});
|
||||
}
|
||||
|
||||
this.$store.dispatch('training/updateMapState', [...row.containSectionList]);
|
||||
this.beforeSectionList = row.containSectionList || [];
|
||||
this.$store.dispatch('training/updateMapState', [...row.containSectionList]);
|
||||
this.beforeSectionList = row.containSectionList || [];
|
||||
|
||||
// 设置选中指令
|
||||
let operate = {
|
||||
type: MapDeviceType.Signal.type,
|
||||
operation: OperationEvent.Signal.arrangementRoute.choose.operation,
|
||||
val: row.code
|
||||
};
|
||||
// 设置选中指令
|
||||
const operate = {
|
||||
type: MapDeviceType.Signal.type,
|
||||
operation: OperationEvent.Signal.arrangementRoute.choose.operation,
|
||||
val: row.code
|
||||
};
|
||||
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
commit() {
|
||||
if (this.row && this.row.canSetting) {
|
||||
// let names = '';
|
||||
// if (this.row.overlapSectionList && this.row.overlapSectionList.length > 0) {
|
||||
// names = names + this.row.overlapSectionList.map(elem => { return elem.name }).join('');
|
||||
// }
|
||||
// if (this.row.overlapSwitchList && this.row.overlapSwitchList.length > 0) {
|
||||
// names = names + this.row.overlapSwitchList.map(elem => { return elem.name }).join('');
|
||||
// }
|
||||
// let operate = {
|
||||
// type: MapDeviceType.Signal.type,
|
||||
// operation: OperationEvent.Signal.arrangementRoute.menu.operation,
|
||||
// messages: [`进路设置:${this.row.name}${names}(${this.row.stationName})`]
|
||||
// }
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
commit() {
|
||||
if (this.row && this.row.canSetting) {
|
||||
const operate = {
|
||||
send: true,
|
||||
type: MapDeviceType.Signal.type,
|
||||
operation: OperationEvent.Signal.arrangementRoute.menu.operation
|
||||
};
|
||||
|
||||
// this.loading = true;
|
||||
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
// this.loading = false;
|
||||
// if (valid) {
|
||||
// this.doClose();
|
||||
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
// this.$refs.confirmControl.doShow(operate);
|
||||
// }
|
||||
// }).catch(error => {
|
||||
// this.loading = false;
|
||||
// this.doClose();
|
||||
// this.$refs.noticeInfo.doShow(operate);
|
||||
// });
|
||||
let operate = {
|
||||
send: true,
|
||||
type: MapDeviceType.Signal.type,
|
||||
operation: OperationEvent.Signal.arrangementRoute.menu.operation,
|
||||
// operation: OperationEvent.Signal.arrangementRoute.confirm.operation,
|
||||
}
|
||||
this.loading = true;
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
this.loading = false;
|
||||
if (valid) {
|
||||
this.doClose();
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.doClose();
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
const operate = {
|
||||
type: MapDeviceType.Signal.type,
|
||||
operation: OperationEvent.Command.cancel.menu.operation
|
||||
};
|
||||
|
||||
this.loading = true;
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
this.loading = false;
|
||||
if (valid) {
|
||||
this.doClose();
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.loading = false;
|
||||
this.doClose();
|
||||
this.$refs.noticeInfo.doShow(operate);
|
||||
})
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
let operate = {
|
||||
type: MapDeviceType.Signal.type,
|
||||
operation: OperationEvent.Command.cancel.menu.operation,
|
||||
}
|
||||
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.doClose();
|
||||
}
|
||||
}).catch(error => {
|
||||
this.doClose();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
this.$store.dispatch('training/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.doClose();
|
||||
}
|
||||
}).catch(() => {
|
||||
this.doClose();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
51
src/main.js
51
src/main.js
@ -9,7 +9,6 @@ import 'element-ui/lib/theme-chalk/index.css';
|
||||
|
||||
import '@/styles/index.scss'; // global css
|
||||
|
||||
import Theme from '@/jmap/theme/factory';
|
||||
import LangStorage from '@/utils/lang';
|
||||
import App from './App';
|
||||
import VueI18n from 'vue-i18n';
|
||||
@ -51,53 +50,3 @@ router.beforeEach((to, from, next) => {
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
Vue.prototype.$theme = new Theme();
|
||||
Vue.prototype.$messageBox = function(msge) {
|
||||
if (this.$confirm) {
|
||||
this.$confirm(`${msge || '处理失败'}!`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'warning',
|
||||
showCancelButton: false,
|
||||
center: true
|
||||
}).then(() => {
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Vue.prototype.$convertField = function(fieldValue, enumList, converFormat, isList = false) {
|
||||
const arr = [];
|
||||
if (enumList && converFormat && converFormat.length >= 2) {
|
||||
const value = converFormat[0];
|
||||
const label = converFormat[1];
|
||||
if (isList) {
|
||||
enumList.forEach((element, i) => {
|
||||
fieldValue.forEach((v, j) => {
|
||||
if ('' + fieldValue[j] === '' + enumList[i][value]) {
|
||||
arr.push(enumList[i][label]);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
for (let i = 0; i < enumList.length; i++) {
|
||||
if ('' + fieldValue === '' + enumList[i][value]) {
|
||||
return enumList[i][label];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isList ? arr: '';
|
||||
};
|
||||
|
||||
Vue.prototype.$convertList = function(FromList, ToList, checktypeFunction) {
|
||||
if (FromList) {
|
||||
ToList.length = 0;
|
||||
FromList.forEach(elem => {
|
||||
if (checktypeFunction(elem)) {
|
||||
ToList.push({ value: elem.code, label: elem.name });
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -1,26 +1,26 @@
|
||||
export default {
|
||||
ConstSelect: {
|
||||
// 剧本录制模块枚举
|
||||
// 剧本录制模块枚举
|
||||
deviceType: [
|
||||
{label: '进路', value: 'Route'},
|
||||
{label: '区段', value: 'Section'},
|
||||
{label: '信号机', value: 'Signal'},
|
||||
{label: '站台', value: 'StationStand'},
|
||||
{label: '集中站', value: 'Station'},
|
||||
{label: '控制模式', value: 'StationControl'},
|
||||
{label: '道岔', value: 'Switch'},
|
||||
{label: '列车', value: 'Train'},
|
||||
],
|
||||
// 行为触发条件类型
|
||||
triggerType:[
|
||||
{label: '对话', value: 'Conversation'},
|
||||
{label: '设备', value: 'DeviceCondition'},
|
||||
{label: '无', value: 'None'},
|
||||
],
|
||||
// 动作类型
|
||||
actionType:[
|
||||
{label: '对话', value: 'Conversation'},
|
||||
{label: '指令', value: 'Command'},
|
||||
]
|
||||
}
|
||||
};
|
||||
{label: '进路', value: 'Route'},
|
||||
{label: '区段', value: 'Section'},
|
||||
{label: '信号机', value: 'Signal'},
|
||||
{label: '站台', value: 'StationStand'},
|
||||
{label: '集中站', value: 'Station'},
|
||||
{label: '控制模式', value: 'StationControl'},
|
||||
{label: '道岔', value: 'Switch'},
|
||||
{label: '列车', value: 'Train'}
|
||||
],
|
||||
// 行为触发条件类型
|
||||
triggerType: [
|
||||
{label: '对话', value: 'Conversation'},
|
||||
{label: '设备', value: 'DeviceCondition'},
|
||||
{label: '无', value: 'None'}
|
||||
],
|
||||
// 动作类型
|
||||
actionType: [
|
||||
{label: '对话', value: 'Conversation'},
|
||||
{label: '指令', value: 'Command'}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
@ -4,6 +4,7 @@ import DataForm from '@/components/QueryListPage/DataForm';
|
||||
import TurnbackBar from '@/components/TurnbackBar';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import Dictionary from '@/scripts/DictionaryData';
|
||||
import Theme from '@/jmap/theme/factory';
|
||||
|
||||
// 全局组件
|
||||
Vue.component('DataForm', DataForm);
|
||||
@ -36,3 +37,53 @@ Vue.prototype.$addWindowResizeListener = function(cb) {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Vue.prototype.$theme = new Theme();
|
||||
Vue.prototype.$messageBox = function(msge) {
|
||||
if (this.$confirm) {
|
||||
this.$confirm(`${msge || '处理失败'}!`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'warning',
|
||||
showCancelButton: false,
|
||||
center: true
|
||||
}).then(() => {
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Vue.prototype.$convertField = function(fieldValue, enumList, converFormat, isList = false) {
|
||||
const arr = [];
|
||||
if (enumList && converFormat && converFormat.length >= 2) {
|
||||
const value = converFormat[0];
|
||||
const label = converFormat[1];
|
||||
if (isList) {
|
||||
enumList.forEach((element, i) => {
|
||||
fieldValue.forEach((v, j) => {
|
||||
if ('' + fieldValue[j] === '' + enumList[i][value]) {
|
||||
arr.push(enumList[i][label]);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
for (let i = 0; i < enumList.length; i++) {
|
||||
if ('' + fieldValue === '' + enumList[i][value]) {
|
||||
return enumList[i][label];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isList ? arr: '';
|
||||
};
|
||||
|
||||
Vue.prototype.$convertList = function(FromList, ToList, checktypeFunction) {
|
||||
if (FromList) {
|
||||
ToList.length = 0;
|
||||
FromList.forEach(elem => {
|
||||
if (checktypeFunction(elem)) {
|
||||
ToList.push({ value: elem.code, label: elem.name });
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ OperateConverter.prototype = {
|
||||
convert: function (operate) {
|
||||
if (operate.send) {
|
||||
let command = null;
|
||||
let converter = getConverter(OperateHandler.operates);
|
||||
const converter = getConverter(OperateHandler.operates);
|
||||
if (converter) {
|
||||
command = converter.convert(OperateHandler.operates);
|
||||
}
|
||||
@ -37,7 +37,7 @@ OperateConverter.prototype = {
|
||||
},
|
||||
|
||||
sendToServer: function (command) {
|
||||
let group = router.currentRoute.query.group;
|
||||
const group = router.currentRoute.query.group;
|
||||
return new Promise((resolve, reject) => {
|
||||
sendCommand(group, command).then((response) => {
|
||||
resolve(response);
|
||||
@ -50,7 +50,7 @@ OperateConverter.prototype = {
|
||||
/** 转换操作 为 指令并发送 */
|
||||
convertAndSend: function (operate) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let command = this.convert(operate);
|
||||
const command = this.convert(operate);
|
||||
if (command) {
|
||||
this.sendToServer(command).then(response => {
|
||||
resolve(response);
|
||||
@ -61,7 +61,7 @@ OperateConverter.prototype = {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export default new OperateConverter();
|
||||
export default new OperateConverter();
|
||||
|
@ -23,16 +23,16 @@ OperateHandler.prototype = {
|
||||
*/
|
||||
judge: function (operate) {
|
||||
let valid = false;
|
||||
let steps = this.getSteps();
|
||||
let order = this.getOrder();
|
||||
const steps = this.getSteps();
|
||||
const order = this.getOrder();
|
||||
if (order >= steps) {
|
||||
return valid;
|
||||
}
|
||||
|
||||
let standard = steps[order];
|
||||
if (operate && standard && operate.code == standard.code && operate.type == standard.type
|
||||
&& operate.operation == standard.operation
|
||||
&& operate.val == standard.val) {
|
||||
const standard = steps[order];
|
||||
if (operate && standard && operate.code == standard.code && operate.type == standard.type &&
|
||||
operate.operation == standard.operation &&
|
||||
operate.val == standard.val) {
|
||||
valid = true;
|
||||
}
|
||||
return valid;
|
||||
@ -48,7 +48,7 @@ OperateHandler.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
//如果是正常的第一步操作,需要清空operates数组
|
||||
// 如果是正常的第一步操作,需要清空operates数组
|
||||
if (operate.type === 'mbm' || operate.type === 'bar' || operate.start === true) {
|
||||
this.cleanOperates();
|
||||
}
|
||||
@ -56,13 +56,13 @@ OperateHandler.prototype = {
|
||||
this.operates.push(operate);
|
||||
|
||||
// 预处理
|
||||
let converter = getConverter(this.operates);
|
||||
const converter = getConverter(this.operates);
|
||||
if (converter && converter.preHandle instanceof Function) {
|
||||
operate = converter.preHandle(this.operates);
|
||||
}
|
||||
|
||||
let valid = true;
|
||||
let mode = this.getTrainingMode();
|
||||
const mode = this.getTrainingMode();
|
||||
if (TrainingMode.EDIT === mode) {
|
||||
// 编辑制作模式
|
||||
if (this.getOperateBreakStatus()) {
|
||||
@ -85,9 +85,9 @@ OperateHandler.prototype = {
|
||||
}
|
||||
|
||||
// 发送每一步的步骤数据;
|
||||
let basicInfo = store.getters['training/basicInfo'];
|
||||
const basicInfo = store.getters['training/basicInfo'];
|
||||
if (basicInfo.id && valid) {
|
||||
let group = router.currentRoute.query.group;
|
||||
const group = router.currentRoute.query.group;
|
||||
sendTrainingNextStep({ trainingId: basicInfo.id, operate: operate }, group);
|
||||
}
|
||||
|
||||
@ -104,8 +104,8 @@ OperateHandler.prototype = {
|
||||
},
|
||||
handle: function (operate) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let rtn = { valid: false, response: null };
|
||||
let valid = this.validate(operate);
|
||||
const rtn = { valid: false, response: null };
|
||||
const valid = this.validate(operate);
|
||||
|
||||
rtn.valid = valid;
|
||||
|
||||
@ -139,4 +139,4 @@ OperateHandler.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
export default new OperateHandler();
|
||||
export default new OperateHandler();
|
||||
|
@ -4,12 +4,15 @@ import store from '@/store';
|
||||
function handle(state, data) {
|
||||
// console.log(data, 'socket订阅');
|
||||
const msg = data.body;
|
||||
const path = window.location.href;
|
||||
switch (data.type) {
|
||||
case 'Order_Pay_Result': // 订单支付结果消息
|
||||
state.payOrder = msg;
|
||||
break;
|
||||
case 'JointTraining_Room': // 综合演练室-房间消息
|
||||
state.jointRoomInfo = msg; // 房间信息
|
||||
if (!path.includes('/plan') || !path.includes('/dp/')) {
|
||||
state.jointRoomInfo = msg; // 房间信息
|
||||
}
|
||||
break;
|
||||
case 'JointTraining_User': // 综合演练室-用户消息
|
||||
handleUserinfo(state, msg); // 分配角色权限消息
|
||||
|
@ -3,6 +3,7 @@ import { login, logout, getInfo } from '@/api/login';
|
||||
import { getToken, setToken, removeToken, removeScreenToken, setScreenToken, getScreenToken, setPlanToken, getPlanToken, removePlanToken, handleToken, handleRemoveToken } from '@/utils/auth';
|
||||
import { getUserConfigInfo } from '@/api/management/user';
|
||||
import { LoginParams } from '@/utils/login';
|
||||
import { creatSubscribe, perpetualTopic } from '@/utils/stomp';
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
@ -65,24 +66,24 @@ const user = {
|
||||
execFc = (token) => {
|
||||
setScreenToken(token);
|
||||
commit('SET_TOKENSCREEN', token);
|
||||
// let header = { group: '', 'X-Token': getScreenToken() };
|
||||
// creatSubscribe(perpetualTopic, header);
|
||||
const header = { group: '', 'X-Token': getScreenToken() };
|
||||
creatSubscribe(perpetualTopic, header);
|
||||
};
|
||||
} else if (userInfo.type == 'plan') {
|
||||
params = Object.assign({ account: username, password }, LoginParams.LianJiHua);
|
||||
execFc = (token) => {
|
||||
setPlanToken(token);
|
||||
commit('SET_TOKENPLAN', token);
|
||||
// let header = { group: '', 'X-Token': getPlanToken() };
|
||||
// creatSubscribe(perpetualTopic, header);
|
||||
const header = { group: '', 'X-Token': getPlanToken() };
|
||||
creatSubscribe(perpetualTopic, header);
|
||||
};
|
||||
} else {
|
||||
params = Object.assign({ account: username, password }, LoginParams.LianKeTang);
|
||||
execFc = (token) => {
|
||||
setToken(token);
|
||||
commit('SET_TOKEN', token);
|
||||
// let header = { group: '', 'X-Token': getToken() };
|
||||
// creatSubscribe(perpetualTopic, header);
|
||||
const header = { group: '', 'X-Token': getToken() };
|
||||
creatSubscribe(perpetualTopic, header);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user