rt-sim-training-client/src/views/drts/scene/index.vue

121 lines
4.0 KiB
Vue
Raw Normal View History

<template>
<div>
<query-list-page ref="user" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<create-scene ref="createScene" :script-list="scriptList" title="创建场景" @create="handleConfirmCreate" />
<!-- <create-practice ref="modifyPractice" :map-list="mapList" title="修改实操" @reloadTable="reloadTable" @create="handleConfirmModify" /> -->
</div>
</template>
<script>
import { launchFullscreen } from '@/utils/screen';
import { getCompetitionPracticalScene, addCompetitionPracticalScene } from '@/api/competition';
import { getScriptPageListOnlineNew } from '@/api/script';
import CreateScene from './create';
export default {
name:'SceneManage',
components:{
CreateScene
},
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'
},
{
name: '删 除',
handleClick: this.doDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: '添 加', handler: this.doCreate }
]
}
};
},
mounted() {
getScriptPageListOnlineNew().then(response=>{
this.scriptList = response.data.list.map(elem => { return { value: elem.id, label: elem.name }; });
// this.queryForm.queryObject.scriptId.config.data = this.scriptList;
});
},
methods:{
doUpdate() {
},
doDelete() {
},
doCreate() {
this.$refs.createScene.doShow();
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleConfirmCreate(data) {
addCompetitionPracticalScene(data).then(resp => {
this.reloadTable();
this.$message.success('创建场景成功');
}).catch(error => {
this.$messageBox(`创建场景失败: ${error.message}`);
});
}
}
};
</script>