增加派班计划

This commit is contained in:
ival 2019-08-30 09:00:36 +08:00
parent c9937ffc48
commit 3da74652c5
10 changed files with 258 additions and 211 deletions

17
src/api/scheduling.js Normal file
View File

@ -0,0 +1,17 @@
import request from '@/utils/request';
export function querySecheduling(group, params) {
return request({
url: `/api/scheduling/${group}/day`,
method: 'get',
params
});
}
export function generateScheduling(group, params) {
return request({
url: `/api/scheduling/${group}/generate`,
method: 'post',
params
});
}

View File

@ -160,14 +160,6 @@ export function getEveryDayRunPlanData(group) {
}); });
} }
/** 生成手机同步仿真二维码*/
// export function getSimulationQrCodeUrl(group) {
// return request({
// url: `/api/simulation/${group}/qrCode`,
// method: 'post'
// });
// }
/** 录制脚本仿真*/ /** 录制脚本仿真*/
export function scriptRecordNotify(scriptId) { export function scriptRecordNotify(scriptId) {
return request({ return request({
@ -293,85 +285,6 @@ export function modifyScriptAction(group, actionId, data) {
}); });
} }
// /** 根据成员角色查询设备列表*/
// export function getDevicesByRole(group, params) {
// return request({
// url: `/api/simulation/${group}/role/devices`,
// method: 'get',
// params
// });
// }
// /** 获取任务录制的成员角色列表 */
// export function getMembersByGroup(group) {
// return request({
// url: `/api/simulation/${group}/questRecord/members`,
// method: 'get'
// });
// }
// /** 添加任务角色成员 */
// export function postQuestMember(group, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/member`,
// method: 'post',
// data
// });
// }
// /** 删除任务角色成员 */
// export function deleteQuestMember(group, memberId) {
// return request({
// url: `/api/simulation/${group}/questRecord/member/${memberId}`,
// method: 'delete'
// });
// }
// // /** 添加/修改任务角色行为 */
// export function postMemberBehavior(group, memberId, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior`,
// method: 'post',
// data
// });
// }
// /** 删除任务角色行为 */
// export function deleteMemberBehavior(group, memberId, behaviorId) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}`,
// method: 'delete'
// });
// }
// /** 删除任务角色行为动作 */
// export function deleteMemberBehaviorAction(group, memberId, behaviorId, actionId) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action/${actionId}`,
// method: 'delete'
// });
// }
// /** 添加/修改任务角色行为动作 */
// export function postMemberBehaviorAction(group, memberId, behaviorId, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/${memberId}/behavior/${behaviorId}/action`,
// method: 'post',
// data
// });
// }
// /** 添加/修改任务目标条件*/
// export function postTargetConditionAction(group, data) {
// return request({
// url: `/api/simulation/${group}/questRecord/targetCondition`,
// method: 'post',
// data
// });
// }
// /** 删除任务目标条件*/
// export function deleteTargetConditionAction(group, tcId) {
// return request({
// url: `/api/simulation/${group}/questRecord/targetCondition/${tcId}`,
// method: 'delete'
// });
// }
/** 分页查询存在的仿真 */ /** 分页查询存在的仿真 */
export function getExistingSimulation(params) { export function getExistingSimulation(params) {
return request({ return request({
@ -396,14 +309,6 @@ export function getDeviceCodeByDeviceType(group, params) {
params params
}); });
} }
// /** 根据设备类型获取设备条件列表 */
// export function getDeviceCoditionByDeviceType(params) {
// return request({
// url: `/api/simulation/deviceType/conditions`,
// method: 'get',
// params
// });
// }
/** 获取任务录制的数据 */ /** 获取任务录制的数据 */
export function getScriptRecord(group) { export function getScriptRecord(group) {
@ -494,3 +399,12 @@ export function generateDayRunPlan(planId, group) {
method: 'post' method: 'post'
}); });
} }
/** 创建排班计划仿真*/
export function schedulingNotify(params) {
return request({
url: `/api/scheduling/simulation`,
method: 'post',
params
});
}

View File

@ -42,9 +42,9 @@ class EMouse extends Group {
// 创建道岔边框 // 创建道岔边框
craeteSwitchBorder() { craeteSwitchBorder() {
const sectionA = this.device.model.sectionAInstance.instance; const sectionA = this.getInstanceByCode(this.device.model.sectionACode);
const sectionB = this.device.model.sectionBInstance.instance; const sectionB = this.getInstanceByCode(this.device.model.sectionBCode);
const sectionC = this.device.model.sectionCInstance.instance; const sectionC = this.getInstanceByCode(this.device.model.sectionCCode);
const rect = this.device.getBoundingRect(); const rect = this.device.getBoundingRect();
sectionA && rect.union(sectionA.getBoundingRect()); sectionA && rect.union(sectionA.getBoundingRect());

View File

@ -160,9 +160,6 @@ export function parser(data, skinCode) {
section['relSwitchCode'] = elem.code; section['relSwitchCode'] = elem.code;
} }
mapDevice[elem.code]['sectionAInstance'] = cnodeSection;
mapDevice[elem.code]['sectionBInstance'] = lnodeSection;
mapDevice[elem.code]['sectionCInstance'] = rnodeSection;
rnodeSection['layer'] = -1; rnodeSection['layer'] = -1;
} }
}, this); }, this);

View File

@ -49,7 +49,7 @@ import { launchFullscreen } from '@/utils/screen';
import { queryPermissionSimulation } from '@/api/management/author'; import { queryPermissionSimulation } from '@/api/management/author';
import { postCreateRoom, getjointTraining, checkRoomExist } from '@/api/chat'; import { postCreateRoom, getjointTraining, checkRoomExist } from '@/api/chat';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { simulationNotify } from '@/api/simulation'; import { simulationNotify, schedulingNotify } from '@/api/simulation';
import localStore from 'storejs'; import localStore from 'storejs';
import LimitList from '@/views/components/limits/index'; import LimitList from '@/views/components/limits/index';
import WindowResizeHandler from '@/mixin/WindowResizeHandler'; import WindowResizeHandler from '@/mixin/WindowResizeHandler';
@ -226,32 +226,37 @@ export default {
const query = { skinCode: this.courseModel.skinCode, group: this.jointGroup }; const query = { skinCode: this.courseModel.skinCode, group: this.jointGroup };
this.$router.push({ path: `/trainroom`, query: query }); this.$router.push({ path: `/trainroom`, query: query });
}, },
async start() { async createRoom() {
if (this.courseModel.prdType == '03') { try {
try { this.buttonLoading = true;
this.buttonLoading = true; const param = {
const param = { mapId: Number(this.mapId),
mapId: Number(this.mapId), prdCode: this.courseModel.prdCode
prdCode: this.courseModel.prdCode };
}; const res = await postCreateRoom(param);
const res = await postCreateRoom(param); if (res && res.code == 200) {
if (res && res.code == 200) { const query = { skinCode: this.courseModel.skinCode, group: res.data };
const query = { skinCode: this.courseModel.skinCode, group: res.data }; this.$router.push({ path: `/trainroom`, query: query });
this.$router.push({ path: `/trainroom`, query: query });
}
} catch (error) {
this.buttonLoading = false;
if (error.code == 20001) {
this.$confirm(this.$t('tip.createRoomFailedHint'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {}).catch(() => {});
}
if (error.code == 500009) {
this.$messageBox(error.message);
}
} }
} catch (error) {
this.buttonLoading = false;
if (error.code == 20001) {
this.$confirm(this.$t('tip.createRoomFailedHint'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {}).catch(() => {});
}
if (error.code == 500009) {
this.$messageBox(error.message);
}
}
},
async start() {
if (this.courseModel.prdType == '05') {
this.jumpScheduling();
} else if (this.courseModel.prdType == '03') {
this.createRoom();
} else { } else {
if (this.courseModel.pmsList.length) { if (this.courseModel.pmsList.length) {
this.jump(); this.jump();
@ -270,6 +275,18 @@ export default {
} }
} }
}, },
jumpScheduling() {
this.buttonLoading = true;
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
schedulingNotify(data).then(resp => {
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.buttonLoading = false;
});
},
jump() { jump() {
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode }; const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
this.buttonLoading = true; this.buttonLoading = true;

View File

@ -113,7 +113,6 @@ export default {
} }
this.$nextTick(() => { this.$nextTick(() => {
const mapId = getSessionStorage('demonList') || null; const mapId = getSessionStorage('demonList') || null;
console.log(mapId);
this.$refs.tree.setCurrentKey(mapId); this.$refs.tree.setCurrentKey(mapId);
this.loading = false; this.loading = false;
}); });

View File

@ -1,110 +1,205 @@
<template> <template>
<div> <div>
<el-dialog <el-dialog
title="排班计划" :title="title"
:visible.sync="show" :visible.sync="show"
top="50px" top="50px"
width="70%" width="95%"
:before-do-close="doClose" :before-do-close="doClose"
:close-on-click-modal="false" :close-on-click-modal="false"
:z-index="2000" :z-index="2000"
> >
<QueryListPage <div class="scheduling">
ref="queryListPage" <el-card class="scheduling_header">
:pager-config="pagerConfig" <el-form>
:query-form="queryForm" <el-row>
:query-list="queryList" <el-col :span="6">
/> <el-form-item label="派班选择:">
<el-date-picker
v-model="formModel.date"
type="date"
value-format="yyyy-MM-dd"
@change="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="运行图名称:">
<el-select v-model="formModel.runPlanId" style="display: inline-block">
<el-option
v-for="item in runPlanList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="派班模式:">
<div>{{ formModel.mode }}</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<div class="scheduling_body">
<div class="scheduling_body-label">{{ title }}</div>
<div class="scheduling_body-table">
<el-table
border
height="500"
:data="tableData"
>
<el-table-column prop="id" label="" width="80" />
<el-table-column prop="code" label="ID" width="180" />
<el-table-column prop="name" label="姓名" />
<el-table-column prop="amount1" label="数值 1" />
<el-table-column prop="amount2" label="数值 2" />
<el-table-column prop="amount3" label="数值 3" />
</el-table>
</div>
</div>
</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getScriptPageListOnline } from '@/api/script';
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
import { querySecheduling, generateScheduling } from '@/api/scheduling';
export default { export default {
name: 'AddQuest', name: 'AddQuest',
props: { props: {
group: {
type: String,
required: true
}
}, },
data() { data() {
return { return {
show: false, show: false,
roleShow: false, runPlanList: [],
mapList: [], formModel: {
pagerConfig: { date: '',
pageSize: 'pageSize', mode: '',
pageIndex: 'pageNum' runPlanId: ''
}, },
row: {}, tableData: [{
form: { code: '12987122',
role: '' name: '王小虎',
}, amount1: '234',
memberList: [], amount2: '3.2',
queryForm: { amount3: 10
labelWidth: '80px', }, {
reset: false, code: '12987123',
show: false, name: '王小虎',
queryObject: { amount1: '165',
amount2: '4.43',
} amount3: 12
}, }, {
queryList: { code: '12987124',
query: this.listQuest, name: '王小虎',
selectCheckShow: false, amount1: '324',
indexShow: true, amount2: '1.9',
columns: [ amount3: 9
{ }, {
title: '任务名称', code: '12987125',
prop: 'name' name: '王小虎',
}, amount1: '621',
{ amount2: '2.2',
title: '地图', amount3: 17
prop: 'mapId', }, {
type: 'tag', code: '12987126',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['id', 'name']); }, name: '王小虎',
tagType: (row) => { return 'success'; } amount1: '539',
}, amount2: '4.1',
{ amount3: 15
title: '创建时间', }]
prop: 'createTime'
}
],
actions: [
]
},
currentModel: {}
}; };
}, },
computed: {
title() {
return '排班计划';
}
},
created() { created() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
doShow() { doShow() {
this.formModel.day = '';
this.show = true; this.show = true;
this.reloadTable();
}, },
doClose() { doClose() {
this.show = false; this.show = false;
}, },
listQuest(params) { loadInitData() {
params['skinCode'] = this.$route.query.skinCode;
return getScriptPageListOnline(params);
},
async loadInitData() {
//
this.mapList = []; this.mapList = [];
listPublishMap().then(response => { listPublishMap().then(response => {
this.mapList = response.data; this.mapList = response.data;
}); });
}, },
handleQuery(day) {
reloadTable() { if (day) {
if (this.queryList && this.queryList.reload) { querySecheduling(this.group, {day}).then(resp => {
this.queryList.reload(); if (!resp.data) {
this.$confirm('无派班计划,是否创建?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
this.handleGenerate(day);
}).catch(() => { });
}
});
} }
},
handleGenerate(day) {
generateScheduling(this.group, {day}).then(respt => {
this.$message.success('创建派班计划成功');
}).catch(error => {
this.$messageBox(`${error.message}`);
});
} }
} }
}; };
</script> </script>
<style scoped rel="stylesheet/scss" lang="scss">
.scheduling {
&_header {
background: #fff;
padding: 10px;
}
&_body {
margin-top: 30px;
background: #ffff;
border: 1px solid #F1F1F1;
width: 100%;
overflow: auto;
&-label {
padding-left: 10px;
}
&-table {
width: 150%;
}
}
}
/deep/ .el-table {
td,th {
padding: 0px;
}
td:nth-child(1), th:nth-child(1) {
background: #fefefe;
}
}
/deep/ .el-dialog__body {
background: #fafafa;
}
/deep/ label {
font-weight: 0;
}
</style>

View File

@ -38,7 +38,7 @@
@faultChooseShow="faultChooseShow" @faultChooseShow="faultChooseShow"
@runQuestLoadShow="runQuestLoadShow" @runQuestLoadShow="runQuestLoadShow"
@switchMode="switchMode" @switchMode="switchMode"
@handleScheduling="handleScheduling" @schedulingShow="schedulingShow"
/> />
<menu-system-time ref="menuSystemTime" :offset="offset" :right="right" :group="group" /> <menu-system-time ref="menuSystemTime" :offset="offset" :right="right" :group="group" />
@ -52,7 +52,7 @@
<run-plan-Load ref="runPlanLoad" :group="group" /> <run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" /> <run-plan-view ref="runPlanView" :group="group" />
<add-quest ref="addQuest" @selectQuest="selectQuest" /> <add-quest ref="addQuest" @selectQuest="selectQuest" />
<scheduling ref="scheduling" /> <scheduling ref="scheduling" :group="group" />
</div> </div>
</template> </template>
@ -80,9 +80,7 @@ import { getProductDetail } from '@/api/management/mapprd';
import { runDiagramQuit, loadScript, getSimulationInfo } from '@/api/simulation'; import { runDiagramQuit, loadScript, getSimulationInfo } from '@/api/simulation';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
// import { isFullscreen } from '@/utils/screen';
import { loadMapData, loadMapDataById } from '@/utils/loaddata'; import { loadMapData, loadMapDataById } from '@/utils/loaddata';
// import { handleToken } from '@/utils/auth';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import Vue from 'vue'; import Vue from 'vue';
@ -138,12 +136,13 @@ export default {
panelShow: true, panelShow: true,
simulationShow: false, simulationShow: false,
drivingShow: false, drivingShow: false,
questId: 0, // Id questId: 0, // Id
group: '', group: '',
prdTypeMap: { prdTypeMap: {
'01': '01', // => '01': '01', // =>
'02': '02', // => '02': '02', // =>
'04': '02' // => '04': '02', // =>
'05': '' // => null
}, },
ibpShow: false ibpShow: false
}; };
@ -587,7 +586,7 @@ export default {
faultChooseShow() { faultChooseShow() {
this.$refs.faultChoose.doShow(); this.$refs.faultChoose.doShow();
}, },
handleScheduling() { schedulingShow() {
this.$refs.scheduling.doShow(); this.$refs.scheduling.doShow();
} }
} }

View File

@ -7,9 +7,9 @@
</div> </div>
<div class="display-draft"> <div class="display-draft">
<el-button-group> <el-button-group>
<el-button v-if="$route.query.prdType == '05'" @click="jumpIbp">IBP盘</el-button> <el-button v-if="isShowIbp" type="success" @click="jumpIbp">IBP盘</el-button>
<el-button type="jumpjlmap3d" @click="jumpjlmap3d">{{ jl3dname }}</el-button> <el-button type="jumpjlmap3d" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
<template v-if="questId"> <template v-if="isShowQuest">
<el-button type="danger" @click="handleQuitQuest">退出剧本</el-button> <el-button type="danger" @click="handleQuitQuest">退出剧本</el-button>
</template> </template>
<template v-else> <template v-else>
@ -25,7 +25,6 @@
<!-- 单人仿真 --> <!-- 单人仿真 -->
<script> <script>
// import ChartView from './demon/chartView';
import SetTime from './demon/setTime'; import SetTime from './demon/setTime';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { getGoodsTryUse } from '@/api/management/goods'; import { getGoodsTryUse } from '@/api/management/goods';
@ -40,7 +39,6 @@ import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'MenuDemon', name: 'MenuDemon',
components: { components: {
// ChartView,
SetTime SetTime
}, },
props: { props: {
@ -62,10 +60,10 @@ export default {
data() { data() {
return { return {
isDisable: false, isDisable: false,
tryTime: 0, // tryTime: 0, //
timeNow: 0, // timeNow: 0, //
time: null, // time: null, //
countTime: 0, // countTime: 0, //
remainingTime: 0, remainingTime: 0,
goodsId: this.$route.query.goodsId, goodsId: this.$route.query.goodsId,
try: this.$route.query.try, // try: this.$route.query.try, //
@ -77,6 +75,14 @@ export default {
jl3dname: '三维视图' jl3dname: '三维视图'
}; };
}, },
computed: {
isShowIbp() {
return this.$route.query.prdType == '06';
},
isShowQuest() {
return this.questId;
}
},
watch: { watch: {
'$store.state.training.subscribeCount': function () { '$store.state.training.subscribeCount': function () {
this.group && this.initLoadPage(); this.group && this.initLoadPage();

View File

@ -5,7 +5,7 @@
</el-select> </el-select>
<el-button-group> <el-button-group>
<el-button v-if="$route.query.prdType == '06'" size="small" type="success" @click="handleScheduling">排班计划 <el-button v-if="isShowScheduling" size="small" type="primary" @click="handleScheduling">排班计划
</el-button> </el-button>
<el-button v-if="isDemon" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">加载剧本 <el-button v-if="isDemon" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">加载剧本
</el-button> </el-button>
@ -73,6 +73,9 @@ export default {
}, },
isDemon() { isDemon() {
return this.$route.params.mode === 'demon'; return this.$route.params.mode === 'demon';
},
isShowScheduling() {
return this.$route.query.prdType == '05';
} }
}, },
watch: { watch: {
@ -134,7 +137,7 @@ export default {
this.runing = run; this.runing = run;
}, },
handleScheduling() { handleScheduling() {
this.$emit('handleScheduling'); this.$emit('schedulingShow');
}, },
setFault() { setFault() {
this.$emit('faultChooseShow'); this.$emit('faultChooseShow');