修改 创建剧本的跳转逻辑
编制剧本的表单重置
This commit is contained in:
parent
aae4d4d162
commit
14901a50f2
@ -19,7 +19,7 @@
|
||||
<el-option v-for="member in memberList" :key="member.id" :label="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-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-form-item>
|
||||
<el-form-item label="设备指令" class="conditionVO" prop="actionVO.type" v-if="isCommandAdd">
|
||||
@ -97,7 +97,7 @@
|
||||
{ required: true, message: '请选择主体角色', trigger: 'change' }
|
||||
],
|
||||
reply:[
|
||||
{ required: true, message: '请输入回复消息', trigger: 'blur' }
|
||||
{ required: true, message: '请输入内容', trigger: 'blur' }
|
||||
],
|
||||
targetId:[
|
||||
{ required: true, message: '请选择目标角色', trigger: 'change' }
|
||||
@ -155,6 +155,7 @@
|
||||
this.initActionData();
|
||||
this.$message.success('添加动作成功');
|
||||
this.$emit('create');
|
||||
this.resetDisabled();
|
||||
}).catch(error => {
|
||||
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(){
|
||||
this.modalData.actionVO.memberId="";
|
||||
this.modalData.actionVO.targetId="";
|
||||
@ -198,6 +212,7 @@
|
||||
this.isConversitionAdd=true;
|
||||
this.isCommandAdd=false;
|
||||
this.isJinLu=false;
|
||||
this.clearValidate();
|
||||
break;
|
||||
}
|
||||
case "Command":{
|
||||
@ -212,12 +227,15 @@
|
||||
{
|
||||
this.isJinLu=false;
|
||||
}
|
||||
this.clearValidate();
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
this.clearValidate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
changeCommand(index){
|
||||
switch(index)
|
||||
@ -225,13 +243,16 @@
|
||||
case "Train_Manual_Route_Blocking_Drive":{
|
||||
this.isJinLu=true;
|
||||
this.getDeviceCode();
|
||||
this.clearValidate();
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
this.isJinLu=false;
|
||||
this.clearValidate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
doShow(data){
|
||||
if(data)
|
||||
|
@ -9,7 +9,7 @@
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
: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 prop="time" label="完成时间" width="200">
|
||||
</el-table-column>
|
||||
|
@ -32,8 +32,6 @@
|
||||
</el-card>
|
||||
</template>
|
||||
<script>
|
||||
// import { getPublishLessonTree, getPublishLessonDetail } from '@/api/jmap/lesson';
|
||||
// import { PermissionType } from '@/scripts/ConstDic';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest';
|
||||
import { listPublishMap } from '@/api/jmap/map';
|
||||
@ -72,6 +70,7 @@ export default {
|
||||
this.mapList = [];
|
||||
listPublishMap().then(response => {
|
||||
this.mapList = response.data;
|
||||
this.loading = false;
|
||||
this.mapSelect=this.mapList[0].id;
|
||||
this.getQuestPageList(this.mapSelect);
|
||||
})
|
||||
@ -80,12 +79,15 @@ export default {
|
||||
this.loading = true;
|
||||
this.getQuestPageList(id);
|
||||
},
|
||||
getQuestPageList(id){
|
||||
getQuestPageList(id).then(response => {
|
||||
this.loading = false;
|
||||
this.treeList=response.data;
|
||||
}).catch((err) => {
|
||||
});
|
||||
async getQuestPageList(id){
|
||||
// getQuestPageList(id).then(response => {
|
||||
// this.loading = false;
|
||||
// this.treeList=response.data;
|
||||
// }).catch((err) => {
|
||||
// });
|
||||
let response=await getQuestPageList(id);
|
||||
this.loading = false;
|
||||
this.treeList=response.data;
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
if (obj) {
|
||||
@ -94,15 +96,30 @@ export default {
|
||||
}
|
||||
},
|
||||
clickEvent(obj, data, ele) {
|
||||
setSessionStorage('scriptId', obj.id);
|
||||
// setSessionStorage('scriptId', obj.id);
|
||||
this.$router.push({ path: `${UrlConfig.script.detail}/${obj.id}` });
|
||||
},
|
||||
addScript(){
|
||||
this.refresh(null);
|
||||
this.$router.push({ path: `${UrlConfig.script.prefix}` });
|
||||
this.refresh();
|
||||
},
|
||||
refresh() {
|
||||
this.getQuestPageList(this.mapSelect);
|
||||
refresh(data) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import {listPublishMap} from '@/api/jmap/map';
|
||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||
import {createQuest} from '@/api/quest';
|
||||
@ -59,13 +60,15 @@
|
||||
rules() {
|
||||
let crules = {
|
||||
name: [
|
||||
{ required: true, message: '请输入剧本', trigger: 'blur' },
|
||||
{ required: true, message: '请输入剧本名称', trigger: 'blur' },
|
||||
{ required: true, message: '请输入剧本名称', trigger: 'change' },
|
||||
],
|
||||
mapId: [
|
||||
{ required: true, message: '请选择地图', trigger: 'change' },
|
||||
],
|
||||
description:[
|
||||
{ required: true, message: '请输入剧本描述', trigger: 'blur' },
|
||||
{ required: true, message: '请输入剧本描述', trigger: 'change' },
|
||||
]
|
||||
}
|
||||
return crules
|
||||
@ -96,10 +99,12 @@
|
||||
this.loading=true;
|
||||
let data=this.formModel;
|
||||
createQuest(data).then(resp => {
|
||||
this.$emit('refresh');
|
||||
let data={mapId:self.formModel.mapId,scriptId:resp.data};
|
||||
this.$emit('refresh',data);
|
||||
this.$message.success('创建剧本成功');
|
||||
this.formModel={};
|
||||
this.loading=false;
|
||||
this.$router.push({ path: `${UrlConfig.script.detail}/${resp.data}` });
|
||||
}).catch(error => {
|
||||
this.loading=false;
|
||||
this.$messageBox(`创建剧本失败: ${error.message}`);
|
||||
|
@ -36,14 +36,9 @@
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
},
|
||||
refresh() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.scriptTree.refresh();
|
||||
});
|
||||
refresh(data) {
|
||||
this.$refs.scriptTree.refresh(data);
|
||||
}
|
||||
// refresh(filterSelect) {
|
||||
// this.$refs && this.$refs.tree && this.$refs.tree.refresh(filterSelect);
|
||||
// }
|
||||
},
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user