This commit is contained in:
ival 2019-08-20 14:03:11 +08:00
commit febfddfc15
5 changed files with 299 additions and 280 deletions

View File

@ -142,6 +142,7 @@ export default {
meter: '米',
code: '编码:',
codeC: '编码',
imageName: '图片名称:',
imageWidth: '图片宽度:',
imageHeight: '图片高度:',
@ -329,6 +330,7 @@ export default {
trainCode: '列车编号:',
groupNumber: '车组号:',
trainNumber: '车组号',
modelCode: '车类型:',
trainmodelCreate: '新建车类型',

View File

@ -1,43 +1,47 @@
<template>
<div>
<el-form :model="modalData" ref="modalData" :rules="rules" label-width="100px" class="actionInfo" label-position="right">
<el-form-item label="主体角色" class="conditionVO" prop="actionVO.memberId">
<el-select v-model="modalData.actionVO.memberId" placeholder="请选择主体角色" :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-select>
</el-form-item>
<el-form-item label="动作类型" class="conditionVO" prop="actionVO.type" >
<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-select>
</el-form-item>
<el-form-item label="目标角色" class="conditionVO" prop="actionVO.targetId" v-if="isConversitionAdd">
<el-select v-model="modalData.actionVO.targetId" placeholder="请选择目标角色" :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-select>
</el-form-item>
<el-form-item label="内容" class="conditionVO" prop="actionVO.reply" v-if="isConversitionAdd">
<el-input v-model="modalData.actionVO.reply" type="textarea" class="textareaStyle" rows="3" :disabled="isPause&&isNotModify"></el-input>
</el-form-item>
<el-form-item label="设备指令" class="conditionVO" prop="actionVO.deviceCommand" v-if="isCommandAdd">
<el-select v-model="modalData.actionVO.deviceCommand " placeholder="请选择设备指令" @change="changeCommand" class="inputStyle" :disabled="isPause&&isModify">
<el-option v-for="deviceCommand in deviceCommandList" :key="deviceCommand.deviceCommand" :label="deviceCommand.label" :value="deviceCommand.deviceCommand"></el-option>
</el-select>
</el-form-item>
<el-form-item label="起始站台" class="conditionVO" v-if="isJinLu" prop="param.startStation">
<el-select v-model="modalData.param.startStation " placeholder="请选择起始站台" class="inputStyle" :disabled="isPause&&isNotModify">
<el-option v-for="station in stationList" :key="station.code" :label="station.name" :value="station.code"></el-option>
</el-select>
</el-form-item>
<el-form-item label="终点站台" class="conditionVO" v-if="isJinLu" prop="param.endStation">
<el-select v-model="modalData.param.endStation " placeholder="请选择终点站台" class="inputStyle" :disabled="isPause&&isNotModify">
<el-option v-for="station in stationList" :key="station.code" :label="station.name" :value="station.code"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addScriptActionInfo('modalData')" :disabled="isPause&&isNotModify" :loading="modifying">{{buttonName}}</el-button>
</el-form-item>
</el-form>
<el-card class="conversitionCard">
<div class="addConversition">添加对话</div>
<el-form :model="modalData" ref="modalData" :rules="rules" label-width="100px" class="actionInfo" label-position="right">
<!-- <el-form-item label="动作类型" class="conditionVO" prop="actionVO.type" >
<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-select>
</el-form-item> -->
<el-form-item :label="memberName" class="conditionVO" prop="actionVO.memberId">
<el-select v-model="modalData.actionVO.memberId" placeholder="请选择主体角色" :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-select>
</el-form-item>
<el-form-item label="接收者" class="conditionVO" prop="actionVO.targetId" v-if="isConversitionAdd">
<el-select v-model="modalData.actionVO.targetId" placeholder="请选择目标角色" :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-select>
</el-form-item>
<el-form-item label="内容" class="conditionVO" prop="actionVO.reply" v-if="isConversitionAdd">
<el-input v-model="modalData.actionVO.reply" type="textarea" class="textareaStyle" rows="3" :disabled="isPause&&isNotModify"></el-input>
</el-form-item>
<el-form-item label="设备指令" class="conditionVO" prop="actionVO.deviceCommand" v-if="isCommandAdd">
<el-select v-model="modalData.actionVO.deviceCommand " placeholder="请选择设备指令" @change="changeCommand" class="inputStyle" :disabled="isPause&&isModify">
<el-option v-for="deviceCommand in deviceCommandList" :key="deviceCommand.deviceCommand" :label="deviceCommand.label" :value="deviceCommand.deviceCommand"></el-option>
</el-select>
</el-form-item>
<el-form-item label="起始站台" class="conditionVO" v-if="isJinLu" prop="param.startStation">
<el-select v-model="modalData.param.startStation " placeholder="请选择起始站台" class="inputStyle" :disabled="isPause&&isNotModify">
<el-option v-for="station in stationList" :key="station.code" :label="station.name" :value="station.code"></el-option>
</el-select>
</el-form-item>
<el-form-item label="终点站台" class="conditionVO" v-if="isJinLu" prop="param.endStation">
<el-select v-model="modalData.param.endStation " placeholder="请选择终点站台" class="inputStyle" :disabled="isPause&&isNotModify">
<el-option v-for="station in stationList" :key="station.code" :label="station.name" :value="station.code"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addScriptActionInfo('modalData')" :disabled="isPause&&isNotModify" :loading="modifying">{{buttonName}}</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
@ -102,6 +106,7 @@
isPause:false,
isNotModify:true,
modifying:false,
memberName:"讲述者",
isConversitionAdd:true,
isCommandAdd:false,
actionTypeList:DeviceTypeDic.ConstSelect.actionType,
@ -216,6 +221,7 @@
{
this.$refs['modalData'].resetFields();
// this.$nextTick(function(){
this.memberName="讲述者";
this.deviceTypeReadOnly=false;
this.modalData.actionVO.type="Conversation";
this.modalData.actionVO.memberId="";
@ -243,6 +249,7 @@
switch(index)
{
case "Conversation":{
this.memberName="讲述者";
this.isConversitionAdd=true;
this.isCommandAdd=false;
this.isJinLu=false;
@ -250,6 +257,7 @@
break;
}
case "Command":{
this.memberName="执行者";
this.isConversitionAdd=false;
this.isCommandAdd=true;
//
@ -330,6 +338,10 @@
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.addConversition{
margin-left:10px;
}
.addAction{
margin-top: 20px;
margin-left: 5px;
@ -348,4 +360,13 @@
.textareaStyle{
width:300px;
}
.conversitionCard{
margin-left: 20px;
padding-bottom: 20px;
margin-top: 10px;
}
.addConversition{
font-size:15px;
padding: 20px 10px;
}
</style>

View File

@ -1,14 +1,14 @@
<template>
<div>
<div class="actionPaneInner">
<div class="actionList">
<span class="titleStyle">剧本动作</span>
</div>
<div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar">
<add-action ref="addBehavior" :group="group" @create="create" :buttonName="buttonName" :operateType="operateType" @modifyButtonName="modifyButtonName" class="addScript"></add-action>
<div class="vertialLine"></div>
<!-- <div class="vertialLine"></div> -->
<div class="block actionListTable">
<el-timeline :reverse="reverse">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar">
<el-timeline :reverse="reverse" class="el_timeline">
<el-timeline-item v-for="(actionInfo,index) in actionInfoList" :key="index">
<el-card>
<div class="actionTable">
@ -23,8 +23,8 @@
</el-card>
</el-timeline-item>
</el-timeline>
</el-scrollbar>
</div>
</el-scrollbar>
</div>
</div>
</template>
@ -137,10 +137,14 @@
},
create(){
this.reloadTable();
this.$nextTick(function(){
debugger;
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
});
},
modifyAction(row){
// var div = this.$refs['elActionScrollbar'].$refs['wrap'];
// div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
this.operateType="modify";
this.buttonName="修改动作"
this.$refs.addBehavior.doShow(row);
@ -154,6 +158,10 @@
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.actionPaneInner{
height:100%;
padding-top:70px;
}
.addScript{
float:left;
width:450px;
@ -161,24 +169,31 @@
position: fixed;
}
.actionListTable{
margin-top: 15px;
margin-left: 5px;
font-size: 15px;
width:452px;
width:490px;
display: inline-block;
margin-left:450px;
height:100%;
}
.actionList{
margin-top: 10px;
margin-left: 5px;
padding-top: 20px;
margin-left: 20px;
font-size: 15px;
margin-bottom:10px;
padding-bottom: 15px;
position: absolute;
top: 0;
left: 0;
margin-right: 20px;
width: 940px;
border-bottom: 1px #ccc solid;
}
.titleStyle{
margin-left:10px;
}
.tab-pane-big{
height:380px;
height:100%;
padding-bottom: 20px;
position: relative;
}
.actionTable{
width:370px;
@ -193,10 +208,14 @@
display: inline-block;
}
.vertialLine{
height: 380px;
height: 100%;
margin-left: 440px;
border-right: 1px #dadada solid;
position: fixed;
position:absolute;
width: 0px;
}
.el_timeline{
width: 470px;
margin-top:10px;
}
</style>

View File

@ -1,30 +1,18 @@
<template>
<div class="reminder-drag">
<div ref="drapBox" class="reminder-box">
<div class="tip-title">
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" />
<i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" />
<p v-if="isShrink" style="color: #fff;">
<span>{{ title }}</span>
</p>
</div>
<div ref="dragBody" class="tip-body-box">
<div class="tip-body">
<div>
<get-action ref="getAction" :group="group" />
</div>
<!-- <el-button-group class="button-group1"> -->
<!-- </el-button-group> -->
<el-button-group class="button-group">
<el-button v-if="isPause" type="primary" :disabled="executeDisabled" @click="pauseScript">暂停</el-button>
<el-button v-else type="primary" :disabled="executeDisabled" @click="executePlayScript">恢复并执行</el-button>
<el-button type="primary" @click="saveMaplocation">{{ $t('scriptRecord.saveMaplocation') }}</el-button>
<el-button type="danger" @click="dumpScenesData">重置剧本</el-button>
<el-button type="primary" @click="saveScenesStage">{{ $t('scriptRecord.saveBackground') }}</el-button>
<el-button type="success" :loading="isSavingScript" @click="saveScenesData">{{ $t('scriptRecord.saveData') }}</el-button>
<!-- 暂停 -->
</el-button-group>
<div class="reminder-drag">
<div class="reminder-box" ref="drapBox" :style="{height:'100%'}">
<div class="actionPane">
<get-action ref="getAction" :group="group"></get-action>
</div>
<el-button-group class="button-group">
<el-button type="primary" @click="pauseScript" v-if="isPause" :disabled="executeDisabled">暂停</el-button>
<el-button type="primary" @click="executePlayScript" v-else :disabled="executeDisabled">恢复并执行</el-button>
<!-- <el-button type="primary" @click="saveMaplocation">{{$t('scriptRecord.saveMaplocation')}}</el-button> -->
<el-button type="danger" @click="dumpScenesData">重置剧本</el-button>
<el-button type="primary" @click="saveScenesStage">{{$t('scriptRecord.saveBackground')}}</el-button>
<el-button type="success" @click="saveScenesData" :loading="isSavingScript" >{{$t('scriptRecord.saveData')}}</el-button>
<!-- 暂停 -->
</el-button-group>
</div>
</div>
</div>
@ -35,157 +23,165 @@ import Vue from 'vue';
import GetAction from './scriptRecord/getAction';
import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scriptPause, executeScript} from '@/api/simulation';
export default {
name: 'TipScriptRecord',
components: {
GetAction
},
props: {
group: {
type: String,
required: true
}
},
// this.$t('scriptRecord.scriptTitle')
data() {
return {
title: '剧本编制',
isShrink: false,
mapLocation: {},
autoSaveScript: null,
isSavingScript: false,
isPause: false,
executeDisabled: false
// isSaveStage: true,
};
},
created() {
},
mounted() {
this.initAutoSaveScript();
this.shrink();
},
beforeDestroy() {
this.clearAutoSave();
},
methods: {
jump(obj) {
},
shrink() {
const height = this.$refs.dragBody.offsetHeight + 40;
const top = this.$refs.drapBox.style.top;
if (this.isShrink) {
this.$refs.drapBox.style.height = '40px';
this.$refs.drapBox.style.top = '';
this.isShrink = false;
} else {
this.$refs.drapBox.style.height = height + 'px';
this.$refs.drapBox.style.top = top;
this.isShrink = true;
}
},
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.isSaveStage = false;
this.$store.dispatch('scriptRecord/updateSimulationPause', true);
// this.$message.success('');
}).catch(() => {
this.$messageBox('暂停失败!');
});
},
executePlayScript() {
executeScript(this.group).then(resp => {
// this.isSaveStage = false;
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
// this.$message.success('');
}).catch(() => {
this.$messageBox('恢复失败!');
});
},
saveScenesStage() {
saveScriptScenes(this.group).then(resp => {
// this.isSaveStage = false;
this.$message.success('保存背景成功');
}).catch(() => {
this.$messageBox('保存背景失败!');
});
},
saveScenesData() {
this.isSavingScript=true;
saveScriptData(this.group).then(resp => {
this.$message.success('保存数据成功');
this.isSavingScript=false;
this.initAutoSaveScript();
}).catch(error => {
this.$messageBox(`保存数据失败!: ${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('此操作将会清除已保存的编制数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dumpScriptData(group).then(resp => {
// this.isSaveStage = true;
this.$parent.resetBeginTime();
this.$refs['getAction'].loadInitData();
this.initAutoSaveScript();
this.$message.success('清除数据成功');
}).catch(() => {
this.$messageBox('清除数据失败!');
});
}).catch(() => {
this.initAutoSaveScript();
});
},
saveMaplocation() {
const data=Vue.prototype.$jlmap.$options;
const group=this.$route.query.group;
const dataZoom={scale: data.scaleRate, x: data.offsetX, y: data.offsetY};
updateMapLocation(group, dataZoom).then(response=>{
this.$message.success('更新定位成功');
}).catch(error => {
this.$messageBox(`更新定位失败: ${error.message}`);
});
}
}
};
export default {
name: 'TipScriptRecord',
props: {
group: {
type: String,
required: true
},
},
components: {
GetAction,
},
// this.$t('scriptRecord.scriptTitle')
data() {
return {
title:"剧本编制",
isShrink: false,
mapLocation:{},
autoSaveScript: null,
isSavingScript:false,
isPause:false,
executeDisabled:false,
// isSaveStage: true,
}
},
created() {
},
mounted(){
this.initAutoSaveScript();
// this.shrink();
},
beforeDestroy() {
this.clearAutoSave();
},
methods: {
jump(obj) {
},
shrink() {
let height = this.$refs.dragBody.offsetHeight + 40;
let top = this.$refs.drapBox.style.top;
if (this.isShrink) {
this.$refs.drapBox.style.height = '40px';
this.$refs.drapBox.style.top = '';
this.isShrink = false;
} else {
this.$refs.drapBox.style.height = height + 'px';
this.$refs.drapBox.style.top = top;
this.isShrink = true;
}
},
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.isSaveStage = false;
this.$store.dispatch('scriptRecord/updateSimulationPause',true);
// this.$message.success('');
}).catch(error => {
this.$messageBox('暂停失败!');
});
},
executePlayScript(){
executeScript(this.group).then(resp => {
// this.isSaveStage = false;
this.$store.dispatch('scriptRecord/updateSimulationPause',false);
// this.$message.success('');
}).catch(error => {
this.$messageBox('恢复失败!');
});
},
saveScenesStage() {
let data=Vue.prototype.$jlmap.$options;
let group=this.$route.query.group;
let dataZoom={scale:data.scaleRate,x:data.offsetX,y:data.offsetY};
saveScriptScenes(this.group).then(resp => {
updateMapLocation(group,dataZoom).then(response=>{
// this.$message.success('');
this.$message.success('保存背景成功');
}).catch(error => {
this.$messageBox(`更新定位失败: ${error.message}`);
});
// this.isSaveStage = false;
// this.$message.success('');
}).catch(error => {
this.$messageBox('保存背景失败!');
})
},
saveScenesData() {
this.isSavingScript=true;
saveScriptData(this.group).then(resp => {
this.$message.success('保存数据成功');
this.isSavingScript=false;
this.initAutoSaveScript();
}).catch(error => {
this.$messageBox(`保存数据失败!: ${error.message}`);
this.isSavingScript=false;
if (error.code === 40004 || error.code === 40005 || error.code === 40003) {
this.clearAutoSave();
} else {
this.initAutoSaveScript();
}
})
},
dumpScenesData() {
this.clearAutoSave();
let group=this.group;
this.$confirm('此操作将会清除已保存的编制数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dumpScriptData(group).then(resp => {
// this.isSaveStage = true;
this.$parent.resetBeginTime();
this.$refs["getAction"].loadInitData();
this.initAutoSaveScript();
this.$message.success('清除数据成功');
}).catch(error => {
this.$messageBox('清除数据失败!');
})
}).catch(error => {
this.initAutoSaveScript();
})
},
saveMaplocation()
{
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.tip-body-box {
position: relative;
// height: 540px;
}
// .tip-body-box {
// position: relative;
// height:100%;
// }
.tab-pane-big{
height:420px;
// width:100%;
// height:100%;
}
.breadColor{
color:#fff;
@ -194,61 +190,42 @@ export default {
.reminder-box {
position: absolute;
float: left;
left: 15px;
bottom: 15px;
width: 995px;
height: 540px;
left: 0px;
top:0px;
width: 955px;
height:100%;
background-color: #fff;
border-radius: 5px;
overflow: hidden;
z-index: 10;
font-size: 18px;
.tip-title {
width: 100%;
overflow: hidden;
height: 40px;
display: flex;
align-items: center;
flex-direction: row-reverse;
background-color: #409EFF;
border-radius: 5px 5px 0 0;
justify-content: space-between;
padding: 0 10px;
.actionPane{
height: 100%;
padding-bottom: 80px;
}
.tip-body {
height: 500px;
padding: 10px;
.list-label {
width: 105px;
}
.button-group{
margin-top:15px;
margin-left: 20px;
float:right;
}
.button-group1{
margin-top:15px;
margin-left: 20px;
float:left;
}
.actionInfo{
margin-top:30px;
}
.conditionVO{
width:400px;
}
.actionList{
margin-top: 10px;
margin-left: 5px;
font-size: 15px;
margin-bottom:10px;
}
.titleStyle{
margin-left:10px;
}
.list-label {
width: 105px;
}
.button-group{
position: absolute;
bottom: 30px;
right: 20px;
}
.actionInfo{
margin-top:30px;
}
.conditionVO{
width:400px;
}
.actionList{
margin-top: 10px;
margin-left: 5px;
font-size: 15px;
margin-bottom:10px;
}
.titleStyle{
margin-left:10px;
}
.icon {

View File

@ -1,24 +1,24 @@
<template>
<div>
<el-tabs v-model="activeName" class="card">
<el-tab-pane class="view-control" label="操作" name="second">
<el-tab-pane class="view-control" :label="$t('map.operation')" name="second">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }">
<el-table :data="trainList.filter(data => !search || data.groupNumber.toLowerCase().includes(search.toLowerCase()))" style="width: 100%">
<el-table-column label="车组号" prop="groupNumber" />
<el-table-column label="编码" prop="code" />
<el-table-column :label="$t('map.trainNumber')" prop="groupNumber" />
<el-table-column :label="$t('map.codeC')" prop="code" />
<el-table-column align="right">
<template slot="header">
<el-input v-model="search" size="mini" placeholder="输入关键字搜索" />
<el-input v-model="search" size="mini" :placeholder="$t('map.pleaseSelect')" />
</template>
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">{{ $t('map.deleteObj') }}</el-button>
</template>
</el-table-column>
</el-table>
</el-scrollbar>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="handleCreate">创建</el-button>
<el-button type="primary" size="small" @click="handleCreate">{{ $t('map.create') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>