BUG:【教学管理】实训管理功能没有操作

This commit is contained in:
fan 2022-12-30 15:21:51 +08:00
parent b97a155b24
commit fa0f25690f

View File

@ -10,7 +10,7 @@ import { createSimulation } from '@/api/simulation';
import ConstConfig from '@/scripts/ConstConfig';
import { getSessionStorage } from '@/utils/auth';
import { launchFullscreen } from '@/utils/screen';
import { getAllPublishTrainingList, getPublishTrainingListInOrg } from '@/api/jmap/training';
import { getAllPublishTrainingList, getPublishTrainingListInOrg, publishTrainingPutOn, publishTrainingPutOff, publishTrainingDelete } from '@/api/jmap/training';
export default {
name:'TrainingManage',
data() {
@ -85,14 +85,30 @@ export default {
{
type: 'button',
title: this.$t('trainingManage.operate'),
hide: this.hasTeachingDataManage,
width: '150',
width: '200',
buttons: [
// {
// name: '',
// handleClick: this.loadScript,
// type: 'primary',
// showControl:(row) => { return row.mapSystem; }
// }
{
name: '加载',
handleClick: this.loadScript,
name: '上架',
handleClick: this.handlerShelf,
type: 'primary',
showControl:(row) => { return row.mapSystem; }
showControl: row => row.state !== 1
},
{
name: '下架',
handleClick: this.handlerSoldOut,
type: 'warning',
showControl: row => row.state !== 2
},
{
name: '删除',
handleClick: this.handlerDelete,
type: 'danger'
}
]
}
@ -121,6 +137,33 @@ export default {
});
},
methods: {
handlerShelf(index, data) {
publishTrainingPutOn({ids: [data.id]}).then(resp=>{
this.queryList.reload();
this.$message.success('实训上架成功!');
}).catch(e => this.$message.error('实训上架失败!'));
},
handlerSoldOut(index, data) {
console.log(data, index);
publishTrainingPutOff({ids: [data.id]}).then(resp=>{
this.queryList.reload();
this.$message.success('实训下架成功!');
}).catch(e => this.$message.error('实训下架失败!'));
},
handlerDelete(index, data) {
this.$confirm('此操作将删除此实训, 是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
publishTrainingDelete({ids: [data.id]}).then(response => {
this.$message.success('删除实训成功');
this.queryList.reload();
}).catch((error) => {
this.$messageBox(`删除实训失败: ${error.message}`);
});
});
},
hasTeachingDataManage() {
return this.$route.path.includes('/teachingDataManage/');
},