代码调整
This commit is contained in:
parent
74cedff597
commit
68314b3b08
@ -7,9 +7,9 @@
|
||||
<el-select v-model="addModel.memberId" placeholder="" style="width:145px" size="mini" @change="changeMember">
|
||||
<el-option
|
||||
v-for="item in memberList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
:key="item.id"
|
||||
:label="item.normalName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -58,6 +58,7 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import {covertMemberData} from '@/views/newMap/displayNew/utils';
|
||||
import { getTrainingStepList, getTrainingMmembers, updateTrainingGradeRules, getTrainingGradeRules } from '@/api/trainingManage';
|
||||
export default {
|
||||
name: 'GradeRules',
|
||||
@ -69,9 +70,7 @@ export default {
|
||||
loading:false,
|
||||
title:'评分',
|
||||
allstepList:[],
|
||||
memberList:[
|
||||
{code:'1', name:'行调'}
|
||||
],
|
||||
memberList:[],
|
||||
currentStepMap:{},
|
||||
gradeRulesMap:{},
|
||||
addModel:{
|
||||
@ -108,10 +107,19 @@ export default {
|
||||
});
|
||||
// 获取角色信息
|
||||
getTrainingMmembers(row.id).then(res=>{
|
||||
debugger;
|
||||
// this.memberList = res.data;
|
||||
let activeTrainList = [];
|
||||
if (this.$store.state.training.started) {
|
||||
activeTrainList = this.$store.state.map.activeTrainList;
|
||||
}
|
||||
// 获取仿真成员列表
|
||||
const result = covertMemberData(activeTrainList, res.data);
|
||||
let list = [];
|
||||
result.deviceListData.forEach(item => {
|
||||
list = list.concat(item);
|
||||
});
|
||||
this.memberList = list;
|
||||
if (this.memberList.length > 0) {
|
||||
this.changeMember(this.memberList[0].code);
|
||||
this.changeMember(this.memberList[0].id);
|
||||
}
|
||||
//
|
||||
}).catch((e) => {
|
||||
@ -139,6 +147,7 @@ export default {
|
||||
});
|
||||
this.addModel.fullMarks = '';
|
||||
}
|
||||
debugger;
|
||||
this.addModel.memberId = memberId;
|
||||
},
|
||||
doClose() {
|
||||
@ -157,8 +166,21 @@ export default {
|
||||
details.push({elementId:key, score:this.currentStepMap[key]});
|
||||
});
|
||||
this.addModel.details = details;
|
||||
updateTrainingGradeRules(this.trainingId, this.addModel).then(resp => {
|
||||
const gradeRulesList = Object.values(this.gradeRulesMap);
|
||||
gradeRulesList.forEach(gradeRule=>{
|
||||
if (gradeRule.memberId == this.addModel.memberId) {
|
||||
gradeRule = this.addModel;
|
||||
}
|
||||
});
|
||||
if (!this.gradeRulesMap[this.addModel.memberId] && this.addModel.details.length > 0) {
|
||||
gradeRulesList.push(this.addModel);
|
||||
}
|
||||
updateTrainingGradeRules(this.trainingId, gradeRulesList).then(resp => {
|
||||
this.loading = false;
|
||||
this.$message.success('更新实训评分规则成功!');
|
||||
this.gradeRulesMap[this.addModel.memberId] = this.addModel;
|
||||
}).catch((e) => {
|
||||
this.loading = false;
|
||||
console.error(e);
|
||||
this.$message.error('更新实训评分规则失败!');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user