路由调整

接口调整
This commit is contained in:
joylink_cuiweidong 2019-10-31 13:56:42 +08:00
parent b5b08a0afd
commit 681ac5e886
13 changed files with 1614 additions and 1631 deletions

View File

@ -91,6 +91,7 @@ function handleRoute(to, from, next, routeInfo) {
} else {
// 除没有动态改变权限的需求可直接next() 删下方权限判断
if (hasPermission(store.getters.roles, to.meta.roles)) {
debugger;
if (to.path === '/404' && to.redirectedFrom === '/') {
next(localStore.get('trainingPlatformRoute' + store.getters.id) || '/trainingPlatform');
} else {

View File

@ -338,7 +338,8 @@ export const asyncRouter = [
hidden: true
},
{
path: 'lesson/home/:mapId/:skinCode',
path: 'lesson/home/:mapId',
// /:skinCode
component: LessonHome,
hidden: true
},

File diff suppressed because it is too large Load Diff

View File

@ -95,12 +95,13 @@ export default {
switch (obj.type) {
case 'scriptDesign': {
setSessionStorage('designType', 'scriptDesign');
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?skinCode=${obj.skinCode}` });
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}` });
break;
}
case 'lessonDesign': {
setSessionStorage('designType', 'lessonDesign');
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}/${obj.skinCode}`, query: {cityCode: obj.cityCode} });
// /${obj.skinCode}
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}`, query: {cityCode: obj.cityCode} });
break;
}
case 'runPlanDesign': {

View File

@ -3,14 +3,14 @@
<div class="jalmap3ddiv">
<div class="trainstatus">
{{$t('jlmap3d.trainGroupNumber')}}{{ trainnum }} {{ stoptimes }}
{{ $t('jlmap3d.trainGroupNumber') }}{{ trainnum }} {{ stoptimes }}
</div>
<div class="display-draft">
<el-button-group>
<!-- <el-button type="primary" @click="raystand">站台选择</el-button> -->
<el-button type="primary" @click="cctvplane">{{ cctvbuttonmsg }}</el-button>
<el-button type="primary" @click="showplane">{{ showbuttonmsg }}</el-button>
<el-button type="primary" @click="back">{{$t('global.back')}}</el-button>
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
@ -20,8 +20,7 @@
<div id="jlsimulation" class="jlmap3ddraw">
<canvas id="canvastexture" />
</div>
<div id="jlcctv" v-show="cctvshow" class="jlmap3cctv">
</div>
<div v-show="cctvshow" id="jlcctv" class="jlmap3cctv"/>
<Drive-Mmi v-if="mmishow" ref="mmiui" />
@ -53,185 +52,185 @@ import DriveTms from '@/views/jlmap3d/drive/sceneview/tmsview';
var train;
export default {
name: 'Jl3dDrive',
components: {
DriveMmi,
DriveTms
},
data() {
return {
trainlist: null,
stationlist: null,
msgdata: null,
training: {
id: '',
name: '',
remarks: ''
},
mapdata: null,
jlmap3d: null,
selectmodel: null,
cctvshow:true,
cctvbuttonmsg: this.$t('jlmap3d.surveillanceHidden'),
mmishow: false,
showbuttonmsg: this.$t('jlmap3d.trainInstrumentationDisplay'),
trainnum: '',
stoptimes: ''
};
},
watch: {
'jlmap3d.nowspeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updatespeed(newVal);
}
}
}
},
'jlmap3d.nowmxlen': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updatelen(newVal);
}
}
}
},
'jlmap3d.atpspeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updateatpspeed(newVal);
}
}
}
},
'jlmap3d.atospeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updateatospeed(newVal);
}
}
}
},
'jlmap3d.trainnum': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.trainnum = newVal;
}
}
},
'jlmap3d.stime': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.stoptimes = newVal;
}
}
},
'jlmap3d.drivecount': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.$refs.mmiui.updatedrivedata(this.jlmap3d.drivedata);
}
}
}
},
beforeDestroy() {
if (this.jlmap3d) {
this.jlmap3d.webwork.postMessage('off');
this.jlmap3d.endsocket();
this.jlmap3d.dispose();
this.jlmap3d = null;
name: 'Jl3dDrive',
components: {
DriveMmi,
DriveTms
},
data() {
return {
trainlist: null,
stationlist: null,
msgdata: null,
training: {
id: '',
name: '',
remarks: ''
},
mapdata: null,
jlmap3d: null,
selectmodel: null,
cctvshow:true,
cctvbuttonmsg: this.$t('jlmap3d.surveillanceHidden'),
mmishow: false,
showbuttonmsg: this.$t('jlmap3d.trainInstrumentationDisplay'),
trainnum: '',
stoptimes: ''
};
},
watch: {
'jlmap3d.nowspeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updatespeed(newVal);
}
}
}
},
'jlmap3d.nowmxlen': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updatelen(newVal);
}
}
}
},
'jlmap3d.atpspeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updateatpspeed(newVal);
}
}
}
},
'jlmap3d.atospeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updateatospeed(newVal);
}
}
}
},
'jlmap3d.trainnum': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.trainnum = newVal;
}
}
},
'jlmap3d.stime': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.stoptimes = newVal;
}
}
},
'jlmap3d.drivecount': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.$refs.mmiui.updatedrivedata(this.jlmap3d.drivedata);
}
}
}
},
beforeDestroy() {
if (this.jlmap3d) {
this.jlmap3d.webwork.postMessage('off');
this.jlmap3d.endsocket();
this.jlmap3d.dispose();
this.jlmap3d = null;
// this.$destroy();
}
},
// this.$destroy();
}
},
mounted() {
this.mmishow = true;
mounted() {
this.mmishow = true;
// this.$refs.mmiui.init();
},
methods: {
show: function (skinCode) {
// console.log("show");
// console.log(skinCode);
// console.log(this.jlmap3d);
// this.$refs.mmiui.init();
},
methods: {
show: function (skinCode) {
// console.log("show");
// console.log(skinCode);
// console.log(this.jlmap3d);
if (this.jlmap3d == null) {
this.init(skinCode);
} else {
// this.jlmap3d.restart();
this.jlmap3d.eventon();
this.jlmap3d.animateon();
if (this.jlmap3d == null) {
this.init(skinCode);
} else {
// this.jlmap3d.restart();
this.jlmap3d.eventon();
this.jlmap3d.animateon();
}
},
init: function (skinCode) {
const mapdata = this.$store.getters['map/map'];
const dom = document.getElementById('app');
this.jlmap3d = new JLmapDriving(dom, mapdata, skinCode,this.$store);
this.jlmap3d.eventon();
this.cctvshow = false;
}
},
init: function (skinCode) {
const mapdata = this.$store.getters['map/map'];
const dom = document.getElementById('app');
this.jlmap3d = new JLmapDriving(dom, mapdata, skinCode, this.$store);
this.jlmap3d.eventon();
this.cctvshow = false;
},
raystand() {
this.jlmap3d.rayswitch('stand');
},
raytrain() {
this.jlmap3d.rayswitch('train');
},
raysection() {
this.jlmap3d.rayswitch('section');
},
raysignal() {
this.jlmap3d.rayswitch('signal');
},
rayswitch() {
this.jlmap3d.rayswitch('switch');
},
sstation(changedata) {
this.jlmap3d.updatecamera(changedata.mesh, 'station');
},
strain(changedata) {
if (changedata.dispose == false) {
this.jlmap3d.updatecamera(changedata, 'train');
}
},
raystand() {
this.jlmap3d.rayswitch('stand');
},
raytrain() {
this.jlmap3d.rayswitch('train');
},
raysection() {
this.jlmap3d.rayswitch('section');
},
raysignal() {
this.jlmap3d.rayswitch('signal');
},
rayswitch() {
this.jlmap3d.rayswitch('switch');
},
sstation(changedata) {
this.jlmap3d.updatecamera(changedata.mesh, 'station');
},
strain(changedata) {
if (changedata.dispose == false) {
this.jlmap3d.updatecamera(changedata, 'train');
}
},
},
back() {
this.$emit('showdriving');
this.jlmap3d.eventoff();
this.jlmap3d.animateoff();
// this.jlmap3d = null;
},
showplane() {
if (this.mmishow == true) {
this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationHidden');
this.mmishow = false;
} else {
this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationDisplay');
this.mmishow = true;
}
back() {
this.$emit('showdriving');
this.jlmap3d.eventoff();
this.jlmap3d.animateoff();
// this.jlmap3d = null;
},
showplane() {
if (this.mmishow == true) {
this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationHidden');
this.mmishow = false;
} else {
this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationDisplay');
this.mmishow = true;
}
},
cctvplane() {
if (this.cctvshow == true) {
this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceHidden');
this.cctvshow = false;
this.jlmap3d.cctvoff();
} else {
this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceDisplay');
this.cctvshow = true;
this.jlmap3d.cctvon();
}
},
cctvplane() {
if (this.cctvshow == true) {
this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceHidden');
this.cctvshow = false;
this.jlmap3d.cctvoff();
} else {
this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceDisplay');
this.cctvshow = true;
this.jlmap3d.cctvon();
}
}
}
}
}
};
</script>

View File

@ -197,6 +197,7 @@ export default {
//
const res = await getPlaceholderList({ trainingType: data.trainingType });
this.placeholderList = res.data;
debugger;
this.formModel = {
id: data.id,
trainingName: this.repliceName(data.trainingName, this.placeholderList),
@ -227,7 +228,6 @@ export default {
},
changeList(val) {
//
debugger;
getPlaceholderList({ trainingType: val}).then(res => {
this.placeholderList = res.data;
});
@ -250,6 +250,7 @@ export default {
},
create() {
const self = this;
this.loading = true;
this.placeholderList.forEach(item => {
if (this.formModel.trainingName.includes(`{${item.name}}`)) {
const name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`);
@ -261,7 +262,6 @@ export default {
}
});
this.loading = true;
postTrainingRulesData(this.formModel).then(response => {
self.loading = false;
self.$message.success(this.$t('lesson.createOperateSuccess'));

View File

@ -287,7 +287,6 @@ export default {
addAutoTraining(data).then(response => {
this.$message.success(this.$t('tip.automaticGenerationTrainingSuccess'));
debugger;
this.$emit('refresh');
this.close();
}).catch(() => {

View File

@ -5,7 +5,7 @@
<el-header style="height:50px;">
<el-row class="actionList">
<span class="titleStyle">{{ $t('scriptRecord.scriptRecordTitle') }}</span>
<span class="titleStyle">( {{$t('scriptRecord.language')}}: {{ $route.query.lang=="en"?$t('scriptRecord.english'):$t('scriptRecord.chinese') }} )</span>
<span class="titleStyle">( {{ $t('scriptRecord.language') }}: {{ $route.query.lang=="en"?$t('scriptRecord.english'):$t('scriptRecord.chinese') }} )</span>
</el-row>
</el-header>
<el-main style="padding-top:10px;padding-bottom:10px;">
@ -34,153 +34,153 @@ import AddRole from '../scriptRecord/addRole';
import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scriptPause, executeScript} from '@/api/simulation';
export default {
name: 'TipScriptRecord',
components: {
GetAction,
AddRole,
AddAction
},
props: {
group: {
type: String,
required: true
},
width: {
type: Number || String,
required: true
}
},
data() {
return {
title: this.$t('scriptRecord.scriptRecordTitle'),
isShrink: false,
mapLocation: {},
autoSaveScript: null,
isSavingScript: false,
isPause: true,
executeDisabled: false,
backDisabled: false,
size: {
width: 350,
height: window.innerHeight-342
}
};
},
watch: {
'$store.state.scriptRecord.bgSet': function (val) {
this.backDisabled=val;
},
'$store.state.app.windowSizeCount': function() {
this.size = { width: 350, height: window.innerHeight-342};
},
width: function(val) {
this.size = { width: val / 2 - 20, height: window.innerHeight - 342};
}
},
mounted() {
this.initAutoSaveScript();
this.backDisabled=this.$store.state.scriptRecord.bgSet;
},
beforeDestroy() {
this.clearAutoSave();
},
methods: {
setIsParse(isPause) {
this.isPause=isPause;
},
setDisabled(data) {
this.executeDisabled=!data;
},
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;
}
},
pauseScript() {
scriptPause(this.group).then(resp => {
this.$store.dispatch('scriptRecord/updateSimulationPause', true);
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.pauseFail'));
});
},
executePlayScript() {
executeScript(this.group).then(resp => {
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.recoverFail'));
});
},
saveScenesStage() {
const data=Vue.prototype.$jlmap.$options;
const group=this.$route.query.group;
const dataZoom={scale: data.scaleRate, x: data.offsetX, y: data.offsetY};
saveScriptScenes(this.group).then(resp => {
updateMapLocation(group, dataZoom).then(response=>{
this.$store.dispatch('scriptRecord/updateBgSet', true);
this.$message.success(this.$t('scriptRecord.saveBackgroundSuceess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.updateLocationFail')}: ${error.message}`);
});
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.saveBackgroundFail'));
});
name: 'TipScriptRecord',
components: {
GetAction,
AddRole,
AddAction
},
props: {
group: {
type: String,
required: true
},
width: {
type: Number || String,
required: true
}
},
data() {
return {
title: this.$t('scriptRecord.scriptRecordTitle'),
isShrink: false,
mapLocation: {},
autoSaveScript: null,
isSavingScript: false,
isPause: true,
executeDisabled: false,
backDisabled: false,
size: {
width: 350,
height: window.innerHeight - 342
}
};
},
watch: {
'$store.state.scriptRecord.bgSet': function (val) {
this.backDisabled = val;
},
'$store.state.app.windowSizeCount': function() {
this.size = { width: 350, height: window.innerHeight - 342};
},
width: function(val) {
this.size = { width: val / 2 - 20, height: window.innerHeight - 342};
}
},
mounted() {
this.initAutoSaveScript();
this.backDisabled = this.$store.state.scriptRecord.bgSet;
},
beforeDestroy() {
this.clearAutoSave();
},
methods: {
setIsParse(isPause) {
this.isPause = isPause;
},
setDisabled(data) {
this.executeDisabled = !data;
},
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;
}
},
pauseScript() {
scriptPause(this.group).then(resp => {
this.$store.dispatch('scriptRecord/updateSimulationPause', true);
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.pauseFail'));
});
},
executePlayScript() {
executeScript(this.group).then(resp => {
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.recoverFail'));
});
},
saveScenesStage() {
const data = Vue.prototype.$jlmap.$options;
const group = this.$route.query.group;
const dataZoom = {scale: data.scaleRate, x: data.offsetX, y: data.offsetY};
saveScriptScenes(this.group).then(resp => {
updateMapLocation(group, dataZoom).then(response=>{
this.$store.dispatch('scriptRecord/updateBgSet', true);
this.$message.success(this.$t('scriptRecord.saveBackgroundSuceess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.updateLocationFail')}: ${error.message}`);
});
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.saveBackgroundFail'));
});
},
saveScenesData() {
this.isSavingScript=true;
saveScriptData(this.group).then(resp => {
this.$message.success(this.$t('scriptRecord.saveDataSucess'));
this.isSavingScript=false;
this.initAutoSaveScript();
}).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();
}
});
},
dumpScenesData() {
this.clearAutoSave();
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(() => {
dumpScriptData(group).then(resp => {
this.$parent.$refs['display'].$refs['menuScript'].resetBeginTime();
this.$refs['getAction'].loadInitData();
this.$refs['addRole'].initData();
this.$refs['addAction'].initData();
this.initAutoSaveScript();
this.$store.dispatch('scriptRecord/updateBgSet', false);
this.$message.success(this.$t('scriptRecord.resetDataSuccess'));
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.resetDataFail'));
});
}).catch(() => {
this.initAutoSaveScript();
});
},
refresh() {
this.$refs['addAction'].initData();
},
create() {
this.$refs['getAction'].loadInitData();
},
setAction(row) {
this.$refs['addAction'].doShow(row);
}
}
},
saveScenesData() {
this.isSavingScript = true;
saveScriptData(this.group).then(resp => {
this.$message.success(this.$t('scriptRecord.saveDataSucess'));
this.isSavingScript = false;
this.initAutoSaveScript();
}).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();
}
});
},
dumpScenesData() {
this.clearAutoSave();
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(() => {
dumpScriptData(group).then(resp => {
this.$parent.$refs['display'].$refs['menuScript'].resetBeginTime();
this.$refs['getAction'].loadInitData();
this.$refs['addRole'].initData();
this.$refs['addAction'].initData();
this.initAutoSaveScript();
this.$store.dispatch('scriptRecord/updateBgSet', false);
this.$message.success(this.$t('scriptRecord.resetDataSuccess'));
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.resetDataFail'));
});
}).catch(() => {
this.initAutoSaveScript();
});
},
refresh() {
this.$refs['addAction'].initData();
},
create() {
this.$refs['getAction'].loadInitData();
},
setAction(row) {
this.$refs['addAction'].doShow(row);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,16 +1,13 @@
<template>
<el-card :style="{height: height+'px'}">
<div class="scriptHeader">
<div class="scriptList">{{$t('scriptRecord.scriptList')}}</div>
<el-button size="small" type="primary" @click="handleCreate" class="createScript">{{$t('scriptRecord.scriptCreate')}}</el-button>
</div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;display: inline-block;"/>
<script-publish ref='publishScript' @reloadTable="reloadTable" @create="handleConfirmPublish" :title="$t('scriptRecord.publishScript')">
</script-publish>
<create-script ref='createScript' @reloadTable="reloadTable" @create="handleConfirmCreate" :title="$t('scriptRecord.createScript')">
</create-script>
<create-script ref='modifyScript' @reloadTable="reloadTable" @create="handleConfirmModify" :title="$t('scriptRecord.modifyScript')">
</create-script>
<div class="scriptHeader">
<div class="scriptList">{{ $t('scriptRecord.scriptList') }}</div>
<el-button size="small" type="primary" class="createScript" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button>
</div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;display: inline-block;" />
<script-publish ref="publishScript" :title="$t('scriptRecord.publishScript')" @reloadTable="reloadTable" @create="handleConfirmPublish" />
<create-script ref="createScript" :title="$t('scriptRecord.createScript')" @reloadTable="reloadTable" @create="handleConfirmCreate" />
<create-script ref="modifyScript" :title="$t('scriptRecord.modifyScript')" @reloadTable="reloadTable" @create="handleConfirmModify" />
</el-card>
</template>
@ -20,259 +17,260 @@ import ConstConfig from '@/scripts/ConstConfig';
import { UrlConfig } from '@/router/index';
import { mapGetters } from 'vuex';
import { admin, superAdmin} from '@/router';
import { getQuestPageList,createQuest,deleteQuest,updateQuest,publishQuest,retractQuest} from '@/api/quest';
import { getQuestPageList, createQuest, deleteQuest, updateQuest, publishQuest, retractQuest} from '@/api/quest';
import { launchFullscreen } from '@/utils/screen';
import { scriptDraftRecordNotify,scriptRecordNotify } from '@/api/simulation';
import { scriptDraftRecordNotify, scriptRecordNotify } from '@/api/simulation';
import CreateScript from './create';
import ScriptPublish from './publish';
export default {
name: 'ScriptDraft',
name: 'ScriptDraft',
components: {
CreateScript,
ScriptPublish
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: true,
show:false
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('scriptRecord.scriptName'),
prop: 'name'
},
{
title: this.$t('scriptRecord.scriptDescription'),
prop: 'description',
},
{
title: this.$t('scriptRecord.status'),
prop: 'status',
type: 'tag',
columnValue: (row) => { return this.covertData(row)},
tagType: (row) => { return ''; }
},
{
title: this.$t('scriptRecord.revokeReason'),
prop: 'explanation',
},
{
type: 'button',
title: this.$t('scriptRecord.operate'),
width: '400',
buttons: [
{
name: this.$t('scriptRecord.scriptRecord'),
handleClick: this.drawUp,
type: 'success',
showControl:(row) => { return !(row.status==1) },
},
{
name: this.$t('scriptRecord.scriptModify'),
handleClick: this.handleModify,
type: 'primary',
showControl:(row) => { return !(row.status==1) },
},
{
name: this.$t('scriptRecord.scriptDelete'),
handleClick: this.deleteScript,
type: 'danger',
showControl:(row) => { return !(row.status==1) },
},
{
name: this.covertButtonname(),
handleClick: this.publishScript,
type: 'primary',
showControl:(row) => { return row.status==0 },
},
{
name: this.$t('scriptRecord.applyRevoke'),
handleClick: this.revokeScript,
type: 'primary',
showControl:(row) => { return row.status==1 },
},
{
name: this.$t('scriptRecord.preview'),
handleClick: this.previewScript,
type: 'success',
// showControl:(row) => { return row.status==1},
}
]
}
CreateScript,
ScriptPublish
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: true,
show:false
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('scriptRecord.scriptName'),
prop: 'name'
},
{
title: this.$t('scriptRecord.scriptDescription'),
prop: 'description'
},
{
title: this.$t('scriptRecord.status'),
prop: 'status',
type: 'tag',
columnValue: (row) => { return this.covertData(row); },
tagType: (row) => { return ''; }
},
{
title: this.$t('scriptRecord.revokeReason'),
prop: 'explanation'
},
{
type: 'button',
title: this.$t('scriptRecord.operate'),
width: '400',
buttons: [
{
name: this.$t('scriptRecord.scriptRecord'),
handleClick: this.drawUp,
type: 'success',
showControl:(row) => { return !(row.status == 1); }
},
{
name: this.$t('scriptRecord.scriptModify'),
handleClick: this.handleModify,
type: 'primary',
showControl:(row) => { return !(row.status == 1); }
},
{
name: this.$t('scriptRecord.scriptDelete'),
handleClick: this.deleteScript,
type: 'danger',
showControl:(row) => { return !(row.status == 1); }
},
{
name: this.covertButtonname(),
handleClick: this.publishScript,
type: 'primary',
showControl:(row) => { return row.status == 0; }
},
{
name: this.$t('scriptRecord.applyRevoke'),
handleClick: this.revokeScript,
type: 'primary',
showControl:(row) => { return row.status == 1; }
},
{
name: this.$t('scriptRecord.preview'),
handleClick: this.previewScript,
type: 'success'
// showControl:(row) => { return row.status==1},
}
]
}
]
}
};
},
computed: {
height() {
return this.$store.state.app.height - 50-30;
}
},
watch: {
'$route' () {
this.reloadTable();
}
},
methods: {
queryFunction(params) {
return getQuestPageList(this.$route.params.mapId,params);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
drawUp(index,row) {
scriptRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id,lang:row.lang };
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'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteQuest(row.id).then(response => {
this.$message.success(this.$t('scriptRecord.deleteScriptSucess'));
this.reloadTable();
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.deleteScriptFail'));
});
}).catch(() => { });
},
//
handleConfirmCreate(data) {
if(Cookies.get("user_lang")=="en"){
data.lang='en';
}else{
data.lang='zh';
}
createQuest(data).then(resp => {
this.reloadTable();
this.$message.success(this.$t('scriptRecord.createScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createScriptFail')}: ${error.message}`);
})
},
//
handleModify(index, row){
this.$refs.modifyScript.doShow(row.id);
},
//
handleConfirmModify(data){
if(Cookies.get("user_lang")=="en"){
data.lang='en';
}else{
data.lang='zh';
}
updateQuest(data.id,data).then(resp => {
this.reloadTable();
this.$message.success(this.$t('scriptRecord.modifyScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.modifyScriptFail')}: ${error.message}`);
})
},
//
handleCreate() {
this.$refs.createScript.doShow(null);
},
covertData(row){
let releaseReview=ConstConfig.ConstSelect.releaseReview;
let lastData=Object.assign({}, row);
if(Cookies.get("user_lang")=="en"){
releaseReview.forEach(function(element){
let rolename=element.value;
if(lastData.status==rolename){
lastData.status=element.enlabel;
}
});
}else{
releaseReview.forEach(function(element){
let rolename=element.value;
if(lastData.status==rolename){
lastData.status=element.label;
}
});
}
return lastData.status;
// let explanation=lastData.explanation?'{ '+lastData.explanation+'}':'';
// return lastData.status+explanation;
},
handleConfirmPublish(data){
publishQuest(data.id,{'scriptName':data.scriptName}).then(resp => {
this.reloadTable();
this.$message.success(this.$t('scriptRecord.publishScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.publishScriptFailed')}: ${error.message}`);
});
},
publishScript(index,row){
if(this.$store.getters.roles.indexOf(admin) >= 0 || this.$store.getters.roles.indexOf(superAdmin) >= 0){
this.$refs.publishScript.doShow(row);
}else{
this.$confirm(this.$t('scriptRecord.releaseScriptTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
publishQuest(row.id,{name:''}).then(resp => {
this.reloadTable();
this.$message.success(this.$t('scriptRecord.releaseScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.releaseScriptFailed')}: ${error.message}`);
});
}).catch(() => { });
}
};
},
computed: {
height() {
return this.$store.state.app.height - 50 - 30;
}
},
watch: {
'$route' () {
this.reloadTable();
}
},
methods: {
queryFunction(params) {
return getQuestPageList(this.$route.params.mapId, params);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
drawUp(index, row) {
scriptRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, lang:row.lang };
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'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteQuest(row.id).then(response => {
this.$message.success(this.$t('scriptRecord.deleteScriptSucess'));
this.reloadTable();
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.deleteScriptFail'));
});
}).catch(() => { });
},
//
handleConfirmCreate(data) {
if (Cookies.get('user_lang') == 'en') {
data.lang = 'en';
} else {
data.lang = 'zh';
}
createQuest(data).then(resp => {
this.reloadTable();
this.$message.success(this.$t('scriptRecord.createScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createScriptFail')}: ${error.message}`);
});
},
//
handleModify(index, row) {
this.$refs.modifyScript.doShow(row.id);
},
//
handleConfirmModify(data) {
if (Cookies.get('user_lang') == 'en') {
data.lang = 'en';
} else {
data.lang = 'zh';
}
updateQuest(data.id, data).then(resp => {
this.reloadTable();
this.$message.success(this.$t('scriptRecord.modifyScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.modifyScriptFail')}: ${error.message}`);
});
},
//
handleCreate() {
this.$refs.createScript.doShow(null);
},
covertData(row) {
const releaseReview = ConstConfig.ConstSelect.releaseReview;
const lastData = Object.assign({}, row);
if (Cookies.get('user_lang') == 'en') {
releaseReview.forEach(function(element) {
const rolename = element.value;
if (lastData.status == rolename) {
lastData.status = element.enlabel;
}
});
} else {
releaseReview.forEach(function(element) {
const rolename = element.value;
if (lastData.status == rolename) {
lastData.status = element.label;
}
});
}
return lastData.status;
// let explanation=lastData.explanation?'{ '+lastData.explanation+'}':'';
// return lastData.status+explanation;
},
handleConfirmPublish(data) {
publishQuest(data.id, {'scriptName':data.scriptName}).then(resp => {
this.reloadTable();
this.$message.success(this.$t('scriptRecord.publishScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.publishScriptFailed')}: ${error.message}`);
});
},
publishScript(index, row) {
if (this.$store.getters.roles.indexOf(admin) >= 0 || this.$store.getters.roles.indexOf(superAdmin) >= 0) {
this.$refs.publishScript.doShow(row);
} else {
this.$confirm(this.$t('scriptRecord.releaseScriptTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
publishQuest(row.id, {name:''}).then(resp => {
this.reloadTable();
this.$message.success(this.$t('scriptRecord.releaseScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.releaseScriptFailed')}: ${error.message}`);
});
}).catch(() => { });
}
},
covertButtonname(){
if(this.$store.getters.roles.indexOf(admin) >= 0 || this.$store.getters.roles.indexOf(superAdmin) >= 0){
return this.$t('scriptRecord.publish');
}else{
return this.$t('scriptRecord.applyPublish');
}
},
revokeScript(index,row){
this.$confirm(this.$t('scriptRecord.revokeScriptTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
retractQuest(row.id).then(resp => {
this.reloadTable();
this.$message.success(this.$t('approval.revokeScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('approval.revokeScriptFailed')}: ${error.message}`);
});
}).catch(() => { });
},
previewScript(index,row){
scriptDraftRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id,skinCode:this.$route.query.skinCode,try:0};
this.$router.push({ path: `${UrlConfig.design.display}/demon`, query });
launchFullscreen();
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
});
// skinCode=02&group=16-128-757&prdType=02&mapId=18&code=JLFZZX-1&goodsId=&try=0
}
}
}
},
covertButtonname() {
if (this.$store.getters.roles.indexOf(admin) >= 0 || this.$store.getters.roles.indexOf(superAdmin) >= 0) {
return this.$t('scriptRecord.publish');
} else {
return this.$t('scriptRecord.applyPublish');
}
},
revokeScript(index, row) {
this.$confirm(this.$t('scriptRecord.revokeScriptTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
retractQuest(row.id).then(resp => {
this.reloadTable();
this.$message.success(this.$t('approval.revokeScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('approval.revokeScriptFailed')}: ${error.message}`);
});
}).catch(() => { });
},
previewScript(index, row) {
scriptDraftRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, try:0};
// skinCode:this.$route.query.skinCode,
this.$router.push({ path: `${UrlConfig.design.display}/demon`, query });
launchFullscreen();
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
});
// skinCode=02&group=16-128-757&prdType=02&mapId=18&code=JLFZZX-1&goodsId=&try=0
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,70 +1,70 @@
<template>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{$t('global.confirm')}}</el-button>
<el-button @click="doClose">{{$t('global.cancel')}}</el-button>
</span>
</el-dialog>
</div>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'ScriptOperate',
data() {
return {
dialogVisible: false,
formModel:{
scriptName:'',
id:'',
},
isShow: false,
}
export default {
name: 'ScriptOperate',
props: {
title: String,
type:String
},
data() {
return {
dialogVisible: false,
formModel:{
scriptName:'',
id:''
},
isShow: false
};
},
computed: {
form() {
const form = {
labelWidth: '150px',
items: [
{ prop: 'scriptName', label: this.$t('approval.scriptName'), type: 'text', required: true}
]
};
return form;
},
props: {
title: String,
type:String,
},
computed: {
form() {
let form={
labelWidth: '150px',
items: [
{ prop: 'scriptName', label: this.$t('approval.scriptName'), type: 'text', required: true},
]
}
return form
},
rules() {
let crules ={
scriptName: [
{ required: true, message: this.$t('approval.inputScriptName'), trigger: 'blur' },
]
}
return crules
},
},
methods: {
doShow(row) {
this.formModel.scriptName=row.name;
this.formModel.id=row.id;
this.dialogVisible = true
},
doCreate() {
let self = this
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose()
})
},
doClose() {
this.$refs.dataform.resetForm();
this.isShow = false;
this.dialogVisible = false
}
rules() {
const crules = {
scriptName: [
{ required: true, message: this.$t('approval.inputScriptName'), trigger: 'blur' }
]
};
return crules;
}
};
},
methods: {
doShow(row) {
this.formModel.scriptName = row.name;
this.formModel.id = row.id;
this.dialogVisible = true;
},
doCreate() {
const self = this;
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose();
});
},
doClose() {
this.$refs.dataform.resetForm();
this.isShow = false;
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{

View File

@ -61,322 +61,307 @@
</el-scrollbar>
</template>
<script>
import Vue from 'vue';
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
import {addScriptAction,modifyScriptAction,getAvailableDeviceCommand,getDeviceCodeByDeviceType,getScriptPlayMember} from '@/api/simulation';
export default {
name: 'addAction',
props: {
group: {
type: String,
required: true
},
size:{
type: Object,
required: true
}
import Vue from 'vue';
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
import {addScriptAction, modifyScriptAction, getAvailableDeviceCommand, getDeviceCodeByDeviceType, getScriptPlayMember} from '@/api/simulation';
export default {
name: 'AddAction',
props: {
group: {
type: String,
required: true
},
watch:{
'$store.state.map.mapViewLoadedCount': function (val) {
Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation);
this.isPause=!(this.$store.state.scriptRecord.simulationPause);
this.$parent.$parent.$parent.setIsParse(this.isPause);
},
'$store.state.scriptRecord.simulationPause': function(val){
this.isPause=!(this.$store.state.scriptRecord.simulationPause);
this.$parent.$parent.$parent.setIsParse(this.isPause);
this.$refs['modalData'].clearValidate();
this.$refs['commandData'].clearValidate();
if(!val)
{
this.initActionData();
this.initCommandActionData();
size:{
type: Object,
required: true
}
},
data() {
return {
buttonName:this.$t('scriptRecord.addConversitionButton'),
operateType:'add',
modalData:{
actionVO:{
memberId:'',
targetId:'',
reply:'',
type:'Conversation'
}
},
},
data() {
return {
buttonName:this.$t('scriptRecord.addConversitionButton'),
operateType:"add",
modalData:{
actionVO:{
memberId:"",
targetId:"",
reply:"",
type:"Conversation",
}
commandData:{
action:{
memberId:'',
deviceCommand:'',
commandParamList:[],
type:'Command'
},
commandData:{
action:{
memberId:"",
deviceCommand:"",
commandParamList:[],
type:"Command",
},
param:{
startStation:"",
endStation:"",
}
param:{
startStation:'',
endStation:''
}
},
isPause:false,
isNotModify:true,
modifying:false,
adding:false,
isJinLu:false,
stationList:[],
memberList:[],
deviceCommandList:[],
orginMemberList:[],
rules:{
actionVO:{
memberId:[
{ required: true, message: this.$t('scriptRecord.narratorRules'), trigger: 'change' }
],
reply:[
{ required: true, message: this.$t('scriptRecord.conversitionContentRules'), trigger: 'blur' }
],
targetId:[
{ required: true, message: this.$t('scriptRecord.receiverRules'), trigger: 'change' }
]
}
},
commandRules:{
action:{
memberId:[
{ required: true, message: this.$t('scriptRecord.executorRules'), trigger: 'change' }
],
deviceCommand:[
{ required: true, message: this.$t('scriptRecord.executeCommandRules'), trigger: 'change' }
]
},
isPause:false,
isNotModify:true,
modifying:false,
adding:false,
isJinLu:false,
stationList:[],
memberList:[],
deviceCommandList:[],
orginMemberList:[],
rules:{
actionVO:{
memberId:[
{ required: true, message: this.$t('scriptRecord.narratorRules'), trigger: 'change' }
],
reply:[
{ required: true, message: this.$t('scriptRecord.conversitionContentRules'), trigger: 'blur' }
],
targetId:[
{ required: true, message: this.$t('scriptRecord.receiverRules'), trigger: 'change' }
]
},
},
commandRules:{
action:{
memberId:[
{ required: true, message: this.$t('scriptRecord.executorRules'), trigger: 'change' }
],
deviceCommand:[
{ required: true, message: this.$t('scriptRecord.executeCommandRules'), trigger: 'change' }
]
},
param:{
startStation:[
{ required: true, message: this.$t('scriptRecord.startStationRules'), trigger: 'change' }
],
endStation:[
{ required: true, message: this.$t('scriptRecord.endStationRules'), trigger: 'change' }
]
}
param:{
startStation:[
{ required: true, message: this.$t('scriptRecord.startStationRules'), trigger: 'change' }
],
endStation:[
{ required: true, message: this.$t('scriptRecord.endStationRules'), trigger: 'change' }
]
}
}
};
},
watch:{
'$store.state.map.mapViewLoadedCount': function (val) {
Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation);
this.isPause = !(this.$store.state.scriptRecord.simulationPause);
this.$parent.$parent.$parent.setIsParse(this.isPause);
},
mounted(){
this.initData();
'$store.state.scriptRecord.simulationPause': function(val) {
this.isPause = !(this.$store.state.scriptRecord.simulationPause);
this.$parent.$parent.$parent.setIsParse(this.isPause);
this.$refs['modalData'].clearValidate();
this.$refs['commandData'].clearValidate();
if (!val) {
this.initActionData();
this.initCommandActionData();
}
}
},
mounted() {
this.initData();
},
methods:{
initData() {
this.buttonName = this.$t('scriptRecord.addConversitionButton');
this.operateType = 'add';
getScriptPlayMember(this.group).then(resp => {
const roleTypeList = ConstConfig.ConstSelect.roleType;
this.orginMemberList = resp.data;
let lastData = JSON.stringify(resp.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);
this.memberList = lastData;
this.getDeviceCode();
this.resetDisabled();
this.initCommandActionData();
}).catch(error => {});
},
methods:{
initData(){
this.buttonName=this.$t('scriptRecord.addConversitionButton');
this.operateType="add";
getScriptPlayMember(this.group).then(resp => {
let roleTypeList=ConstConfig.ConstSelect.roleType;
this.orginMemberList=resp.data;
let lastData=JSON.stringify(resp.data);
roleTypeList.forEach(function(element){
let 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);
changeRole(index) {
const role = this.orginMemberList.find(elem=>{ return elem.id == index; }).role;
const data = {role:role};
getAvailableDeviceCommand(data).then(response=>{
if (Cookies.get('user_lang') == 'en') {
const tempData = response.data;
tempData.forEach( element => {
switch (element.deviceCommand) {
case 'Train_Manual_Limit_Drive': {
element.label = 'Confirm to run to the front station';
break;
}
case 'Train_Manual_Route_Blocking_Drive': {
element.label = 'Drive as the route block method';
break;
}
}
});
lastData=JSON.parse(lastData);
this.memberList=lastData;
this.getDeviceCode();
this.resetDisabled();
this.initCommandActionData();
}).catch(error => {})
},
changeRole(index){
let role=this.orginMemberList.find(elem=>{return elem.id==index}).role;
let data={role:role};
getAvailableDeviceCommand(data).then(response=>{
if(Cookies.get("user_lang")=="en"){
let tempData=response.data;
tempData.forEach( element => {
switch(element.deviceCommand){
case "Train_Manual_Limit_Drive":{
element.label="Confirm to run to the front station";
break;
}
case "Train_Manual_Route_Blocking_Drive":{
element.label="Drive as the route block method";
break;
}
}
});
this.deviceCommandList=tempData;
}else{
this.deviceCommandList=response.data;
}
if(response.data.length<=0)
{
this.commandData.action.deviceCommand="";
this.isJinLu=false;
}
});
},
getDeviceCode(){
let params = {deviceType:"StationStand"};
let group=this.group;
getDeviceCodeByDeviceType(group,params).then(response =>{
let resultData=response.data;
resultData=JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g,"name"));
this.stationList=resultData;
})
},
addCommandAction(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let group=this.group;
this.commandData.action.type="Command";
if(this.commandData.action.deviceCommand=="Train_Manual_Route_Blocking_Drive")
{this.commandData.action.commandParamList=[this.commandData.param.startStation,this.commandData.param.endStation];}
let data=this.commandData.action;
let obj=this;
this.adding=true;
addScriptAction(group,data).then(response=>{
this.adding=false;
this.$message.success(this.$t('scriptRecord.addCommandSucess'));
this.deviceCommandList = tempData;
} else {
this.deviceCommandList = response.data;
}
if (response.data.length <= 0) {
this.commandData.action.deviceCommand = '';
this.isJinLu = false;
}
});
},
getDeviceCode() {
const params = {deviceType:'StationStand'};
const group = this.group;
getDeviceCodeByDeviceType(group, params).then(response =>{
let resultData = response.data;
resultData = JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g, 'name'));
this.stationList = resultData;
});
},
addCommandAction(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const group = this.group;
this.commandData.action.type = 'Command';
if (this.commandData.action.deviceCommand == 'Train_Manual_Route_Blocking_Drive') { this.commandData.action.commandParamList = [this.commandData.param.startStation, this.commandData.param.endStation]; }
const data = this.commandData.action;
const obj = this;
this.adding = true;
addScriptAction(group, data).then(response=>{
this.adding = false;
this.$message.success(this.$t('scriptRecord.addCommandSucess'));
this.$emit('create');
// this.$emit('create',[this.commandData.action.memberId]);
// this.$parent.$parent.$refs['addRole'].resetData([this.commandData.action.memberId]);
// this.initCommandActionData();
}).catch(error => {
this.adding = false;
this.$messageBox(`${this.$t('scriptRecord.addCommandFail')}: ${error.message}`);
});
} else {
console.log('error submit!!');
return false;
}
});
},
addScriptActionInfo(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const group = this.group;
this.modalData.actionVO.type = 'Conversation';
const data = this.modalData.actionVO;
const obj = this;
this.modifying = true;
if (this.operateType == 'add') {
addScriptAction(group, data).then(response=>{
this.modifying = false;
this.$message.success(this.$t('scriptRecord.addConversitionSuccess'));
this.$emit('create');
// this.$emit('create',[this.commandData.action.memberId]);
// this.$parent.$parent.$refs['addRole'].resetData([this.commandData.action.memberId]);
// this.initCommandActionData();
// [this.modalData.actionVO.memberId]
// this.initActionData();
// this.$parent.$parent.$refs['addRole'].resetData([this.modalData.actionVO.memberId,this.modalData.actionVO.targetId]);
}).catch(error => {
this.adding=false;
this.$messageBox(`${this.$t('scriptRecord.addCommandFail')}: ${error.message}`);
this.modifying = false;
this.$messageBox(`${this.$t('scriptRecord.addConversitionFail')}: ${error.message}`);
});
} else {
const actionId = this.modalData.actionVO.id;
modifyScriptAction(group, actionId, data).then(response=>{
this.modifying = false;
this.isNotModify = true;
this.$emit('setDisabled', this.isNotModify);
this.buttonName = this.$t('scriptRecord.addConversitionButton');
this.operateType = 'add';
this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess'));
this.$emit('create');
// this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]);
this.initActionData();
}).catch(error => {
this.modifying = false;
this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`);
});
}
else {
console.log('error submit!!');
return false;
}
});
},
addScriptActionInfo(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let group=this.group;
this.modalData.actionVO.type="Conversation";
let data=this.modalData.actionVO;
let obj=this;
this.modifying=true;
if(this.operateType=="add")
{
addScriptAction(group,data).then(response=>{
this.modifying=false;
this.$message.success(this.$t('scriptRecord.addConversitionSuccess'));
this.$emit('create');
// [this.modalData.actionVO.memberId]
// this.initActionData();
// this.$parent.$parent.$refs['addRole'].resetData([this.modalData.actionVO.memberId,this.modalData.actionVO.targetId]);
}).catch(error => {
this.modifying=false;
this.$messageBox(`${this.$t('scriptRecord.addConversitionFail')}: ${error.message}`);
});
}
else
{
let actionId=this.modalData.actionVO.id;
modifyScriptAction(group,actionId,data).then(response=>{
this.modifying=false;
this.isNotModify=true;
this.$emit("setDisabled",this.isNotModify);
this.buttonName=this.$t('scriptRecord.addConversitionButton');
this.operateType="add";
this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess'));
this.$emit('create');
// this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]);
this.initActionData();
}).catch(error => {
this.modifying=false;
this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`);
});
}
}
else {
console.log('error submit!!');
return false;
}
});
},
resetDisabled(){
if(this.$refs['modalData'])
{
this.$refs['modalData'].resetFields();
this.modalData.actionVO.type="Conversation";
this.modalData.actionVO.memberId="";
this.modalData.actionVO.targetId="";
this.modalData.actionVO.reply="";
} else {
console.log('error submit!!');
return false;
}
},
clearValidate(){
if(this.$refs['commandData'])
{
this.$refs['commandData'].clearValidate();
}
},
initActionData(){
this.resetDisabled();
},
initCommandActionData(){
if(this.$refs['commandData'])
{
this.deviceCommandList=[];
this.$refs['commandData'].resetFields();
this.commandData.action.memberId="";
this.commandData.param.startStation="";
this.isJinLu=false;
this.commandData.param.endStation="";
}
},
changeCommand(index){
switch(index)
{
case "Train_Manual_Route_Blocking_Drive":{
this.isJinLu=true;
this.getDeviceCode();
this.clearValidate();
break;
}
default:{
this.isJinLu=false;
this.clearValidate();
break;
}
}
},
changeItem(){
if(!(this.isPause&&this.isNotModify))
{
let temp=this.modalData.actionVO.memberId;
this.modalData.actionVO.memberId=this.modalData.actionVO.targetId;
this.modalData.actionVO.targetId=temp;
}
},
doShow(data){
if(data)
{
this.buttonName=this.$t('scriptRecord.modifyConversition');
this.operateType="modify";
this.clearValidate();
this.isNotModify=false;
this.$emit("setDisabled",this.isNotModify);
// this.initData();
this.modalData.actionVO.id=data.id;
this.modalData.actionVO.memberId=data.memberId;
this.modalData.actionVO.type=data.type;
if(data.type=="Conversation")
{
this.isJinLu=false;
this.modalData.actionVO.targetId=data.targetId;
this.modalData.actionVO.reply=data.reply;
}
});
},
resetDisabled() {
if (this.$refs['modalData']) {
this.$refs['modalData'].resetFields();
this.modalData.actionVO.type = 'Conversation';
this.modalData.actionVO.memberId = '';
this.modalData.actionVO.targetId = '';
this.modalData.actionVO.reply = '';
}
},
clearValidate() {
if (this.$refs['commandData']) {
this.$refs['commandData'].clearValidate();
}
},
initActionData() {
this.resetDisabled();
},
initCommandActionData() {
if (this.$refs['commandData']) {
this.deviceCommandList = [];
this.$refs['commandData'].resetFields();
this.commandData.action.memberId = '';
this.commandData.param.startStation = '';
this.isJinLu = false;
this.commandData.param.endStation = '';
}
},
changeCommand(index) {
switch (index) {
case 'Train_Manual_Route_Blocking_Drive': {
this.isJinLu = true;
this.getDeviceCode();
this.clearValidate();
break;
}
default: {
this.isJinLu = false;
this.clearValidate();
break;
}
}
},
changeItem() {
if (!(this.isPause && this.isNotModify)) {
const temp = this.modalData.actionVO.memberId;
this.modalData.actionVO.memberId = this.modalData.actionVO.targetId;
this.modalData.actionVO.targetId = temp;
}
},
doShow(data) {
if (data) {
this.buttonName = this.$t('scriptRecord.modifyConversition');
this.operateType = 'modify';
this.clearValidate();
this.isNotModify = false;
this.$emit('setDisabled', this.isNotModify);
// this.initData();
this.modalData.actionVO.id = data.id;
this.modalData.actionVO.memberId = data.memberId;
this.modalData.actionVO.type = data.type;
if (data.type == 'Conversation') {
this.isJinLu = false;
this.modalData.actionVO.targetId = data.targetId;
this.modalData.actionVO.reply = data.reply;
}
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -16,102 +16,102 @@ import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
import {getScriptPlayMember, getScriptMemberData, cancleScriptMembers, selectScriptMembers, modifyScriptMemberSex} from '@/api/simulation';
export default {
name: 'AddRole',
props: {
group: {
type: String,
required: true
}
},
data() {
return {
allRoleData: [],
selectRoleData: [],
sexGroup: this.$t('scriptRecord.roleSexMale')
};
},
watch: {
'$store.state.socket.simulationStart': function (val) {
if (val) {
this.initData();
}
}
},
mounted() {
this.initData();
},
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;
});
});
},
coverData(data) {
const roleTypeList=ConstConfig.ConstSelect.roleType;
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 {
name: 'AddRole',
props: {
group: {
type: String,
required: true
}
},
data() {
return {
allRoleData: [],
selectRoleData: [],
sexGroup: this.$t('scriptRecord.roleSexMale')
};
},
watch: {
'$store.state.socket.simulationStart': function (val) {
if (val) {
this.initData();
}
}
},
mounted() {
this.initData();
},
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;
});
});
},
coverData(data) {
const roleTypeList = ConstConfig.ConstSelect.roleType;
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 => {
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 => {
this.$messageBox(`${this.$t('scriptRecord.cancleScriptActorFail')}: ${error.message}`);
this.initData();
});
}
}
},
changeSex(event, id) {
const group=this.$props.group;
const data={'gender': event};
modifyScriptMemberSex(group, id, data).then(response=>{
this.$message.success(this.$t('scriptRecord.modifyScriptActorSexSuccess'));
})
.catch(error => {
this.$messageBox(`${this.$t('scriptRecord.modifyScriptActorSexFail')}: ${error.message}`);
});
}
}
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 => {
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 => {
this.$messageBox(`${this.$t('scriptRecord.cancleScriptActorFail')}: ${error.message}`);
this.initData();
});
}
}
},
changeSex(event, id) {
const group = this.$props.group;
const data = {'gender': event};
modifyScriptMemberSex(group, id, data).then(response=>{
this.$message.success(this.$t('scriptRecord.modifyScriptActorSexSuccess'));
})
.catch(error => {
this.$messageBox(`${this.$t('scriptRecord.modifyScriptActorSexFail')}: ${error.message}`);
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -32,116 +32,116 @@
import {getScriptRecord, deleteScriptAction, getAvailableDeviceCommand } from '@/api/simulation';
import ConstConfig from '@/scripts/ConstConfig';
export default {
name: 'GetAction',
props: {
group: {
type: String,
required: true
},
size: {
type: Object,
required: true
}
},
data() {
return {
actionInfoList: [],
deviceCommandList: [],
reverse: true,
loading: true,
// behaviorName:"",
memberName: ''
};
},
watch: {
actionInfoList: function(val) {
this.$nextTick(function() {
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
});
}
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
// const group=this.$route.query.group;
const data={role: 'Driver'};
getAvailableDeviceCommand(data).then(response=>{
this.deviceCommandList=response.data;
this.loadOtherData(this.$route.query);
});
},
loadOtherData(obj) {
const group=obj.group;
getScriptRecord(group).then(response=>{
this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet);
this.actionInfoList=[];
const roleTypeList=ConstConfig.ConstSelect.roleType;
name: 'GetAction',
props: {
group: {
type: String,
required: true
},
size: {
type: Object,
required: true
}
},
data() {
return {
actionInfoList: [],
deviceCommandList: [],
reverse: true,
loading: true,
// behaviorName:"",
memberName: ''
};
},
watch: {
actionInfoList: function(val) {
this.$nextTick(function() {
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop = this.$refs['elActionScrollbar'].wrap.scrollHeight;
});
}
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
// const group=this.$route.query.group;
const data = {role: 'Driver'};
getAvailableDeviceCommand(data).then(response=>{
this.deviceCommandList = response.data;
this.loadOtherData(this.$route.query);
});
},
loadOtherData(obj) {
const group = obj.group;
getScriptRecord(group).then(response=>{
this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet);
this.actionInfoList = [];
const roleTypeList = ConstConfig.ConstSelect.roleType;
let memberVOList=JSON.stringify(response.data.memberVOList);
roleTypeList.forEach(function(element) {
const rolename=element.value;
memberVOList=memberVOList.replace(new RegExp(rolename, 'g'), element.label);
});
memberVOList=JSON.parse(memberVOList);
const actionList=response.data.actionVOList;
let memberVOList = JSON.stringify(response.data.memberVOList);
roleTypeList.forEach(function(element) {
const rolename = element.value;
memberVOList = memberVOList.replace(new RegExp(rolename, 'g'), element.label);
});
memberVOList = JSON.parse(memberVOList);
const actionList = response.data.actionVOList;
actionList.forEach(element => {
actionList.forEach(element => {
const member=memberVOList.find(elem=>{ return elem.id==element.memberId; });
const member = memberVOList.find(elem=>{ return elem.id == element.memberId; });
const memberName=member.name?' - '+member.name:'';
switch (element.type) {
case 'Conversation':
{
const target=memberVOList.find(elem=>{ return elem.id==element.targetId; });
const targetName=target.name?' - '+target.name:'';
this.actionInfoList.push({id: element.id, isCoversition: true, memberName: member.role+memberName, targetName: target.role+targetName, reply: element.reply, row: element, visible: true});
break;
}
case 'Command':
{
const deviceCommand=this.deviceCommandList.find(elem=>{ return elem.deviceCommand==element.deviceCommand; });
switch (element.deviceCommand) {
case 'Train_Manual_Route_Blocking_Drive':
{
this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role+memberName, command: deviceCommand.label, row: element, visible: false});
break;
}
case 'Train_Manual_Limit_Drive':
{
this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role+memberName, command: deviceCommand.label, row: element, visible: false});
break;
}
}
}
}
});
if (response.data.mapLocation) {
const mapLocation={'offsetX': response.data.mapLocation.x, 'offsetY': response.data.mapLocation.y, 'scaleRate': response.data.mapLocation.scale};
this.$store.dispatch('scriptRecord/updateMapLocation', mapLocation);
}
this.loading=false;
});
},
deleteAction(row) {
const group=this.$props.group;
deleteScriptAction(group, row).then(resp => {
this.reloadTable();
this.$message.success('删除行为动作成功');
}).catch(error => {
this.$messageBox(`删除行为动作失败: ${error.message}`);
});
},
reloadTable() {
this.loadInitData();
},
modifyAction(row) {
this.$emit('setAction', row);
}
}
const memberName = member.name ? ' - ' + member.name:'';
switch (element.type) {
case 'Conversation':
{
const target = memberVOList.find(elem=>{ return elem.id == element.targetId; });
const targetName = target.name ? ' - ' + target.name:'';
this.actionInfoList.push({id: element.id, isCoversition: true, memberName: member.role + memberName, targetName: target.role + targetName, reply: element.reply, row: element, visible: true});
break;
}
case 'Command':
{
const deviceCommand = this.deviceCommandList.find(elem=>{ return elem.deviceCommand == element.deviceCommand; });
switch (element.deviceCommand) {
case 'Train_Manual_Route_Blocking_Drive':
{
this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role + memberName, command: deviceCommand.label, row: element, visible: false});
break;
}
case 'Train_Manual_Limit_Drive':
{
this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role + memberName, command: deviceCommand.label, row: element, visible: false});
break;
}
}
}
}
});
if (response.data.mapLocation) {
const mapLocation = {'offsetX': response.data.mapLocation.x, 'offsetY': response.data.mapLocation.y, 'scaleRate': response.data.mapLocation.scale};
this.$store.dispatch('scriptRecord/updateMapLocation', mapLocation);
}
this.loading = false;
});
},
deleteAction(row) {
const group = this.$props.group;
deleteScriptAction(group, row).then(resp => {
this.reloadTable();
this.$message.success('删除行为动作成功');
}).catch(error => {
this.$messageBox(`删除行为动作失败: ${error.message}`);
});
},
reloadTable() {
this.loadInitData();
},
modifyAction(row) {
this.$emit('setAction', row);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>