存在仿真管理调整

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){ if (!role) {
role = ""; role = '';
} }
return request({ return request({
url: `/common/simulation/${group}/members?role=${role}`, url: `/common/simulation/${group}/members?role=${role}`,
@ -96,3 +96,18 @@ export function simulationStart(group) {
method: 'put' 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) { // export function getExistingSimulation(params) {
return request({ // return request({
url: `/manage/simulation/exists`, // url: `/manage/simulation/exists`,
method: 'get', // method: 'get',
params // params
}); // });
} // }
//
/** 删除存在的仿真 */ // /** 删除存在的仿真 */
export function deleteExistingSimulation(group) { // export function deleteExistingSimulation(group) {
return request({ // return request({
url: `/manage/simulation/${group}`, // url: `/manage/simulation/${group}`,
method: 'delete' // method: 'delete'
}); // });
} // }
/** 获取任务录制的所有动作(新版)*/ /** 获取任务录制的所有动作(新版)*/
export function getScriptAllAction(group) { export function getScriptAllAction(group) {

View File

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

View File

@ -1,15 +1,19 @@
<template> <template>
<div> <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> </div>
</template> </template>
<script> <script>
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie'; 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 { export default {
name: 'SimulationManage', name: 'SimulationManage',
components: { components: {
ViewMember
}, },
data() { data() {
return { return {
@ -44,66 +48,53 @@ export default {
}, },
simulationTypeList: [{label: '仿真', value: 'SIMULATION'}, {label: '课程', value: 'LESSON'}, {label: '考试', value: 'EXAM'}, {label: '剧本编制', value: 'SCRIPT_MAKING'}], simulationTypeList: [{label: '仿真', value: 'SIMULATION'}, {label: '课程', value: 'LESSON'}, {label: '考试', value: 'EXAM'}, {label: '剧本编制', value: 'SCRIPT_MAKING'}],
queryList: { queryList: {
query: getExistingSimulation, query: getExistSimulationList,
selectCheckShow: false, selectCheckShow: false,
paginationHiden: true,
indexShow: true, indexShow: true,
columns: [ columns: [
// {
// title: this.$t('system.userName'),
// prop: 'creator.name'
// },
{ {
title: this.$t('system.userName'), title: '仿真ID',
prop: 'creator.name' 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'), title: this.$t('system.mapName'),
prop: 'map.name' prop: 'map.name',
},
{
title: 'Group',
prop: 'group'
},
{
title: this.$t('system.isError'),
prop: 'error',
type: 'tag', 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) => { tagType: (row) => {
switch (row.error) { return 'success';
case true: return 'success';
case false: return 'danger';
}
} }
}, },
{
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'), title: this.$t('system.prdType'),
prop: 'prodType', prop: 'prodType',
@ -112,16 +103,21 @@ export default {
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ // {
title: this.$t('system.simulationGroupId'), // title: this.$t('system.simulationGroupId'),
prop: 'onlineUserIdList', // prop: 'userList',
type: 'basicText', // type: 'basicText',
columnValue: (row) => { return this.listJoiningTogether(row.onlineUserIdList); } // columnValue: (row) => { return this.listJoiningTogether(row.userList); }
}, // },
{ {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
buttons: [ buttons: [
{
name: '仿真用户信息',
handleClick: this.viewMember,
type: ''
},
{ {
name: this.$t('system.destory'), name: this.$t('system.destory'),
handleClick: this.handleDelete, handleClick: this.handleDelete,
@ -146,15 +142,18 @@ export default {
this.queryForm.queryObject.prdType.config.data = this.prdTypeList; this.queryForm.queryObject.prdType.config.data = this.prdTypeList;
}, },
methods: { methods: {
listJoiningTogether(sessionList) { // listJoiningTogether(sessionList) {
let sessionId = ''; // let sessionId = '';
if (sessionList && sessionList.length > 0) { // if (sessionList && sessionList.length > 0) {
sessionList.forEach((item) => { // sessionList.forEach((item) => {
sessionId = sessionId + item + ','; // sessionId = sessionId + item.name + '(' + item.id + ')' + ',';
}); // });
sessionId = sessionId.substring(0, sessionId.length - 1); // sessionId = sessionId.substring(0, sessionId.length - 1);
} // }
return sessionId; // return sessionId;
// },
viewMember(index, row) {
this.$refs.viewMember.doShow(row.id);
}, },
handleDelete(index, row) { handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelUserSimulation'), this.$t('global.tips'), { this.$confirm(this.$t('system.wellDelUserSimulation'), this.$t('global.tips'), {
@ -162,7 +161,7 @@ export default {
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
deleteExistingSimulation(row.group).then(response => { destroySimulation(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess')); this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable(); this.reloadTable();
}).catch(() => { }).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>