This commit is contained in:
ival 2019-08-16 14:40:52 +08:00
commit 37390ff549
5 changed files with 62 additions and 24 deletions

View File

@ -19,7 +19,7 @@
<el-option v-for="member in memberList" :key="member.id" :label="member.name" :value="member.id"></el-option> <el-option v-for="member in memberList" :key="member.id" :label="member.name" :value="member.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="回复消息" class="conditionVO" prop="actionVO.reply" v-if="isConversitionAdd"> <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"></el-input> <el-input v-model="modalData.actionVO.reply" type="textarea" class="textareaStyle" rows="3"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备指令" class="conditionVO" prop="actionVO.type" v-if="isCommandAdd"> <el-form-item label="设备指令" class="conditionVO" prop="actionVO.type" v-if="isCommandAdd">
@ -97,7 +97,7 @@
{ required: true, message: '请选择主体角色', trigger: 'change' } { required: true, message: '请选择主体角色', trigger: 'change' }
], ],
reply:[ reply:[
{ required: true, message: '请输入回复消息', trigger: 'blur' } { required: true, message: '请输入内容', trigger: 'blur' }
], ],
targetId:[ targetId:[
{ required: true, message: '请选择目标角色', trigger: 'change' } { required: true, message: '请选择目标角色', trigger: 'change' }
@ -155,6 +155,7 @@
this.initActionData(); this.initActionData();
this.$message.success('添加动作成功'); this.$message.success('添加动作成功');
this.$emit('create'); this.$emit('create');
this.resetDisabled();
}).catch(error => { }).catch(error => {
this.$messageBox(`添加动作失败: ${error.message}`); this.$messageBox(`添加动作失败: ${error.message}`);
}); });
@ -178,6 +179,19 @@
} }
}); });
}, },
resetDisabled(){
if(this.$refs['modalData'])
{
debugger;
this.$refs['modalData'].resetFields();
}
},
clearValidate(){
if(this.$refs['modalData'])
{
this.$refs['modalData'].clearValidate();
}
},
initActionData(){ initActionData(){
this.modalData.actionVO.memberId=""; this.modalData.actionVO.memberId="";
this.modalData.actionVO.targetId=""; this.modalData.actionVO.targetId="";
@ -198,6 +212,7 @@
this.isConversitionAdd=true; this.isConversitionAdd=true;
this.isCommandAdd=false; this.isCommandAdd=false;
this.isJinLu=false; this.isJinLu=false;
this.clearValidate();
break; break;
} }
case "Command":{ case "Command":{
@ -212,12 +227,15 @@
{ {
this.isJinLu=false; this.isJinLu=false;
} }
this.clearValidate();
break; break;
} }
default:{ default:{
this.clearValidate();
break; break;
} }
} }
}, },
changeCommand(index){ changeCommand(index){
switch(index) switch(index)
@ -225,13 +243,16 @@
case "Train_Manual_Route_Blocking_Drive":{ case "Train_Manual_Route_Blocking_Drive":{
this.isJinLu=true; this.isJinLu=true;
this.getDeviceCode(); this.getDeviceCode();
this.clearValidate();
break; break;
} }
default:{ default:{
this.isJinLu=false; this.isJinLu=false;
this.clearValidate();
break; break;
} }
} }
}, },
doShow(data){ doShow(data){
if(data) if(data)

View File

@ -9,7 +9,7 @@
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="actionList" border class="actionListTable"> :data="actionList" border class="actionListTable">
<el-table-column prop="reply" label="回复消息" width="200"> <el-table-column prop="reply" label="内容" width="200">
</el-table-column> </el-table-column>
<el-table-column prop="time" label="完成时间" width="200"> <el-table-column prop="time" label="完成时间" width="200">
</el-table-column> </el-table-column>

View File

@ -32,8 +32,6 @@
</el-card> </el-card>
</template> </template>
<script> <script>
// import { getPublishLessonTree, getPublishLessonDetail } from '@/api/jmap/lesson';
// import { PermissionType } from '@/scripts/ConstDic';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
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';
@ -72,6 +70,7 @@ export default {
this.mapList = []; this.mapList = [];
listPublishMap().then(response => { listPublishMap().then(response => {
this.mapList = response.data; this.mapList = response.data;
this.loading = false;
this.mapSelect=this.mapList[0].id; this.mapSelect=this.mapList[0].id;
this.getQuestPageList(this.mapSelect); this.getQuestPageList(this.mapSelect);
}) })
@ -80,12 +79,15 @@ export default {
this.loading = true; this.loading = true;
this.getQuestPageList(id); this.getQuestPageList(id);
}, },
getQuestPageList(id){ async getQuestPageList(id){
getQuestPageList(id).then(response => { // getQuestPageList(id).then(response => {
this.loading = false; // this.loading = false;
this.treeList=response.data; // this.treeList=response.data;
}).catch((err) => { // }).catch((err) => {
}); // });
let response=await getQuestPageList(id);
this.loading = false;
this.treeList=response.data;
}, },
showContextMenu(e, obj, node, vueElem) { showContextMenu(e, obj, node, vueElem) {
if (obj) { if (obj) {
@ -94,15 +96,30 @@ export default {
} }
}, },
clickEvent(obj, data, ele) { clickEvent(obj, data, ele) {
setSessionStorage('scriptId', obj.id); // setSessionStorage('scriptId', obj.id);
this.$router.push({ path: `${UrlConfig.script.detail}/${obj.id}` }); this.$router.push({ path: `${UrlConfig.script.detail}/${obj.id}` });
}, },
addScript(){ addScript(){
this.refresh(null);
this.$router.push({ path: `${UrlConfig.script.prefix}` }); this.$router.push({ path: `${UrlConfig.script.prefix}` });
this.refresh();
}, },
refresh() { refresh(data) {
this.getQuestPageList(this.mapSelect); let that=this;
if(data)
{
let currentMapId=this.mapSelect;
if(currentMapId!=data.mapId)
{
this.mapSelect=data.mapId;
}
this.getQuestPageList(this.mapSelect).then(function(){
that.$refs.tree.setCurrentKey(data.scriptId);
});
}
else
{
this.getQuestPageList(this.mapSelect);
}
} }
} }
} }

View File

@ -18,6 +18,7 @@
</template> </template>
<script> <script>
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';
import {createQuest} from '@/api/quest'; import {createQuest} from '@/api/quest';
@ -59,13 +60,15 @@
rules() { rules() {
let crules = { let crules = {
name: [ name: [
{ required: true, message: '请输入剧本', trigger: 'blur' }, { required: true, message: '请输入剧本名称', trigger: 'blur' },
{ required: true, message: '请输入剧本名称', trigger: 'change' },
], ],
mapId: [ mapId: [
{ required: true, message: '请选择地图', trigger: 'change' }, { required: true, message: '请选择地图', trigger: 'change' },
], ],
description:[ description:[
{ required: true, message: '请输入剧本描述', trigger: 'blur' }, { required: true, message: '请输入剧本描述', trigger: 'blur' },
{ required: true, message: '请输入剧本描述', trigger: 'change' },
] ]
} }
return crules return crules
@ -96,10 +99,12 @@
this.loading=true; this.loading=true;
let data=this.formModel; let data=this.formModel;
createQuest(data).then(resp => { createQuest(data).then(resp => {
this.$emit('refresh'); let data={mapId:self.formModel.mapId,scriptId:resp.data};
this.$emit('refresh',data);
this.$message.success('创建剧本成功'); this.$message.success('创建剧本成功');
this.formModel={}; this.formModel={};
this.loading=false; this.loading=false;
this.$router.push({ path: `${UrlConfig.script.detail}/${resp.data}` });
}).catch(error => { }).catch(error => {
this.loading=false; this.loading=false;
this.$messageBox(`创建剧本失败: ${error.message}`); this.$messageBox(`创建剧本失败: ${error.message}`);

View File

@ -36,14 +36,9 @@
drapWidth(width) { drapWidth(width) {
this.widthLeft = Number(width); this.widthLeft = Number(width);
}, },
refresh() { refresh(data) {
this.$nextTick(() => { this.$refs.scriptTree.refresh(data);
this.$refs.scriptTree.refresh();
});
} }
// refresh(filterSelect) {
// this.$refs && this.$refs.tree && this.$refs.tree.refresh(filterSelect);
// }
}, },
} }