添加 修改系统时间接口

剧本编制 添加角色 代码调整
This commit is contained in:
joylink_cuiweidong 2022-07-27 11:28:18 +08:00
parent f8b83fc4e6
commit d28803292e
5 changed files with 126 additions and 1 deletions

View File

@ -284,6 +284,15 @@ export function getEveryDayRunPlanNew(group) {
});
}
/** 大铁线路 修改系统时间 */
export function modifySystemTime(data, group) {
return request({
url: `simulation/${group}/modifySystemTime`,
method: 'PUT',
data: data
});
}
/** 新版地图按计划行车 */
export function ranAsPlan(data, group) {
return request({

View File

@ -0,0 +1,85 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="show" width="550px" :before-close="doClose">
<el-form ref="form" label-width="120px" :model="formModel" :rules="rules">
<el-form-item :label="$t('display.setTime.systemTime')" prop="initTime">
<el-time-picker
v-model="formModel.initTime"
:picker-options="pickerOptions"
:placeholder="$t('display.setTime.anyTime')"
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="show = false">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" :loading="status" @click="handleSure">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { modifySystemTime } from '@/api/simulation';
import { prefixIntrger } from '@/utils/date';
//
export default {
data() {
return {
show: false,
formModel: {
time: new Date()
},
maxNumber: 1,
pickerOptions: { selectableRange: '00:00:00 - 23:59:59' },
status: false
};
},
computed: {
title() {
return '修改系统时间';
},
group() {
return this.$route.query.group;
},
rules() {
return {
time: [
{ required: true, message: this.$t('display.setTime.selectSystemTime'), trigger: 'change' }
]
};
}
},
methods: {
doShow() {
// this.formModel.time = new Date(this.$store.state.training.initTime || null);
this.show = true;
},
doClose() {
this.status = false;
this.show = false;
},
formatTime(initTime) {
const hh = prefixIntrger(initTime.getHours(), 2);
const mm = prefixIntrger(initTime.getMinutes(), 2);
const ss = prefixIntrger(initTime.getSeconds(), 2);
return `${hh}:${mm}:${ss}`;
},
handleSure() {
this.$refs.form.validate((valid) => {
if (valid) {
this.status = true;
const model = {
time: this.formatTime(this.formModel.time)
};
modifySystemTime(model, this.group).then(resp => {
this.status = false;
}).catch(() => {
this.status = false;
this.$messageBox('修改系统时间失败,请稍后再试');
});
this.doClose();
}
});
}
}
};
</script>

View File

@ -29,6 +29,9 @@
<template v-if="isScriptRun">
<el-button type="danger" size="small" @click="handleQuitQuest">退出剧本</el-button>
</template>
<template v-if="$route.query.lineCode == '16'">
<el-button type="primary" size="small" @click="modifySystemTime">修改系统时间</el-button>
</template>
<template v-else-if="!projectDevice">
<el-button v-if="project !== 'srsandbox' && $route.query.lineCode !== '16' " type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
<!-- isDisable&& -->
@ -51,6 +54,7 @@
/>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<modify-time v-if="$route.query.lineCode == '16'" ref="modifySysTime" />
</div>
</template>
@ -58,6 +62,7 @@
<!-- 单人仿真 -->
<script>
import SetTime from './demon/setTime';
import ModifyTime from './demon/modifyTime';
import DemonMenu from './demonMenu';
import DemonChat from './demonChat';
import { Notification } from 'element-ui';
@ -80,6 +85,7 @@ export default {
name: 'MenuDemon',
components: {
SetTime,
ModifyTime,
DemonChat,
MenuSchema,
DemonMenu,
@ -306,6 +312,10 @@ export default {
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
},
//
modifySystemTime() {
this.$refs.modifySysTime.doShow();
},
//
async selectQuest({row, id, mapLocation, roleName}) {
try {

View File

@ -37,12 +37,16 @@
<el-button v-if="isAdministrator && !datie" v-loading="pauseLoading" :type="simulationPaused?'warning':'primary'" size="small" @click="startOrPause">{{ simulationPaused?'开始':'暂停' }}</el-button>
<el-button type="danger" size="small" @click="end">{{ $t('joinTraining.initialize') }}</el-button>
</template>
<template v-if="$route.query.lineCode == '16'">
<el-button type="primary" size="small" @click="modifySystemTime">修改系统时间</el-button>
</template>
</template>
<el-button type="primary" :loading="backLoading" size="small" @click="back">退出</el-button>
</el-button-group>
</div>
<qr-code ref="qrCode" />
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<modify-time v-if="$route.query.lineCode == '16'" ref="modifySysTime" />
<equipment ref="equipment" />
<contect-us ref="contectUs" />
</div>
@ -54,6 +58,7 @@ import StatusIcon from '@/views/components/StatusIcon/statusIcon';
import ChatBox from '../chatView/chatBox';
import Equipment from '@/views/newMap/displayNew/demon/equipment';
import SetTime from '@/views/newMap/displayNew/demon/setTime';
import ModifyTime from '@/views/newMap/displayNew/demon/modifyTime';
import { ranAsPlan, exitRunPlan, clearSimulation } from '@/api/simulation';
import { exitFullscreen } from '@/utils/screen';
import { getSimulationQrcode } from '@/api/jointSimulation';
@ -71,6 +76,7 @@ export default {
ChatBox,
QrCode,
SetTime,
ModifyTime,
Equipment,
ContectUs,
StatusIcon
@ -285,6 +291,10 @@ export default {
});
}
},
//
modifySystemTime() {
this.$refs.modifySysTime.doShow();
},
// Admin Instructor Dispatcher Attendant Audience Driver MAINTAINER
addrolesList(list) {
list.forEach(item => {

View File

@ -20,7 +20,7 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="formModel.type === 'STATION_SUPERVISOR'" label="值班车站:" prop="deviceCode">
<el-form-item v-if="stationRoleList.includes(formModel.type)" label="值班车站:" prop="deviceCode">
<el-select v-model="formModel.deviceCode" placeholder="请选择" size="small">
<el-option
v-for="item in filterStationList"
@ -60,6 +60,17 @@ export default {
name:'',
deviceCode: ''
},
stationRoleList:[
'STATION_SUPERVISOR',
'STATION_ASSISTANT',
'STATION_MASTER',
'STATION_SIGNALER',
'STATION_PASSENGER',
'STATION_SWITCH_MAN',
'STATION_FACILITATOR',
'STATION_WORKER',
'DEVICE_MANAGER'
],
filterStationList: [],
rules: {
type: [