剧本列表页面 样式调整

This commit is contained in:
joylink_cuiweidong 2019-08-20 17:54:40 +08:00
parent 0afda8953a
commit 7f2c741818
6 changed files with 45 additions and 13 deletions

View File

@ -420,10 +420,11 @@ export function getSimulationInfo(group) {
}
/** 获取可用的设备指令*/
export function getAvailableDeviceCommand() {
export function getAvailableDeviceCommand(params) {
return request({
url: `/api/simulation/deviceCommand/available`,
method: 'get'
method: 'get',
params
});
}

View File

@ -6,6 +6,8 @@ const scriptRecord = {
state: {
mapLocation: {}, //地图定位,
simulationPause: true ,
scriptId:"",
},
getters: {
mapLocation: (state)=>{
@ -14,6 +16,9 @@ const scriptRecord = {
simulationPause:(state)=>{
return state.simulationPause;
},
scriptId: (state)=>{
return state.scriptId;
},
},
mutations: {
setMapLocation: (state, mapLocation) => {
@ -22,6 +27,9 @@ const scriptRecord = {
setSimulationPause: (state, simulationPause) => {
state.simulationPause = simulationPause;
},
setscriptId: (state, scriptId) => {
state.scriptId = scriptId;
},
},
actions: {
/**
@ -33,6 +41,9 @@ const scriptRecord = {
updateSimulationPause: ({ commit }, simulationPause) => {
commit('setSimulationPause', simulationPause);
},
updateScriptId: ({ commit }, scriptId) => {
commit('setscriptId', scriptId);
},
}
};
export default scriptRecord;

View File

@ -82,6 +82,7 @@ export default {
// debugger;
// this.$store
localStore.set("script_mapId", id);
this.$store.dispatch('scriptRecord/updateScriptId',id);
this.getQuestPageList(id);
},
async getQuestPageList(id){

View File

@ -18,6 +18,7 @@
</template>
<script>
// import localStore from 'storejs';
import { UrlConfig } from '@/router/index';
import {listPublishMap} from '@/api/jmap/map';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
@ -77,6 +78,11 @@
// return ''
// }
},
watch:{
'$store.state.scriptRecord.scriptId': function (val) {
this.formModel.mapId=val;
}
},
mounted() {
this.loadInitData();
},
@ -88,6 +94,7 @@
this.mapList = [];
listPublishMap().then(response => {
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name } });
this.formModel.mapId=this.$store.state.scriptRecord.scriptId|| this.mapList[0].value;
})
},
doCreate() {

View File

@ -30,12 +30,12 @@
<div class="addCommand">添加指令</div>
<el-form :model="commandData" ref="commandData" :rules="commandRules" label-width="100px" class="actionInfo" label-position="right">
<el-form-item label="执行者" class="conditionVO" prop="action.memberId">
<el-select v-model="commandData.action.memberId" placeholder="请选择执行者" :disabled="isPause">
<el-select v-model="commandData.action.memberId" placeholder="请选择执行者" :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-select>
</el-form-item>
<el-form-item label="设备指令" class="conditionVO" prop="action.deviceCommand">
<el-select v-model="commandData.action.deviceCommand " placeholder="请选择设备指令" @change="changeCommand" class="inputStyle" :disabled="isPause">
<el-form-item label="执行指令" class="conditionVO" prop="action.deviceCommand">
<el-select v-model="commandData.action.deviceCommand " placeholder="请选择执行指令" @change="changeCommand" class="inputStyle" :disabled="isPause">
<el-option v-for="deviceCommand in deviceCommandList" :key="deviceCommand.deviceCommand" :label="deviceCommand.label" :value="deviceCommand.deviceCommand"></el-option>
</el-select>
</el-form-item>
@ -132,6 +132,7 @@
stationList:[],
memberList:[],
deviceCommandList:[],
orginMemberList:[],
rules:{
actionVO:{
memberId:[
@ -151,7 +152,7 @@
{ required: true, message: '请选择主体角色', trigger: 'change' }
],
deviceCommand:[
{ required: true, message: '请选择设备指令', trigger: 'change' }
{ required: true, message: '请选择执行指令', trigger: 'change' }
]
},
param:{
@ -172,6 +173,7 @@
initData(){
getScriptMemberData(this.group).then(resp => {
let roleTypeList=ConstConfig.ConstSelect.roleType;
this.orginMemberList=resp.data;
let lastData=JSON.stringify(resp.data);
roleTypeList.forEach(function(element){
let rolename=element.value;
@ -179,12 +181,21 @@
});
lastData=JSON.parse(lastData);
this.memberList=lastData;
getAvailableDeviceCommand().then(response=>{
this.deviceCommandList=response.data;
this.getDeviceCode();
});
this.getDeviceCode();
}).catch(error => {})
},
changeRole(index){
let role=this.orginMemberList.find(elem=>{return elem.id==index}).role;
let data={role:role};
getAvailableDeviceCommand(data).then(response=>{
this.deviceCommandList=response.data;
if(response.data.length<=0)
{
this.commandData.action.deviceCommand="";
this.isJinLu=false;
}
});
},
getDeviceCode(){
let params = {deviceType:"StationStand"};
let group=this.group;
@ -246,7 +257,7 @@
modifyScriptAction(group,actionId,data).then(response=>{
this.modifying=false;
this.isNotModify=true;
this.$parent.$parent.setDisabled(this.isNotModify);
this.$parent.$parent.$parent.setDisabled(this.isNotModify);
this.$emit('modifyButtonName');
this.$message.success('修改动作成功');
this.$emit('create');
@ -314,7 +325,7 @@
{
this.clearValidate();
this.isNotModify=false;
this.$parent.$parent.setDisabled(this.isNotModify);
this.$parent.$parent.$parent.setDisabled(this.isNotModify);
this.initData();
this.modalData.actionVO.id=data.id;
this.modalData.actionVO.memberId=data.memberId;

View File

@ -65,7 +65,8 @@
methods:{
loadInitData() {
let group=this.$route.query.group;
getAvailableDeviceCommand().then(response=>{
let data={role:"Driver"};
getAvailableDeviceCommand(data).then(response=>{
this.deviceCommandList=response.data;
this.loadOtherData(this.$route.query);
});