2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-08 10:16:14 +08:00
|
|
|
<el-dialog
|
|
|
|
v-dialogDrag
|
2019-11-14 13:59:33 +08:00
|
|
|
v-dialogLoading="pageLoading"
|
2019-08-08 10:16:14 +08:00
|
|
|
:title="title"
|
|
|
|
:visible.sync="show"
|
|
|
|
width="600px"
|
|
|
|
:before-close="doClose"
|
|
|
|
:z-index="2000"
|
|
|
|
:modal="false"
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
>
|
|
|
|
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
|
|
|
|
<el-tree
|
|
|
|
ref="tree"
|
2019-11-14 13:59:33 +08:00
|
|
|
node-key="group"
|
2019-08-08 10:16:14 +08:00
|
|
|
class="filter-tree"
|
2019-11-14 13:59:33 +08:00
|
|
|
default-expand-all
|
2019-08-08 10:16:14 +08:00
|
|
|
:data="trainingList"
|
|
|
|
:props="defaultProps"
|
|
|
|
:filter-node-method="filterNode"
|
|
|
|
:style="{height: height+'px'}"
|
|
|
|
@node-click="clickEvent"
|
|
|
|
>
|
2020-03-31 18:50:16 +08:00
|
|
|
<div slot-scope="{ node, data }" class="list-elem custom-tree-node">
|
2019-10-25 17:49:44 +08:00
|
|
|
<span v-if="data.state=='01'">{{ '['+data.mapName+']'+($t('global.trainingNotStart').replace('{name}', data.creator.nickName)) }}</span>
|
|
|
|
<span v-else>{{ '['+data.mapName+']'+($t('global.trainingHasStart').replace('{name}', data.creator.nickName)) }}</span>
|
2020-03-31 18:50:16 +08:00
|
|
|
<el-button
|
|
|
|
type="text"
|
|
|
|
size="mini"
|
|
|
|
@click="handleJoinRoom(data)"
|
|
|
|
>进入</el-button>
|
2019-11-14 13:59:33 +08:00
|
|
|
</div>
|
2019-08-08 10:16:14 +08:00
|
|
|
</el-tree>
|
|
|
|
</el-scrollbar>
|
2019-08-19 14:02:20 +08:00
|
|
|
<span
|
2019-08-19 20:27:23 +08:00
|
|
|
slot="footer"
|
2019-08-19 14:02:20 +08:00
|
|
|
class="dialog-footer"
|
|
|
|
>
|
2020-03-31 18:50:16 +08:00
|
|
|
<el-button v-loading="loading" type="primary" :disabled="!group" @click="handleJoin">{{ $t('global.joinNewRoom') }}</el-button>
|
2019-08-19 14:02:20 +08:00
|
|
|
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
|
2019-08-08 10:16:14 +08:00
|
|
|
</span>
|
|
|
|
</el-dialog>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-08 10:16:14 +08:00
|
|
|
import { getjointTrainList, getjointTraining, putJointTrainingSimulationEntrance } from '@/api/chat';
|
2020-03-16 15:29:26 +08:00
|
|
|
import { getjointTrainListNew, putJointTrainingSimulationEntranceNew, getjointTrainingNew } from '@/api/jointTraining';
|
2019-08-08 10:16:14 +08:00
|
|
|
import { getPublishMapInfo } from '@/api/jmap/map';
|
|
|
|
import { launchFullscreen } from '@/utils/screen';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 10:16:14 +08:00
|
|
|
export default {
|
2019-10-31 17:30:24 +08:00
|
|
|
name: 'DeomonList',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dialogShow: false,
|
|
|
|
height: 120,
|
|
|
|
trainingList: [],
|
|
|
|
defaultProps: {
|
|
|
|
label: 'roomName'
|
|
|
|
},
|
|
|
|
group: '',
|
|
|
|
state: '',
|
2019-11-14 13:59:33 +08:00
|
|
|
mapId: '',
|
|
|
|
loading: false,
|
|
|
|
pageLoading: false
|
2019-10-31 17:30:24 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
show() {
|
|
|
|
return this.dialogShow;
|
|
|
|
},
|
|
|
|
title() {
|
|
|
|
return this.$t('global.synthesisTrainingTitle');
|
|
|
|
},
|
|
|
|
isWatch() {
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
isjoin() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
filterNode(value, data) {
|
|
|
|
if (!value) return true;
|
|
|
|
return data.label.indexOf(value) !== -1;
|
|
|
|
},
|
|
|
|
clickEvent(obj, node, data) {
|
|
|
|
this.state = obj.state;
|
|
|
|
this.group = obj.group;
|
|
|
|
this.mapId = obj.mapId;
|
|
|
|
},
|
2019-11-14 13:59:33 +08:00
|
|
|
async doShow() {
|
2019-10-31 17:30:24 +08:00
|
|
|
try {
|
2019-11-14 13:59:33 +08:00
|
|
|
this.pageLoading = true;
|
|
|
|
this.dialogShow = true;
|
|
|
|
this.loading = false;
|
2020-03-31 18:50:16 +08:00
|
|
|
const resp = await getjointTrainListNew();
|
|
|
|
this.trainingList = resp.data || [];
|
2019-11-14 13:59:33 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
var training = this.trainingList[0] || {};
|
|
|
|
if (training) {
|
|
|
|
this.state = training.state;
|
|
|
|
this.group = training.group;
|
|
|
|
this.mapId = training.mapId;
|
|
|
|
this.$refs.tree.setCurrentKey(this.group);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
|
|
|
} finally {
|
|
|
|
this.pageLoading = false;
|
2019-10-31 17:30:24 +08:00
|
|
|
}
|
|
|
|
},
|
2019-11-14 13:59:33 +08:00
|
|
|
async doClose() {
|
2019-10-31 17:30:24 +08:00
|
|
|
this.dialogShow = false;
|
|
|
|
},
|
2020-03-31 18:50:16 +08:00
|
|
|
async handleJoinRoom(data) {
|
2019-11-14 13:59:33 +08:00
|
|
|
try {
|
2020-03-16 15:29:26 +08:00
|
|
|
const rest = await getPublishMapInfo(this.mapId);
|
2020-03-31 18:50:16 +08:00
|
|
|
await getjointTrainingNew(data.group);
|
|
|
|
if (data.state == '02') {
|
2019-10-31 17:30:24 +08:00
|
|
|
launchFullscreen();
|
2020-03-31 18:50:16 +08:00
|
|
|
const query = { lineCode: rest.data.lineCode, mapId: this.mapId, group: this.group, drawWay: true };
|
|
|
|
await putJointTrainingSimulationEntranceNew(this.group);
|
|
|
|
this.$router.push({ path: `/jointTrainingNew`, query: query });
|
|
|
|
} else if (data.state == '01') {
|
|
|
|
const query = { group: this.group, drawWay: true };
|
2019-10-31 17:30:24 +08:00
|
|
|
this.$router.push({ path: `/trainroom`, query: query });
|
|
|
|
}
|
2019-11-14 13:59:33 +08:00
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
|
|
|
} finally {
|
|
|
|
this.loading = false;
|
2019-10-31 17:30:24 +08:00
|
|
|
}
|
2020-03-31 18:50:16 +08:00
|
|
|
},
|
|
|
|
handleJoin() {
|
|
|
|
this.$emit('enterQcode');
|
|
|
|
this.dialogShow = false;
|
2019-10-31 17:30:24 +08:00
|
|
|
}
|
|
|
|
}
|
2019-08-08 10:16:14 +08:00
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
/deep/ {
|
|
|
|
.el-dialog__body {
|
|
|
|
padding: 0px 30px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-tree {
|
|
|
|
overflow: hidden !important;
|
2019-11-14 13:59:33 +08:00
|
|
|
.list-elem {
|
|
|
|
height: 30px;
|
|
|
|
line-height: 30px;
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.el-tree-node.is-current>.el-tree-node__content {
|
|
|
|
background-color: #e4e3e3 !important;
|
|
|
|
}
|
|
|
|
}
|
2020-03-31 18:50:16 +08:00
|
|
|
.custom-tree-node {
|
|
|
|
flex: 1;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
font-size: 14px;
|
|
|
|
padding-right: 8px;
|
|
|
|
}
|
2019-08-08 10:16:14 +08:00
|
|
|
</style>
|