2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-09-02 15:37:57 +08:00
|
|
|
<el-card :style="{height: height+'px'}">
|
2019-09-26 13:21:15 +08:00
|
|
|
<div class="scriptHeader">
|
|
|
|
<div class="scriptList">{{$t('scriptRecord.scriptList')}}</div>
|
|
|
|
<el-button size="small" type="primary" @click="handleCreate" class="createScript">{{$t('scriptRecord.scriptCreate')}}</el-button>
|
|
|
|
</div>
|
2019-10-17 13:54:41 +08:00
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;display: inline-block;"/>
|
|
|
|
<script-publish ref='publishScript' @reloadTable="reloadTable" @create="handleConfirmPublish" :title="$t('scriptRecord.publishScript')">
|
|
|
|
</script-publish>
|
2019-09-26 10:54:07 +08:00
|
|
|
<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')">
|
2019-09-26 09:07:19 +08:00
|
|
|
</create-script>
|
2019-09-02 15:37:57 +08:00
|
|
|
</el-card>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-10-15 16:18:25 +08:00
|
|
|
import Cookies from 'js-cookie';
|
2019-10-14 13:10:36 +08:00
|
|
|
import ConstConfig from '@/scripts/ConstConfig';
|
2019-09-02 15:37:57 +08:00
|
|
|
import { UrlConfig } from '@/router/index';
|
2019-10-14 13:10:36 +08:00
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { admin, superAdmin} from '@/router';
|
2019-10-17 10:06:52 +08:00
|
|
|
import { getQuestPageList,createQuest,deleteQuest,updateQuest,publishQuest,retractQuest} from '@/api/quest';
|
2019-09-26 10:54:07 +08:00
|
|
|
import { launchFullscreen } from '@/utils/screen';
|
|
|
|
import { scriptRecordNotify } from '@/api/simulation';
|
|
|
|
import CreateScript from './create';
|
2019-10-17 13:54:41 +08:00
|
|
|
import ScriptPublish from './publish';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-09-02 15:37:57 +08:00
|
|
|
export default {
|
|
|
|
name: 'ScriptDraft',
|
2019-09-26 10:54:07 +08:00
|
|
|
components: {
|
|
|
|
CreateScript,
|
2019-10-17 13:54:41 +08:00
|
|
|
ScriptPublish
|
2019-09-26 10:54:07 +08:00
|
|
|
},
|
2019-09-02 15:37:57 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2019-10-17 10:06:52 +08:00
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
|
|
|
labelWidth: '100px',
|
|
|
|
reset: true,
|
|
|
|
show:false
|
|
|
|
},
|
|
|
|
queryList: {
|
|
|
|
query: this.queryFunction,
|
|
|
|
selectCheckShow: false,
|
|
|
|
indexShow: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: this.$t('scriptRecord.scriptName'),
|
|
|
|
prop: 'name'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('scriptRecord.scriptDescription'),
|
|
|
|
prop: 'description',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('scriptRecord.status'),
|
|
|
|
prop: 'status',
|
|
|
|
type: 'tag',
|
|
|
|
columnValue: (row) => { return this.covertData(row)},
|
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('scriptRecord.revokeReason'),
|
|
|
|
prop: 'explanation',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'button',
|
|
|
|
title: this.$t('scriptRecord.operate'),
|
|
|
|
width: '400',
|
|
|
|
buttons: [
|
|
|
|
{
|
|
|
|
name: this.$t('scriptRecord.scriptRecord'),
|
|
|
|
handleClick: this.drawUp,
|
2019-10-17 13:54:41 +08:00
|
|
|
type: 'success',
|
2019-10-17 18:09:02 +08:00
|
|
|
showControl:(row) => { return !(row.status==1) },
|
2019-10-17 10:06:52 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('scriptRecord.scriptModify'),
|
|
|
|
handleClick: this.handleModify,
|
2019-10-17 13:54:41 +08:00
|
|
|
type: 'primary',
|
2019-10-17 18:09:02 +08:00
|
|
|
showControl:(row) => { return !(row.status==1) },
|
2019-10-17 10:06:52 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('scriptRecord.scriptDelete'),
|
|
|
|
handleClick: this.deleteScript,
|
2019-10-17 13:54:41 +08:00
|
|
|
type: 'danger',
|
2019-10-17 18:09:02 +08:00
|
|
|
showControl:(row) => { return !(row.status==1) },
|
2019-10-17 13:54:41 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.covertButtonname(),
|
|
|
|
handleClick: this.publishScript,
|
|
|
|
type: 'primary',
|
2019-10-17 18:09:02 +08:00
|
|
|
showControl:(row) => { return row.status==0 },
|
2019-10-17 13:54:41 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('scriptRecord.applyRevoke'),
|
|
|
|
handleClick: this.revokeScript,
|
|
|
|
type: 'primary',
|
2019-10-17 18:09:02 +08:00
|
|
|
showControl:(row) => { return row.status==1 },
|
2019-10-17 13:54:41 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('scriptRecord.preview'),
|
|
|
|
handleClick: this.previewScript,
|
|
|
|
type: 'success',
|
2019-10-17 18:09:02 +08:00
|
|
|
showControl:(row) => { return row.status==1 },
|
2019-10-17 10:06:52 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2019-09-02 15:37:57 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
height() {
|
|
|
|
return this.$store.state.app.height - 50;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2019-10-12 17:15:25 +08:00
|
|
|
'$route' () {
|
2019-10-17 13:54:41 +08:00
|
|
|
this.reloadTable();
|
2019-09-02 15:37:57 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2019-10-17 13:54:41 +08:00
|
|
|
this.reloadTable();
|
2019-09-02 15:37:57 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2019-10-17 10:06:52 +08:00
|
|
|
queryFunction(params) {
|
|
|
|
return getQuestPageList(this.$route.params.mapId,params);
|
2019-09-02 15:37:57 +08:00
|
|
|
},
|
2019-10-17 10:06:52 +08:00
|
|
|
reloadTable() {
|
|
|
|
if (this.queryList && this.queryList.reload) {
|
|
|
|
this.queryList.reload();
|
|
|
|
}
|
2019-09-26 10:54:07 +08:00
|
|
|
},
|
|
|
|
drawUp(index,row) {
|
|
|
|
scriptRecordNotify(row.id).then(resp => {
|
2019-10-16 16:36:25 +08:00
|
|
|
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id,lang:row.lang };
|
2019-09-26 10:54:07 +08:00
|
|
|
this.$router.push({ path: `${UrlConfig.scriptDisplay}/script`, query });
|
|
|
|
launchFullscreen();
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
|
2019-09-02 15:37:57 +08:00
|
|
|
});
|
|
|
|
},
|
2019-09-26 10:54:07 +08:00
|
|
|
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'));
|
2019-10-17 13:54:41 +08:00
|
|
|
this.reloadTable();
|
2019-09-26 10:54:07 +08:00
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('scriptRecord.deleteScriptFail'));
|
2019-09-02 15:37:57 +08:00
|
|
|
});
|
2019-09-26 10:54:07 +08:00
|
|
|
}).catch(() => { });
|
|
|
|
},
|
|
|
|
// 确定创建
|
|
|
|
handleConfirmCreate(data) {
|
2019-10-16 16:36:25 +08:00
|
|
|
if(Cookies.get("user_lang")=="en"){
|
|
|
|
data.lang='en';
|
|
|
|
}else{
|
|
|
|
data.lang='zh';
|
2019-09-02 15:37:57 +08:00
|
|
|
}
|
2019-09-26 10:54:07 +08:00
|
|
|
createQuest(data).then(resp => {
|
|
|
|
this.reloadTable();
|
2019-10-16 16:36:25 +08:00
|
|
|
this.$message.success(this.$t('scriptRecord.createScriptSuccess'));
|
2019-09-26 10:54:07 +08:00
|
|
|
}).catch(error => {
|
2019-10-16 16:36:25 +08:00
|
|
|
this.$messageBox(`${this.$t('scriptRecord.createScriptFail')}: ${error.message}`);
|
2019-09-26 10:54:07 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
//修改
|
2019-10-17 09:16:40 +08:00
|
|
|
handleModify(index, row){
|
2019-09-26 10:54:07 +08:00
|
|
|
this.$refs.modifyScript.doShow(row.id);
|
|
|
|
},
|
|
|
|
//确认修改
|
|
|
|
handleConfirmModify(data){
|
2019-10-16 16:36:25 +08:00
|
|
|
if(Cookies.get("user_lang")=="en"){
|
|
|
|
data.lang='en';
|
|
|
|
}else{
|
|
|
|
data.lang='zh';
|
|
|
|
}
|
2019-09-26 10:54:07 +08:00
|
|
|
updateQuest(data.id,data).then(resp => {
|
|
|
|
this.reloadTable();
|
2019-10-16 16:36:25 +08:00
|
|
|
this.$message.success(this.$t('scriptRecord.modifyScriptSuccess'));
|
2019-09-26 10:54:07 +08:00
|
|
|
}).catch(error => {
|
2019-10-16 16:36:25 +08:00
|
|
|
this.$messageBox(`${this.$t('scriptRecord.modifyScriptFail')}: ${error.message}`);
|
2019-09-26 10:54:07 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
// 创建
|
|
|
|
handleCreate() {
|
|
|
|
this.$refs.createScript.doShow(null);
|
|
|
|
},
|
2019-10-14 13:10:36 +08:00
|
|
|
covertData(row){
|
|
|
|
let releaseReview=ConstConfig.ConstSelect.releaseReview;
|
2019-10-22 11:20:43 +08:00
|
|
|
let lastData=Object.assign({}, row);
|
|
|
|
if(Cookies.get("user_lang")=="en"){
|
|
|
|
releaseReview.forEach(function(element){
|
|
|
|
let rolename=element.value;
|
|
|
|
if(lastData.status==rolename){
|
|
|
|
lastData.status=element.enlabel;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
releaseReview.forEach(function(element){
|
|
|
|
let rolename=element.value;
|
|
|
|
if(lastData.status==rolename){
|
|
|
|
lastData.status=element.label;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-10-14 13:58:26 +08:00
|
|
|
return lastData.status;
|
|
|
|
// let explanation=lastData.explanation?'{ 说明:'+lastData.explanation+'}':'';
|
|
|
|
// return lastData.status+explanation;
|
2019-10-14 13:10:36 +08:00
|
|
|
},
|
2019-10-17 13:54:41 +08:00
|
|
|
handleConfirmPublish(data){
|
|
|
|
publishQuest(data.id,{'scriptName':data.scriptName}).then(resp => {
|
|
|
|
this.reloadTable();
|
|
|
|
this.$message.success(this.$t('scriptRecord.publishScriptSuccess'));
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(`${this.$t('scriptRecord.publishScriptFailed')}: ${error.message}`);
|
|
|
|
});
|
|
|
|
},
|
2019-10-14 13:10:36 +08:00
|
|
|
publishScript(index,row){
|
2019-10-17 13:54:41 +08:00
|
|
|
if(this.$store.getters.roles.indexOf(admin) >= 0 || this.$store.getters.roles.indexOf(superAdmin) >= 0){
|
|
|
|
this.$refs.publishScript.doShow(row);
|
2019-10-14 13:58:26 +08:00
|
|
|
}else{
|
2019-10-17 13:54:41 +08:00
|
|
|
this.$confirm(this.$t('scriptRecord.releaseScriptTip'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
publishQuest(row.id,{name:''}).then(resp => {
|
|
|
|
this.reloadTable();
|
|
|
|
this.$message.success(this.$t('scriptRecord.releaseScriptSuccess'));
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(`${this.$t('scriptRecord.releaseScriptFailed')}: ${error.message}`);
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
|
2019-10-14 13:10:36 +08:00
|
|
|
}
|
2019-10-14 13:58:26 +08:00
|
|
|
},
|
|
|
|
covertButtonname(){
|
2019-10-17 13:54:41 +08:00
|
|
|
if(this.$store.getters.roles.indexOf(admin) >= 0 || this.$store.getters.roles.indexOf(superAdmin) >= 0){
|
2019-10-14 13:58:26 +08:00
|
|
|
return this.$t('scriptRecord.publish');
|
|
|
|
}else{
|
|
|
|
return this.$t('scriptRecord.applyPublish');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
revokeScript(index,row){
|
2019-10-17 13:54:41 +08:00
|
|
|
this.$confirm(this.$t('scriptRecord.revokeScriptTip'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
retractQuest(row.id).then(resp => {
|
|
|
|
this.reloadTable();
|
|
|
|
this.$message.success(this.$t('approval.revokeScriptSuccess'));
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(`${this.$t('approval.revokeScriptFailed')}: ${error.message}`);
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
2019-10-14 15:35:11 +08:00
|
|
|
},
|
|
|
|
previewScript(index,row){
|
2019-10-15 13:41:23 +08:00
|
|
|
scriptRecordNotify(row.id).then(resp => {
|
2019-10-16 09:18:26 +08:00
|
|
|
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id,skinCode:this.$route.query.skinCode,try:0};
|
|
|
|
this.$router.push({ path: `${UrlConfig.design.display}/demon`, query });
|
2019-10-15 13:41:23 +08:00
|
|
|
launchFullscreen();
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(`${this.$t('scriptRecord.createSimulationFail')}: ${error.message}`);
|
|
|
|
});
|
|
|
|
// skinCode=02&group=16-128-757&prdType=02&mapId=18&code=JLFZZX-1&goodsId=&try=0
|
2019-09-02 15:37:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-08-15 09:04:17 +08:00
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
2019-09-26 13:21:15 +08:00
|
|
|
.createScript{
|
|
|
|
display:inline-block;float:right;margin-right:20px;
|
|
|
|
}
|
|
|
|
.scriptHeader{
|
|
|
|
display:inline-block;margin-top:40px;width: 90%;margin-left:5%;
|
|
|
|
}
|
|
|
|
.scriptList{
|
|
|
|
display:inline-block;padding:7px 0px
|
|
|
|
}
|
2019-10-14 13:10:36 +08:00
|
|
|
.el-button+.el-button {
|
|
|
|
margin-left: 10px;
|
|
|
|
margin-top: 5px;
|
|
|
|
}
|
2019-08-15 09:04:17 +08:00
|
|
|
</style>
|