新版剧本代码调整

This commit is contained in:
joylink_cuiweidong 2020-03-27 11:31:40 +08:00
parent 9a9716e5a9
commit 966bed109b
8 changed files with 225 additions and 39 deletions

View File

@ -157,6 +157,14 @@ export function scriptRecordNotify(scriptId) {
});
}
/** 录制脚本仿真(新版)*/
export function scriptRecordNotifyNew(scriptId) {
return request({
url: `/api/scriptSimulation/${scriptId}/scriptWrite`,
method: 'get'
});
}
/** 保存剧本背景*/
export function saveScriptScenes(group) {
return request({
@ -189,6 +197,13 @@ export function getScriptMemberData(group) {
method: 'get'
});
}
/** 获取剧本编制的所有成员角色(新版地图)*/
export function getScriptMemberDataNew(group) {
return request({
url: `/api/scriptSimulation/${group}/allMember`,
method: 'get'
});
}
/** 获取剧本出演成员角色 */
export function getScriptPlayMember(group) {
@ -198,6 +213,14 @@ export function getScriptPlayMember(group) {
});
}
/** 获取剧本出演成员角色(新版地图) */
export function getScriptPlayMemberNew(group) {
return request({
url: `/api/scriptSimulation/${group}/allPlayer`,
method: 'get'
});
}
/** 取消剧本演出成员角色 */
export function cancleScriptMembers(group, data) {
return request({
@ -207,6 +230,15 @@ export function cancleScriptMembers(group, data) {
});
}
/** 取消剧本演出成员角色 */
export function cancleScriptMembersNew(group, data) {
return request({
url: `/api/scriptSimulation/${group}/removePlayers`,
method: 'put',
data
});
}
/** 选择剧本演出成员角色 */
export function selectScriptMembers(group, data) {
return request({
@ -216,6 +248,15 @@ export function selectScriptMembers(group, data) {
});
}
/** 选择剧本演出成员角色 (新版地图)*/
export function selectScriptMembersNew(group, data) {
return request({
url: `/api/scriptSimulation/${group}/choosePlayers`,
method: 'put',
data
});
}
/** 修改剧本演出成员性别 */
export function modifyScriptMemberSex(group, playerId, data) {
return request({

View File

@ -57,6 +57,7 @@ const LessonDetail = () => import('@/views/lesson/details');
const ScriptmanageHome = () => import('@/views/scriptManage/home');
const ScriptDisplay = () => import('@/views/scriptManage/display/index');
const ScriptDisplayNew = () => import('@/views/scriptManage/display/indexNew');
const IbpHome = () => import('@/views/ibp/home');
const IbpDraw = () => import('@/views/ibp/ibpDraw/index');
@ -154,6 +155,7 @@ export const UrlConfig = {
display: '/display',
displayNew: '/displayNew',
scriptDisplay: '/scriptDisplay',
scriptDisplayNew:'/scriptDisplayNew',
examRuleDraft: '/examRule/draft',
examRuleManage: '/examRule/manage',
lesson: {
@ -517,6 +519,13 @@ export const asyncRouter = [
},
hidden: true
},
{ // 剧本编辑 战场图
path: '/scriptDisplayNew/:mode',
component: ScriptDisplayNew,
meta: {
},
hidden: true
},
{
path: '/displayIscs/system',
component: IscsSystem,

View File

@ -87,7 +87,15 @@ export default {
{label: '司机', value: 'Driver', enLabel: 'Driver '},
{label: '通号', value: 'Repair', enLabel: 'Repairman '}
],
roleTypeNew:[
{label: '管理员', value: 'ADMIN', enLabel: 'Admin '},
// {label: '教员', value: 'Instructor', enLabel: 'Instructor '},
{label: '行调', value: 'DISPATCHER', enLabel: 'Dispatcher '},
{label: '行值', value: 'STATION_SUPERVISOR', enLabel: 'Attendant '},
{label: '观众', value: 'AUDIENCE', enLabel: 'Audience '},
{label: '司机', value: 'DRIVER', enLabel: 'Driver '},
{label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '}
],
SimulationType: [
{ label: '实训', value: 'Training'},
{ label: '仿真(行调/现地/司机)', value: 'Simulation'},

View File

@ -90,7 +90,7 @@ export default {
switch (obj.type) {
case 'scriptDesign': {
setSessionStorage('designType', 'scriptDesign');
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?lineCode=${obj.lineCode}` });
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?lineCode=${obj.lineCode}&drawWay=${obj.drawWay}` });
break;
}
case 'lessonDesign': {
@ -152,7 +152,8 @@ export default {
type: 'scriptDesign',
mapId: elem.id,
cityCode: elem.cityCode,
lineCode: elem.lineCode
lineCode: elem.lineCode,
drawWay: elem.drawWay
// code:elem.children.find(n => { return n.name.includes("")})
});
elem.children.push(

View File

@ -0,0 +1,59 @@
<template>
<div class="script-parent">
<div class="script-card" :style="{width: widthLeft+'px'}">
<tip-script-record ref="tipTaskRecord" :group="group" :width="widthLeft" />
</div>
<drap-left :width-left="widthLeft" :min="780" :max="980" @drapWidth="drapWidth" />
<div class="script-display">
<display ref="display" :size="size" />
</div>
</div>
</template>
<script>
import Display from '@/views/newMap/displayNew/index';
import TipScriptRecord from './tipScriptRecord';
import drapLeft from '@/views/components/drapLeft/index';
export default {
name: 'ScriptDisplayNew',
components: {
Display,
TipScriptRecord,
drapLeft
},
data() {
return {
widthLeft: 780,
size: {
width: document.documentElement.clientWidth - 780,
height: document.documentElement.clientHeight
},
group: this.$route.query.group
};
},
watch: {
'$store.state.app.windowSizeCount': function() {
this.size = { width: this.$store.state.app.width - 780, height: this.$store.state.app.height};
},
widthLeft: function(val) {
this.size = { width: this.$store.state.app.width - val, height: this.$store.state.app.height};
}
},
methods: {
drapWidth(width) {
this.widthLeft = Number(width);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.script-parent {
display: flex;
flex-flow: row;
.script-card {
width: 780px;
}
}
</style>

View File

@ -18,7 +18,7 @@ import { UrlConfig } from '@/router/index';
import { admin, superAdmin} from '@/router';
import { getQuestPageList, createQuest, deleteQuest, updateQuest, publishQuest, retractQuest} from '@/api/quest';
import { launchFullscreen } from '@/utils/screen';
import { scriptDraftRecordNotify, scriptRecordNotify } from '@/api/simulation';
import { scriptDraftRecordNotify, scriptRecordNotify, scriptRecordNotifyNew } from '@/api/simulation';
import CreateScript from './create';
import ScriptPublish from './publish';
@ -125,13 +125,25 @@ export default {
}
},
drawUp(index, row) {
scriptRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, lang:row.lang, lineCode:this.$route.query.lineCode };
this.$router.push({ path: `${UrlConfig.scriptDisplay}/script`, query });
launchFullscreen();
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
});
const drawWay = this.$route.query.drawWay;
if (drawWay == 'true') {
scriptRecordNotifyNew(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, lang:row.lang, lineCode:this.$route.query.lineCode, drawWay:drawWay};
this.$router.push({ path: `${UrlConfig.scriptDisplayNew}/script`, query });
launchFullscreen();
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
});
} else {
scriptRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, lang:row.lang, lineCode:this.$route.query.lineCode };
this.$router.push({ path: `${UrlConfig.scriptDisplay}/script`, query });
launchFullscreen();
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
});
}
},
deleteScript(index, row) {
this.$confirm(this.$t('scriptRecord.deleteScriptTip'), this.$t('global.tips'), {

View File

@ -14,7 +14,7 @@
<script>
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
import {getScriptPlayMember, getScriptMemberData, cancleScriptMembers, selectScriptMembers, modifyScriptMemberSex} from '@/api/simulation';
import {getScriptPlayMember, getScriptPlayMemberNew, getScriptMemberData, getScriptMemberDataNew, cancleScriptMembers, cancleScriptMembersNew, selectScriptMembers, selectScriptMembersNew, modifyScriptMemberSex} from '@/api/simulation';
export default {
name: 'AddRole',
props: {
@ -43,19 +43,38 @@ export default {
methods: {
initData() {
const group = this.$props.group;
getScriptMemberData(group).then(response=>{
const lastData = JSON.stringify(response.data);
this.allRoleData = this.coverData(lastData);
getScriptPlayMember(group).then(response=>{
const last = response.data;
// let userdata=JSON.stringify(response.data)
// let reg=new RegExp('\"id\":\"(.*?)\\\"','g');
// let datalist=userdata.match(reg);
const data = [];
last.forEach(function(element) { data.push(element.id); });
this.selectRoleData = data;
if (this.$route.query.drawWay == 'true') {
getScriptMemberDataNew(group).then(response=>{
debugger;
const lastData = JSON.stringify(response.data);
this.allRoleData = this.coverDataNew(lastData);
getScriptPlayMemberNew(group).then(response=>{
const last = response.data;
// let userdata=JSON.stringify(response.data)
// let reg=new RegExp('\"id\":\"(.*?)\\\"','g');
// let datalist=userdata.match(reg);
const data = [];
last.forEach(function(element) { data.push(element.id); });
this.selectRoleData = data;
});
});
});
} else {
getScriptMemberData(group).then(response=>{
const lastData = JSON.stringify(response.data);
this.allRoleData = this.coverData(lastData);
getScriptPlayMember(group).then(response=>{
const last = response.data;
// let userdata=JSON.stringify(response.data)
// let reg=new RegExp('\"id\":\"(.*?)\\\"','g');
// let datalist=userdata.match(reg);
const data = [];
last.forEach(function(element) { data.push(element.id); });
this.selectRoleData = data;
});
});
}
},
coverData(data) {
const roleTypeList = ConstConfig.ConstSelect.roleType;
@ -72,32 +91,67 @@ export default {
lastData = JSON.parse(lastData);
return lastData;
},
coverDataNew(data) {
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
let lastData = data.replace(new RegExp('id', 'g'), 'key');
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);
return lastData;
},
handleChange(value, direction, movedKeys) {
switch (direction) {
case 'right': {
const group = this.$props.group;
const data = movedKeys;
selectScriptMembers(group, data).then(response=>{
this.$message.success(this.$t('scriptRecord.selectScriptActorSuccess'));
this.$emit('refresh');
})
.catch(error => {
if (this.$route.query.drawWay == 'true') {
selectScriptMembersNew(group, data).then(response=>{
this.$message.success(this.$t('scriptRecord.selectScriptActorSuccess'));
this.$emit('refresh');
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.selectScriptActorFail')}: ${error.message}`);
return false;
});
} else {
selectScriptMembers(group, data).then(response=>{
this.$message.success(this.$t('scriptRecord.selectScriptActorSuccess'));
this.$emit('refresh');
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.selectScriptActorFail')}: ${error.message}`);
return false;
});
}
break;
}
case 'left': {
const group = this.$props.group;
const data = movedKeys;
cancleScriptMembers(group, data).then(response=>{
this.$emit('refresh');
this.$message.success(this.$t('scriptRecord.cancleScriptActorSuccess'));
})
.catch(error => {
if (this.$route.query.drawWay == 'true') {
cancleScriptMembersNew(group, data).then(response=>{
this.$emit('refresh');
this.$message.success(this.$t('scriptRecord.cancleScriptActorSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.cancleScriptActorFail')}: ${error.message}`);
this.initData();
});
} else {
cancleScriptMembers(group, data).then(response=>{
this.$emit('refresh');
this.$message.success(this.$t('scriptRecord.cancleScriptActorSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.cancleScriptActorFail')}: ${error.message}`);
this.initData();
});
}
}
}
},

View File

@ -77,11 +77,13 @@ export default {
getDeviceCode() {
const params = {deviceType:'StationStand'};
const group = this.$route.query.group;
getDeviceCodeByDeviceType(group, params).then(response =>{
let resultData = response.data;
resultData = JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g, 'name'));
this.stationList = resultData;
});
if (this.$route.query.drawWay != 'true') {
getDeviceCodeByDeviceType(group, params).then(response =>{
let resultData = response.data;
resultData = JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g, 'name'));
this.stationList = resultData;
});
}
},
deviceSelect(em) {
if (this.field.toUpperCase() === 'selectSingalCode'.toUpperCase() && em._type.toUpperCase() === 'Signal'.toUpperCase()) {