剧本列表页面 样式调整

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({ return request({
url: `/api/simulation/deviceCommand/available`, url: `/api/simulation/deviceCommand/available`,
method: 'get' method: 'get',
params
}); });
} }

View File

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

View File

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

View File

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

View File

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

View File

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