rt-sim-training-client/src/views/scriptManage/tipScriptRecord.vue

807 lines
32 KiB
Vue
Raw Normal View History

2020-06-11 18:32:26 +08:00
<template>
2020-12-08 09:42:38 +08:00
<div>
<div class="scriptRecordNew">
<div v-if="!dialogVisible" class="scriptRecordNewTitle" @click="minisize">
<span class="titleStyle">{{ $t('scriptRecord.scriptRecordTitle') }}</span>
</div>
</div>
<div>
<el-dialog
v-dialogDrag
:title="$t('scriptRecord.scriptRecordTitle')"
z-index="2008"
class="__scriptRecord"
:visible.sync="dialogVisible"
:modal="false"
append-to-body
:close-on-click-modal="false"
width="700px"
>
<div class="scriptRecordNewIn">
<el-tabs type="card">
<el-tab-pane :label="$t('scriptRecord.scriptRecordTitle')+'('+language+')'">
<div class="eachScriptPanel">
<div class="scriptPanelLeft">
<div class="panelLeftSelect">
<div>
<span style="font-size:13px;">当前剧本角色:</span>
<span style="font-size:13px;">{{ getRoleName(memberId) }}</span>
</div>
<div class="quickChange">
<div class="quickChangeList" style="margin:10px 0px 10px 0px;overflow-y:auto;height:200px;">
<div v-for="member in quickChangeMember.list" :key="member.id" class="setGroupOut">
<span style="font-size: 14px">{{ member.normalName }}</span>
<span class="setGroup">
<span v-if="member.userId" class="hasSetted">已设置</span>
<span v-else class="settingBtn" @click="changeRole(member)">设置</span>
</span>
</div>
2020-08-18 15:40:01 +08:00
</div>
</div>
</div>
<el-button-group v-if="!isReplaceBg" class="button-group">
<el-button v-if="isPause" size="small" type="primary" :disabled="executeDisabled" @click="pauseScript">{{ $t('scriptRecord.drivingPause') }}</el-button>
<el-button v-else size="small" type="primary" :disabled="executeDisabled" @click="executePlayScript">恢复</el-button>
<el-button size="small" type="danger" :disabled="!backDisabled" @click="dumpScenesData">{{ $t('scriptRecord.resetScript') }}</el-button>
<el-button v-if="backDisabled" size="small" type="primary" @click="startReplaceBg">{{ $t('scriptRecord.startReplaceBg') }}</el-button>
<el-button v-else size="small" type="primary" :disabled="backDisabled" @click="saveScenesStage">{{ $t('scriptRecord.saveBackground') }}</el-button>
<el-button size="small" type="success" :loading="isSavingScript" @click="saveScenesData">{{ $t('scriptRecord.saveData') }}</el-button>
</el-button-group>
</div>
<div class="scriptPanelRight">
<get-action-new ref="getAction" :group="group" :size="size" :member-list="memberList" @showConditionManage="showConditionManage" />
2020-08-17 18:47:38 +08:00
</div>
</div>
<template v-if="isReplaceBg">
<div class="mask" />
<el-button-group class="button-group">
2020-11-04 18:27:24 +08:00
<el-button v-if="isPause" size="small" type="primary" :disabled="executeDisabled" @click="pauseScript">{{ $t('scriptRecord.drivingPause') }}</el-button>
<el-button v-else size="small" type="primary" :disabled="executeDisabled" @click="executePlayScript">恢复</el-button>
<el-button size="small" type="primary" @click="confirmReplaceBg">{{ $t('scriptRecord.confirmReplaceBg') }}</el-button>
<el-button size="small" type="info" @click="cancelReplaceBg">{{ $t('scriptRecord.cancelReplaceBg') }}</el-button>
2020-11-04 18:27:24 +08:00
</el-button-group>
</template>
</el-tab-pane>
<el-tab-pane label="所有成员">
<div class="eachScriptPanel">
<all-script-role
ref="allScriptRole"
:member-id="memberId"
:tree-data="treeData"
:group="group"
@changeMode="changeMode"
@addMember="addMember"
/>
2020-08-17 18:47:38 +08:00
</div>
</el-tab-pane>
</el-tabs>
</div>
</el-dialog>
2020-06-11 18:32:26 +08:00
</div>
2021-05-18 10:04:03 +08:00
<add-script-member ref="addScriptMember" :station-list="stationList" @addScriptMember="addScriptMember" />
2020-11-05 18:02:02 +08:00
<condition-manage ref="conditionManage" @clearConditionActionId="clearConditionActionId" />
2020-06-11 18:32:26 +08:00
</div>
</template>
<script>
2020-06-12 11:31:30 +08:00
import Vue from 'vue';
import Cookies from 'js-cookie';
2020-08-17 18:47:38 +08:00
import {getDraftScriptByGroupNew, getAllSelectedScriptRole } from '@/api/script';
import ConstConfig from '@/scripts/ConstConfig';
2020-08-17 18:47:38 +08:00
import AddScriptMember from './addScriptMember';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
import GetActionNew from './getAction';
2020-08-17 18:47:38 +08:00
import AllScriptRole from './allScriptRole';
import { getToken } from '@/utils/auth';
2021-05-18 10:04:03 +08:00
import { mapGetters } from 'vuex';
2020-11-04 14:48:36 +08:00
import ConditionManage from './conditionManage';
2020-11-04 14:42:48 +08:00
import {executeScriptNew, dumpScriptDataNew, saveScriptDataNew, saveScriptScenesNew, updateMapLocationNew, simulationPause, startReplaceBg, confirmReplaceBg, cancelReplaceBg} from '@/api/simulation';
2020-06-11 18:32:26 +08:00
export default {
2020-08-03 09:18:27 +08:00
name:'TipScriptRecord',
2020-06-11 18:32:26 +08:00
components: {
2020-08-17 18:47:38 +08:00
GetActionNew,
AllScriptRole,
2020-11-04 14:48:36 +08:00
AddScriptMember,
ConditionManage
2020-06-11 18:32:26 +08:00
},
props: {
group: {
type: String,
required: true
},
2020-08-13 16:18:19 +08:00
offset:{
type: Number,
required: true
2020-11-04 14:42:48 +08:00
},
2020-11-04 18:27:24 +08:00
isReplaceBg: {
type: Boolean,
default: false
}
2020-06-11 18:32:26 +08:00
},
data() {
return {
2020-09-01 18:27:36 +08:00
isFirst:true,
2020-06-12 11:31:30 +08:00
language:'',
isPause:false,
executeDisabled: false,
backDisabled: false,
autoSaveScript: null,
isSavingScript: false,
2020-06-17 14:18:46 +08:00
mapLocation:null,
2020-09-01 18:27:36 +08:00
quickChangeMember:{list:[]},
2020-06-12 11:31:30 +08:00
size: {
width: 300,
height: 300
2020-08-13 16:45:27 +08:00
},
openWindow:null,
treeData:[],
memberList:[],
driverList:[],
activeTrainList:[],
oldMember:{id:null, type:''},
dialogVisible: false
2020-06-11 18:32:26 +08:00
};
},
2020-09-01 18:27:36 +08:00
computed:{
2021-05-18 10:04:03 +08:00
...mapGetters('map', [
'stationList'
]),
2020-09-01 18:27:36 +08:00
memberId() {
return this.$store.state.scriptRecord.updateRoleId;
},
memberType() {
return this.$store.state.scriptRecord.userRole;
},
2020-09-01 18:27:36 +08:00
orignalUserRoleId() {
return this.$store.state.training.orignalUserRoleId;
2020-11-04 18:27:24 +08:00
}
2020-09-01 18:27:36 +08:00
},
2020-06-12 11:31:30 +08:00
watch:{
'$store.state.map.mapViewLoadedCount': function (val) {
Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation);
this.isPause = !(this.$store.state.scriptRecord.simulationPause);
2020-06-17 14:18:46 +08:00
if (this.mapLocation) {
const newMapLocation = {'offsetX': this.mapLocation.x, 'offsetY': this.mapLocation.y, 'scaleRate': this.mapLocation.scale};
Vue.prototype.$jlmap.setOptions(newMapLocation);
}
2020-06-12 11:31:30 +08:00
},
'$store.state.scriptRecord.bgSet': function (val) {
this.backDisabled = val;
2020-06-12 16:12:33 +08:00
},
'$store.state.scriptRecord.simulationPause': function(val) {
this.isPause = !(this.$store.state.scriptRecord.simulationPause);
2020-06-18 14:19:13 +08:00
},
2020-09-01 18:27:36 +08:00
'memberList':function(val) {
if (this.isFirst) {
this.isFirst = false;
this.initData();
}
},
'$store.state.training.memberList': function (val) {
if (val && val.length) {
const memberData = this.$store.state.training.memberData;
this.driverList = [];
this.treeData = [];
if (this.$store.state.training.started) {
this.activeTrainList = this.$store.state.map.activeTrainList;
}
// 获取仿真成员列表
const result = covertMemberData(this.activeTrainList, Object.values(memberData));
this.driverList = result.driverList;
this.treeData = [{
label: '行调',
id: 'dispatcher',
type: 'role',
children: result.deviceListData[0]
}, {
label: '车站值班员',
id: 'stationSupervisor',
type: 'role',
children: result.deviceListData[2]
}, {
label: '司机',
id: 'driver',
type: 'role',
children: result.deviceListData[3]
}, {
label: '通号',
id: 'maintainer',
type: 'role',
children: result.deviceListData[1]
}, {
label: '车辆段信号楼',
id: 'depotDispatcher',
type: 'role',
children: result.deviceListData[4]
}, {
label: '上级部门',
id: 'parentDepartment',
type: 'role',
children: result.deviceListData[5]
}, {
label: '电力调度',
id: 'electricDispatcher',
type: 'role',
children: result.deviceListData[6]
2020-11-03 18:52:33 +08:00
},
{
label: '停车场信号楼',
id: 'parkingLotSignalBuilding',
type: 'role',
children: result.deviceListData[7]
},
{
label: '车站助理',
id: 'stationAssistant',
type: 'role',
children: result.deviceListData[8]
},
{
label: '车站站长',
id: 'stationMaster',
type: 'role',
children: result.deviceListData[9]
},
{
label: '车站信号员',
id: 'stationSignaler',
type: 'role',
children: result.deviceListData[10]
},
{
label: '车站客运员',
id: 'stationPassenger',
type: 'role',
children: result.deviceListData[11]
},
{
label: '车站扳道员',
id: 'stationSwitchMan',
type: 'role',
children: result.deviceListData[12]
},
{
2022-07-25 18:06:04 +08:00
label: '车站引导员',
id: 'stationFacilitator',
type: 'role',
children: result.deviceListData[13]
},
{
label: '车站工务工',
id: 'stationWorker',
type: 'role',
children: result.deviceListData[14]
2022-07-26 10:14:45 +08:00
},
{
label: '设备管理员',
id: 'deviceManager',
type: 'role',
children: result.deviceListData[15]
2022-08-02 11:00:18 +08:00
},
{
label: '车务段段长',
id: 'trainMaster',
type: 'role',
children: result.deviceListData[16]
}
];
this.memberList = result.lastMemberList;
}
},
// 按计划行车的列车列表更新(更新司机列表)
'$store.state.map.activeTrainListChange': function (val) {
const activeTrainList = this.$store.state.map.activeTrainList;
if (this.driverList.length > 0) {
const driverList = [];
if (activeTrainList && activeTrainList.length) {
activeTrainList.sort();
activeTrainList.forEach(groupNumber => {
const drivers = this.driverList.find(driver=>{
return driver.deviceCode == groupNumber;
});
if (drivers) {
driverList.push(drivers);
}
});
}
// this.memberData = [...this.treeData[0].children, ...this.treeData[1].children, ...this.treeData[2].children, ...this.treeData[3].children, ...this.treeData[4].children];
this.treeData[2].children = driverList;
} else {
this.activeTrainList = activeTrainList;
}
2020-06-12 11:31:30 +08:00
}
},
2020-06-11 18:32:26 +08:00
mounted() {
this.language = this.$route.query.lang == 'en' ? this.$t('scriptRecord.english') : this.$t('scriptRecord.chinese');
2020-06-12 11:31:30 +08:00
getDraftScriptByGroupNew(this.group).then(response=>{
this.backDisabled = response.data.bgSet;
2020-06-17 14:18:46 +08:00
this.mapLocation = response.data.mapLocation;
2020-06-12 11:31:30 +08:00
this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet);
});
2020-06-11 18:32:26 +08:00
},
methods:{
2020-06-12 11:31:30 +08:00
initData() {
2020-09-01 18:27:36 +08:00
getAllSelectedScriptRole(this.group).then(res=>{
res.data.forEach(each=>{
const eachMember = this.memberList.find(member=>{ return member.id == each.id; });
if (eachMember) {
this.quickChangeMember.list.push(eachMember);
}
2020-08-17 18:47:38 +08:00
});
this.oldMember = {id:this.memberId, type:this.memberType};
2020-06-12 11:31:30 +08:00
});
2020-06-11 18:32:26 +08:00
},
2020-08-17 18:47:38 +08:00
addScriptMember(member) {
2020-08-17 19:11:59 +08:00
member.userId = '';
member.disabled = false;
2020-08-17 18:47:38 +08:00
const lastData = JSON.stringify([member]);
const covertmember = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
const newMember = covertmember[0];
this.memberList.push(newMember);
2022-08-02 11:00:18 +08:00
const deviceTypeList = ['行调', '行值', '司机', '通号', '车辆段信号楼', '上级部门', '电力调度', '停车场信号楼', '车站助理', '车站站长', '车站信号员', '车站客运员', '车站扳道员', '车站引导员', '车站工务工', '设备管理员', '车务段段长'];
const index = deviceTypeList.indexOf(newMember.type);
if (index >= 0) {
const treeDataIn = this.treeData[index];
treeDataIn.children.push(newMember);
this.treeData[index] = treeDataIn;
2020-09-01 18:27:36 +08:00
}
2020-08-17 18:47:38 +08:00
},
addMember() {
this.$refs.addScriptMember.doShow();
},
2020-08-18 15:40:01 +08:00
changeRole(member) {
this.$refs.allScriptRole.changeRole(member);
},
2020-08-17 18:47:38 +08:00
getRoleName(memberId) {
const currentMember = this.memberList.find(member=>{
return member.id == memberId;
});
if (currentMember) {
2020-09-11 15:09:43 +08:00
return currentMember.normalName;
2020-08-17 18:47:38 +08:00
}
return '';
},
2020-06-11 18:32:26 +08:00
minisize() {
this.dialogVisible = true;
2020-06-12 11:31:30 +08:00
},
covert(data, roleTypeList) {
let lastData = data;
roleTypeList.forEach(function(element) {
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel);
} else {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.label);
}
});
lastData = JSON.parse(lastData);
lastData.forEach(each=>{
2020-07-08 13:05:09 +08:00
let deviceName = '';
if (each.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](each.deviceCode);
if (device) {
if (device._type == 'Train') {
deviceName = device.groupNumber;
} else {
deviceName = device.name;
}
} else {
deviceName = each.deviceCode;
}
}
2020-09-11 15:09:43 +08:00
each.deviceName = deviceName;
2020-09-01 18:27:36 +08:00
each.normalName = each.type + deviceName + (each.name ? '' + each.name : '');
2020-09-11 15:09:43 +08:00
each.label = each.normalName;
2020-06-12 11:31:30 +08:00
});
return lastData;
},
pauseScript() {
simulationPause(this.group).then(resp => {
this.$store.dispatch('scriptRecord/updateSimulationPause', true);
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.pauseFail'));
});
},
saveScenesData() {
this.isSavingScript = true;
2020-07-03 09:46:26 +08:00
const data = Vue.prototype.$jlmap.$options;
const dataZoom = {scale: data.scaleRate, x: data.offsetX, y: data.offsetY};
updateMapLocationNew(this.group, dataZoom).then(response=>{
saveScriptDataNew(this.group).then(resp => {
this.$message.success(this.$t('scriptRecord.saveDataSucess'));
this.isSavingScript = false;
2020-06-23 18:59:20 +08:00
// this.initAutoSaveScript();
2020-07-03 09:46:26 +08:00
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`);
this.isSavingScript = false;
if (error.code === 40004 || error.code === 40005 || error.code === 40003) {
// this.clearAutoSave();
} else {
// // this.initAutoSaveScript();
}
});
2020-06-12 11:31:30 +08:00
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`);
this.isSavingScript = false;
if (error.code === 40004 || error.code === 40005 || error.code === 40003) {
2020-06-23 18:59:20 +08:00
// this.clearAutoSave();
2020-06-12 11:31:30 +08:00
} else {
2020-06-23 18:59:20 +08:00
// // this.initAutoSaveScript();
2020-06-12 11:31:30 +08:00
}
});
2020-07-03 09:46:26 +08:00
2020-06-12 11:31:30 +08:00
},
saveScenesStage() {
const data = Vue.prototype.$jlmap.$options;
const group = this.$route.query.group;
const dataZoom = {scale: data.scaleRate, x: data.offsetX, y: data.offsetY};
2020-07-03 09:46:26 +08:00
updateMapLocationNew(group, dataZoom).then(response=>{
saveScriptScenesNew(this.group).then(resp => {
2020-06-12 11:31:30 +08:00
this.$store.dispatch('scriptRecord/updateBgSet', true);
this.$message.success(this.$t('scriptRecord.saveBackgroundSuceess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.updateLocationFail')}: ${error.message}`);
});
}).catch((error) => {
this.$messageBox(`${this.$t('scriptRecord.saveBackgroundFail')}: ${error.message}`);
});
},
initAutoSaveScript() {
const timeout = 1000 * 20;
this.clearAutoSave(this.autoSaveScript);
this.autoSaveScript = setInterval(this.saveScenesData, timeout);
},
clearAutoSave() {
if (this.autoSaveScript) {
clearInterval(this.autoSaveScript);
this.autoSaveScript = null;
}
},
executePlayScript() {
executeScriptNew(this.group).then(resp => {
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.recoverFail'));
});
},
dumpScenesData() {
// this.clearAutoSave();
2020-06-12 11:31:30 +08:00
const group = this.group;
this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
dumpScriptDataNew(group).then(resp => {
2020-11-06 14:23:43 +08:00
// this.$parent.resetBeginTime();
2020-06-12 11:31:30 +08:00
this.$refs['getAction'].loadInitData();
2020-08-31 16:51:36 +08:00
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:this.memberId,
2020-09-01 18:27:36 +08:00
newMemberId:this.orignalUserRoleId,
2020-08-31 16:51:36 +08:00
userId:this.$store.state.user.id,
name:this.$store.state.user.nickname
}
);
2020-09-01 18:27:36 +08:00
const new_member = this.memberList.find(mem=>{ return mem.id == this.orignalUserRoleId; });
const old_member = this.memberList.find(mem=>{ return mem.id == this.memberId; });
if (new_member && old_member) {
new_member.userId = this.$store.state.user.id;
new_member.disabled = true;
this.quickChangeMember.list = [new_member];
this.$emit('resetChat');
}
2020-11-05 15:31:28 +08:00
this.$refs.conditionManage && this.$refs.conditionManage.handleClose();
this.$refs.getAction.conditionActionId = '';
2020-09-01 18:27:36 +08:00
this.$store.dispatch('training/setPrdType', '02');
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('scriptRecord/updateRole', new_member.type + ':' + this.orignalUserRoleId);
2020-06-12 11:31:30 +08:00
this.$store.dispatch('scriptRecord/updateBgSet', false);
2020-09-01 18:27:36 +08:00
// this.memberId = this.orignalUserRoleId;
this.oldMember = {id:this.orignalUserRoleId, type:new_member.type};
2020-06-12 11:31:30 +08:00
this.$message.success(this.$t('scriptRecord.resetDataSuccess'));
}).catch(() => {
2020-11-06 14:23:43 +08:00
// console.log(error);
2020-06-12 11:31:30 +08:00
this.$messageBox(this.$t('scriptRecord.resetDataFail'));
});
});
},
changeMode(member) {
let prdType = '';
if (this.openWindow) {
this.openWindow.close();
}
const role = Object.assign({}, member);
if (role.type == '行值') {
prdType = '01';
role.type = 'STATION_SUPERVISOR';
this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$store.dispatch('training/setRoleDeviceCode', role.deviceCode);
} else if (role.type == '行调') {
prdType = '02';
role.type = 'DISPATCHER';
this.$store.dispatch('training/setRoles', 'DISPATCHER');
} else if (role.type == '司机') {
prdType = '04';
role.type = 'DRIVER';
this.$store.dispatch('training/setRoles', 'DRIVER');
} else if (role.type == '通号') {
prdType = '';
role.type = 'MAINTAINER';
this.$store.dispatch('training/setRoles', 'MAINTAINER');
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer',
query:{
mapid:this.$route.query.mapId,
group:this.group,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
this.openWindow = window.open(routeData.href);
} else if (role.type == '车辆段信号楼') {
prdType = '05';
role.type = 'DEPOT_DISPATCHER';
this.$store.dispatch('training/setRoles', 'DEPOT_DISPATCHER');
} else if (role.type == '上级部门') {
prdType = '';
role.type = 'PARENT_DEPARTMENT';
this.$store.dispatch('training/setRoles', 'PARENT_DEPARTMENT');
} else if (role.type == '电力调度') {
prdType = '';
role.type = 'ELECTRIC_DISPATCHER';
this.$store.dispatch('training/setRoles', 'ELECTRIC_DISPATCHER');
2020-11-03 18:52:33 +08:00
} else if (role.type == '停车场信号楼') {
prdType = '';
role.type = 'PARKING_LOT_SIGNAL_BUILDING';
this.$store.dispatch('training/setRoles', 'PARKING_LOT_SIGNAL_BUILDING');
2022-07-26 10:41:08 +08:00
} else if (role.type == '车站助理') {
prdType = '';
role.type = 'STATION_ASSISTANT';
this.$store.dispatch('training/setRoles', 'STATION_ASSISTANT');
} else if (role.type == '车站站长') {
prdType = '';
role.type = 'STATION_MASTER';
this.$store.dispatch('training/setRoles', 'STATION_MASTER');
} else if (role.type == '车站信号员') {
2022-07-26 13:55:26 +08:00
prdType = '01';
2022-07-26 10:41:08 +08:00
role.type = 'STATION_SIGNALER';
this.$store.dispatch('training/setRoles', 'STATION_SIGNALER');
} else if (role.type == '车站客运员') {
prdType = '';
role.type = 'STATION_PASSENGER';
this.$store.dispatch('training/setRoles', 'STATION_PASSENGER');
} else if (role.type == '车站扳道员') {
prdType = '01';
2022-07-26 10:41:08 +08:00
role.type = 'STATION_SWITCH_MAN';
this.$store.dispatch('training/setRoles', 'STATION_SWITCH_MAN');
} else if (role.type == '车站引导员') {
prdType = '';
role.type = 'STATION_FACILITATOR';
this.$store.dispatch('training/setRoles', 'STATION_FACILITATOR');
} else if (role.type == '车站工务工') {
prdType = '';
role.type = 'STATION_WORKER';
this.$store.dispatch('training/setRoles', 'STATION_WORKER');
} else if (role.type == '设备管理员') {
prdType = '';
role.type = 'DEVICE_MANAGER';
this.$store.dispatch('training/setRoles', 'DEVICE_MANAGER');
2022-08-01 17:48:03 +08:00
} else if (role.type == '车务段段长') {
prdType = '';
role.type = 'TRAIN_MASTER';
this.$store.dispatch('training/setRoles', 'TRAIN_MASTER');
} else {
prdType = '';
}
this.$store.dispatch('training/setPrdType', prdType);
this.$store.dispatch('scriptRecord/updateRole', role.type + ':' + role.id);
const newRole = role;
const oldRole = this.oldMember;
const quickChangeMember = this.quickChangeMember.list;
quickChangeMember.forEach((mem, index)=>{
if (oldRole.id && mem.id == oldRole.id) {
delete mem.userId;
}
if (newRole.id == mem.id) {
mem.userId = this.$store.state.user.id;
}
});
this.quickChangeMember = {list:quickChangeMember};
const memberdata = this.quickChangeMember.list.find(mem=>{ return mem.id == newRole.id; });
if (!memberdata) {
newRole.userId = this.$store.state.user.id;
const roleTypeEnumMap = {
'STATION_SUPERVISOR':'行值',
'DISPATCHER':'行调',
'DRIVER':'司机',
'MAINTAINER':'通号',
'DEPOT_DISPATCHER':'车辆段信号楼',
'PARENT_DEPARTMENT':'上级部门',
2020-11-04 09:26:22 +08:00
'ELECTRIC_DISPATCHER':'电力调度',
2022-07-26 10:41:08 +08:00
'PARKING_LOT_SIGNAL_BUILDING':'停车场信号楼',
'STATION_ASSISTANT':'车站助理',
'STATION_MASTER':'车站站长',
'STATION_SIGNALER':'车站信号员',
'STATION_PASSENGER':'车站客运员',
'STATION_SWITCH_MAN':'车站扳道员',
'STATION_FACILITATOR':'车站引导员',
'STATION_WORKER':'车站工务工',
2022-08-01 17:48:03 +08:00
'DEVICE_MANAGER':'设备管理员',
'TRAIN_MASTER':'车务段段长'
2022-07-26 10:41:08 +08:00
};
newRole.type = roleTypeEnumMap[newRole.type];
this.quickChangeMember.list.push(newRole);
}
this.$store.dispatch('training/updateMemberListInScript',
{
oldMemberId:this.oldMember.id,
newMemberId:role.id,
userId:this.$store.state.user.id,
name:this.$store.state.user.nickname
}
);
this.oldMember = Object.assign({}, role);
this.$refs.allScriptRole.updateLoading();
2020-11-04 18:27:24 +08:00
},
startReplaceBg() {
startReplaceBg(this.group).then(resp => {
this.$emit('setReplace', true);
}).catch(error => {
this.$messageBox(error.message);
});
},
confirmReplaceBg() {
confirmReplaceBg(this.group).then(resp => {
this.$message.success('替换成功');
this.$emit('setReplace', false);
}).catch(error => {
this.$messageBox(error.message);
});
},
cancelReplaceBg() {
cancelReplaceBg(this.group).then(resp => {
this.$emit('setReplace', false);
}).catch(error => {
this.$messageBox(error.message);
});
},
2020-11-06 13:15:18 +08:00
showConditionManage(actionInfo) {
this.$refs.conditionManage.doShow(actionInfo);
2020-11-05 18:02:02 +08:00
},
clearConditionActionId() {
this.$refs.getAction.conditionActionId = '';
2020-11-04 18:27:24 +08:00
}
2020-06-11 18:32:26 +08:00
}
};
</script>
<style lang="scss">
.__scriptRecord {
padding: 0;
pointer-events: none !important;
}
.__scriptRecord {
.el-dialog__header {
padding: 10px 0;
pointer-events: all !important;
text-align: center;
}
.el-dialog__body {
padding: 0;
pointer-events: all !important;
}
.el-dialog__headerbtn {
top: 10px;
right: 10px;
}
}
</style>
2020-06-11 18:32:26 +08:00
<style lang="scss" scoped>
2020-06-12 11:31:30 +08:00
.button-group{
position: absolute;
2020-11-04 16:17:01 +08:00
left: 0;
bottom: 0;
2020-11-04 14:42:48 +08:00
z-index: 5;
2020-06-12 11:31:30 +08:00
}
.eachScriptPanel{
height: 300px;
display: inline-block;
width:100%;
}
.scriptPanelLeft{
width: 330px;
height: 100%;
vertical-align: top;
position: absolute;
left: 0;
top: 0;
2020-06-12 16:12:33 +08:00
z-index: 2;
2020-06-12 11:31:30 +08:00
}
.scriptPanelRight{
width: 680px;
2020-11-04 16:17:01 +08:00
position: relative;
2020-06-11 18:32:26 +08:00
}
.scriptRecordNew{
position: absolute;
z-index: 10;
right: 12px;
top: calc(45% + 100px);
2020-06-11 18:32:26 +08:00
}
.scriptRecordNewTitle{
position: absolute;
background: #fff;
border-radius: 5px 0px 0px 5px ;
2020-06-11 18:32:26 +08:00
padding: 5px 0px;
width: 23px;
2020-06-11 18:32:26 +08:00
text-align: center;
left: 50%;
transform: translateX(-50%);
cursor: pointer;
2021-01-27 09:47:26 +08:00
top:-28px;
2020-06-11 18:32:26 +08:00
}
.scriptRecordNewIn{
padding: 10px;
background: #fff;
2020-06-12 16:12:33 +08:00
height: 380px;
2020-06-12 11:31:30 +08:00
}
.scriptPanelRight{
2020-08-18 15:40:01 +08:00
}
.quickChange{
width: 300px;
}
.quickChange_head{
font-size: 14px;
margin-top: 5px;
color: #409eff;
}
.setGroup{
font-size: 14px;
float: right;
margin-right: 15px;
}
.settingBtn{
color: #409eff;
cursor: pointer;
padding: 2px 10px;
2020-08-18 15:40:01 +08:00
border-radius: 4px;
border: 1px #409eff solid;
2020-08-18 15:40:01 +08:00
}
.setGroupOut{
2020-10-30 15:06:05 +08:00
padding: 4px 6px;
}
.setGroupOut:hover{
background-color:#ccc;
2020-06-11 18:32:26 +08:00
}
.hasSetted{
width: 50px;
text-align: center;
display: inline-block;
}
2020-11-04 14:42:48 +08:00
.mask {
position: absolute;
2020-11-04 16:17:01 +08:00
top:0;
right:0;
bottom:0;
left:0;
2020-11-04 14:42:48 +08:00
opacity: 0.5;
z-index: 2;
&::before {
content: '';
position: absolute;
top:0;
right:0;
bottom:0;
left:0;
background: #aaa;
filter: blur(20px);
}
}
2020-06-11 18:32:26 +08:00
</style>