实训功能

This commit is contained in:
dong 2022-08-22 13:43:40 +08:00
parent dd43337d50
commit ba81b37ca0
8 changed files with 134 additions and 36 deletions

View File

@ -57,9 +57,9 @@ export function publishTraining(data) {
});
}
/** 更新当前用户的某个实训草稿的大字段信息 */
export function updateTrainingBlob(data) {
export function updateTrainingContent(data) {
return request({
url: `/api/v2/draft/training/update/blob`,
url: `/api/v2/draft/training/update/content`,
method: 'post',
data
});

View File

@ -28,6 +28,7 @@ import approval from './approval';
import systemGenerate from './systemGenerate';
import login from './login';
import designPlatform from './designPlatform';
import trainingManage from './trainingManage';
export default {
enLocale,
@ -59,5 +60,6 @@ export default {
approval,
systemGenerate,
login,
designPlatform
designPlatform,
trainingManage
};

View File

@ -0,0 +1,14 @@
export default {
create: 'create',
editTagTitle: 'Training establishment',
name: 'The name of the training',
description: 'description',
type: 'type',
labelJson: 'tag',
operate: 'operate',
record: 'record',
modify: 'modify',
delete: 'delete',
publish: 'publish',
preview: 'preview'
};

View File

@ -28,6 +28,7 @@ import approval from './approval';
import systemGenerate from './systemGenerate';
import login from './login';
import designPlatform from './designPlatform';
import trainingManage from './trainingManage';
export default {
cnLocale,
@ -59,5 +60,6 @@ export default {
approval,
systemGenerate,
login,
designPlatform
designPlatform,
trainingManage
};

View File

@ -0,0 +1,14 @@
export default {
create: '创建',
editTagTitle: '实训编制',
name: '实训名称',
description: '描述',
type: '类型',
labelJson: '标签',
operate: '操作',
record: '编制',
modify: '修改',
delete: '删除',
publish: '发布',
preview: '预览'
};

View File

@ -1,23 +1,44 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :modal="false" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
<div>
<div class="editContentTab">
<div v-if="tabVisible" class="editContentTabLable" @click="minisize">
<span class="titleStyle">{{ $t('trainingManage.editTagTitle') }}</span>
</div>
</div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :modal="false" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { updateTrainingBlob, getTrainingAll } from '@/api/trainingManage';
import { updateTrainingContent, getTrainingAll } from '@/api/trainingManage';
import Vue from 'vue';
export default {
name: 'UpdateBlob',
name: 'EditContent',
props: {},
data() {
return {
tabVisible: false,
dialogVisible: false,
editData: {
id: '',
mapId: '',
mapLocation: '',
bgScene: '',
runPlanId:'',
operaList: '',
stepList: '',
scoringRuleList: '',
memberList: '',
playerIdList: '',
failureCondition: ''
},
formModel: {
id: '',
mapId: '',
@ -55,17 +76,29 @@ export default {
]
};
return form;
},
rules() {
const crules = {
type: [
{ required: true, message: '请选择实训类型', trigger: 'blur' }
]
};
return crules;
}
},
methods: {
minisize() {
this.dialogVisible = true;
},
doShow(data) {
this.getTrainingAll(data);
this.dialogVisible = true;
this.tabVisible = true;
},
doCreate() {
this.$refs.dataform.validateForm(async() => {
console.log(this.formModel, '---this.formModel---');
updateTrainingBlob(this.formModel).then(res => {
updateTrainingContent(this.formModel).then(res => {
console.log('更新大数据成功', res);
this.doClose();
}).catch(err => {
@ -74,7 +107,7 @@ export default {
});
},
doClose() {
this.$refs.dataform.resetForm();
// this.$refs.dataform.resetForm();
this.dialogVisible = false;
},
getTrainingAll(data) {
@ -103,4 +136,22 @@ export default {
/deep/ .el-dialog--center .el-dialog__body{
padding: 25px 65px 30px 10px;
}
.editContentTab{
position: absolute;
z-index: 10;
right: 12px;
top: calc(45% + 100px);
}
.editContentTabLable{
position: absolute;
background: #fff;
border-radius: 5px 0px 0px 5px ;
padding: 5px 0px;
width: 23px;
text-align: center;
left: 50%;
transform: translateX(-50%);
cursor: pointer;
top:-28px;
}
</style>

View File

@ -6,15 +6,18 @@
<el-button size="small" @click="showList">实训列表</el-button>
</el-button-group>
</div>
<TrainingList ref="trainingList" />
<TrainingList ref="trainingList" @editBlob="editBlob" />
<EditContent ref="EditBlob" v-dialogDrag />
</div>
</template>
<script>
import TrainingList from './trainingList.vue';
import EditContent from './EditContent.vue';
export default {
name:'DemonMenu',
components:{
TrainingList
TrainingList,
EditContent
},
props:{
},
@ -48,6 +51,9 @@ export default {
},
showList() {
this.$refs.trainingList.doShow();
},
editBlob(data) {
this.$refs.EditBlob.doShow(data);
}
}

View File

@ -1,14 +1,14 @@
<template>
<el-dialog v-dialogDrag title="实训管理" :visible.sync="dialogVisible" width="1000px" :before-close="doClose" center>
<div>
<div class="scriptHeader">
<div class="scriptList">实训草稿列表</div>
<div class="trainingHeader">
<div class="trainingList">实训草稿列表</div>
<div class="flexNull" />
<el-button size="small" type="primary" class="createScript" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button>
<el-button size="small" type="primary" class="createScript" @click="handleCreate">{{ $t('trainingManage.create') }}</el-button>
</div>
<QueryListPage ref="queryListPage" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<Create ref="create" v-dialogDrag @edit="getListData" />
<EditBlob ref="EditBlob" v-dialogDrag />
</div>
</el-dialog>
</template>
@ -18,14 +18,13 @@ import { getTrainingList} from '@/api/trainingManage';
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
import Create from './create.vue';
import EditBlob from './editBlob.vue';
import { deleteTraining, publishTraining, updateTrainingBlob } from '@/api/trainingManage';
import { deleteTraining, publishTraining } from '@/api/trainingManage';
export default {
name: 'TrainingList',
components:{
Create,
EditBlob
Create
},
props: {},
data() {
@ -46,52 +45,58 @@ export default {
indexShow: true,
columns: [
{
title: '实训名称',
title: this.$t('trainingManage.name'),
prop: 'name'
},
{
title: '描述',
title: this.$t('trainingManage.description'),
prop: 'description'
},
{
title: '类型',
title: this.$t('trainingManage.type'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.covertData(row); },
tagType: (row) => { return ''; }
},
{
title: '标签',
title: this.$t('trainingManage.labelJson'),
prop: 'labelJson'
},
{
type: 'button',
title: this.$t('scriptRecord.operate'),
title: this.$t('trainingManage.operate'),
width: '450',
buttons: [
{
name: this.$t('scriptRecord.scriptRecord'),
name: this.$t('trainingManage.record'),
handleClick: this.drawUp,
type: 'success',
showControl:(row) => { return row.id; }
},
{
name: this.$t('scriptRecord.scriptModify'),
name: this.$t('trainingManage.modify'),
handleClick: this.handleModify,
type: 'primary',
showControl:(row) => { return row.id; }
},
{
name: this.$t('scriptRecord.scriptDelete'),
name: this.$t('trainingManage.delete'),
handleClick: this.deleteScript,
type: 'danger',
showControl:(row) => { return row.id; }
},
{
name: this.$t('scriptRecord.publish'),
name: this.$t('trainingManage.publish'),
handleClick: this.publishScript,
type: 'primary',
showControl:(row) => { return row.id; }
},
{
name: this.$t('trainingManage.preview'),
handleClick: this.previewScript,
type: 'primary',
showControl:(row) => { return row.id; }
}
]
}
@ -137,7 +142,8 @@ export default {
},
drawUp(index, row) {
console.log('编辑', index, row);
this.$refs.EditBlob.doShow(row);
this.$emit('editBlob', row);
this.doClose();
},
handleModify(index, row) {
console.log('修改', index, row);
@ -164,6 +170,9 @@ export default {
console.log('发布实训失败', err);
});
},
previewScript(index, row) {
console.log('预览', index, row);
},
getListData() {
this.$refs.queryListPage && this.$refs.queryListPage.commitQuery();
}
@ -174,7 +183,7 @@ export default {
/deep/ .el-dialog--center .el-dialog__body{
padding: 10px 25px 10px 25px;
}
.scriptHeader {
.trainingHeader {
display: flex;
justify-content: space-between;
align-items: center;