|
|
@@ -41,16 +41,19 @@
|
|
|
:height="tableHeight"
|
|
|
v-loading="fetchingData"
|
|
|
>
|
|
|
- <el-table-column prop="id" label="ID" width="100"> </el-table-column>
|
|
|
+ <el-table-column prop="id" label="ID" width="80"> </el-table-column>
|
|
|
+ <el-table-column prop="status" label="房间状态" :formatter="statusFormatter" align="center">
|
|
|
+ <template v-slot="{ row }">
|
|
|
+ <el-tag :type="statusTagType(row)">{{ statusFormatter(null, null, row.status) }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="name" label="房间名称"> </el-table-column>
|
|
|
<el-table-column prop="userId" label="用户ID"> </el-table-column>
|
|
|
- <el-table-column prop="type" label="房间类型" :formatter="typeFormatter"> </el-table-column>
|
|
|
- <el-table-column prop="gameId" label="游戏ID"> </el-table-column>
|
|
|
- <el-table-column prop="status" label="房间状态" :formatter="statusFormatter"> </el-table-column>
|
|
|
- <el-table-column prop="requireTicket" label="需要门票" :formatter="requireTicketFormatter">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="gameModeId" label="游戏模式"> </el-table-column>
|
|
|
- <el-table-column prop="gameMapId" label="游戏地图"> </el-table-column>
|
|
|
+ <!-- <el-table-column prop="type" label="房间类型" :formatter="typeFormatter"> </el-table-column> -->
|
|
|
+ <el-table-column prop="gameId" label="游戏" :formatter="gameFormatter"> </el-table-column>
|
|
|
+ <el-table-column prop="requireTicket" label="门票" :formatter="requireTicketFormatter"> </el-table-column>
|
|
|
+ <el-table-column prop="gameModeId" label="游戏模式" :formatter="modeFormatter"> </el-table-column>
|
|
|
+ <el-table-column prop="gameMapId" label="游戏地图" :formatter="mapFormatter"> </el-table-column>
|
|
|
<el-table-column prop="bonus" label="奖金"> </el-table-column>
|
|
|
<el-table-column prop="createdAt" label="创建时间" width="150"></el-table-column>
|
|
|
<el-table-column label="操作" align="center" fixed="right" width="150">
|
|
|
@@ -164,12 +167,12 @@ export default {
|
|
|
{ label: '用户', value: 'USER' }
|
|
|
],
|
|
|
statusOptions: [
|
|
|
- { label: '报名中', value: 'WAITING' },
|
|
|
- { label: '进行中', value: 'GAMING' },
|
|
|
- { label: '完成', value: 'FINISH' },
|
|
|
- { label: '待裁判', value: 'AUDIT' },
|
|
|
- { label: '流局', value: 'PASSED' },
|
|
|
- { label: '取消', value: 'CANCELLED' }
|
|
|
+ { label: '报名中', value: 'WAITING', type: '' },
|
|
|
+ { label: '进行中', value: 'GAMING', type: '' },
|
|
|
+ { label: '完成', value: 'FINISH', type: 'success' },
|
|
|
+ { label: '待裁判', value: 'AUDIT', type: 'warning' },
|
|
|
+ { label: '取消', value: 'CANCELLED', type: 'info' },
|
|
|
+ { label: '流局', value: 'INVALID', type: 'info' }
|
|
|
],
|
|
|
requireTicketOptions: [
|
|
|
{ label: '1', value: 'LEVEL_1' },
|
|
|
@@ -181,6 +184,10 @@ export default {
|
|
|
{ label: '7', value: 'LEVEL_7' },
|
|
|
{ label: '8', value: 'LEVEL_8' }
|
|
|
],
|
|
|
+ gameOptions: [],
|
|
|
+ modeOptions: [],
|
|
|
+ mapOptions: [],
|
|
|
+ ticketOptions: [],
|
|
|
loadingDetail: false,
|
|
|
showDetail: false,
|
|
|
selected: null,
|
|
|
@@ -197,6 +204,32 @@ export default {
|
|
|
return this.$refs.table.selection.map(i => i.id);
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.$http.post('/game/all', {}, { body: 'json' }).then(res => {
|
|
|
+ this.gameOptions = res.content.map(i => {
|
|
|
+ return {
|
|
|
+ label: i.name,
|
|
|
+ value: i.id
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.$http.post('/gameMode/all', {}, { body: 'json' }).then(res => {
|
|
|
+ this.modeOptions = res.content.map(i => {
|
|
|
+ return {
|
|
|
+ label: i.name,
|
|
|
+ value: i.id
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.$http.post('/gameMap/all', {}, { body: 'json' }).then(res => {
|
|
|
+ this.mapOptions = res.content.map(i => {
|
|
|
+ return {
|
|
|
+ label: i.name,
|
|
|
+ value: i.id
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
methods: {
|
|
|
beforeCreated() {
|
|
|
if (this.$route.query.status) {
|
|
|
@@ -204,28 +237,28 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
typeFormatter(row, column, cellValue, index) {
|
|
|
- let selectedOption = this.typeOptions.find(i => i.value === cellValue);
|
|
|
- if (selectedOption) {
|
|
|
- return selectedOption.label;
|
|
|
- }
|
|
|
- return '';
|
|
|
+ return (this.typeOptions.find(i => i.value === cellValue) || {}).label;
|
|
|
},
|
|
|
statusFormatter(row, column, cellValue, index) {
|
|
|
- let selectedOption = this.statusOptions.find(i => i.value === cellValue);
|
|
|
- if (selectedOption) {
|
|
|
- return selectedOption.label;
|
|
|
- }
|
|
|
- return '';
|
|
|
+ return (this.statusOptions.find(i => i.value === cellValue) || {}).label;
|
|
|
+ },
|
|
|
+ statusTagType(row) {
|
|
|
+ return (this.statusOptions.find(i => i.value === row.status) || {}).type;
|
|
|
+ },
|
|
|
+ gameFormatter(row, column, cellValue, index) {
|
|
|
+ return (this.gameOptions.find(i => i.value === cellValue) || {}).label;
|
|
|
+ },
|
|
|
+ modeFormatter(row, column, cellValue, index) {
|
|
|
+ return (this.modeOptions.find(i => i.value === cellValue) || {}).label;
|
|
|
+ },
|
|
|
+ mapFormatter(row, column, cellValue, index) {
|
|
|
+ return (this.mapOptions.find(i => i.value === cellValue) || {}).label;
|
|
|
},
|
|
|
requireTicketFormatter(row, column, cellValue, index) {
|
|
|
- let selectedOption = this.requireTicketOptions.find(i => i.value === cellValue);
|
|
|
- if (selectedOption) {
|
|
|
- return selectedOption.label;
|
|
|
- }
|
|
|
- return '';
|
|
|
+ return (this.requireTicketOptions.find(i => i.value === cellValue) || {}).label;
|
|
|
},
|
|
|
beforeGetData() {
|
|
|
- return { search: this.search, query: { del: false, needAudit: true, status: this.status } };
|
|
|
+ return { search: this.search, query: { del: false, status: this.status } };
|
|
|
},
|
|
|
toggleMultipleMode(multipleMode) {
|
|
|
this.multipleMode = multipleMode;
|