This commit is contained in:
joylink_cuiweidong 2022-08-22 14:44:27 +08:00
commit ac620e5607
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({ return request({
url: `/api/v2/draft/training/update/blob`, url: `/api/v2/draft/training/update/content`,
method: 'post', method: 'post',
data data
}); });

View File

@ -28,6 +28,7 @@ import approval from './approval';
import systemGenerate from './systemGenerate'; import systemGenerate from './systemGenerate';
import login from './login'; import login from './login';
import designPlatform from './designPlatform'; import designPlatform from './designPlatform';
import trainingManage from './trainingManage';
export default { export default {
enLocale, enLocale,
@ -59,5 +60,6 @@ export default {
approval, approval,
systemGenerate, systemGenerate,
login, 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 systemGenerate from './systemGenerate';
import login from './login'; import login from './login';
import designPlatform from './designPlatform'; import designPlatform from './designPlatform';
import trainingManage from './trainingManage';
export default { export default {
cnLocale, cnLocale,
@ -59,5 +60,6 @@ export default {
approval, approval,
systemGenerate, systemGenerate,
login, 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,4 +1,10 @@
<template> <template>
<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> <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" /> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -6,18 +12,33 @@
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button> <el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div>
</template> </template>
<script> <script>
import { updateTrainingBlob, getTrainingAll } from '@/api/trainingManage'; import { updateTrainingContent, getTrainingAll } from '@/api/trainingManage';
import Vue from 'vue'; import Vue from 'vue';
export default { export default {
name: 'UpdateBlob', name: 'EditContent',
props: {}, props: {},
data() { data() {
return { return {
tabVisible: false,
dialogVisible: false, dialogVisible: false,
editData: {
id: '',
mapId: '',
mapLocation: '',
bgScene: '',
runPlanId:'',
operaList: '',
stepList: '',
scoringRuleList: '',
memberList: '',
playerIdList: '',
failureCondition: ''
},
formModel: { formModel: {
id: '', id: '',
mapId: '', mapId: '',
@ -55,17 +76,29 @@ export default {
] ]
}; };
return form; return form;
},
rules() {
const crules = {
type: [
{ required: true, message: '请选择实训类型', trigger: 'blur' }
]
};
return crules;
} }
}, },
methods: { methods: {
minisize() {
this.dialogVisible = true;
},
doShow(data) { doShow(data) {
this.getTrainingAll(data); this.getTrainingAll(data);
this.dialogVisible = true; this.dialogVisible = true;
this.tabVisible = true;
}, },
doCreate() { doCreate() {
this.$refs.dataform.validateForm(async() => { this.$refs.dataform.validateForm(async() => {
console.log(this.formModel, '---this.formModel---'); console.log(this.formModel, '---this.formModel---');
updateTrainingBlob(this.formModel).then(res => { updateTrainingContent(this.formModel).then(res => {
console.log('更新大数据成功', res); console.log('更新大数据成功', res);
this.doClose(); this.doClose();
}).catch(err => { }).catch(err => {
@ -74,7 +107,7 @@ export default {
}); });
}, },
doClose() { doClose() {
this.$refs.dataform.resetForm(); // this.$refs.dataform.resetForm();
this.dialogVisible = false; this.dialogVisible = false;
}, },
getTrainingAll(data) { getTrainingAll(data) {
@ -103,4 +136,22 @@ export default {
/deep/ .el-dialog--center .el-dialog__body{ /deep/ .el-dialog--center .el-dialog__body{
padding: 25px 65px 30px 10px; 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> </style>

View File

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

View File

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