实训设计代码调整

This commit is contained in:
dong 2022-09-05 14:23:20 +08:00
parent 0c626140ce
commit cb5179fafb
4 changed files with 72 additions and 13 deletions

View File

@ -128,3 +128,10 @@ export function getTrainingGradeRules(trainingId) {
method: 'get'
});
}
/** 清空步骤 */
export function clearTrainingStep(trainingId) {
return request({
url: `/api/v2/draft/training/${trainingId}/step/clear`,
method: 'delete'
});
}

View File

@ -7,7 +7,7 @@
</el-button-group>
</div>
<TrainingList ref="trainingList" @updateDetails="updateDetails" @gradeRules="gradeRules" />
<EditDetails ref="editDetails" :edit-data="editData" @openEditOperate="openEditOperate" @handleCondition="handleCondition" />
<EditDetails ref="editDetails" :edit-data="editData" @openEditOperate="openEditOperate" @handleCondition="handleCondition" @publish="publish" @preview="preview" />
<EditCondition ref="editCondition" v-dialogDrag :materials-list="materialsList" @editConditionFn="editConditionFn" />
<edit-operate ref="editOperate" v-dialogDrag @backStepList="backStepList" />
<grade-rules ref="gradeRules" />
@ -55,6 +55,12 @@ export default {
this.getMaterials();
},
methods:{
publish(data) {
this.$refs.trainingList.publishScript(null, data);
},
preview(data) {
this.$refs.trainingList.previewScript(null, data);
},
editConditionFn(data, index, key) {
this.$refs.editDetails.editConditionFn(data, index, key);
},

View File

@ -6,7 +6,14 @@
</div>
</div>
<div class="editContentTitle">
<span>实训名称{{ editData.name || '' }}</span>
<div>
<span>实训名称{{ editData.name || '' }}</span>
</div>
<div>
<el-button size="small" type="primary" @click="previewTraining">预览</el-button>
<el-button size="small" type="primary" @click="publishTraining">发布</el-button>
<el-button size="small" type="primary" @click="clearStep">清空步骤</el-button>
</div>
</div>
<el-tabs v-model="activeName" type="card">
<el-tab-pane label="步骤列表" name="stepList">
@ -105,7 +112,7 @@
</template>
<script>
import { updateTrainingStep, getTrainingAll, updateTrainingBackgroud, getTrainingStepList, updateTrainingMaplocation } from '@/api/trainingManage';
import { updateTrainingStep, getTrainingAll, updateTrainingBackgroud, getTrainingStepList, updateTrainingMaplocation, clearTrainingStep } from '@/api/trainingManage';
import { assignUsersPlayRoles } from '@/api/jointSimulation';
import Vue from 'vue';
import {covertMemberData} from '@/views/newMap/displayNew/utils';
@ -138,7 +145,7 @@ export default {
return this.$route.query.record;
},
tableHeight() {
const s = 200;
const s = 210;
const h = this.$store.state.app.height;
return h - s;
},
@ -175,6 +182,28 @@ export default {
}
},
methods: {
publishTraining() {
console.log('发布实训');
this.$emit('publish', this.editData);
},
previewTraining() {
console.log('预览实训');
this.$emit('preview', this.editData);
},
clearStep() {
this.$confirm('确定清空实训步骤?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
clearTrainingStep(this.editData.id).then(res => {
console.log(res, '清空步骤');
this.getStepList(this.editData);
}).cathc(err => {
console.log(err, '清空步骤失败');
});
}).catch(e => {});
},
editConditionFn(data, index, key) {
this.tableData[index][key] = data;
this.dialogVisible = true;
@ -397,8 +426,10 @@ export default {
}
}
.editContentTitle {
height: 40px;
line-height: 40px;
height: 50px;
padding: 0 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -236,13 +236,28 @@ export default {
},
publishScript(index, row) {
console.log('发布', index, row);
if (!row.id) { return; }
publishTraining({draftId: row.id}).then(res => {
console.log('发布实训成功', res);
this.$message.success('发布实训成功!');
}).catch(err => {
console.log('发布实训失败', err);
this.$message.error('发布实训失败');
this.$prompt('请输入发布后名称', '提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
inputValue: row.name,
inputErrorMessage: '输入不能为空',
inputValidator: (value) => {
if (!value) {
return '输入不能为空';
}
}
}).then(suc => {
if (!row.id || !suc.value) { return; }
publishTraining({draftId: row.id, reName: suc.value}).then(res => {
console.log('发布实训成功', res);
this.$message.success('发布实训成功!');
}).catch(err => {
console.log('发布实训失败', err);
this.$message.error(`发布实训失败!,${err.message}`);
});
});
},
async previewScript(index, data) {