产品分化剧本修改

This commit is contained in:
joylink_cuiweidong 2019-09-26 10:54:07 +08:00
parent bde4904b2a
commit 0bb8e6ba0b
4 changed files with 181 additions and 67 deletions

View File

@ -4,6 +4,7 @@ export default {
saveData: 'Save Data',
mapList: 'Map List',
createScript: 'Create Script',
modifyScript: 'Modify Script',
scriptName: 'Script Name',
addScript: 'Add Script',
map: 'Map',
@ -15,6 +16,7 @@ export default {
createScriptFail: 'Create script failure',
scriptDetail: 'Script Detail',
scriptRecord: 'Record',
scriptCreate: 'Create',
scriptModify: 'Modify',
scriptDelete: 'Delete',
getScriptFail: 'Get script information failure',

View File

@ -4,6 +4,7 @@ export default {
saveData: '保存数据',
mapList: '地图列表',
createScript: '创建剧本',
modifyScript: '修改剧本',
scriptName: '剧本名称',
addScript: '添加剧本',
map: '所属地图',
@ -15,6 +16,7 @@ export default {
createScriptFail: '创建剧本失败',
scriptDetail: '剧本详情',
scriptRecord: '编制',
scriptCreate: '创建',
scriptModify: '修改',
scriptDelete: '删除',
getScriptFail: '获取剧本信息失败',

View File

@ -0,0 +1,109 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="25%" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{$t('global.confirm')}}</el-button>
<el-button @click="doClose">{{$t('global.cancel')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { listPublishMap } from '@/api/jmap/map'
import { getQuestById} from '@/api/quest';
export default {
name: 'ScriptDraft',
data() {
return {
dialogVisible: false,
mapList: [],
taskStatusList: [],
disabled:null,
formModel: {
name: '',
mapId: '',
description:''
},
isShow: false,
}
},
props: {
title: String,
},
computed: {
form() {
let isAdd = this.type === 'ADD'
let form = {
labelWidth: '100px',
items: [
{ prop: 'name', label: this.$t('scriptRecord.scriptName'), type: 'text', required: true},
{ prop: 'mapId', label: this.$t('scriptRecord.map'), type: 'select', required: true, options: this.mapList,disabled:this.disabled},
{ prop: 'description', label: this.$t('scriptRecord.scriptDescription'), type: 'textarea', required: true},
]
}
return form
},
rules() {
let crules = {
name: [
{ required: true, message: '请输入剧本', trigger: 'blur' },
],
mapId: [
{ required: true, message: '请选择地图', trigger: 'change' },
],
description:[
{ required: true, message: '请输入剧本描述', trigger: 'blur' },
]
}
return crules
},
// title() {
// return ''
// }
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
this.mapList = [];
listPublishMap().then(response => {
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name } });
})
},
doShow(questid) {
if(questid)
{
getQuestById(questid).then(resp=>{
let data={'name':resp.data.name,'description':resp.data.description,'mapId':resp.data.mapId};
this.formModel=data;
this.formModel.id=questid;
this.disabled="disabled";
this.dialogVisible = true
});
}
else
{
this.formModel.mapId=this.$route.params.mapId;
this.disabled="disabled";
this.dialogVisible = true
}
},
doCreate() {
let self = this
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose()
})
},
doClose() {
this.$refs.dataform.resetForm();
this.isShow = false;
this.dialogVisible = false
}
}
}
</script>

View File

@ -1,6 +1,6 @@
<template>
<el-card :style="{height: height+'px'}">
<el-button size="small" type="primary" @click="handleCreate" style="margin-left:100px;">{{$t('scriptRecord.scriptCreate')}}</el-button>
<el-table
:data="tableData"
stripe
@ -23,15 +23,17 @@
<el-table-column
label="操作"
>
<el-button size="small" type="success" @click="drawUp">{{$t('scriptRecord.scriptRecord')}}</el-button>
<el-button size="small" type="primary" @click="modifyScript">{{$t('scriptRecord.scriptModify')}}</el-button>
<el-button size="small" type="danger" @click="deleteScript">{{$t('scriptRecord.scriptDelete')}}</el-button>
<template slot-scope="scope">
<el-button size="small" type="success" @click="drawUp(scope.$index, scope.row)">{{$t('scriptRecord.scriptRecord')}}</el-button>
<el-button size="small" type="primary" @click="handleModify(scope.$index, scope.row)">{{$t('scriptRecord.scriptModify')}}</el-button>
<el-button size="small" type="danger" @click="deleteScript(scope.$index, scope.row)">{{$t('scriptRecord.scriptDelete')}}</el-button>
</template>
</el-table-column>
</el-table>
<!-- <create-script ref='createScript' @reloadTable="reloadTable" @create="handleConfirmCreate" title="创建脚本">
<create-script ref='createScript' @reloadTable="reloadTable" @create="handleConfirmCreate" :title="$t('scriptRecord.createScript')">
</create-script>
<create-script ref='modifyScript' @reloadTable="reloadTable" @create="handleConfirmModify" :title="$t('scriptRecord.modifyScript')">
</create-script>
<create-script ref='modifyScript' @reloadTable="reloadTable" @create="handleConfirmModify" title="修改脚本">
</create-script> -->
<!-- <div class="home-box">
<el-card class="box-card">
@ -53,10 +55,16 @@
import { UrlConfig } from '@/router/index';
// import {listPublishMap} from '@/api/jmap/map';
import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest';
import { launchFullscreen } from '@/utils/screen';
import { scriptRecordNotify } from '@/api/simulation';
import CreateScript from './create';
// import {createQuest} from '@/api/quest';
export default {
name: 'ScriptDraft',
components: {
CreateScript,
},
data() {
return {
tableData:[],
@ -98,65 +106,58 @@ export default {
let response=await getQuestPageList(id);
this.tableData=response.data;
},
// //
// handleConfirmCreate(data) {
// createQuest(data).then(resp => {
// this.reloadTable();
// this.$message.success('');
// }).catch(error => {
// this.$messageBox(`: ${error.message}`);
// })
// },
// //
// handleModify(index, row){
// this.$refs.modifyScript.doShow(row.id);
// },
// //
// handleConfirmModify(data){
// updateQuest(data.id,data).then(resp => {
// this.reloadTable();
// this.$message.success('');
// }).catch(error => {
// this.$messageBox(`: ${error.message}`);
// })
// },
// //
// handleCreate(index, row) {
// this.$refs.createScript.doShow(null);
// },
// //
// handleRecord(index, row) {
// scriptRecordNotify(row.id).then(resp => {
// let query = { skinStyle: row.skinCode, group: resp.data, scriptId: row.id };
// this.$router.push({ path: `${UrlConfig.display}/script`, query });
// launchFullscreen();
// }).catch(error => {
// this.$messageBox(`仿: ${error.message}`);
// })
// },
// //
// handleDelete(index, row) {
// this.$confirm(', ?', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// }).then(() => {
// deleteQuest(row.id).then(response => {
// this.$message.success('')
// this.reloadTable()
// }).catch(error => {
// this.reloadTable()
// if (error.code == 500) {
// this.$messageBox('')
// } else if (error.code == 500009) {
// this.$messageBox('使')
// }
// })
// }).catch(() => { })
// },
// reloadTable() {
// this.queryList.reload()
// }
drawUp(index,row) {
scriptRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id };
this.$router.push({ path: `${UrlConfig.scriptDisplay}/script`, query });
launchFullscreen();
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
});
},
deleteScript(index,row) {
this.$confirm(this.$t('scriptRecord.deleteScriptTip'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteQuest(row.id).then(response => {
this.$message.success(this.$t('scriptRecord.deleteScriptSucess'));
this.loadInitData();
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.deleteScriptFail'));
});
}).catch(() => { });
},
//
handleConfirmCreate(data) {
createQuest(data).then(resp => {
this.reloadTable();
this.$message.success('创建剧本成功');
}).catch(error => {
this.$messageBox(`创建剧本失败: ${error.message}`);
})
},
//
handleModify(index, row){
this.$refs.modifyScript.doShow(row.id);
},
//
handleConfirmModify(data){
updateQuest(data.id,data).then(resp => {
this.reloadTable();
this.$message.success('修改剧本成功');
}).catch(error => {
this.$messageBox(`修改剧本失败: ${error.message}`);
})
},
//
handleCreate() {
this.$refs.createScript.doShow(null);
},
reloadTable() {
this.loadInitData();
}
// loadInitData() {
// this.mapList = [];