定时保存数据

剧本编制页面修改
This commit is contained in:
joylink_cuiweidong 2019-08-19 14:09:08 +08:00
parent 9ca049157c
commit 43dfc04281
12 changed files with 187 additions and 1383 deletions

View File

@ -4,84 +4,19 @@
const scriptRecord = { const scriptRecord = {
namespaced: true, namespaced: true,
state: { state: {
deviceConditionList: [], //任务目标列表
memberList:[], //角色列表,
script:[], //剧本列表,
memberName:"", //角色名称,
behaviorName:"", //动作名称
mapLocation: {}, //地图定位 mapLocation: {}, //地图定位
}, },
getters: { getters: {
deviceConditionList: (state) => {
return state.deviceConditionList;
},
memberList:(state)=>{
return state.memberList;
},
script:(state)=>{
return state.script;
},
memberName:(state)=>{
return state.memberName;
},
behaviorName:(state)=>{
return state.behaviorName;
},
mapLocation:(state)=>{ mapLocation:(state)=>{
return state.mapLocation; return state.mapLocation;
} }
}, },
mutations: { mutations: {
setDeviceCondition: (state, deviceConditionList) => {
state.deviceConditionList = deviceConditionList;
},
setMemberList: (state, memberList) => {
state.memberList = memberList;
},
setScript:(state, script) => {
state.script = script;
},
setMemberName:(state, memberName) => {
state.memberName = memberName;
},
setBehaviorName:(state, behaviorName) => {
state.behaviorName = behaviorName;
},
setMapLocation:(state, mapLocation) => { setMapLocation:(state, mapLocation) => {
state.mapLocation = mapLocation; state.mapLocation = mapLocation;
}, },
}, },
actions: { actions: {
/**
* 设置任务目标列表
*/
updateDeviceCondition: ({ commit }, deviceConditionList) => {
commit('setDeviceCondition', deviceConditionList);
},
/**
* 设置角色列表
*/
updateMemberList: ({ commit }, memberList) => {
commit('setMemberList', memberList);
},
/**
* 设置剧本列表
*/
updateScript: ({ commit }, script) => {
commit('setScript', script);
},
/**
* 设置角色名称
*/
updateMemberName:({ commit }, memberName) => {
commit('setMemberName', memberName);
},
/**
* 设置动作名称
*/
updateBehaviorName:({ commit }, behaviorName) => {
commit('setBehaviorName', behaviorName);
},
/** /**
* 设置地图定位 * 设置地图定位
*/ */

View File

@ -6,9 +6,9 @@
<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-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="完成时间" class="conditionVO"> <!-- <el-form-item label="完成时间" class="conditionVO">
<el-input-number v-model="modalData.actionVO.time " class="inputStyle" :min="0"></el-input-number> <el-input-number v-model="modalData.actionVO.time " class="inputStyle" :min="0"></el-input-number>
</el-form-item> </el-form-item> -->
<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"> <el-select v-model="modalData.actionVO.type " placeholder="请选择动作类型" @change="changeType">
<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>
@ -82,7 +82,7 @@
actionVO:{ actionVO:{
memberId:"", memberId:"",
targetId:"", targetId:"",
time:0, // time:0,
reply:"", reply:"",
type:"Conversation", type:"Conversation",
deviceCommand:"", deviceCommand:"",
@ -208,10 +208,11 @@
} }
}, },
initActionData(){ initActionData(){
// debugger;
this.modalData.actionVO.memberId=""; this.modalData.actionVO.memberId="";
this.modalData.actionVO.targetId=""; this.modalData.actionVO.targetId="";
this.modalData.actionVO.type="Conversation"; this.modalData.actionVO.type="Conversation";
this.modalData.actionVO.time=0; // this.modalData.actionVO.time=0;
this.modalData.actionVO.reply=""; this.modalData.actionVO.reply="";
this.modalData.param.startStation=""; this.modalData.param.startStation="";
this.isConversitionAdd=true; this.isConversitionAdd=true;
@ -277,7 +278,7 @@
this.modalData.actionVO.id=data.id; this.modalData.actionVO.id=data.id;
this.modalData.actionVO.memberId=data.memberId; this.modalData.actionVO.memberId=data.memberId;
this.modalData.actionVO.type=data.type; this.modalData.actionVO.type=data.type;
this.modalData.actionVO.time=data.time; // this.modalData.actionVO.time=data.time;
if(data.type=="Conversation") if(data.type=="Conversation")
{ {
this.modalData.actionVO.targetId=data.targetId; this.modalData.actionVO.targetId=data.targetId;

View File

@ -1,316 +0,0 @@
<template>
<div>
<el-form :model="behavior" ref="behavior" :rules="rules" label-width="80px" class="roleAction" label-position="right">
<el-form-item label="是否主动">
<el-switch v-model="behavior.auto"></el-switch>
</el-form-item>
<el-form-item label="目标角色" class="conditionVO" prop="targetMemberId">
<el-select v-model="behavior.targetMemberId" placeholder="请选择目标角色" class="inputStyle">
<el-option v-for="targetMember in targetMemberList" :key="targetMember.id" :label="targetMember.name" :value="targetMember.id" ></el-option>
</el-select>
</el-form-item>
<el-form-item label="描述" class="conditionVO" prop="description">
<el-input type="textarea" v-model="behavior.description" class="textareaStyle" rows="3"></el-input>
</el-form-item>
<el-form-item label="触发条件" class="conditionVO" prop="conditionVO.triggerType">
<el-select v-model="behavior.conditionVO.triggerType" placeholder="请选择触发条件" @change="triggerTypeChange" class="inputStyle">
<el-option v-for="trigCondition in trigConditionList" :key="trigCondition.value" :label="trigCondition.label" :value="trigCondition.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="内容" class="conditionVO" prop="conditionVO.content" v-if="isConversationShow">
<el-input v-model="behavior.conditionVO.content" class="inputStyle"></el-input>
</el-form-item>
<el-form-item label="关键字" class="conditionVO" prop="conditionVO.keyWord" v-if="isConversationShow">
<el-input v-model="behavior.conditionVO.keyWord" class="inputStyle"></el-input>
</el-form-item>
<el-form-item label="重点内容" class="conditionVO" v-if="isConversationShow">
<el-tag :key="index" v-for="(tag,index) in behavior.conditionVO.importantList" closable :disable-transitions="false" @close="handleClose(tag)">
{{tag}}
</el-tag>
<el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
></el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput">添加</el-button>
</el-form-item>
</el-form>
<div v-if="isDeviceShow">
<device-condition ref="deviceCondition" :group="group" :title="conditionTitle" :ConditionVOList="behavior.conditionVO.deviceConditionList" :isAdding="isAdding" @changeAdding="changeAdding"></device-condition>
</div>
<div style="margin-top:20px;margin-left:80px;">
<el-button type="primary" @click="addQuestBehavior">{{buttonName}}</el-button>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import DeviceTypeDic from '@/scripts/DeviceTypeDic';
import DeviceCondition from './deviceCondition';
import {getQuestRecord,postMemberBehavior} from '@/api/simulation';
export default {
name: 'addBehavior',
props: {
group: {
type: String,
required: true
},
memberId:{
type:String,
required: true
},
title:{
type: String,
required: true
},
operateType:{
type: String,
required: true
},
buttonName:{
type: String,
required: true
},
},
components:{
DeviceCondition
},
data() {
return {
inputVisible: false,
inputValue: '',
conditionTitle:"设备条件",
targetMemberList:[],
deviceConditionList:[],
trigConditionList:DeviceTypeDic.ConstSelect.triggerType,
isConversationShow:false,
isDeviceShow:false,
isAdding:false,
behavior:{
auto:false,
targetMemberId:null,
description:"",
conditionVO:{
importantList:[],
content:"",
keyWord:"",
triggerType:"None",
deviceConditionList:[],
},
id:null,
},
rules:{
targetMemberId:[
{ required: true, message: '请选择目标角色', trigger: 'change' }
],
description:[
{ required: true, message: '请输入描述', trigger: 'blur' }
],
conditionVO:{
content: [
{ required: true, message: '请输入内容', trigger: 'blur' }
],
keyWord:[
{ required: true, message: '请输入关键字', trigger: 'blur' }
]
}
}
}
},
mounted(){
this.loadInitData(this.$route.query);
},
methods:{
loadInitData(obj) {
let group=obj.group;
let memberId=this.$props.memberId;
getQuestRecord(group).then(response=>{
let datalist=response.data.memberVOList;
this.targetMemberList=datalist;
});
},
showInput() {
this.inputVisible = true;
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus();
});
},
handleClose(tag) {
this.behavior.conditionVO.importantList.splice(this.behavior.conditionVO.importantList.indexOf(tag), 1);
},
handleInputConfirm() {
let inputValue = this.inputValue;
if (inputValue) {
this.behavior.conditionVO.importantList.push(inputValue);
}
this.inputVisible = false;
this.inputValue = '';
},
addQuestBehavior(){
this.$refs["behavior"].validate((valid) => {
if (valid) {
let group=this.$props.group;
let memberId=this.$props.memberId;
switch(this.behavior.conditionVO.triggerType)
{
case 'DeviceCondition':
{
if(this.isAdding)
{
this.behavior.conditionVO.deviceConditionList.pop();
this.$refs.deviceCondition.resetDisabled();
}
if(this.behavior.conditionVO.deviceConditionList.length<=0)
{
this.$messageBox(`请添加设备条件`);
return;
}
break;
}
case 'None':
{
this.behavior.conditionVO={};
this.behavior.conditionVO.triggerType="None";
break;
}
}
if(memberId)
{
let behavior=this.behavior;
postMemberBehavior(group,memberId,behavior).then(response=>{
this.behavior={
auto:false,
description:"",
conditionVO:{
triggerType:"None",
importantList:[],
content:"",
keyWord:"",
deviceConditionList:[],
},
targetMemberId:null,
id:null
};
this.isConversationShow=false;
this.isDeviceShow=false;
if(this.$props.operateType==="add")
{
this.$message.success('添加行为成功');
}
else
{
this.$emit('modifyButtonName');
this.$message.success('修改行为成功');
}
this.$emit('create');
}).catch(error => {
if(this.$props.operateType==="add")
{
this.$messageBox(`添加行为失败: ${error.message}`);
}
else
{
this.$messageBox(`修改行为失败: ${error.message}`);
}
})
}
} else {
console.log('error submit!!');
return false;
}
});
},
doShow(data){
if(data)
{
this.behavior.auto=data.auto;
this.behavior.targetMemberId=data.targetMemberId;
this.behavior.description=data.description;
this.behavior.id=data.id;
this.behavior.conditionVO.triggerType=data.conditionVO.triggerType;
switch(data.conditionVO.triggerType)
{
case "None":{
this.isConversationShow=false;
this.isDeviceShow=false;
break;
}
case "Conversation":{
this.isConversationShow=true;
this.isDeviceShow=false;
this.behavior.conditionVO.importantList=data.conditionVO.importantList;
this.behavior.conditionVO.content=data.conditionVO.content;
this.behavior.conditionVO.keyWord=data.conditionVO.keyWord;
break;
}
case 'DeviceCondition':{
this.isConversationShow=false;
this.isDeviceShow=true;
var newData=JSON.parse(JSON.stringify(data.conditionVO.deviceConditionList).replace(/\"code\"/g,'"isAdded":true,"code"'));
this.behavior.conditionVO.deviceConditionList=newData;
this.resetDisabled();
break;
}
default:{
break;
}
}
}
},
resetDisabled(){
if(this.$refs['deviceCondition'])
{
this.$refs['deviceCondition'].resetDisabled();
}
},
triggerTypeChange(data){
switch(data){
case "Conversation":{
this.isConversationShow=true;
this.isDeviceShow=false;
break;
}
case "DeviceCondition":{
this.isConversationShow=false;
this.isDeviceShow=true;
break;
}
default: {
this.isConversationShow=false;
this.isDeviceShow=false;
break;
}
}
this.$refs['behavior'].clearValidate();
},
changeAdding(data)
{
this.isAdding=data;
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.inputStyle{
width:300px;
height:20px;
}
.textareaStyle{
width:300px;
}
.button-new-tag {
margin-left: 10px;
height: 32px;
line-height: 30px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.el-tag + .el-tag {
margin-left: 10px;
}
</style>

View File

@ -1,173 +0,0 @@
<template>
<div>
<el-form label-width="80px">
<el-form-item :label="title">
<el-button type="primary" size="small" @click="addDeviceCondition" :disabled="isdisabled">添加</el-button>
</el-form-item>
</el-form>
<el-table
:data="ConditionVOList" border style="margin-top:10px;margin-left:10px;width:901px">
<el-table-column :label="$t('scriptRecord.deviceType')" width="150">
<template slot-scope="scope">
<div v-if="scope.row.isAdded">{{scope.row.deviceType}}</div>
<el-select v-else v-model="scope.row.deviceType" placeholder="请选择" @change="changeDeviceType($event,scope.row)">
<el-option v-for="deviceType in deviceTypeList" :key="deviceType.value" :label="deviceType.label" :value="deviceType.value"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('scriptRecord.deviceCode')" width="150">
<template slot-scope="scope">
<div v-if="scope.row.isAdded">{{scope.row.code}}</div>
<el-select v-else v-model="scope.row.code" placeholder="请选择">
<el-option v-for="deviceCode in deviceCodeList" :key="deviceCode.code" :label="deviceCode.name" :value="deviceCode.code"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('scriptRecord.deviceCondition')" width="150">
<template slot-scope="scope">
<div v-if="scope.row.isAdded">{{scope.row.condition}}</div>
<el-select v-else v-model="scope.row.condition" placeholder="请选择">
<el-option v-for="deviceCondition in deviceCondList" :key="deviceCondition.condition" :label="deviceCondition.label" :value="deviceCondition.condition"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('scriptRecord.paramDeviceType')" width="150">
<template slot-scope="scope">
<div v-if="scope.row.isAdded">{{scope.row.paramDeviceType}}</div>
<el-select v-else v-model="scope.row.paramDeviceType" placeholder="请选择" @change="changeParamDeviceType">
<el-option v-for="deviceType in deviceTypeList" :key="deviceType.value" :label="deviceType.label" :value="deviceType.value"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('scriptRecord.paramDeviceCode')" width="150">
<template slot-scope="scope">
<div v-if="scope.row.isAdded">{{scope.row.paramCode}}</div>
<el-select v-else v-model="scope.row.paramCode" placeholder="请选择">
<el-option v-for="paramDeviceCode in paramDeviceCodeList" :key="paramDeviceCode.code" :label="paramDeviceCode.name" :value="paramDeviceCode.code"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('scriptRecord.operation')" width="150">
<template slot-scope="scope">
<el-row v-if="scope.row.isAdded">
<el-button type="primary" size="mini" @click="deleteOperate(scope.$index)">删除</el-button>
</el-row>
<el-row v-else>
<el-button type="primary" size="mini" @click="determineOperate(scope.row)">确定</el-button>
<el-button type="primary" size="mini" @click="cancleOperate">取消</el-button>
</el-row>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import DeviceTypeDic from '@/scripts/DeviceTypeDic';
import Vue from 'vue';
import {getDeviceCodeByDeviceType,getDeviceCoditionByDeviceType} from '@/api/simulation';
export default {
name: 'deviceCondition',
props: {
group: {
type: String,
required: true
},
ConditionVOList:{
type: Array,
required: true
},
isAdding:{
type: Boolean,
required: true
},
title:{
type: String,
required: true
}
},
mounted(){
this.isdisabled=false;
},
data(){
return{
deviceTypeList:DeviceTypeDic.ConstSelect.deviceType,
deviceCodeList:[],
deviceCondList:[],
paramDeviceCodeList:[],
isdisabled:false,
}
},
methods:{
changeDeviceType(index,row){
let params = {deviceType:index};
let group=this.$props.group;
row.code="";
row.condition="";
getDeviceCodeByDeviceType(group,params).then(response =>{
let resultData=response.data;
resultData=this.changeData(index,resultData);
this.deviceCodeList=resultData;
})
getDeviceCoditionByDeviceType(params).then(response =>{
this.deviceCondList=response.data;
});
},
changeParamDeviceType(index){
let params = {deviceType:index};
let group=this.$props.group;
getDeviceCodeByDeviceType(group,params).then(response =>{
let resultData=response.data;
resultData=this.changeData(index,resultData);
this.paramDeviceCodeList=resultData;
})
},
changeData(param,data){
return param=="Train"?JSON.parse(JSON.stringify(data).replace(/groupNumber/g,"name")):data;
},
deleteOperate(data){
this.$props.ConditionVOList.splice(data,1);
},
determineOperate(data){
if(data.deviceType=="")
{
this.$messageBox(`请选择设备类型`);
return;
}
if(data.code=="")
{
this.$messageBox(`请选择设备编号`);
return;
}
if(data.condition=="")
{
this.$messageBox(`请选择设备条件`);
return;
}
this.$props.ConditionVOList[this.$props.ConditionVOList.length-1].isAdded=true;
this.isdisabled=false;
this.$emit("changeAdding",false);
},
cancleOperate(){
this.isdisabled=false;
this.$props.ConditionVOList.pop();
this.$emit("changeAdding",false);
},
addDeviceCondition(){
this.isdisabled=true;
let deviceCondition={
deviceType:"",
code:"",
condition:"",
paramCode:"",
paramDeviceType:null,
isAdded:false,
};
this.$emit("changeAdding",true);
this.$props.ConditionVOList.push(deviceCondition);
},
resetDisabled(){
this.isdisabled=false;
}
}
}
</script>

View File

@ -5,6 +5,7 @@
</div> </div>
<div class="tab-pane-big"> <div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar"> <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="block actionListTable"> <div class="block actionListTable">
<el-timeline :reverse="reverse"> <el-timeline :reverse="reverse">
<el-timeline-item v-for="(actionInfo,index) in actionInfoList" :key="index"> <el-timeline-item v-for="(actionInfo,index) in actionInfoList" :key="index">
@ -23,7 +24,7 @@
</el-timeline-item> </el-timeline-item>
</el-timeline> </el-timeline>
</div> </div>
<add-action ref="addBehavior" :group="group" @create="create" :buttonName="buttonName" :operateType="operateType" @modifyButtonName="modifyButtonName"></add-action>
<!-- <el-table <!-- <el-table
v-loading="loading" v-loading="loading"
:data="actionList" border class="actionListTable"> :data="actionList" border class="actionListTable">
@ -161,8 +162,8 @@
this.reloadTable(); this.reloadTable();
}, },
modifyAction(row){ modifyAction(row){
var div = this.$refs['elActionScrollbar'].$refs['wrap']; // var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight; // div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
this.operateType="modify"; this.operateType="modify";
this.buttonName="修改动作" this.buttonName="修改动作"
this.$refs.addBehavior.doShow(row); this.$refs.addBehavior.doShow(row);
@ -176,11 +177,19 @@
</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";
.addScript{
float:left;
width:450px;
display: inline-block;
position: fixed;
}
.actionListTable{ .actionListTable{
margin-top: 40px; margin-top: 15px;
margin-left: 5px; margin-left: 5px;
font-size: 15px; font-size: 15px;
width:802px; width:452px;
display: inline-block;
margin-left:450px;
} }
.actionList{ .actionList{
margin-top: 10px; margin-top: 10px;
@ -195,8 +204,8 @@
height:380px; height:380px;
} }
.actionTable{ .actionTable{
width:570px; width:370px;
padding: 15px; padding: 15px 0px 10px 15px;
display: inline-block; display: inline-block;
line-height: 200%; line-height: 200%;
} }

View File

@ -1,147 +0,0 @@
<template>
<div>
<div class="behaviorList">
<i class="el-icon-back" @click="backToMember" style="cursor:pointer;"></i>
<span class="titleStyle">{{memberName}}角色<span class="titleStyle">/</span><span class="titleStyle">行为信息</span></span>
</div>
<div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar">
<add-behavior ref="addBehavior" :title="title" :group="group" :memberId="memberId" @create="handleCreate" :operateType="operateType" :buttonName="buttonName" @modifyButtonName="modifyButtonName"></add-behavior>
<div class="behaviorList">行为列表</div>
<el-table
v-loading="loading"
:data="behaviorList" border class="behaviorListTable">
<el-table-column label="是否主动触发" width="150">
<template slot-scope="scope">
<div>{{scope.row.auto?"是":"否"}}</div>
</template>
</el-table-column>
<el-table-column label="目标角色" width="200">
<template slot-scope="scope">
<div>{{scope.row.targetMemberId}}</div>
</template>
</el-table-column>
<el-table-column label="描述" width="200">
<template slot-scope="scope">
<div>{{scope.row.description}}</div>
</template>
</el-table-column>
<el-table-column label="触发条件" width="150">
<template slot-scope="scope">
<div>{{scope.row.conditionVO.triggerType==null?"无":scope.row.conditionVO.triggerType}}</div>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-row>
<el-button type="primary" size="mini" @click="modifyActions(scope.row)">修改</el-button>
<el-button type="primary" size="mini" @click="deleteBehavior(scope.row)">删除</el-button>
</el-row>
<el-row style="margin-top:10px"><el-button type="primary" size="mini" @click="getActions(scope.row)">动作操作</el-button></el-row>
</template>
</el-table-column>
</el-table>
</el-scrollbar>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import {getQuestRecord,deleteMemberBehavior} from '@/api/simulation';
import AddBehavior from './addBehavior';
export default {
name: 'behaviorList',
props: {
group: {
type: String,
required: true
},
memberId:{
type: String,
required: true
}
},
components:{
AddBehavior
},
data() {
return {
behaviorList:[],
memberName:"",
loading:true,
title:"",
operateType:"add",
buttonName:"添加行为",
}
},
mounted(){
this.memberName=this.$store.state.scriptRecord.memberName;
this.loadInitData(this.$route.query);
},
methods:{
loadInitData(obj) {
let group=obj.group;
let memberId=this.$props.memberId;
getQuestRecord(group).then(response=>{
let datalist=response.data.memberVOList;
this.behaviorList=datalist.find(elem=>{return elem.id==memberId}).behaviorVOList;
this.loading=false;
});
},
deleteBehavior(row){
let group=this.$props.group;
let memberId=this.$props.memberId;
deleteMemberBehavior(group,memberId,row.id).then(resp => {
this.reloadTable();
this.$message.success('删除任务角色行为成功');
}).catch(error => {
this.$messageBox(`删除任务角色行为失败: ${error.message}`);
});
},
reloadTable(){
this.loadInitData(this.$route.query);
},
backToMember(){
this.$emit('backToMember');
},
modifyButtonName(){
this.buttonName="添加行为",
this.operateType="add"
},
modifyActions(row){
var div = this.$refs['elScrollbar'].$refs['wrap'];
div.scrollTop=0;
this.operateType="modify";
this.buttonName="修改行为"
this.$refs.addBehavior.doShow(row);
},
getActions(row){
this.$emit('getActions',row);
},
handleCreate(){
this.reloadTable();
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.behaviorListTable{
margin-top: 20px;
margin-left: 5px;
font-size: 15px;
width:901px;
}
.behaviorList{
margin-top: 10px;
margin-left: 5px;
font-size: 15px;
margin-bottom:20px;
}
.titleStyle{
margin-left:10px;
}
.tab-pane-big{
height:370px;
}
</style>

View File

@ -1,82 +0,0 @@
<template>
<el-tabs v-model="activeName" type="card">
<el-tab-pane :label="$t('scriptRecord.roleManage')" name="first">
<div class="tab-pane">
<el-scrollbar wrapClass="scrollbar-wrapper">
<role-section ref="roleSection" :group="group" @getBehaviorList="getBehaviorList"></role-section>
</el-scrollbar>
</div>
</el-tab-pane>
<el-tab-pane :label="$t('scriptRecord.targetCondition')" name="second">
<div class="tab-pane">
<el-scrollbar wrapClass="scrollbar-wrapper">
<target-condition ref="targetCondition" :group="group"></target-condition>
</el-scrollbar>
</div>
</el-tab-pane>
<el-tab-pane :label="$t('scriptRecord.taskScript')" name="third">
<div class="tab-pane">
<el-scrollbar wrapClass="scrollbar-wrapper">
<task-script ref="taskScript" :group="group"></task-script>
</el-scrollbar>
</div>
</el-tab-pane>
</el-tabs>
</template>
<script>
import Vue from 'vue';
import RoleSection from './roleSection';
import TargetCondition from './targetCondition';
import TaskScript from './taskScript';
import {getQuestRecord} from '@/api/simulation';
export default {
name: 'roleConditionScript',
props: {
group: {
type: String,
required: true
},
},
components: {
TargetCondition,
TaskScript,
RoleSection,
},
data() {
return {
activeName:"first",
}
},
created(){
this.loadInitData(this.$route.query);
},
methods: {
loadInitData(obj) {
let group=obj.group;
getQuestRecord(group).then(response =>{
let deviceConditionList=response.data.questTargetVO.deviceConditionVOList;
this.$store.dispatch('scriptRecord/updateDeviceCondition', deviceConditionList);
this.$store.dispatch('scriptRecord/updateMemberList', response.data.memberVOList);
this.$store.dispatch('scriptRecord/updateScript', response.data.script);
if(response.data.mapLocation)
{
let mapLocation={"offsetX":response.data.mapLocation.x,"offsetY":response.data.mapLocation.y,"scaleRate":response.data.mapLocation.scale};
this.$store.dispatch('scriptRecord/updateMapLocation', mapLocation);
}
});
},
getBehaviorList(row){
this.$emit('getBehaviorList',row.id);
this.$store.dispatch('scriptRecord/updateMemberName',row.name);
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.tab-pane{
height:360px;
}
</style>

View File

@ -1,160 +0,0 @@
<template>
<div>
<el-form :model="memberVO" ref="memberVO" :rules="rules" label-width="100px" class="roleAction" label-position="right">
<el-form-item :label="$t('scriptRecord.roleName')" class="conditionVO" prop="name">
<el-input v-model="memberVO.name" class="inputStyle"></el-input>
</el-form-item>
<el-form-item :label="$t('scriptRecord.roleType')" class="conditionVO" prop="role">
<el-select v-model="memberVO.role" placeholder="请选择角色类型" @change="changeRoleType">
<el-option v-for="rolerType in roleTypeList" :key="rolerType.label" :label="rolerType.label" :value="rolerType.value"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('scriptRecord.deviceCode')" class="conditionVO">
<el-select v-model="memberVO.deviceCode" clearable placeholder="请选择设备编码">
<el-option v-for="deviceCode in deviceCodeList" :key="deviceCode.code" :label="deviceCode.name" :value="deviceCode.code"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addQuestMember('memberVO')">{{$t('scriptRecord.roleAdd')}}</el-button>
</el-form-item>
</el-form>
<div class="roleList">{{$t('scriptRecord.roleList')}}</div>
<el-table
v-loading="loading"
:data="memberList" border class="memberList">
<el-table-column prop="name" :label="$t('scriptRecord.roleName')" width="350">
</el-table-column>
<el-table-column :label="$t('scriptRecord.operation')" width="350">
<template slot-scope="scope">
<el-row>
<el-button type="primary" size="mini" @click="getMembers(scope.row)">{{$t('scriptRecord.behaviorOperate')}}</el-button>
<el-button type="primary" size="mini" @click="deleteMember(scope.$index,scope.row)">{{$t('scriptRecord.delete')}}</el-button>
</el-row>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import Vue from 'vue';
import ConstConfig from '@/scripts/ConstConfig';
import {getQuestRecord,getDevicesByRole,postQuestMember,deleteQuestMember} from '@/api/simulation';
export default {
name: 'roleSection',
props: {
group: {
type: String,
required: true
}
},
data() {
return {
deviceCodeList:[],
memberList:[],
loading:true,
memberVO:
{
role:"Admin",
deviceCode:'',
},
roleTypeList:ConstConfig.ConstSelect.roleType,
title:"添加角色",
rules:{
name:[
{ required: true, message: '请输入角色名称', trigger: 'blur' }
],
}
}
},
watch: {
'$store.state.scriptRecord.memberList': function (val, old){
this.memberList=val;
this.loading=false;
}
},
methods:{
getDeviceInfo(){
let params = { role:this.memberVO.role};
let group=this.$props.group;
getDevicesByRole(group,params).then(response => {
this.deviceCodeList=response.data;
});
},
addQuestMember(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let data=this.memberVO;
let group=this.group;
postQuestMember(group,data).then(resp => {
this.reloadTable();
this.memberVO.role="Admin";
this.memberVO.deviceCode="";
this.memberVO.name="";
this.deviceCodeList=[];
this.$message.success('添加任务角色成功');
}).catch(error => {
this.$messageBox(`添加任务角色失败: ${error.message}`);
})
} else {
console.log('error submit!!');
return false;
}
});
},
changeRoleType(index){
this.deviceCodeList=[];
let params = { role:index};
let group=this.group;
getDevicesByRole(group,params).then(response => {
this.memberVO.deviceCode="";
let resultData=response.data;
if(index=="Driver")
{resultData=JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g,"name"));}
this.deviceCodeList=resultData;
});
},
reloadTable(){
let group=this.group;
getQuestRecord(group).then(response=>{
this.memberList=response.data.memberVOList;
this.$store.dispatch('scriptRecord/updateScript', response.data.script);
this.$store.dispatch('scriptRecord/updateMemberList', response.data.memberVOList);
});
},
deleteMember(index,row){
let group=this.group;
deleteQuestMember(group,row.id).then(resp => {
this.reloadTable();
this.$message.success('删除任务角色成功');
}).catch(error => {
this.$messageBox(`删除任务角色失败: ${error.message}`);
});
},
getMembers(row){
this.$emit('getBehaviorList',row);
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.roleAction{
margin-top:10px;
margin-left:10px;
}
.roleList{
margin-top: 20px;
margin-left: 5px;
font-size: 15px;
}
.memberList{
// width:94%;
width:701px;
margin-top:20px;
margin-left:5px;
}
.inputStyle{
width:200px;
height:30px;
}
</style>

View File

@ -1,97 +0,0 @@
<template>
<el-form label-width="80px" label-position="right" style="margin-top:15px">
<device-condition ref="deviceCondition" :group="group" :title="conditionTitle" :ConditionVOList="deviceConditionList" :isAdding="isAdding" @changeAdding="changeAdding"></device-condition>
<el-form-item class="ConditionButton">
<el-button type="primary" @click="addQuestAction()">提交</el-button>
</el-form-item>
</el-form>
</template>
<script>
import DeviceTypeDic from '@/scripts/DeviceTypeDic';
import DeviceCondition from './deviceCondition';
import {postTargetConditionAction} from '@/api/simulation';
export default {
name: 'targetCondition',
props: {
group: {
type: String,
required: true
},
},
watch:{
// '$store.state.menuOperation.selected': function (val) {
// if(this.fieldS!=""&&val!=null)
// {
// debugger;
// }
// }
'$store.state.scriptRecord.deviceConditionList': function (val, old){
if(val!=undefined)
{
var newData=JSON.parse(JSON.stringify(val).replace(/\"code\"/g,'"isAdded":true,"code"'));
this.deviceConditionList=newData;
}
else
{
this.deviceConditionList=[];
}
}
},
data(){
return{
deviceConditionList:[],
conditionTitle:this.$t("scriptRecord.conditionTitle"),
isAdding:false,
// fieldS:"",
}
},
components:{
DeviceCondition
},
methods:{
addQuestAction(){
if(this.isAdding)
{
this.deviceConditionList.pop();
this.$refs.deviceCondition.resetDisabled();
}
if(this.deviceConditionList.length<=0)
{
this.$messageBox(`请添加设备条件`);
return;
}
let group=this.$props.group;
let data={deviceConditionVOList:this.deviceConditionList};
let that=this;
postTargetConditionAction (group,data).then(responese => {
this.$message.success('保存目标条件成功');
this.$store.dispatch('scriptRecord/updateDeviceCondition', that.deviceConditionList);
// this.$emit('create');
}).catch((err) => {
this.$messageBox(`保存目标条件失败: ${error.message}`);
});
},
changeAdding(data)
{
this.isAdding=data;
},
// hover(field) {
// if (field == 'relStandCode') {
// this.fieldS = field === this.fieldS ? '' : field;
// // this.$emit('fieldSelect', this.fieldS);
// } else {
// this.field = field === this.field ? '' : field;
// }
// },
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.ConditionButton{
margin-top:20px;
margin-left:0px;
}
</style>

View File

@ -1,197 +0,0 @@
<template>
<el-form :model="taskScript" ref="taskScript" :rules="rules" label-width="80px" label-position="right">
<el-form-item label="角色行为" class="conditionVO" prop="behavior">
<el-select v-model="taskScript.memberId" placeholder="请选择剧本角色" @change="changeMember">
<el-option v-for="taskScriptMember in taskScriptList" :key="taskScriptMember.id" :label="taskScriptMember.name" :value="taskScriptMember.id"></el-option>
</el-select>
<el-select v-model="taskScript.behavior" placeholder="请选择角色行为" @change="changeBehavior">
<el-option v-for="behavior in behaviorList" :key="behavior.id" :label="behavior.description" :value="behavior.id"></el-option>
</el-select>
<el-button type="primary" size="small" @click="addTaskScript">添加</el-button>
</el-form-item>
<el-table
:data="data.scriptBehaviorList" border class="scriptBehaviorList">
<el-table-column label="剧本角色" width="200" prop="memberName">
</el-table-column>
<el-table-column label="角色行为" width="200" prop="behaviorName">
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-row>
<el-button type="primary" size="mini" @click="deleteOperate(scope.$index)">删除</el-button>
</el-row>
</template>
</el-table-column>
</el-table>
<el-form-item>
<el-button type="primary" @click="addTaskScriptList" style="margin-top:30px;">提交</el-button>
</el-form-item>
</el-form>
</template>
<script>
import Vue from 'vue';
import Sortable from 'sortablejs';
import {saveTaskScript,getQuestRecord} from '@/api/simulation';
export default {
name: 'taskScript',
props: {
group: {
type: String,
required: true
}
},
mounted(){
this.rowDrop();
},
data() {
return {
taskScript:{
index:"",
memberId:"",
behavior:"",
},
taskScriptMembername:"",
behaviorName:"",
taskScriptList:[],
behaviorList:[],
data:{
scriptBehaviorList:[],
},
rules:{
behavior:[
{ required: true, message: '请选择角色行为', trigger: 'change' }
],
}
}
},
watch: {
'$store.state.scriptRecord.memberList': function (val, old){
this.taskScript.memberId="";
this.taskScript.behavior="";
this.taskScriptList=val;
},
'$store.state.scriptRecord.script': function (val, old){
let script=val;
let memeberList=this.taskScriptList;
this.setScriptList(memeberList,script);
}
},
methods:{
setScriptList(memeberList,script){
if(script.behaviorIdList!=undefined)
{
let behaviorIdList=script.behaviorIdList;
let scriptBehaviorList=[];
for(var i=0;i<behaviorIdList.length;i++)
{
let behaviorId=behaviorIdList[i];
let scriptBehavior={};
for(var j=0;j<memeberList.length;j++)
{
let behaviorVOList=memeberList[j].behaviorVOList;
for(var k=0;k<behaviorVOList.length;k++)
{
if(behaviorVOList[k].id==behaviorId)
{
scriptBehavior.memberId=memeberList[j].id;
scriptBehavior.memberName=memeberList[j].name;
scriptBehavior.behavior=behaviorId;
scriptBehavior.behaviorName=behaviorVOList[k].description;
scriptBehaviorList.push(scriptBehavior);
}
}
}
}
this.data.scriptBehaviorList=scriptBehaviorList;
}
},
rowDrop(){
const that = this;
const tbody = document.querySelector('.scriptBehaviorList .el-table__body-wrapper tbody');
if (tbody) {
Sortable.create(tbody, {
onEnd({newIndex, oldIndex}) {
that.data.scriptBehaviorList.splice(newIndex, 0, that.data.scriptBehaviorList.splice(oldIndex, 1)[0]);
var newArray = that.data.scriptBehaviorList.slice(0);
that.data.scriptBehaviorList = [];
that.$nextTick(function () {
that.data.scriptBehaviorList = newArray;
});
}
})
}
},
changeMember(index)
{
this.taskScript.behavior="";
let taskScriptList=this.taskScriptList;
for(let i=0;i<taskScriptList.length;i++)
{
if(taskScriptList[i].id==index)
{
this.taskScriptMembername=taskScriptList[i].name;
this.behaviorList=taskScriptList[i].behaviorVOList;
return;
}
}
},
changeBehavior(index){
let obj = this.behaviorList.find((item)=>{
return item.id === index;
});
this.behaviorName=obj.description;
},
addTaskScript(){
this.$refs['taskScript'].validate((valid) => {
if (valid) {
let scriptBehavior={
memberId:this.taskScript.memberId,
behavior:this.taskScript.behavior,
memberName:this.taskScriptMembername,
behaviorName:this.behaviorName,
};
this.data.scriptBehaviorList.push(scriptBehavior);
this.behaviorList=[];
this.taskScript.behavior="";
this.taskScript.memberId="";
}
else {
console.log('error submit!!');
return false;
}
});
},
deleteOperate(data){
this.data.scriptBehaviorList.splice(data,1);
},
addTaskScriptList(){
if(this.data.scriptBehaviorList.length<=0)
{
this.$messageBox(`请添加角色行为`);
return;
}
let behaviorIdList=[];
for(let i=0;i<this.data.scriptBehaviorList.length;i++)
{
behaviorIdList.push(this.data.scriptBehaviorList[i].behavior);
}
let group=this.$props.group;
let that=this;
saveTaskScript(group,behaviorIdList).then(response=>{
this.$message.success('保存任务剧本成功');
this.$store.dispatch('scriptRecord/updateScript', {"behaviorIdList":behaviorIdList});
}).catch(error => {
this.$messageBox(`保存任务剧本失败: ${error.message}`);
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.scriptBehaviorList{
margin-top:30px;
margin-left:10px;
width:601px
}
</style>

View File

@ -1,127 +1,157 @@
<template> <template>
<div class="reminder-drag"> <div class="reminder-drag">
<div ref="drapBox" class="reminder-box"> <div class="reminder-box" ref="drapBox">
<div class="tip-title"> <div class="tip-title">
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" /> <i class="icon el-icon-minus" @click="shrink" v-show="isShrink"></i>
<i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" /> <i class="icon el-icon-plus" @click="shrink" v-show="!isShrink"></i>
<p v-if="isShrink" style="color: #fff;"> <p style="color: #fff;" v-if="isShrink">
<span>{{ title }}</span> <span>{{ title }}</span>
</p> </p>
</div> </div>
<div ref="dragBody" class="tip-body-box"> <div class="tip-body-box" ref="dragBody">
<div class="tip-body"> <div class="tip-body">
<div> <div>
<get-action ref="getAction" :group="group" /> <get-action ref="getAction" :group="group"></get-action>
</div> </div>
<el-button-group class="button-group"> <el-button-group class="button-group">
<el-button type="danger" @click="dumpScenesData">重置剧本</el-button> <el-button type="danger" @click="dumpScenesData">重置剧本</el-button>
<el-button type="primary" @click="saveMaplocation">{{ $t('scriptRecord.saveMaplocation') }}</el-button> <el-button type="primary" @click="saveMaplocation">{{$t('scriptRecord.saveMaplocation')}}</el-button>
<el-button type="primary" @click="saveScenesStage">{{ $t('scriptRecord.saveBackground') }}</el-button> <el-button type="primary" @click="saveScenesStage">{{$t('scriptRecord.saveBackground')}}</el-button>
<el-button type="success" @click="saveScenesData">{{ $t('scriptRecord.saveData') }}</el-button> <el-button type="success" @click="saveScenesData" :loading="isSavingScript" >{{$t('scriptRecord.saveData')}}</el-button>
</el-button-group> <!-- 暂停 -->
</el-button-group>
</div>
</div>
</div> </div>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import GetAction from './scriptRecord/getAction'; import GetAction from './scriptRecord/getAction';
import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation} from '@/api/simulation'; import { launchFullscreen, exitFullscreen } from '@/utils/screen';
import {saveScriptScenes, saveScriptData, dumpScriptData,updateMapLocation} from '@/api/simulation';
export default { export default {
name: 'TipScriptRecord', name: 'TipScriptRecord',
components: { props: {
GetAction group: {
}, type: String,
props: { required: true
group: { },
type: String, },
required: true components: {
} GetAction,
}, },
// this.$t('scriptRecord.scriptTitle') // this.$t('scriptRecord.scriptTitle')
data() { data() {
return { return {
title: '剧本编制', title:"剧本编制",
isShrink: false, isShrink: false,
mapLocation: {} mapLocation:{},
// isSaveStage: true, autoSaveScript: null,
}; isSavingScript:false,
}, // isSaveStage: true,
watch: { }
'$store.state.map.mapViewLoadedCount': function (val) { },
Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation); watch: {
} '$store.state.map.mapViewLoadedCount': function (val) {
}, Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation);
created() { }
}, },
mounted() { created() {
this.shrink(); },
}, mounted(){
methods: { this.initAutoSaveScript();
jump(obj) { this.shrink();
}, },
shrink() { beforeDestroy() {
const height = this.$refs.dragBody.offsetHeight + 40; this.clearAutoSave();
const top = this.$refs.drapBox.style.top; },
if (this.isShrink) { methods: {
this.$refs.drapBox.style.height = '40px'; jump(obj) {
this.$refs.drapBox.style.top = ''; },
this.isShrink = false; shrink() {
} else { let height = this.$refs.dragBody.offsetHeight + 40;
this.$refs.drapBox.style.height = height + 'px'; let top = this.$refs.drapBox.style.top;
this.$refs.drapBox.style.top = top; if (this.isShrink) {
this.isShrink = true; this.$refs.drapBox.style.height = '40px';
} this.$refs.drapBox.style.top = '';
}, this.isShrink = false;
// getActions(row){ } else {
// this.displayType="action"; this.$refs.drapBox.style.height = height + 'px';
// this.behaviorId=row.id; this.$refs.drapBox.style.top = top;
// this.$store.dispatch('scriptRecord/updateBehaviorName',row.description); this.isShrink = true;
// }, }
saveScenesStage() { },
saveScriptScenes(this.group).then(resp => { initAutoSaveScript() {
// this.isSaveStage = false; const timeout = 1000 * 20;
this.$message.success('保存背景成功'); this.clearAutoSave(this.autoSaveScript);
}).catch(() => { this.autoSaveScript = setInterval(this.saveScenesData,timeout);
this.$messageBox('保存背景失败!'); },
}); clearAutoSave() {
}, if (this.autoSaveScript) {
saveScenesData() { clearInterval(this.autoSaveScript);
saveScriptData(this.group).then(resp => { this.autoSaveScript = null;
this.$message.success('保存数据成功'); }
}).catch(error => { },
this.$messageBox(`保存数据失败!: ${error.message}`); // getActions(row){
}); // this.displayType="action";
}, // this.behaviorId=row.id;
dumpScenesData() { // this.$store.dispatch('scriptRecord/updateBehaviorName',row.description);
const group=this.group; // },
this.$confirm('此操作将会清除已保存的编制数据, 是否继续?', '提示', { saveScenesStage() {
confirmButtonText: '确定',
cancelButtonText: '取消', saveScriptScenes(this.group).then(resp => {
type: 'warning' // this.isSaveStage = false;
}).then(() => { this.$message.success('保存背景成功');
dumpScriptData(group).then(resp => { }).catch(error => {
// this.isSaveStage = true; this.$messageBox('保存背景失败!');
this.$message.success('清除数据成功'); })
}).catch(() => { },
this.$messageBox('清除数据失败!'); saveScenesData() {
}); this.isSavingScript=true;
}).catch(() => { }); saveScriptData(this.group).then(resp => {
}, this.$message.success('保存数据成功');
saveMaplocation() { this.isSavingScript=false;
const data=Vue.prototype.$jlmap.$options; this.initAutoSaveScript();
const group=this.$route.query.group; }).catch(error => {
const dataZoom={scale: data.scaleRate, x: data.offsetX, y: data.offsetY}; this.$messageBox(`保存数据失败!: ${error.message}`);
updateMapLocation(group, dataZoom).then(response=>{ this.isSavingScript=false;
this.$message.success('更新定位成功'); if (error.code === 40004 || error.code === 40005 || error.code === 40003) {
}).catch(error => { this.clearAutoSave();
this.$messageBox(`更新定位失败: ${error.message}`); } else {
}); this.initAutoSaveScript();
} }
} })
}; },
dumpScenesData() {
let group=this.group;
this.$confirm('此操作将会清除已保存的编制数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dumpScriptData(group).then(resp => {
// this.isSaveStage = true;
this.$message.success('清除数据成功');
}).catch(error => {
this.$messageBox('清除数据失败!');
})
}).catch(error => { })
},
saveMaplocation()
{
let data=Vue.prototype.$jlmap.$options;
let group=this.$route.query.group;
let dataZoom={scale:data.scaleRate,x:data.offsetX,y:data.offsetY};
updateMapLocation(group,dataZoom).then(response=>{
this.$message.success('更新定位成功');
}).catch(error => {
this.$messageBox(`更新定位失败: ${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";
@ -210,4 +240,4 @@ export default {
} }
} }
} }
</style> </style>

View File

@ -1,15 +1,16 @@
<template> <template>
<el-card v-loading="loading" class="map-list-main"> <el-card v-loading="loading" class="map-list-main">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>地图列表</span> <span class="mapListTitle">地图列表</span>
<el-button type="primary" size="small" @click="addScript" class="addScript">添加剧本</el-button>
</div> </div>
<el-select v-model="mapSelect" size="medium" class="mapSelect" @change="mapSelectChange"> <el-select v-model="mapSelect" size="medium" class="mapSelect" @change="mapSelectChange">
<el-option v-for="item in mapList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in mapList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
<div class="addScript" @click="addScript"> <!-- <div class="addScript" @click="addScript">
<i class="el-icon-plus" style="color:#409eff;font-size:16px;"></i> <i class="el-icon-plus" style="color:#409eff;font-size:16px;"></i>
<span class="addScriptText">添加剧本</span> <span class="addScriptText">添加剧本</span>
</div> </div> -->
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px', width:'100%',margin:'5px 0 0 0' }"> <el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px', width:'100%',margin:'5px 0 0 0' }">
<el-tree <el-tree
ref="tree" ref="tree"
@ -33,6 +34,7 @@
</template> </template>
<script> <script>
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import localStore from 'storejs';
import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest'; import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest';
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth'; import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth';
@ -71,20 +73,18 @@ export default {
listPublishMap().then(response => { listPublishMap().then(response => {
this.mapList = response.data; this.mapList = response.data;
this.loading = false; this.loading = false;
this.mapSelect=this.mapList[0].id; this.mapSelect=localStore.get("script_mapId") || this.mapList[0].id;
this.getQuestPageList(this.mapSelect); this.getQuestPageList(this.mapSelect);
}) })
}, },
mapSelectChange(id){ mapSelectChange(id){
this.loading = true; this.loading = true;
// debugger;
// this.$store
localStore.set("script_mapId", id);
this.getQuestPageList(id); this.getQuestPageList(id);
}, },
async getQuestPageList(id){ async getQuestPageList(id){
// getQuestPageList(id).then(response => {
// this.loading = false;
// this.treeList=response.data;
// }).catch((err) => {
// });
let response=await getQuestPageList(id); let response=await getQuestPageList(id);
this.loading = false; this.loading = false;
this.treeList=response.data; this.treeList=response.data;
@ -125,16 +125,17 @@ export default {
} }
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.mapListTitle{
display: inline-block;
text-align: center;
padding: 8px 0px;
}
.mapSelect { .mapSelect {
width:100%; width:100%;
} }
.addScript{ .addScript{
border: 1px #ccc solid; float: right;
padding: 10px 10px; display: inline-block;
font-size: 14px;
border-radius: 3px;
cursor: pointer;
margin-top: 5px;
} }
.addScriptText{ .addScriptText{
color:#409eff; color:#409eff;