Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
program-walker 2019-10-15 22:20:57 +08:00
commit fdf6f9804c
12 changed files with 445 additions and 397 deletions

View File

@ -80,5 +80,8 @@ export default {
drivingByPlan: 'Driving By Plan', drivingByPlan: 'Driving By Plan',
scriptBack: 'Back', scriptBack: 'Back',
speakTo: 'to', speakTo: 'to',
executeCommandTips: 'execute command: ' executeCommandTips: 'execute command: ',
language: 'language',
chinese: 'Chinese Simplified',
english: 'English'
}; };

View File

@ -81,5 +81,8 @@ export default {
drivingByPlan: '按计划行车', drivingByPlan: '按计划行车',
scriptBack: '返回', scriptBack: '返回',
speakTo: '对', speakTo: '对',
executeCommandTips: '执行指令: ' executeCommandTips: '执行指令: ',
language: '语言',
chinese: '中文',
english: '英文'
}; };

View File

@ -3,8 +3,8 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰 // BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else { } else {

View File

@ -227,6 +227,9 @@ export default {
} }
}); });
}, },
'size.width': function(val) {
this.setWindowSize();
},
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
this.setWindowSize(); this.setWindowSize();
}, },

View File

@ -2,7 +2,7 @@
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<div class="mapPaint"> <div class="mapPaint">
<div class="map-view"> <div class="map-view">
<ibp-plate ref="ibpPlate" :size="size"/> <ibp-plate ref="ibpPlate" :size="size" />
</div> </div>
<div class="map-draft"> <div class="map-draft">
<ibp-operate ref="ibpOperate" @ibpChange="ibpChange" /> <ibp-operate ref="ibpOperate" @ibpChange="ibpChange" />
@ -22,10 +22,10 @@ export default {
}, },
data() { data() {
return { return {
size: { size: {
width: this.$store.state.app.width-521, width: this.$store.state.app.width-521,
height: this.$store.state.app.height - 60 height: this.$store.state.app.height - 60
} }
}; };
}, },
watch: { watch: {
@ -33,9 +33,9 @@ export default {
this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521, height: this.$store.state.app.height - 60 }); this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521, height: this.$store.state.app.height - 60 });
} }
}, },
created() { created() {
this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521, height: this.$store.state.app.height - 60 }); this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521, height: this.$store.state.app.height - 60 });
}, },
mounted() { mounted() {
this.$refs.ibpPlate.show(); this.$refs.ibpPlate.show();
this.$refs.ibpPlate.drawIbpInit(); this.$refs.ibpPlate.drawIbpInit();
@ -44,10 +44,10 @@ export default {
}, },
methods: { methods: {
ibpChange(stationCode) { ibpChange(stationCode) {
this.$refs.ibpPlate.show(stationCode); this.$refs.ibpPlate.show(stationCode);
this.$refs.ibpPlate.drawIbpInit(); this.$refs.ibpPlate.drawIbpInit();
} }
} }
}; };
</script> </script>

View File

@ -23,6 +23,7 @@
<script> <script>
import Cookies from 'js-cookie';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import {listPublishMap} from '@/api/jmap/map'; import {listPublishMap} from '@/api/jmap/map';
import {getQuestById, updateQuest, deleteQuest} from '@/api/quest'; import {getQuestById, updateQuest, deleteQuest} from '@/api/quest';
@ -92,7 +93,7 @@ export default {
const scriptId =this.$route.params.scriptId; const scriptId =this.$route.params.scriptId;
if (parseInt(scriptId)) { if (parseInt(scriptId)) {
getQuestById(scriptId).then(resp=>{ getQuestById(scriptId).then(resp=>{
const data={'name': resp.data.name, 'description': resp.data.description, 'mapId': resp.data.mapId}; const data={'name': resp.data.name, 'description': resp.data.description, 'mapId': resp.data.mapId,'lang':resp.data.lang};
this.formModel=data; this.formModel=data;
this.formModel.id=scriptId; this.formModel.id=scriptId;
}).catch(error => { }).catch(error => {
@ -103,7 +104,7 @@ export default {
drawUp() { drawUp() {
const data=this.formModel; const data=this.formModel;
scriptRecordNotify(data.id).then(resp => { scriptRecordNotify(data.id).then(resp => {
const query = { mapId: data.mapId, group: resp.data, scriptId: data.id }; const query = { mapId: data.mapId, group: resp.data, scriptId: data.id,lang:data.lang };
this.$router.push({ path: `${UrlConfig.scriptDisplay}/script`, query }); this.$router.push({ path: `${UrlConfig.scriptDisplay}/script`, query });
launchFullscreen(); launchFullscreen();
}).catch(error => { }).catch(error => {
@ -112,6 +113,11 @@ export default {
}, },
modifyScript() { modifyScript() {
const data=this.formModel; const data=this.formModel;
if(Cookies.get("user_lang")=="en"){
data.lang='en';
}else{
data.lang='zh';
}
updateQuest(data.id, data).then(resp => { updateQuest(data.id, data).then(resp => {
this.$emit('refresh'); this.$emit('refresh');
this.$message.success(this.$t('scriptRecord.modifyScriptSuccess')); this.$message.success(this.$t('scriptRecord.modifyScriptSuccess'));

View File

@ -1,8 +1,9 @@
<template> <template>
<div class="script-parent"> <div class="script-parent">
<div class="script-card"> <div class="script-card" :style="{width: widthLeft+'px'}">
<tip-script-record ref="tipTaskRecord" :group="group" /> <tip-script-record ref="tipTaskRecord" :group="group" :width="widthLeft" />
</div> </div>
<drap-left :width-left="widthLeft" :min="780" :max="980" @drapWidth="drapWidth" />
<div class="script-display"> <div class="script-display">
<display ref="display" :size="size" /> <display ref="display" :size="size" />
</div> </div>
@ -12,15 +13,18 @@
<script> <script>
import Display from '@/views/display/index'; import Display from '@/views/display/index';
import TipScriptRecord from './tipScriptRecord'; import TipScriptRecord from './tipScriptRecord';
import drapLeft from '@/views/components/drapLeft/index';
export default { export default {
name: 'ScriptDisplay', name: 'ScriptDisplay',
components: { components: {
Display, Display,
TipScriptRecord TipScriptRecord,
drapLeft
}, },
data() { data() {
return { return {
widthLeft: 780,
size: { size: {
width: document.documentElement.clientWidth - 780, width: document.documentElement.clientWidth - 780,
height: document.documentElement.clientHeight height: document.documentElement.clientHeight
@ -33,6 +37,14 @@ export default {
watch: { watch: {
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
this.size = { width: this.$store.state.app.width - 780, height: this.$store.state.app.height}; 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);
} }
} }
}; };

View File

@ -1,10 +1,11 @@
<template> <template>
<div class="reminder-drag"> <div class="reminder-drag">
<div ref="drapBox" class="reminder-box" :style="{height:'100%'}"> <div ref="drapBox" class="reminder-box" :style="{height:'100%', width: width + 'px'}">
<el-container class="actionPane"> <el-container class="actionPane">
<el-header style="height:50px;"> <el-header style="height:50px;">
<el-row class="actionList"> <el-row class="actionList">
<span class="titleStyle">{{ $t('scriptRecord.scriptRecordTitle') }}</span> <span class="titleStyle">{{ $t('scriptRecord.scriptRecordTitle') }}</span>
<span class="titleStyle">( {{$t('scriptRecord.language')}}: {{ $route.query.lang=="en"?$t('scriptRecord.english'):$t('scriptRecord.chinese') }} )</span>
</el-row> </el-row>
</el-header> </el-header>
<el-main style="padding-top:10px;padding-bottom:10px;"> <el-main style="padding-top:10px;padding-bottom:10px;">
@ -12,7 +13,8 @@
<add-action ref="addAction" :group="group" :size="size" @create="create" @setDisabled="setDisabled" /> <add-action ref="addAction" :group="group" :size="size" @create="create" @setDisabled="setDisabled" />
<get-action ref="getAction" :group="group" :size="size" @setAction="setAction" /> <get-action ref="getAction" :group="group" :size="size" @setAction="setAction" />
</el-main> </el-main>
<el-footer> <!-- <el-footer> -->
<el-card class="scriptFooter">
<el-button-group class="button-group"> <el-button-group class="button-group">
<el-button v-if="isPause" type="primary" :disabled="executeDisabled" @click="pauseScript">{{ $t('scriptRecord.drivingPause') }}</el-button> <el-button v-if="isPause" type="primary" :disabled="executeDisabled" @click="pauseScript">{{ $t('scriptRecord.drivingPause') }}</el-button>
<el-button v-else type="primary" :disabled="executeDisabled" @click="executePlayScript">{{ $t('scriptRecord.recoverAndExecute') }}</el-button> <el-button v-else type="primary" :disabled="executeDisabled" @click="executePlayScript">{{ $t('scriptRecord.recoverAndExecute') }}</el-button>
@ -21,13 +23,10 @@
<el-button type="success" :loading="isSavingScript" @click="saveScenesData">{{ $t('scriptRecord.saveData') }}</el-button> <el-button type="success" :loading="isSavingScript" @click="saveScenesData">{{ $t('scriptRecord.saveData') }}</el-button>
<!-- 暂停 --> <!-- 暂停 -->
</el-button-group> </el-button-group>
</el-footer> <!-- </el-footer> -->
</el-card>
</el-container> </el-container>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
@ -48,6 +47,10 @@ export default {
group: { group: {
type: String, type: String,
required: true required: true
},
width: {
type: Number || String,
required: true
} }
}, },
data() { data() {
@ -72,6 +75,9 @@ export default {
}, },
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
this.size = { width: 350, height: window.innerHeight-342}; this.size = { width: 350, height: window.innerHeight-342};
},
width: function(val) {
this.size = { width: val / 2 - 20, height: window.innerHeight - 342};
} }
}, },
mounted() { mounted() {
@ -149,7 +155,7 @@ export default {
this.clearAutoSave(); this.clearAutoSave();
const group=this.group; const group=this.group;
this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), { this.$confirm(this.$t('scriptRecord.clearDataTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
@ -183,13 +189,17 @@ export default {
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
.reminder-drag{
width: 100%;
height: 100%;
}
.reminder-box { .reminder-box {
position: absolute; position: absolute;
float: left; float: left;
left: 0px; left: 0px;
top:0px; top:0px;
width: 765px; // width: 100%;
height:100%; height:100%;
background-color: #fff; background-color: #fff;
overflow: hidden; overflow: hidden;
@ -201,7 +211,7 @@ export default {
} }
.button-group{ .button-group{
margin-bottom: 20px; margin: 8px;
float: right; float: right;
} }

View File

@ -17,6 +17,7 @@
</template> </template>
<script> <script>
import Cookies from 'js-cookie';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import {listPublishMap} from '@/api/jmap/map'; import {listPublishMap} from '@/api/jmap/map';
import {createQuest} from '@/api/quest'; import {createQuest} from '@/api/quest';
@ -93,6 +94,11 @@ export default {
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
this.loading=true; this.loading=true;
const data=this.formModel; const data=this.formModel;
if(Cookies.get("user_lang")=="en"){
data.lang='en';
}else{
data.lang='zh';
}
createQuest(data).then(resp => { createQuest(data).then(resp => {
const data={mapId: self.formModel.mapId, scriptId: resp.data}; const data={mapId: self.formModel.mapId, scriptId: resp.data};
this.$emit('refresh', data); this.$emit('refresh', data);

View File

@ -1,69 +1,69 @@
<template> <template>
<el-scrollbar class="addScript" :style="{width:size.width+'px',height:size.height+'px'}" ref="elActionScrollbar" wrapClass="scrollbar-wrapper"> <el-scrollbar ref="elActionScrollbar" class="addScript" :style="{width:size.width+'px',height:size.height+'px'}" wrap-class="scrollbar-wrapper">
<el-card class="conversitionCard"> <el-card class="conversitionCard">
<div class="addConversition">{{$t('scriptRecord.addConversition')}}</div> <div class="addConversition">{{ $t('scriptRecord.addConversition') }}</div>
<el-form size="mini" :model="modalData" ref="modalData" :rules="rules" label-width="100px" class="conversitionInfo" label-position="right"> <el-form ref="modalData" size="mini" :model="modalData" :rules="rules" label-width="100px" class="conversitionInfo" label-position="right">
<!-- <el-form-item label="动作类型" class="conditionVO" prop="actionVO.type" > <!-- <el-form-item label="动作类型" class="conditionVO" prop="actionVO.type" >
<el-select v-model="modalData.actionVO.type " placeholder="请选择动作类型" @change="changeType" :disabled="deviceTypeReadOnly||isPause"> <el-select v-model="modalData.actionVO.type " placeholder="请选择动作类型" @change="changeType" :disabled="deviceTypeReadOnly||isPause">
<el-option v-for="actionType in actionTypeList" :key="actionType.label" :label="actionType.label" :value="actionType.value"></el-option> <el-option v-for="actionType in actionTypeList" :key="actionType.label" :label="actionType.label" :value="actionType.value"></el-option>
</el-select> </el-select>
</el-form-item> --> </el-form-item> -->
<div> <div>
<div class="itemGroup"> <div class="itemGroup">
<el-form-item :label="$t('scriptRecord.narrator')" class="conditionVO" prop="actionVO.memberId"> <el-form-item :label="$t('scriptRecord.narrator')" class="conditionVO" prop="actionVO.memberId">
<el-select v-model="modalData.actionVO.memberId" :placeholder="$t('scriptRecord.narratorRules')" :disabled="isPause&&isNotModify"> <el-select v-model="modalData.actionVO.memberId" :placeholder="$t('scriptRecord.narratorRules')" :disabled="isPause&&isNotModify">
<el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id"></el-option> <el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('scriptRecord.receiver')" class="conditionVO" prop="actionVO.targetId"> <el-form-item :label="$t('scriptRecord.receiver')" class="conditionVO" prop="actionVO.targetId">
<el-select v-model="modalData.actionVO.targetId" :placeholder="$t('scriptRecord.receiverRules')" :disabled="isPause&&isNotModify"> <el-select v-model="modalData.actionVO.targetId" :placeholder="$t('scriptRecord.receiverRules')" :disabled="isPause&&isNotModify">
<el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id"></el-option> <el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</div> </div>
<div class="changeGroup"> <div class="changeGroup">
<div class="changeTop"></div> <div class="changeTop" />
<i class="el-icon-sort changeItem" @click="changeItem"></i> <i class="el-icon-sort changeItem" @click="changeItem" />
<div class="changeBottom"></div> <div class="changeBottom" />
</div> </div>
</div> </div>
<el-form-item :label="$t('scriptRecord.conversitionContent')" class="conditionVO" prop="actionVO.reply"> <el-form-item :label="$t('scriptRecord.conversitionContent')" class="conditionVO" prop="actionVO.reply">
<el-input v-model="modalData.actionVO.reply" type="textarea" class="textareaStyle" rows="3" :disabled="isPause&&isNotModify"></el-input> <el-input v-model="modalData.actionVO.reply" type="textarea" class="textareaStyle" rows="3" :disabled="isPause&&isNotModify" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="addScriptActionInfo('modalData')" :disabled="isPause&&isNotModify" :loading="modifying">{{buttonName}}</el-button> <el-button type="primary" :disabled="isPause&&isNotModify" :loading="modifying" @click="addScriptActionInfo('modalData')">{{ buttonName }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card class="commandCard"> <el-card class="commandCard">
<div class="addCommand">{{$t('scriptRecord.addCommand')}}</div> <div class="addCommand">{{ $t('scriptRecord.addCommand') }}</div>
<el-form size="mini" :model="commandData" ref="commandData" :rules="commandRules" label-width="120px" class="actionInfo" label-position="right"> <el-form ref="commandData" size="mini" :model="commandData" :rules="commandRules" label-width="120px" class="actionInfo" label-position="right">
<el-form-item :label="$t('scriptRecord.executor')" class="conditionVO" prop="action.memberId"> <el-form-item :label="$t('scriptRecord.executor')" class="conditionVO" prop="action.memberId">
<el-select v-model="commandData.action.memberId" :placeholder="$t('scriptRecord.executorRules')" :disabled="isPause" @change="changeRole"> <el-select v-model="commandData.action.memberId" :placeholder="$t('scriptRecord.executorRules')" :disabled="isPause" @change="changeRole">
<el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id"></el-option> <el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('scriptRecord.executeCommand')" class="conditionVO" prop="action.deviceCommand"> <el-form-item :label="$t('scriptRecord.executeCommand')" class="conditionVO" prop="action.deviceCommand">
<el-select v-model="commandData.action.deviceCommand " :placeholder="$t('scriptRecord.executeCommandRules')" @change="changeCommand" class="inputStyle" :disabled="isPause"> <el-select v-model="commandData.action.deviceCommand " :placeholder="$t('scriptRecord.executeCommandRules')" class="inputStyle" :disabled="isPause" @change="changeCommand">
<el-option v-for="deviceCommand in deviceCommandList" :key="deviceCommand.deviceCommand" :label="deviceCommand.label" :value="deviceCommand.deviceCommand"></el-option> <el-option v-for="deviceCommand in deviceCommandList" :key="deviceCommand.deviceCommand" :label="deviceCommand.label" :value="deviceCommand.deviceCommand" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('scriptRecord.startStation')" class="conditionVO" v-if="isJinLu" prop="param.startStation"> <el-form-item v-if="isJinLu" :label="$t('scriptRecord.startStation')" class="conditionVO" prop="param.startStation">
<el-select v-model="commandData.param.startStation " :placeholder="$t('scriptRecord.startStationRules')" class="inputStyle" :disabled="isPause"> <el-select v-model="commandData.param.startStation " :placeholder="$t('scriptRecord.startStationRules')" class="inputStyle" :disabled="isPause">
<el-option v-for="station in stationList" :key="station.code" :label="station.name" :value="station.code"></el-option> <el-option v-for="station in stationList" :key="station.code" :label="station.name" :value="station.code" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('scriptRecord.endStation')" class="conditionVO" v-if="isJinLu" prop="param.endStation"> <el-form-item v-if="isJinLu" :label="$t('scriptRecord.endStation')" class="conditionVO" prop="param.endStation">
<el-select v-model="commandData.param.endStation " :placeholder="$t('scriptRecord.endStationRules')" class="inputStyle" :disabled="isPause"> <el-select v-model="commandData.param.endStation " :placeholder="$t('scriptRecord.endStationRules')" class="inputStyle" :disabled="isPause">
<el-option v-for="station in stationList" :key="station.code" :label="station.name" :value="station.code"></el-option> <el-option v-for="station in stationList" :key="station.code" :label="station.name" :value="station.code" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="addCommandAction('commandData')" :disabled="isPause" :loading="adding">{{$t('scriptRecord.addCommandButton')}}</el-button> <el-button type="primary" :disabled="isPause" :loading="adding" @click="addCommandAction('commandData')">{{ $t('scriptRecord.addCommandButton') }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
</el-scrollbar> </el-scrollbar>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
@ -201,12 +201,29 @@
let role=this.orginMemberList.find(elem=>{return elem.id==index}).role; let role=this.orginMemberList.find(elem=>{return elem.id==index}).role;
let data={role:role}; let data={role:role};
getAvailableDeviceCommand(data).then(response=>{ 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; this.deviceCommandList=response.data;
if(response.data.length<=0) }
{ if(response.data.length<=0)
this.commandData.action.deviceCommand=""; {
this.isJinLu=false; this.commandData.action.deviceCommand="";
} this.isJinLu=false;
}
}); });
}, },
getDeviceCode(){ getDeviceCode(){

View File

@ -1,136 +1,132 @@
<template> <template>
<el-card class="scriptTop"> <el-card class="scriptTop">
<el-transfer v-model="selectRoleData" :data="allRoleData" class="script-player-choose" :titles="[$t('scriptRecord.allRoles'), $t('scriptRecord.actors')]" @change="handleChange"> <el-transfer v-model="selectRoleData" :data="allRoleData" class="script-player-choose" :titles="[$t('scriptRecord.allRoles'), $t('scriptRecord.actors')]" @change="handleChange">
<span slot-scope="{option}"> <span slot-scope="{option}">
<span>{{option.role+(option.name==undefined?'':option.name)}}</span> <span>{{ option.role+(option.name==undefined?'':option.name) }}</span>
<el-radio-group v-model="option.gender" size="mini" class="sexGroup" @change="changeSex($event,option.key)"> <el-radio-group v-model="option.gender" size="mini" class="sexGroup" @change="changeSex($event,option.key)">
<el-radio-button label="Male">{{$t('scriptRecord.roleSexMale')}}</el-radio-button> <el-radio-button label="Male">{{ $t('scriptRecord.roleSexMale') }}</el-radio-button>
<el-radio-button label="Female">{{$t('scriptRecord.roleSexFemale')}}</el-radio-button> <el-radio-button label="Female">{{ $t('scriptRecord.roleSexFemale') }}</el-radio-button>
</el-radio-group> </el-radio-group>
</span> </span>
</el-transfer> </el-transfer>
</el-card> </el-card>
</template> </template>
<script> <script>
import Vue from 'vue'; import Cookies from 'js-cookie';
import Cookies from 'js-cookie'; import ConstConfig from '@/scripts/ConstConfig';
import ConstConfig from '@/scripts/ConstConfig'; import {getScriptPlayMember, getScriptMemberData, cancleScriptMembers, selectScriptMembers, modifyScriptMemberSex} from '@/api/simulation';
import {getScriptPlayMember,getScriptMemberData,cancleScriptMembers,selectScriptMembers,modifyScriptMemberSex} from '@/api/simulation'; export default {
export default { name: 'AddRole',
name: 'addRole', props: {
props: { group: {
group: { type: String,
type: String, required: true
required: true }
}, },
}, data() {
data() { return {
return { allRoleData: [],
allRoleData:[], selectRoleData: [],
selectRoleData:[], sexGroup: this.$t('scriptRecord.roleSexMale')
sexGroup:this.$t('scriptRecord.roleSexMale'), };
} },
}, watch: {
mounted(){ '$store.state.socket.simulationStart': function (val) {
this.initData(); if (val) {
}, this.initData();
watch:{ }
'$store.state.socket.simulationStart': function (val) { }
if(val) },
{ mounted() {
this.initData(); this.initData();
} },
}, methods: {
}, initData() {
methods:{ const group=this.$props.group;
initData(){ getScriptMemberData(group).then(response=>{
let group=this.$props.group; const lastData=JSON.stringify(response.data);
getScriptMemberData(group).then(response=>{ this.allRoleData=this.coverData(lastData);
let lastData=JSON.stringify(response.data); getScriptPlayMember(group).then(response=>{
this.allRoleData=this.coverData(lastData); const last=response.data;
getScriptPlayMember(group).then(response=>{ // let userdata=JSON.stringify(response.data)
let last=response.data; // let reg=new RegExp('\"id\":\"(.*?)\\\"','g');
// let userdata=JSON.stringify(response.data) // let datalist=userdata.match(reg);
// let reg=new RegExp('\"id\":\"(.*?)\\\"','g'); const data=[];
// let datalist=userdata.match(reg); last.forEach(function(element) { data.push(element.id); });
let data=[]; this.selectRoleData=data;
last.forEach(function(element){data.push(element.id)}); });
this.selectRoleData=data; });
}) },
}) coverData(data) {
}, const roleTypeList=ConstConfig.ConstSelect.roleType;
coverData(data){ let lastData=data.replace(new RegExp('id', 'g'), 'key');
let roleTypeList=ConstConfig.ConstSelect.roleType; roleTypeList.forEach(function(element) {
let lastData=data.replace(new RegExp('id','g'),'key'); const rolename=element.value;
roleTypeList.forEach(function(element){ if (Cookies.get('user_lang')=='en') {
let rolename=element.value; lastData=lastData.replace(new RegExp(rolename, 'g'), element.enLabel);
if(Cookies.get("user_lang")=="en"){ } else {
lastData=lastData.replace(new RegExp(rolename,'g'),element.enLabel);
}else{
lastData=lastData.replace(new RegExp(rolename,'g'),element.label); lastData=lastData.replace(new RegExp(rolename, 'g'), element.label);
} }
}); });
lastData=JSON.parse(lastData); lastData=JSON.parse(lastData);
return lastData; return lastData;
}, },
handleChange(value, direction, movedKeys) { handleChange(value, direction, movedKeys) {
switch(direction) switch (direction) {
{ case 'right': {
case 'right':{ const group=this.$props.group;
let group=this.$props.group; const data=movedKeys;
let data=movedKeys; selectScriptMembers(group, data).then(response=>{
selectScriptMembers(group,data).then(response=>{ this.$message.success(this.$t('scriptRecord.selectScriptActorSuccess'));
this.$message.success(this.$t('scriptRecord.selectScriptActorSuccess')); this.$emit('refresh');
this.$emit("refresh"); })
}) .catch(error => {
.catch(error => { this.$messageBox(`${this.$t('scriptRecord.selectScriptActorFail')}: ${error.message}`);
this.$messageBox(`${this.$t('scriptRecord.selectScriptActorFail')}: ${error.message}`); return false;
return false; });
}); break;
break; }
} case 'left': {
case 'left':{ const group=this.$props.group;
let group=this.$props.group; const data=movedKeys;
let data=movedKeys; cancleScriptMembers(group, data).then(response=>{
cancleScriptMembers(group,data).then(response=>{ this.$emit('refresh');
this.$emit("refresh"); this.$message.success(this.$t('scriptRecord.cancleScriptActorSuccess'));
this.$message.success(this.$t('scriptRecord.cancleScriptActorSuccess')); })
}) .catch(error => {
.catch(error => { this.$messageBox(`${this.$t('scriptRecord.cancleScriptActorFail')}: ${error.message}`);
this.$messageBox(`${this.$t('scriptRecord.cancleScriptActorFail')}: ${error.message}`); this.initData();
this.initData(); });
}); }
} }
} },
}, // resetData(data){
// resetData(data){ // debugger;
// debugger; // let allRoleData=this.allRoleData;
// let allRoleData=this.allRoleData; // // debugger;
// // debugger; // data.forEach(function(element){
// data.forEach(function(element){ // allRoleData.forEach(function(select){
// allRoleData.forEach(function(select){ // if(select.key==element)
// if(select.key==element) // {
// { // debugger;
// debugger; // select.disabled="disabled";
// select.disabled="disabled"; // }
// } // });
// }); // });
// }); // },
// }, changeSex(event, id) {
changeSex(event,id) const group=this.$props.group;
{ const data={'gender': event};
let group=this.$props.group; modifyScriptMemberSex(group, id, data).then(response=>{
let data={"gender":event}; this.$message.success(this.$t('scriptRecord.modifyScriptActorSexSuccess'));
modifyScriptMemberSex(group,id,data).then(response=>{ })
this.$message.success(this.$t('scriptRecord.modifyScriptActorSexSuccess')); .catch(error => {
}) this.$messageBox(`${this.$t('scriptRecord.modifyScriptActorSexFail')}: ${error.message}`);
.catch(error => { });
this.$messageBox(`${this.$t('scriptRecord.modifyScriptActorSexFail')}: ${error.message}`); }
}); }
} };
}
}
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
@ -140,24 +136,28 @@
} }
.scriptTop{ .scriptTop{
padding: 10px 10px; padding: 10px 10px;
width: 730px; width: 100%;
} /deep/ {
/deep/ { .script-player-choose .el-transfer-panel__body{
.script-player-choose .el-transfer-panel__body{ height: 120px;
height: 120px; }
} .script-player-choose .el-transfer-panel__list{
.script-player-choose .el-transfer-panel__list{ height: 120px;
height: 120px; }
} .script-player-choose .el-transfer-panel{
.script-player-choose .el-transfer-panel{ width: 44%;
width: 310px; }
} .el-transfer-panel__item{
.el-transfer-panel__item{ margin-right:0px;
margin-right:0px; }
} .el-transfer__buttons{
.el-transfer__buttons{ padding: 0;
padding: 0 20px; width: 12%;
} .el-button{
margin: 14px auto;
}
}
}
} }
</style> </style>
<style> <style>
@ -166,4 +166,3 @@
} }
</style> </style>

View File

@ -1,159 +1,148 @@
<template> <template>
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar" class="scriptBottom" :style="{width:370+'px',height:size.height+'px'}"> <el-scrollbar ref="elActionScrollbar" wrap-class="scrollbar-wrapper" class="scriptBottom" :style="{width:370+'px',height:size.height+'px'}">
<el-timeline :reverse="reverse" class="el_timeline"> <el-timeline :reverse="reverse" class="el_timeline">
<el-timeline-item v-for="(actionInfo,index) in actionInfoList" :key="index"> <el-timeline-item v-for="(actionInfo,index) in actionInfoList" :key="index">
<el-card> <el-card>
<div class="actionTable"> <div class="actionTable">
<span class="detail" v-html="actionInfo.detail"> <span class="detail" v-html="actionInfo.detail" />
</span> <span class="otherInfo" v-html="actionInfo.otherInfo" />
<span class="otherInfo" v-html="actionInfo.otherInfo"></span> <span v-if="actionInfo.isCoversition">
<span v-if="actionInfo.isCoversition"> <span class="roleClass">{{ actionInfo.memberName }}</span>
<span class="roleClass">{{actionInfo.memberName}}</span> <span>{{ $t('scriptRecord.speakTo') }}</span>
<span>{{$t('scriptRecord.speakTo')}}</span> <span class="roleClass">{{ actionInfo.targetName }}</span>
<span class="roleClass">{{actionInfo.targetName}}</span> <span>: </span>
<span>: </span> <span>{{ actionInfo.reply }}</span>
<span>{{actionInfo.reply}}</span> </span>
</span> <span v-else>
<span v-else> <span class="roleClass">{{ actionInfo.memberName }}</span>
<span class="roleClass">{{actionInfo.memberName}}</span> <span>{{ $t('scriptRecord.executeCommandTips') }}</span>
<span>{{$t('scriptRecord.executeCommandTips')}}</span> <span class="commandStyle">{{ actionInfo.command }}</span>
<span class="commandStyle">{{actionInfo.command}}</span> </span>
</span> </div>
</div> <div class="btnGroup">
<div class="btnGroup"> <el-button v-if="actionInfo.visible" type="primary" size="mini" style="margin-left:10px;" @click="modifyAction(actionInfo.row)">{{ $t('scriptRecord.modifyConversitionButton') }}</el-button>
<el-button type="primary" size="mini" style="margin-left:10px;" @click="modifyAction(actionInfo.row)" v-if="actionInfo.visible">{{$t('scriptRecord.modifyConversitionButton')}}</el-button> <!-- <el-button type="danger" size="mini" @click="deleteAction(actionInfo.id)">删除</el-button> -->
<!-- <el-button type="danger" size="mini" @click="deleteAction(actionInfo.id)">删除</el-button> --> </div>
</div> </el-card>
</el-card> </el-timeline-item>
</el-timeline-item> </el-timeline>
</el-timeline> </el-scrollbar>
</el-scrollbar>
</template> </template>
<script> <script>
import Vue from 'vue'; import {getScriptRecord, deleteScriptAction, getAvailableDeviceCommand } from '@/api/simulation';
import {getScriptRecord,deleteScriptAction,getAvailableDeviceCommand,getScriptPlayMember,getScriptMemberData} from '@/api/simulation'; import ConstConfig from '@/scripts/ConstConfig';
import ConstConfig from '@/scripts/ConstConfig'; export default {
export default { name: 'GetAction',
name: 'getAction', props: {
props: { group: {
group: { type: String,
type: String, required: true
required: true },
}, size: {
size:{ type: Object,
type: Object, required: true
required: true }
} },
}, data() {
data() { return {
return { actionInfoList: [],
actionInfoList:[], deviceCommandList: [],
deviceCommandList:[], reverse: true,
reverse:true, loading: true,
loading:true, // behaviorName:"",
// behaviorName:"", memberName: ''
memberName:"", };
} },
}, watch: {
mounted(){ actionInfoList: function(val) {
this.loadInitData(); this.$nextTick(function() {
}, var div = this.$refs['elActionScrollbar'].$refs['wrap'];
watch:{ div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
actionInfoList: function(val){ });
this.$nextTick(function(){ }
var div = this.$refs['elActionScrollbar'].$refs['wrap']; },
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight; mounted() {
}); this.loadInitData();
} },
}, methods: {
methods:{ loadInitData() {
loadInitData() { // const group=this.$route.query.group;
let group=this.$route.query.group; const data={role: 'Driver'};
let data={role:"Driver"}; getAvailableDeviceCommand(data).then(response=>{
getAvailableDeviceCommand(data).then(response=>{ this.deviceCommandList=response.data;
this.deviceCommandList=response.data; this.loadOtherData(this.$route.query);
this.loadOtherData(this.$route.query); });
}); },
}, loadOtherData(obj) {
loadOtherData(obj){ const group=obj.group;
let group=obj.group; getScriptRecord(group).then(response=>{
getScriptRecord(group).then(response=>{ this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet);
this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet); this.actionInfoList=[];
this.actionInfoList=[]; const roleTypeList=ConstConfig.ConstSelect.roleType;
let roleTypeList=ConstConfig.ConstSelect.roleType;
let memberVOList=JSON.stringify(response.data.memberVOList); let memberVOList=JSON.stringify(response.data.memberVOList);
roleTypeList.forEach(function(element){ roleTypeList.forEach(function(element) {
let rolename=element.value; const rolename=element.value;
memberVOList=memberVOList.replace(new RegExp(rolename,'g'),element.label); memberVOList=memberVOList.replace(new RegExp(rolename, 'g'), element.label);
}); });
memberVOList=JSON.parse(memberVOList); memberVOList=JSON.parse(memberVOList);
let actionList=response.data.actionVOList; const actionList=response.data.actionVOList;
actionList.forEach(element => {
const member=memberVOList.find(elem=>{ return elem.id==element.memberId; });
actionList.forEach(element => { const memberName=member.name?' - '+member.name:'';
switch (element.type) {
let member=memberVOList.find(elem=>{return elem.id==element.memberId}); case 'Conversation':
{
let memberName=member.name?" - "+member.name:""; const target=memberVOList.find(elem=>{ return elem.id==element.targetId; });
switch(element.type) 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});
case "Conversation": break;
{ }
let target=memberVOList.find(elem=>{return elem.id==element.targetId}); case 'Command':
let 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}); const deviceCommand=this.deviceCommandList.find(elem=>{ return elem.deviceCommand==element.deviceCommand; });
break; switch (element.deviceCommand) {
} case 'Train_Manual_Route_Blocking_Drive':
case "Command": {
{ this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role+memberName, command: deviceCommand.label, row: element, visible: false});
let deviceCommand=this.deviceCommandList.find(elem=>{return elem.deviceCommand==element.deviceCommand}); break;
switch(element.deviceCommand) }
{ case 'Train_Manual_Limit_Drive':
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});
this.actionInfoList.push({id:element.id,isCoversition:false,memberName:member.role+memberName,command:deviceCommand.label,row:element,visible:false}); break;
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};
default: this.$store.dispatch('scriptRecord/updateMapLocation', mapLocation);
{ }
} this.loading=false;
} });
break; },
} deleteAction(row) {
} const group=this.$props.group;
}); deleteScriptAction(group, row).then(resp => {
if(response.data.mapLocation) this.reloadTable();
{ this.$message.success('删除行为动作成功');
let mapLocation={"offsetX":response.data.mapLocation.x,"offsetY":response.data.mapLocation.y,"scaleRate":response.data.mapLocation.scale}; }).catch(error => {
this.$store.dispatch('scriptRecord/updateMapLocation', mapLocation); this.$messageBox(`删除行为动作失败: ${error.message}`);
} });
this.loading=false; },
}); reloadTable() {
}, this.loadInitData();
deleteAction(row){ },
let group=this.$props.group; modifyAction(row) {
deleteScriptAction(group,row).then(resp => { this.$emit('setAction', row);
this.reloadTable(); }
this.$message.success('删除行为动作成功'); }
}).catch(error => { };
this.$messageBox(`删除行为动作失败: ${error.message}`);
});
},
reloadTable(){
this.loadInitData();
},
modifyAction(row){
this.$emit("setAction",row);
}
}
}
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
@ -165,7 +154,7 @@
} }
.btnGroup{ .btnGroup{
padding: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;
float:right; float: right;
vertical-align: top; vertical-align: top;
display: inline-block; display: inline-block;
} }