实训管理

This commit is contained in:
dong 2022-08-19 18:03:30 +08:00
parent 3ca13fcd27
commit f1ffae48ef
3 changed files with 127 additions and 3 deletions

View File

@ -56,3 +56,18 @@ export function publishTraining(data) {
data data
}); });
} }
/** 更新当前用户的某个实训草稿的大字段信息 */
export function updateTrainingBlob(data) {
return request({
url: `/api/v2/draft/training/update/blob`,
method: 'post',
data
});
}
/** 获取当前用户的某个实训草稿的所有信息 */
export function getTrainingAll(trainingId) {
return request({
url: `/api/v2/draft/training/all/${trainingId}`,
method: 'get'
});
}

View File

@ -0,0 +1,106 @@
<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>
</template>
<script>
import { updateTrainingBlob, getTrainingAll } from '@/api/trainingManage';
import Vue from 'vue';
export default {
name: 'UpdateBlob',
props: {},
data() {
return {
dialogVisible: false,
formModel: {
id: '',
mapId: '',
mapLocationJson: '',
bgSceneJson: '',
runPlanId:'',
operaJson: '',
stepJson: '',
scoringRuleJson: '',
memberJson: '',
playerIdJson: '',
failureConditionJson: ''
}
};
},
computed: {
title() {
const t = '更新实训信息';
return t;
},
form() {
const form = {
labelWidth: '80px',
items: [
{ prop: 'mapLocationJson', label: '地图定位', type: 'text' },
{ prop: 'bgSceneJson', label: '初始背景', type: 'text' },
{ prop: 'runPlanId', label: '运行图', type: 'text' },
{ prop: 'operaJson', label: '操作列表', type: 'text' },
{ prop: 'stepJson', label: '步骤列表', type: 'text' },
{ prop: 'scoringRuleJson', label: '打分规则', type: 'text' },
{ prop: 'memberJson', label: '仿真成员', type: 'text' },
{ prop: 'playerIdJson', label: '参演成员', type: 'text' },
{ prop: 'failureConditionJson', label: '失败判定', type: 'text' }
]
};
return form;
}
},
methods: {
doShow(data) {
this.getTrainingAll(data);
this.dialogVisible = true;
},
doCreate() {
this.$refs.dataform.validateForm(async() => {
console.log(this.formModel, '---this.formModel---');
updateTrainingBlob(this.formModel).then(res => {
console.log('更新大数据成功', res);
this.doClose();
}).catch(err => {
console.log('更新大数据错误', err);
});
});
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false;
},
getTrainingAll(data) {
getTrainingAll(data.id).then(res => {
Object.keys(this.formModel).forEach(key => {
this.formModel[key] = res.data[key] || '';
});
console.log(res, this.formModel, '获取详细信息成功');
}).catch(err => {
console.log(err, '获取详细信息失败');
Object.keys(this.formModel).forEach(key => {
this.formModel[key] = '';
});
this.formModel.id = data.id;
this.formModel.mapId = data.mapId;
});
},
saveScenesStage() {
const data = Vue.prototype.$jlmap.$options;
return {scale: data.scaleRate, x: data.offsetX, y: data.offsetY};
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{
padding: 25px 65px 30px 10px;
}
</style>

View File

@ -8,6 +8,7 @@
</div> </div>
<QueryListPage ref="queryListPage" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <QueryListPage ref="queryListPage" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<Create ref="create" v-dialogDrag @edit="getListData" /> <Create ref="create" v-dialogDrag @edit="getListData" />
<EditBlob ref="EditBlob" v-dialogDrag />
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
@ -17,13 +18,14 @@ import { getTrainingList} from '@/api/trainingManage';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import Create from './create.vue'; import Create from './create.vue';
import { deleteTraining, publishTraining } from '@/api/trainingManage'; import EditBlob from './editBlob.vue';
import { admin, superAdmin} from '@/router/index'; import { deleteTraining, publishTraining, updateTrainingBlob } from '@/api/trainingManage';
export default { export default {
name: 'TrainingList', name: 'TrainingList',
components:{ components:{
Create Create,
EditBlob
}, },
props: {}, props: {},
data() { data() {
@ -135,6 +137,7 @@ export default {
}, },
drawUp(index, row) { drawUp(index, row) {
console.log('编辑', index, row); console.log('编辑', index, row);
this.$refs.EditBlob.doShow(row);
}, },
handleModify(index, row) { handleModify(index, row) {
console.log('修改', index, row); console.log('修改', index, row);