实训编制功能

This commit is contained in:
dong 2022-08-23 15:17:21 +08:00
parent 831cb965d9
commit 546029e4ad
8 changed files with 222 additions and 80 deletions

View File

@ -32,10 +32,17 @@ export function updateTraining(data) {
data data
}); });
} }
/** 查询步骤列表 */
export function getTrainingStepList(trainingId) {
return request({
url: `/api/v2/draft/training/${trainingId}/step/list`,
method: 'get'
});
}
/** 修改实训所有步骤 */ /** 修改实训所有步骤 */
export function updateTrainingStep(id, data) { export function updateTrainingStep(id, data) {
return request({ return request({
url: ` /api/v2/draft/training/${id}/step/update`, url: `/api/v2/draft/training/${id}/step/update`,
method: 'put', method: 'put',
data: data data: data
}); });
@ -71,3 +78,19 @@ export function getTrainingAll(trainingId) {
method: 'get' method: 'get'
}); });
} }
/** 单独更新当前用户的某个实训草稿的初始背景 */
export function updateTrainingBackgroud(data) {
return request({
url: `/api/v2/draft/training/update/content/backgroud`,
method: 'post',
data
});
}
/** 更新当前用户实训草稿定位 */
export function updateTrainingMaplocation(data) {
return request({
url: `/api/v2/draft/training/update/content/maplocation`,
method: 'post',
data
});
}

View File

@ -657,4 +657,7 @@ export default {
margin-left: 8px; margin-left: 8px;
} }
.pageContainerView{text-align: center; margin: 10px 0; height: 40px;} .pageContainerView{text-align: center; margin: 10px 0; height: 40px;}
.hideOutContent {
min-height: 12px;
}
</style> </style>

View File

@ -10,5 +10,16 @@ export default {
modify: 'modify', modify: 'modify',
delete: 'delete', delete: 'delete',
publish: 'publish', publish: 'publish',
preview: 'preview' preview: 'preview',
mapLocation: 'Save map positioning',
saveBackground: 'Save Background',
saveData: 'Save Data',
stepNum: 'Step number',
stepDescription: 'Steps describe',
rulesId: 'Please enter the step number',
rulesDescription: 'Enter the prompt information',
createStepInfo: 'Creating Procedure Information',
editStepInfo: 'Modifying Step Information',
saveStepData: 'Save Step Information',
roleSelect: 'role choices'
}; };

View File

@ -10,5 +10,16 @@ export default {
modify: '修改', modify: '修改',
delete: '删除', delete: '删除',
publish: '发布', publish: '发布',
preview: '预览' preview: '预览',
mapLocation: '保存地图定位',
saveBackground: '保存背景',
saveData: '保存数据',
stepNum: '步骤序号',
stepDescription: '步骤描述',
rulesId: '请输入步骤序号',
rulesDescription: '请输入步骤提示信息',
createStepInfo: '创建步骤信息',
editStepInfo: '修改步骤信息',
saveStepData: '保存步骤',
roleSelect: '角色选择'
}; };

View File

@ -255,8 +255,8 @@ export default {
{ label: 'SD', value: 'SD' } { label: 'SD', value: 'SD' }
], ],
trainingType: [ // 实训类型 trainingType: [ // 实训类型
{ enlabel: 'single operation', label: '单操', value: 'single'}, { enlabel: 'single operation', label: '单操', value: 'SINGLE'},
{ enlabel: 'scene operation', label: '场景', value: 'scene'} { enlabel: 'scene operation', label: '场景', value: 'SCENE'}
], ],
ioDirectionList:[ // 出入口类型 ioDirectionList:[ // 出入口类型
{value:'DOWN_IN_STATION', label:'下行进站'}, {value:'DOWN_IN_STATION', label:'下行进站'},

View File

@ -5,115 +5,194 @@
<span class="titleStyle">{{ $t('trainingManage.editTagTitle') }}</span> <span class="titleStyle">{{ $t('trainingManage.editTagTitle') }}</span>
</div> </div>
</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="800px" :modal="false" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" /> <div class="stepListBox">
<el-button size="small" type="primary" @click="addStep">新增步骤</el-button>
<QueryListPage ref="queryListPage" :query-form="queryForm" :query-list="queryList" />
</div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button> <el-button size="small" type="primary" @click="updateMapLocation">{{ $t('trainingManage.mapLocation') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button> <el-button size="small" type="primary" @click="saveScenesStage">{{ $t('trainingManage.saveBackground') }}</el-button>
<el-button size="small" type="success" @click="saveStepData">{{ $t('trainingManage.saveStepData') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { updateTrainingContent, getTrainingAll } from '@/api/trainingManage'; import { updateTrainingStep, getTrainingAll, updateTrainingBackgroud, getTrainingStepList, updateTrainingMaplocation } from '@/api/trainingManage';
import Vue from 'vue'; import Vue from 'vue';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
export default { export default {
name: 'EditContent', name: 'EditContent',
props: {}, components:{},
props: {
editData: {
type: Object,
default() {
return {};
}
}
},
data() { data() {
return { return {
tabVisible: false, tabVisible: false,
dialogVisible: false, dialogVisible: false,
editData: {
id: '',
mapId: '',
mapLocation: '',
bgScene: '',
runPlanId:'',
operaList: '',
stepList: '',
scoringRuleList: '',
memberList: '',
playerIdList: '',
failureCondition: ''
},
formModel: { formModel: {
id: '',
mapId: '',
mapLocationJson: '', mapLocationJson: '',
bgSceneJson: '', // runPlanId:'',
runPlanId:'', // operaJson: '',
operaJson: '',
stepJson: '', stepJson: '',
scoringRuleJson: '', scoringRuleJson: '',
memberJson: '', // memberJson: '',
playerIdJson: '', // playerIdJson: '',
failureConditionJson: '' failureConditionJson: ''
},
queryForm: {
show: false
},
queryList: {
height: '500px',
paginationHiden: true,
selectCheckShow: false,
data: [],
columns: [
{
title: this.$t('trainingManage.stepNum'),
width: '80',
prop: 'id',
type: 'basic',
edit: true
},
{
title: this.$t('trainingManage.roleSelect'),
width: '200',
prop: 'memberId',
type: 'select',
options: []
},
{
title: this.$t('trainingManage.stepDescription'),
prop: 'description',
type: 'basic',
edit: true
},
{
type: 'button',
title: this.$t('global.operate'),
width: '100',
buttons: [
{
name: this.$t('global.delete'),
type: 'danger',
handleClick: this.handleDelete
}
]
}
]
} }
}; };
}, },
computed: { computed: {
title() { title() {
const t = '更新实训信息'; const t = this.$t('trainingManage.editTagTitle');
return t; return t;
}, },
form() { group() {
const form = { return this.$route.query.group;
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;
}, },
rules() { watch: {
const crules = { '$store.state.training.memberList': function (val) {
type: [ if (val && val.length) {
{ required: true, message: '请选择实训类型', trigger: 'blur' } const memberData = this.$store.state.training.memberData;
] let activeTrainList = [];
}; if (this.$store.state.training.started) {
return crules; activeTrainList = this.$store.state.map.activeTrainList;
}
// 仿
const result = covertMemberData(activeTrainList, Object.values(memberData));
let list = [];
result.deviceListData.forEach(item => {
list = list.concat(item);
});
list.forEach(every => {
every.code = every.id;
every.name = `${every.label}(${every.type})`;
});
const colObj = this.queryList.columns.find(item => {
return item.prop == 'memberId';
});
if (colObj) {
colObj.options = list;
}
}
} }
}, },
methods: { methods: {
addStep() {
const obj = {
id: this.queryList.data.length + 1 + '',
memberId: '',
description: ''
// triggerCondition: [],
// completionCondition:[],
// failureCondition: [],
// operations: []
};
this.queryList.data.push(obj);
},
handleDelete(index, row) {
console.log('删除', index, row);
this.queryList.data.splice(index, 1);
},
minisize() { minisize() {
this.dialogVisible = true; this.dialogVisible = true;
}, },
doShow(data) { doShow(data) {
this.getTrainingAll(data); // this.getTrainingAllInfo(data);
this.getStepList(data);
this.dialogVisible = true; this.dialogVisible = true;
this.tabVisible = true; this.tabVisible = true;
}, },
doCreate() { saveStepData() {
this.$refs.dataform.validateForm(async() => { const list = [];
console.log(this.formModel, '---this.formModel---'); this.queryList.data.forEach(item => {
updateTrainingContent(this.formModel).then(res => { const obj = {
...item
};
delete obj.isEdit;
list.push(obj);
});
updateTrainingStep(this.editData.id, list).then(res => {
console.log('更新大数据成功', res); console.log('更新大数据成功', res);
this.doClose(); this.doClose();
}).catch(err => { }).catch(err => {
console.log('更新大数据错误', err); console.log('更新大数据错误', err);
}); });
});
}, },
doClose() { doClose() {
// this.$refs.dataform.resetForm();
this.dialogVisible = false; this.dialogVisible = false;
}, },
getTrainingAll(data) { getStepList(data) { //
getTrainingStepList(data.id).then(res => {
console.log(res, '获取步骤成功');
this.queryList.data = res.data;
}).catch(err => {
console.log(err, '获取步骤失败');
this.queryList.data = [];
});
},
getTrainingAllInfo(data) {
getTrainingAll(data.id).then(res => { getTrainingAll(data.id).then(res => {
Object.keys(this.formModel).forEach(key => { Object.keys(this.formModel).forEach(key => {
this.formModel[key] = res.data[key] || ''; this.formModel[key] = res.data[key] || '';
if (key == 'stepJson') {
const sList = res.data[key] ? JSON.parse(res.data[key]) : [];
this.queryList.data = Object.prototype.toString.call(sList) === '[object Array]' ? sList : [];
}
}); });
console.log(res, this.formModel, '获取详细信息成功'); console.log(res, this.formModel, '获取详细信息成功');
}).catch(err => { }).catch(err => {
@ -121,21 +200,31 @@ export default {
Object.keys(this.formModel).forEach(key => { Object.keys(this.formModel).forEach(key => {
this.formModel[key] = ''; this.formModel[key] = '';
}); });
this.formModel.id = data.id; this.queryList.data = [];
this.formModel.mapId = data.mapId; });
},
updateMapLocation() {
console.log('更新地图定位');
const data = Vue.prototype.$jlmap.$options;
const params = {scale: data.scaleRate, x: data.offsetX, y: data.offsetY};
updateTrainingMaplocation({id: this.editData.id, mapLocationJson: JSON.stringify(params)}).then(res => {
console.log('保存背景', res);
this.formModel.mapLocationJson = JSON.stringify(params);
}).catch(err => {
console.log('保存背景失败', err);
}); });
}, },
saveScenesStage() { saveScenesStage() {
const data = Vue.prototype.$jlmap.$options; updateTrainingBackgroud({id: this.editData.id, groupId: this.group}).then(res => {
return {scale: data.scaleRate, x: data.offsetX, y: data.offsetY}; console.log('保存背景', res);
}).catch(err => {
console.log('保存背景失败', err);
});
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{
padding: 25px 65px 30px 10px;
}
.editContentTab{ .editContentTab{
position: absolute; position: absolute;
z-index: 10; z-index: 10;

View File

@ -7,12 +7,13 @@
</el-button-group> </el-button-group>
</div> </div>
<TrainingList ref="trainingList" @editBlob="editBlob" /> <TrainingList ref="trainingList" @editBlob="editBlob" />
<EditContent ref="EditBlob" v-dialogDrag /> <EditContent ref="EditBlob" v-dialogDrag :edit-data="editData" />
</div> </div>
</template> </template>
<script> <script>
import TrainingList from './trainingList.vue'; import TrainingList from './trainingList.vue';
import EditContent from './EditContent.vue'; import EditContent from './editContent.vue';
export default { export default {
name:'DemonMenu', name:'DemonMenu',
components:{ components:{
@ -24,7 +25,8 @@ export default {
data() { data() {
return { return {
hoverBtn: false, hoverBtn: false,
btnWidth: -600 btnWidth: -600,
editData: {}
}; };
}, },
computed:{ computed:{
@ -53,6 +55,7 @@ export default {
this.$refs.trainingList.doShow(); this.$refs.trainingList.doShow();
}, },
editBlob(data) { editBlob(data) {
this.editData = data;
this.$refs.EditBlob.doShow(data); this.$refs.EditBlob.doShow(data);
} }
@ -60,6 +63,9 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .el-dialog__wrapper{
overflow: hidden;
}
.display_top_draft{ .display_top_draft{
position: absolute; position: absolute;
left: 5px; left: 5px;

View File

@ -8,7 +8,6 @@
</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" />
</div> </div>
</el-dialog> </el-dialog>
</template> </template>