存在仿真管理调整

This commit is contained in:
fan 2021-06-17 17:52:28 +08:00
parent fefbf97c99
commit 841763d48a
5 changed files with 167 additions and 89 deletions

View File

@ -29,10 +29,10 @@ export function sendSimulationCommand(group, memberId, type, data) {
});
}
/** 获取仿真成员列表 */
export function getMemberListCommon(group,role) {
export function getMemberListCommon(group, role) {
if(!role){
role = "";
if (!role) {
role = '';
}
return request({
url: `/common/simulation/${group}/members?role=${role}`,
@ -96,3 +96,18 @@ export function simulationStart(group) {
method: 'put'
});
}
/** 获取存在的仿真列表 */
export function getExistSimulationList(params) {
return request({
url: `/common/simulation/list`,
method: 'get',
params
});
}
/** 获取仿真用户信息 */
export function getSimulationUserInfo(id) {
return request({
url: `/common/simulation/${id}/users`,
method: 'get'
});
}

View File

@ -163,22 +163,22 @@ export function cancelReplaceBg(group) {
});
}
/** 分页查询存在的仿真 */
export function getExistingSimulation(params) {
return request({
url: `/manage/simulation/exists`,
method: 'get',
params
});
}
/** 删除存在的仿真 */
export function deleteExistingSimulation(group) {
return request({
url: `/manage/simulation/${group}`,
method: 'delete'
});
}
// /** 分页查询存在的仿真 */
// export function getExistingSimulation(params) {
// return request({
// url: `/manage/simulation/exists`,
// method: 'get',
// params
// });
// }
//
// /** 删除存在的仿真 */
// export function deleteExistingSimulation(group) {
// return request({
// url: `/manage/simulation/${group}`,
// method: 'delete'
// });
// }
/** 获取任务录制的所有动作(新版)*/
export function getScriptAllAction(group) {

View File

@ -377,8 +377,10 @@ export default {
query(queryData) {
this.queryData = queryData;
// this.pageIndex = 1;
this.queryData[this.currentpagerConfig.pageSize] = this.pageSize;
this.queryData[this.currentpagerConfig.pageIndex] = this.pageIndex;
if (!this.queryList.paginationHiden) {
this.queryData[this.currentpagerConfig.pageSize] = this.pageSize;
this.queryData[this.currentpagerConfig.pageIndex] = this.pageIndex;
}
// this.queryList.reload();
this.choose = null;
this.commitQuery();
@ -512,6 +514,7 @@ export default {
self.enableQuery();
return;
}
delete this.queryData.undefined;
if (this.queryList.query instanceof Function) {
this.queryList.query(this.queryData).then(response => {
self.enableQuery();
@ -519,7 +522,7 @@ export default {
this.queryList.afterQuery(response.data);
}
const resultData = response.data;
this.$set(this.queryList, 'data', resultData.list);
this.$set(this.queryList, 'data', this.queryList.paginationHiden ? resultData : resultData.list);
this.$set(this.queryList, 'total', resultData.total);
if (resultData.pageNum) {
this.pageIndex = resultData.pageNum;

View File

@ -1,15 +1,19 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<QueryListPage ref="queryListPage" :query-form="queryForm" :query-list="queryList" />
<view-member ref="viewMember" />
</div>
</template>
<script>
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import { getExistingSimulation, deleteExistingSimulation } from '@/api/simulation';
import ViewMember from './viewMember';
// import { getExistingSimulation, deleteExistingSimulation } from '@/api/simulation';
import { getExistSimulationList, destroySimulation } from '@/api/rtSimulation';
export default {
name: 'SimulationManage',
components: {
ViewMember
},
data() {
return {
@ -44,66 +48,53 @@ export default {
},
simulationTypeList: [{label: '仿真', value: 'SIMULATION'}, {label: '课程', value: 'LESSON'}, {label: '考试', value: 'EXAM'}, {label: '剧本编制', value: 'SCRIPT_MAKING'}],
queryList: {
query: getExistingSimulation,
query: getExistSimulationList,
selectCheckShow: false,
paginationHiden: true,
indexShow: true,
columns: [
// {
// title: this.$t('system.userName'),
// prop: 'creator.name'
// },
{
title: this.$t('system.userName'),
prop: 'creator.name'
title: '仿真ID',
prop: 'id'
},
{
title: '仿真状态',
prop: 'state',
type: 'tag',
columnValue: (row) => {
if (row.state === 1) { return '仿真开始'; } else if (row.state === 0) { return '仿真暂停'; } else if (row.state === 4) { return '仿真错误'; } else { return '未知状态'; }
},
tagType: (row) => {
return 'success';
}
},
{
title: '仿真倍速',
prop: 'speed'
},
// {
// title: '',
// prop: 'type',
// type: 'tag',
// columnValue: (row) => { return this.$convertField(row.type, this.simulationTypeList, ['value', 'label']); },
// tagType: (row) => { return ''; }
//
// },
{
title: this.$t('system.mapName'),
prop: 'map.name'
},
{
title: 'Group',
prop: 'group'
},
{
title: this.$t('system.isError'),
prop: 'error',
prop: 'map.name',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.error, 'Whether'); },
columnValue: (row) => {
return `${row.map.name}( ${row.map.id}- ${row.map.version})`;
},
tagType: (row) => {
switch (row.error) {
case true: return 'success';
case false: return 'danger';
}
return 'success';
}
},
{
title: this.$t('system.isSuspend'),
prop: 'pause',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.pause, 'Whether'); },
tagType: (row) => {
switch (row.pause) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('system.isDrivingAsplanned'),
prop: 'planRunning',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.planRunning, 'Whether'); },
tagType: (row) => {
switch (row.runAsPlan) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: '类型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.simulationTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('system.prdType'),
prop: 'prodType',
@ -112,16 +103,21 @@ export default {
tagType: (row) => { return ''; }
},
{
title: this.$t('system.simulationGroupId'),
prop: 'onlineUserIdList',
type: 'basicText',
columnValue: (row) => { return this.listJoiningTogether(row.onlineUserIdList); }
},
// {
// title: this.$t('system.simulationGroupId'),
// prop: 'userList',
// type: 'basicText',
// columnValue: (row) => { return this.listJoiningTogether(row.userList); }
// },
{
type: 'button',
title: this.$t('global.operate'),
buttons: [
{
name: '仿真用户信息',
handleClick: this.viewMember,
type: ''
},
{
name: this.$t('system.destory'),
handleClick: this.handleDelete,
@ -146,15 +142,18 @@ export default {
this.queryForm.queryObject.prdType.config.data = this.prdTypeList;
},
methods: {
listJoiningTogether(sessionList) {
let sessionId = '';
if (sessionList && sessionList.length > 0) {
sessionList.forEach((item) => {
sessionId = sessionId + item + ',';
});
sessionId = sessionId.substring(0, sessionId.length - 1);
}
return sessionId;
// listJoiningTogether(sessionList) {
// let sessionId = '';
// if (sessionList && sessionList.length > 0) {
// sessionList.forEach((item) => {
// sessionId = sessionId + item.name + '(' + item.id + ')' + ',';
// });
// sessionId = sessionId.substring(0, sessionId.length - 1);
// }
// return sessionId;
// },
viewMember(index, row) {
this.$refs.viewMember.doShow(row.id);
},
handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelUserSimulation'), this.$t('global.tips'), {
@ -162,7 +161,7 @@ export default {
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteExistingSimulation(row.group).then(response => {
destroySimulation(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {

View File

@ -0,0 +1,61 @@
<template>
<el-dialog v-dialogDrag title="仿真用户列表" :visible.sync="dialogVisible" width="80%" :before-close="handleClose" center :close-on-click-modal="false">
<el-table
:data="tableData"
border
style="width: 100%"
>
<el-table-column prop="id" label="用户Id" width="100" />
<el-table-column prop="name" label="用户名" width="100" />
<el-table-column prop="creator" label="仿真创建者" width="100">
<template slot-scope="scope">
<span>{{ scope.row.creator? '是':'否' }}</span>
</template>
</el-table-column>
<el-table-column prop="wsSubscribeMap" label="订阅路径">
<template slot-scope="scope">
<template v-for="(item, key) in scope.row.wsSubscribeMap">
<div :key="key">{{ key + ':' }}
<template v-for="(elem, i) in item">
<el-tag :key="key+i">{{ elem }}</el-tag>
</template>
</div>
</template>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import { getSimulationUserInfo } from '@/api/rtSimulation';
export default {
name: 'DictionaryEdit',
data() {
return {
dialogVisible: false,
tableData: [],
title:'',
isAdd:false
};
},
computed: {
},
methods: {
doShow(id) {
getSimulationUserInfo(id).then(resp => {
this.dialogVisible = true;
this.tableData = resp.data;
}).catch(error => {
this.$message.error('获取仿真用户列表失表:' + error.message);
});
},
handleClose() {
this.dialogVisible = false;
}
}
};
</script>