2020-09-27 11:22:48 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<query-list-page ref="user" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
2020-09-28 14:02:04 +08:00
|
|
|
<create-scene ref="createScene" title="创建场景" :script-list="scriptList" @reloadTable="reloadTable" />
|
|
|
|
<create-scene ref="updateScene" title="更新场景" :script-list="scriptList" @reloadTable="reloadTable" />
|
2020-09-28 20:54:34 +08:00
|
|
|
<modify-step ref="modifyStep" title="编辑步骤数据" />
|
2020-10-27 17:57:59 +08:00
|
|
|
<import-scene :script-list="scriptList" />
|
2020-09-28 14:02:04 +08:00
|
|
|
<!-- <update-scene ref="modifyScene" :script-list="scriptList" @reloadTable="reloadTable" /> -->
|
2020-09-27 11:22:48 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
2020-10-27 17:57:59 +08:00
|
|
|
import { getCompetitionPracticalScene, deleteCompetitionPracticalScene, getSceneExport, postSceneImport } from '@/api/competition';
|
2020-09-27 11:22:48 +08:00
|
|
|
import { getScriptPageListOnlineNew } from '@/api/script';
|
|
|
|
import CreateScene from './create';
|
2020-09-28 14:02:04 +08:00
|
|
|
import ModifyStep from './modify';
|
2020-10-27 17:57:59 +08:00
|
|
|
import ImportScene from './importScene';
|
2020-09-27 11:22:48 +08:00
|
|
|
export default {
|
|
|
|
name:'SceneManage',
|
|
|
|
components:{
|
2020-09-28 14:02:04 +08:00
|
|
|
CreateScene,
|
2020-10-27 17:57:59 +08:00
|
|
|
ModifyStep,
|
|
|
|
ImportScene
|
2020-09-27 11:22:48 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
scriptList:[],
|
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
|
|
|
reset: false,
|
|
|
|
labelWidth: '80px',
|
|
|
|
queryObject: {
|
|
|
|
name: {
|
|
|
|
type: 'text',
|
|
|
|
label: '场景名称'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
queryList: {
|
|
|
|
query: getCompetitionPracticalScene,
|
|
|
|
selectCheckShow: false,
|
|
|
|
indexShow: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: '场景名称',
|
|
|
|
prop: 'name',
|
|
|
|
width: '400'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '场景描述',
|
|
|
|
prop: 'description'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '处置流程',
|
|
|
|
prop: 'disposalProcesses'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '运营部分总分',
|
|
|
|
prop: 'operationScore'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '关联剧本',
|
|
|
|
prop: 'scriptId',
|
|
|
|
type: 'tag',
|
|
|
|
width: '320',
|
|
|
|
columnValue: (row) => { return this.$convertField(row.scriptId, this.scriptList, ['value', 'label']); },
|
|
|
|
tagType: (row) => { return 'success'; }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'button',
|
|
|
|
title: '操 作',
|
|
|
|
width: '420',
|
|
|
|
buttons: [
|
|
|
|
{
|
|
|
|
name: '更 新',
|
|
|
|
handleClick: this.doUpdate,
|
|
|
|
type: 'primary'
|
|
|
|
},
|
2020-09-28 14:02:04 +08:00
|
|
|
{
|
|
|
|
name: '编辑步骤数据',
|
|
|
|
handleClick: this.doModify,
|
|
|
|
type: 'success'
|
|
|
|
},
|
2020-09-27 11:22:48 +08:00
|
|
|
{
|
|
|
|
name: '删 除',
|
|
|
|
handleClick: this.doDelete,
|
|
|
|
type: 'danger'
|
2020-10-27 17:57:59 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '导 出',
|
|
|
|
handleClick: this.doExport,
|
|
|
|
type: 'primary'
|
2020-09-27 11:22:48 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
actions: [
|
2020-10-27 17:57:59 +08:00
|
|
|
{ text: '添 加', handler: this.doCreate },
|
|
|
|
{ text: '导 入', handler: this.doImport }
|
2020-09-27 11:22:48 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2020-10-09 10:57:52 +08:00
|
|
|
created() {
|
2020-09-27 11:22:48 +08:00
|
|
|
getScriptPageListOnlineNew().then(response=>{
|
2020-10-09 10:57:52 +08:00
|
|
|
this.scriptList = response.data.list.map(elem => { return { value: parseInt(elem.id), label: elem.name }; });
|
2020-09-27 11:22:48 +08:00
|
|
|
// this.queryForm.queryObject.scriptId.config.data = this.scriptList;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods:{
|
2020-09-28 14:02:04 +08:00
|
|
|
// 修改
|
|
|
|
doUpdate(index, row) {
|
|
|
|
this.$refs.updateScene.doShow(row.id);
|
2020-09-27 11:22:48 +08:00
|
|
|
},
|
2020-09-28 14:02:04 +08:00
|
|
|
doDelete(index, row) {
|
|
|
|
this.$confirm('此操作将删除此场景, 是否继续?', this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
deleteCompetitionPracticalScene(row.id).then(response => {
|
|
|
|
this.$message.success('删除场景成功');
|
|
|
|
this.reloadTable();
|
|
|
|
}).catch((error) => {
|
|
|
|
this.$messageBox(`删除场景失败: ${error.message}`);
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
2020-09-27 11:22:48 +08:00
|
|
|
},
|
|
|
|
doCreate() {
|
2020-09-28 14:02:04 +08:00
|
|
|
this.$refs.createScene.doShow(null);
|
2020-09-27 11:22:48 +08:00
|
|
|
},
|
2020-10-27 17:57:59 +08:00
|
|
|
doImport() {
|
|
|
|
this.$refs.importScene.doShow();
|
|
|
|
},
|
2020-09-27 11:22:48 +08:00
|
|
|
reloadTable() {
|
|
|
|
if (this.queryList && this.queryList.reload) {
|
|
|
|
this.queryList.reload();
|
|
|
|
}
|
|
|
|
},
|
2020-09-28 14:02:04 +08:00
|
|
|
doModify(index, row) {
|
|
|
|
this.$refs.modifyStep.doShow(row);
|
2020-10-27 17:57:59 +08:00
|
|
|
},
|
|
|
|
doExport(index, row) {
|
|
|
|
getSceneExport(row.id).then(res=>{
|
|
|
|
const resultData = res.data;
|
|
|
|
if (resultData === false) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const content = new Blob([JSON.stringify(resultData)]);
|
|
|
|
const urlObject = window.URL || window.webkitURL || window;
|
|
|
|
const url = urlObject.createObjectURL(content);
|
|
|
|
const el = document.createElement('a');
|
|
|
|
el.href = url;
|
|
|
|
el.download = `${resultData.name}.json`;
|
|
|
|
el.click();
|
|
|
|
urlObject.revokeObjectURL(url);
|
|
|
|
});
|
2020-09-27 11:22:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|