增加派班计划

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) {
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) {
return request({
@ -396,14 +309,6 @@ export function getDeviceCodeByDeviceType(group, params) {
params
});
}
// /** 根据设备类型获取设备条件列表 */
// export function getDeviceCoditionByDeviceType(params) {
// return request({
// url: `/api/simulation/deviceType/conditions`,
// method: 'get',
// params
// });
// }
/** 获取任务录制的数据 */
export function getScriptRecord(group) {
@ -494,3 +399,12 @@ export function generateDayRunPlan(planId, group) {
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() {
const sectionA = this.device.model.sectionAInstance.instance;
const sectionB = this.device.model.sectionBInstance.instance;
const sectionC = this.device.model.sectionCInstance.instance;
const sectionA = this.getInstanceByCode(this.device.model.sectionACode);
const sectionB = this.getInstanceByCode(this.device.model.sectionBCode);
const sectionC = this.getInstanceByCode(this.device.model.sectionCCode);
const rect = this.device.getBoundingRect();
sectionA && rect.union(sectionA.getBoundingRect());

View File

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

View File

@ -49,7 +49,7 @@ import { launchFullscreen } from '@/utils/screen';
import { queryPermissionSimulation } from '@/api/management/author';
import { postCreateRoom, getjointTraining, checkRoomExist } from '@/api/chat';
import { UrlConfig } from '@/router/index';
import { simulationNotify } from '@/api/simulation';
import { simulationNotify, schedulingNotify } from '@/api/simulation';
import localStore from 'storejs';
import LimitList from '@/views/components/limits/index';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
@ -226,32 +226,37 @@ export default {
const query = { skinCode: this.courseModel.skinCode, group: this.jointGroup };
this.$router.push({ path: `/trainroom`, query: query });
},
async start() {
if (this.courseModel.prdType == '03') {
try {
this.buttonLoading = true;
const param = {
mapId: Number(this.mapId),
prdCode: this.courseModel.prdCode
};
const res = await postCreateRoom(param);
if (res && res.code == 200) {
const query = { skinCode: this.courseModel.skinCode, group: res.data };
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);
}
async createRoom() {
try {
this.buttonLoading = true;
const param = {
mapId: Number(this.mapId),
prdCode: this.courseModel.prdCode
};
const res = await postCreateRoom(param);
if (res && res.code == 200) {
const query = { skinCode: this.courseModel.skinCode, group: res.data };
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);
}
}
},
async start() {
if (this.courseModel.prdType == '05') {
this.jumpScheduling();
} else if (this.courseModel.prdType == '03') {
this.createRoom();
} else {
if (this.courseModel.pmsList.length) {
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() {
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
this.buttonLoading = true;

View File

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

View File

@ -1,110 +1,205 @@
<template>
<div>
<el-dialog
title="排班计划"
:title="title"
:visible.sync="show"
top="50px"
width="70%"
width="95%"
:before-do-close="doClose"
:close-on-click-modal="false"
:z-index="2000"
>
<QueryListPage
ref="queryListPage"
:pager-config="pagerConfig"
:query-form="queryForm"
:query-list="queryList"
/>
<div class="scheduling">
<el-card class="scheduling_header">
<el-form>
<el-row>
<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>
</div>
</template>
<script>
import { getScriptPageListOnline } from '@/api/script';
import { listPublishMap } from '@/api/jmap/map';
import { querySecheduling, generateScheduling } from '@/api/scheduling';
export default {
name: 'AddQuest',
props: {
group: {
type: String,
required: true
}
},
data() {
return {
show: false,
roleShow: false,
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
runPlanList: [],
formModel: {
date: '',
mode: '',
runPlanId: ''
},
row: {},
form: {
role: ''
},
memberList: [],
queryForm: {
labelWidth: '80px',
reset: false,
show: false,
queryObject: {
}
},
queryList: {
query: this.listQuest,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '任务名称',
prop: 'name'
},
{
title: '地图',
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['id', 'name']); },
tagType: (row) => { return 'success'; }
},
{
title: '创建时间',
prop: 'createTime'
}
],
actions: [
]
},
currentModel: {}
tableData: [{
code: '12987122',
name: '王小虎',
amount1: '234',
amount2: '3.2',
amount3: 10
}, {
code: '12987123',
name: '王小虎',
amount1: '165',
amount2: '4.43',
amount3: 12
}, {
code: '12987124',
name: '王小虎',
amount1: '324',
amount2: '1.9',
amount3: 9
}, {
code: '12987125',
name: '王小虎',
amount1: '621',
amount2: '2.2',
amount3: 17
}, {
code: '12987126',
name: '王小虎',
amount1: '539',
amount2: '4.1',
amount3: 15
}]
};
},
computed: {
title() {
return '排班计划';
}
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.formModel.day = '';
this.show = true;
this.reloadTable();
},
doClose() {
this.show = false;
},
listQuest(params) {
params['skinCode'] = this.$route.query.skinCode;
return getScriptPageListOnline(params);
},
async loadInitData() {
//
loadInitData() {
this.mapList = [];
listPublishMap().then(response => {
this.mapList = response.data;
});
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
handleQuery(day) {
if (day) {
querySecheduling(this.group, {day}).then(resp => {
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>
<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"
@runQuestLoadShow="runQuestLoadShow"
@switchMode="switchMode"
@handleScheduling="handleScheduling"
@schedulingShow="schedulingShow"
/>
<menu-system-time ref="menuSystemTime" :offset="offset" :right="right" :group="group" />
@ -52,7 +52,7 @@
<run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" />
<add-quest ref="addQuest" @selectQuest="selectQuest" />
<scheduling ref="scheduling" />
<scheduling ref="scheduling" :group="group" />
</div>
</template>
@ -80,9 +80,7 @@ import { getProductDetail } from '@/api/management/mapprd';
import { runDiagramQuit, loadScript, getSimulationInfo } from '@/api/simulation';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login';
// import { isFullscreen } from '@/utils/screen';
import { loadMapData, loadMapDataById } from '@/utils/loaddata';
// import { handleToken } from '@/utils/auth';
import { EventBus } from '@/scripts/event-bus';
import Vue from 'vue';
@ -138,12 +136,13 @@ export default {
panelShow: true,
simulationShow: false,
drivingShow: false,
questId: 0, // Id
questId: 0, // Id
group: '',
prdTypeMap: {
'01': '01', // =>
'02': '02', // =>
'04': '02' // =>
'01': '01', // =>
'02': '02', // =>
'04': '02', // =>
'05': '' // => null
},
ibpShow: false
};
@ -587,7 +586,7 @@ export default {
faultChooseShow() {
this.$refs.faultChoose.doShow();
},
handleScheduling() {
schedulingShow() {
this.$refs.scheduling.doShow();
}
}

View File

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

View File

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