产品分化剧本修改

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

View File

@ -4,6 +4,7 @@ export default {
saveData: '保存数据', saveData: '保存数据',
mapList: '地图列表', mapList: '地图列表',
createScript: '创建剧本', createScript: '创建剧本',
modifyScript: '修改剧本',
scriptName: '剧本名称', scriptName: '剧本名称',
addScript: '添加剧本', addScript: '添加剧本',
map: '所属地图', map: '所属地图',
@ -15,6 +16,7 @@ export default {
createScriptFail: '创建剧本失败', createScriptFail: '创建剧本失败',
scriptDetail: '剧本详情', scriptDetail: '剧本详情',
scriptRecord: '编制', scriptRecord: '编制',
scriptCreate: '创建',
scriptModify: '修改', scriptModify: '修改',
scriptDelete: '删除', scriptDelete: '删除',
getScriptFail: '获取剧本信息失败', 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> <template>
<el-card :style="{height: height+'px'}"> <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 <el-table
:data="tableData" :data="tableData"
stripe stripe
@ -23,15 +23,17 @@
<el-table-column <el-table-column
label="操作" label="操作"
> >
<el-button size="small" type="success" @click="drawUp">{{$t('scriptRecord.scriptRecord')}}</el-button> <template slot-scope="scope">
<el-button size="small" type="primary" @click="modifyScript">{{$t('scriptRecord.scriptModify')}}</el-button> <el-button size="small" type="success" @click="drawUp(scope.$index, scope.row)">{{$t('scriptRecord.scriptRecord')}}</el-button>
<el-button size="small" type="danger" @click="deleteScript">{{$t('scriptRecord.scriptDelete')}}</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-column>
</el-table> </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>
<create-script ref='modifyScript' @reloadTable="reloadTable" @create="handleConfirmModify" title="修改脚本">
</create-script> -->
<!-- <div class="home-box"> <!-- <div class="home-box">
<el-card class="box-card"> <el-card class="box-card">
@ -53,10 +55,16 @@
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
// import {listPublishMap} from '@/api/jmap/map'; // import {listPublishMap} from '@/api/jmap/map';
import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest'; 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'; // import {createQuest} from '@/api/quest';
export default { export default {
name: 'ScriptDraft', name: 'ScriptDraft',
components: {
CreateScript,
},
data() { data() {
return { return {
tableData:[], tableData:[],
@ -98,65 +106,58 @@ export default {
let response=await getQuestPageList(id); let response=await getQuestPageList(id);
this.tableData=response.data; this.tableData=response.data;
}, },
// // drawUp(index,row) {
// handleConfirmCreate(data) { scriptRecordNotify(row.id).then(resp => {
// createQuest(data).then(resp => { const query = { mapId: row.mapId, group: resp.data, scriptId: row.id };
// this.reloadTable(); this.$router.push({ path: `${UrlConfig.scriptDisplay}/script`, query });
// this.$message.success(''); launchFullscreen();
// }).catch(error => { }).catch(error => {
// this.$messageBox(`: ${error.message}`); this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
// }) });
// }, },
// // deleteScript(index,row) {
// handleModify(index, row){ this.$confirm(this.$t('scriptRecord.deleteScriptTip'), this.$t('global.tips'), {
// this.$refs.modifyScript.doShow(row.id); confirmButtonText: this.$t('global.confirm'),
// }, cancelButtonText: this.$t('global.cancel'),
// // type: 'warning'
// handleConfirmModify(data){ }).then(() => {
// updateQuest(data.id,data).then(resp => { deleteQuest(row.id).then(response => {
// this.reloadTable(); this.$message.success(this.$t('scriptRecord.deleteScriptSucess'));
// this.$message.success(''); this.loadInitData();
// }).catch(error => { }).catch(() => {
// this.$messageBox(`: ${error.message}`); this.$messageBox(this.$t('scriptRecord.deleteScriptFail'));
// }) });
// }, }).catch(() => { });
// // },
// handleCreate(index, row) { //
// this.$refs.createScript.doShow(null); handleConfirmCreate(data) {
// }, createQuest(data).then(resp => {
// // this.reloadTable();
// handleRecord(index, row) { this.$message.success('创建剧本成功');
// scriptRecordNotify(row.id).then(resp => { }).catch(error => {
// let query = { skinStyle: row.skinCode, group: resp.data, scriptId: row.id }; this.$messageBox(`创建剧本失败: ${error.message}`);
// this.$router.push({ path: `${UrlConfig.display}/script`, query }); })
// launchFullscreen(); },
// }).catch(error => { //
// this.$messageBox(`仿: ${error.message}`); handleModify(index, row){
// }) this.$refs.modifyScript.doShow(row.id);
// }, },
// // //
// handleDelete(index, row) { handleConfirmModify(data){
// this.$confirm(', ?', '', { updateQuest(data.id,data).then(resp => {
// confirmButtonText: '', this.reloadTable();
// cancelButtonText: '', this.$message.success('修改剧本成功');
// type: 'warning' }).catch(error => {
// }).then(() => { this.$messageBox(`修改剧本失败: ${error.message}`);
// deleteQuest(row.id).then(response => { })
// this.$message.success('') },
// this.reloadTable() //
// }).catch(error => { handleCreate() {
// this.reloadTable() this.$refs.createScript.doShow(null);
// if (error.code == 500) { },
// this.$messageBox('') reloadTable() {
// } else if (error.code == 500009) { this.loadInitData();
// this.$messageBox('使') }
// }
// })
// }).catch(() => { })
// },
// reloadTable() {
// this.queryList.reload()
// }
// loadInitData() { // loadInitData() {
// this.mapList = []; // this.mapList = [];