实训列表接口调整
This commit is contained in:
parent
8084698cd8
commit
b1cec0839d
@ -206,6 +206,14 @@ export function getPublishTrainingListInOrg(data) {
|
||||
data
|
||||
});
|
||||
}
|
||||
/** 查询组织已发布的实训列表 */
|
||||
export function getManageTrainingListInOrg(data) {
|
||||
return request({
|
||||
url: `/api/v2/training/published/manage/infos`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
/** 根据实训id查该已发布实训的所有信息 */
|
||||
export function getPublishTrainingDetail(trainingId) {
|
||||
return request({
|
||||
|
@ -10,7 +10,7 @@ import { createSimulation } from '@/api/simulation';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { getAllPublishTrainingList, getPublishTrainingListInOrg, publishTrainingPutOn, publishTrainingPutOff, publishTrainingDelete } from '@/api/jmap/training';
|
||||
import { getAllPublishTrainingList, getManageTrainingListInOrg, publishTrainingPutOn, publishTrainingPutOff, publishTrainingDelete } from '@/api/jmap/training';
|
||||
export default {
|
||||
name:'TrainingManage',
|
||||
data() {
|
||||
@ -173,7 +173,8 @@ export default {
|
||||
if (this.hasTeachingDataManage()) {
|
||||
return getAllPublishTrainingList(param);
|
||||
} else {
|
||||
return getPublishTrainingListInOrg(param);
|
||||
if (!param.type) { delete param.type; }
|
||||
return getManageTrainingListInOrg(param);
|
||||
}
|
||||
},
|
||||
getLabelJson(row) {
|
||||
@ -203,11 +204,11 @@ export default {
|
||||
loadScript(index, row) {
|
||||
// 子系统: mapSystem 客户端: terminal
|
||||
// row.mapSystem
|
||||
let memberId = '1';
|
||||
if (row.playerIdJson) {
|
||||
memberId = JSON.parse(row.playerIdJson)[0];
|
||||
}
|
||||
const data = {mapId: row.mapId, type:row.mapSystem || 'METRO', itemMap:{DEFAULT_MEMBER:memberId} };
|
||||
// let memberId = '1';
|
||||
// if (row.playerIdJson) {
|
||||
// memberId = JSON.parse(row.playerIdJson)[0];
|
||||
// }
|
||||
// const data = {mapId: row.mapId, type:row.mapSystem || 'METRO', itemMap:{DEFAULT_MEMBER:memberId} };
|
||||
// domConfig: Object
|
||||
// hasExam: false
|
||||
// hasTraining: false
|
||||
|
@ -139,12 +139,6 @@ export default {
|
||||
return this.isEditMode ? this.$t('publish.modifyRules') : this.$t('publish.addRules');
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// getLabelList().then(resp => {
|
||||
// this.labels = [{ label: '无', value: '' }, ...resp.data.map(item => ({ label: item, value: item }))];
|
||||
// });
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
show(detail) {
|
||||
this.dialogShow = true;
|
||||
@ -170,14 +164,7 @@ export default {
|
||||
isDuplicated() {
|
||||
const isDuplicated =
|
||||
this.ruleList.length > 0 &&
|
||||
this.ruleList.some(
|
||||
rule =>
|
||||
rule.type === this.form.type &&
|
||||
rule.subtype === this.form.subtype &&
|
||||
rule.tags &&
|
||||
this.form.tags &&
|
||||
rule.tags.includes(this.form.tags)
|
||||
);
|
||||
this.ruleList.some(rule => rule.type === this.form.type && rule.subtype === this.form.subtype && rule.tags && this.form.tags && rule.tags.includes(this.form.tags));
|
||||
return isDuplicated;
|
||||
},
|
||||
subTypesChange(val) {
|
||||
|
@ -1,154 +1,154 @@
|
||||
<template>
|
||||
<div class="joylink-card">
|
||||
<div class="exam-box">
|
||||
<el-steps class="steps" :active="currentStep">
|
||||
<el-step :title="$t('publish.testDefinitionMaking')" icon="el-icon-edit" />
|
||||
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
|
||||
</el-steps>
|
||||
<div class="joylink-card forms">
|
||||
<exam-from v-show="currentStep === 1" ref="exam" :exam-data="examData" />
|
||||
<rule-from
|
||||
:is-edit-mode="isEditMode"
|
||||
v-show="currentStep === 2"
|
||||
ref="rule"
|
||||
:rule-list="ruleList"
|
||||
:exam-data="examData"
|
||||
/>
|
||||
</div>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button v-if="showPrevStep" type="primary" @click="prevStep">{{
|
||||
this.$t('global.lastStep')
|
||||
}}</el-button>
|
||||
<el-button v-if="showNextStep" type="primary" @click="nextStep">{{
|
||||
this.$t('global.nextStep')
|
||||
}}</el-button>
|
||||
<el-button v-if="currentStep === 2" type="primary" @click="submit">提交</el-button>
|
||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="joylink-card">
|
||||
<div class="exam-box">
|
||||
<el-steps class="steps" :active="currentStep">
|
||||
<el-step :title="$t('publish.testDefinitionMaking')" icon="el-icon-edit" />
|
||||
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
|
||||
</el-steps>
|
||||
<div class="joylink-card forms">
|
||||
<exam-from v-show="currentStep === 1" ref="exam" :exam-data="examData" />
|
||||
<rule-from
|
||||
v-show="currentStep === 2"
|
||||
ref="rule"
|
||||
:is-edit-mode="isEditMode"
|
||||
:rule-list="ruleList"
|
||||
:exam-data="examData"
|
||||
/>
|
||||
</div>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button v-if="showPrevStep" type="primary" @click="prevStep">{{
|
||||
this.$t('global.lastStep')
|
||||
}}</el-button>
|
||||
<el-button v-if="showNextStep" type="primary" @click="nextStep">{{
|
||||
this.$t('global.nextStep')
|
||||
}}</el-button>
|
||||
<el-button v-if="currentStep === 2" type="primary" @click="submit">提交</el-button>
|
||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import RuleFrom from './rule'
|
||||
import ExamFrom from './examFrom'
|
||||
import { getPaperDetail } from '@/api/management/exam'
|
||||
import { UrlConfig } from '@/scripts/ConstDic'
|
||||
import RuleFrom from './rule';
|
||||
import ExamFrom from './examFrom';
|
||||
import { getPaperDetail } from '@/api/management/exam';
|
||||
import { UrlConfig } from '@/scripts/ConstDic';
|
||||
|
||||
import { createPaper, editPaper } from '@/api/management/exam'
|
||||
import { createPaper, editPaper } from '@/api/management/exam';
|
||||
|
||||
export default {
|
||||
name: 'ExamRule',
|
||||
components: {
|
||||
ExamFrom,
|
||||
RuleFrom,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentStep: 1,
|
||||
examData: {
|
||||
name: '',
|
||||
profile: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
validDuration: 30,
|
||||
fullScore: 100,
|
||||
passScore: 60,
|
||||
mapId: '',
|
||||
},
|
||||
ruleList: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
orgId() {
|
||||
return this.$store.state.user.companyId
|
||||
},
|
||||
showPrevStep() {
|
||||
return this.currentStep == 2
|
||||
},
|
||||
showNextStep() {
|
||||
return this.currentStep == 1
|
||||
},
|
||||
isEditMode() {
|
||||
return this.$route.params.mode == 'edit'
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (this.isEditMode) {
|
||||
getPaperDetail(this.$route.params.paperId).then(res => {
|
||||
this.examData = {
|
||||
mapId: res.data.mapId,
|
||||
name: res.data.name,
|
||||
profile: res.data.profile,
|
||||
startTime: res.data.startTime,
|
||||
endTime: res.data.endTime,
|
||||
validDuration: Number(res.data.validDuration),
|
||||
fullScore: res.data.fullScore,
|
||||
passScore: res.data.passScore,
|
||||
}
|
||||
this.ruleList = res.data.ruleList
|
||||
this.$nextTick(() => {
|
||||
this.$refs.exam.haveDate = !!this.examData.startTime
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
prevStep() {
|
||||
this.currentStep = 1
|
||||
},
|
||||
nextStep() {
|
||||
this.$refs.exam
|
||||
.checkForm()
|
||||
.then(() => {
|
||||
this.currentStep = 2
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
submit() {
|
||||
const scoreValid = this.$refs.rule.checkTotolScores()
|
||||
if (!scoreValid) {
|
||||
this.$message.warning('规则满分与试题定义不匹配')
|
||||
return
|
||||
}
|
||||
const examData = { ...this.examData, ...{ orgId: this.orgId } }
|
||||
const ruleData = this.ruleList
|
||||
const uploadData = { ...examData, ruleList: ruleData }
|
||||
console.log(JSON.stringify(uploadData))
|
||||
const uploadMethodMap = {
|
||||
add: createPaper,
|
||||
edit: editPaper,
|
||||
}
|
||||
if (this.isEditMode) {
|
||||
uploadData.id = this.$route.params.paperId
|
||||
}
|
||||
name: 'ExamRule',
|
||||
components: {
|
||||
ExamFrom,
|
||||
RuleFrom
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentStep: 1,
|
||||
examData: {
|
||||
name: '',
|
||||
profile: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
validDuration: 30,
|
||||
fullScore: 100,
|
||||
passScore: 60,
|
||||
mapId: ''
|
||||
},
|
||||
ruleList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
orgId() {
|
||||
return this.$store.state.user.companyId;
|
||||
},
|
||||
showPrevStep() {
|
||||
return this.currentStep == 2;
|
||||
},
|
||||
showNextStep() {
|
||||
return this.currentStep == 1;
|
||||
},
|
||||
isEditMode() {
|
||||
return this.$route.params.mode == 'edit';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.isEditMode) {
|
||||
getPaperDetail(this.$route.params.paperId).then(res => {
|
||||
this.examData = {
|
||||
mapId: res.data.mapId,
|
||||
name: res.data.name,
|
||||
profile: res.data.profile,
|
||||
startTime: res.data.startTime,
|
||||
endTime: res.data.endTime,
|
||||
validDuration: Number(res.data.validDuration),
|
||||
fullScore: res.data.fullScore,
|
||||
passScore: res.data.passScore
|
||||
};
|
||||
this.ruleList = res.data.ruleList;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.exam.haveDate = !!this.examData.startTime;
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
prevStep() {
|
||||
this.currentStep = 1;
|
||||
},
|
||||
nextStep() {
|
||||
this.$refs.exam
|
||||
.checkForm()
|
||||
.then(() => {
|
||||
this.currentStep = 2;
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
submit() {
|
||||
const scoreValid = this.$refs.rule.checkTotalScores();
|
||||
if (!scoreValid) {
|
||||
this.$message.warning('规则满分与试题定义不匹配');
|
||||
return;
|
||||
}
|
||||
const examData = { ...this.examData, ...{ orgId: this.orgId } };
|
||||
const ruleData = this.ruleList;
|
||||
const uploadData = { ...examData, ruleList: ruleData };
|
||||
console.log(JSON.stringify(uploadData));
|
||||
const uploadMethodMap = {
|
||||
add: createPaper,
|
||||
edit: editPaper
|
||||
};
|
||||
if (this.isEditMode) {
|
||||
uploadData.id = this.$route.params.paperId;
|
||||
}
|
||||
|
||||
uploadMethodMap[this.$route.params.mode](uploadData).then(resp => {
|
||||
if (resp.code === 200) {
|
||||
this.$message.success(`${this.isEditMode ? '修改' : '创建'}成功`)
|
||||
this.turnback()
|
||||
} else {
|
||||
this.$message.error(resp.message)
|
||||
console.log(uploadData)
|
||||
console.log(resp)
|
||||
}
|
||||
})
|
||||
},
|
||||
turnback() {
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`
|
||||
if (this.$route.query.source === 'org') {
|
||||
this.$router.go(-1)
|
||||
} else {
|
||||
this.$router.replace({
|
||||
path: `${path}`,
|
||||
query: { mapId: this.$route.query.mapId, noPreLogout: this.$route.query.noPreLogout },
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
uploadMethodMap[this.$route.params.mode](uploadData).then(resp => {
|
||||
if (resp.code === 200) {
|
||||
this.$message.success(`${this.isEditMode ? '修改' : '创建'}成功`);
|
||||
this.turnback();
|
||||
} else {
|
||||
this.$message.error(resp.message);
|
||||
console.log(uploadData);
|
||||
console.log(resp);
|
||||
}
|
||||
});
|
||||
},
|
||||
turnback() {
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
|
||||
if (this.$route.query.source === 'org') {
|
||||
this.$router.go(-1);
|
||||
} else {
|
||||
this.$router.replace({
|
||||
path: `${path}`,
|
||||
query: { mapId: this.$route.query.mapId, noPreLogout: this.$route.query.noPreLogout }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.joylink-card {
|
||||
|
@ -1,168 +1,168 @@
|
||||
<template>
|
||||
<div class="exam-rule">
|
||||
<span>{{ $t('publish.fullScoreTips') }} {{ examData.fullScore }} {{ $t('publish.scorePoints') }}</span>
|
||||
<el-button class="addList" size="small" @click="handleAdd">{{ $t('publish.addRules') }}</el-button>
|
||||
<el-table
|
||||
:data="ruleList"
|
||||
border
|
||||
style="width: 100%; min-height: 300px;"
|
||||
show-summary
|
||||
:summary-method="getSummaries"
|
||||
>
|
||||
<el-table-column prop="type" label="试题类型">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ types[scope.row.type] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="subtype" label="规则类型">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ subtypes[scope.row.subtype] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="score" :label="$t('publish.eachScore')" width="100" />
|
||||
<el-table-column :label="$t('publish.totalScore')" width="90">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ Number(scope.row.amount) * Number(scope.row.score) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="amount" label="题目数量" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.amount }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题库题数">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.topicNum }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类">
|
||||
<template slot-scope="scope">
|
||||
<template v-if="scope.row.tags">
|
||||
<el-tag v-for="tag in scope.row.tags" :key="tag">{{ tag }}</el-tag>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-tag>无</el-tag>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('global.operate')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="editRow(scope)">{{ $t('global.edit') }}</el-button>
|
||||
<el-button type="text" size="small" @click="deleteRule(scope)">{{ $t('global.delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<edit-rule @submit="handleRuleSubmit" :ruleList="ruleList" ref="addRule" />
|
||||
</div>
|
||||
<div class="exam-rule">
|
||||
<span>{{ $t('publish.fullScoreTips') }} {{ examData.fullScore }} {{ $t('publish.scorePoints') }}</span>
|
||||
<el-button class="addList" size="small" @click="handleAdd">{{ $t('publish.addRules') }}</el-button>
|
||||
<el-table
|
||||
:data="ruleList"
|
||||
border
|
||||
style="width: 100%; min-height: 300px;"
|
||||
show-summary
|
||||
:summary-method="getSummaries"
|
||||
>
|
||||
<el-table-column prop="type" label="试题类型">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ types[scope.row.type] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="subtype" label="规则类型">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ subtypes[scope.row.subtype] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="score" :label="$t('publish.eachScore')" width="100" />
|
||||
<el-table-column :label="$t('publish.totalScore')" width="90">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ Number(scope.row.amount) * Number(scope.row.score) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="amount" label="题目数量" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.amount }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题库题数">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.topicNum }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类">
|
||||
<template slot-scope="scope">
|
||||
<template v-if="scope.row.tags">
|
||||
<el-tag v-for="tag in scope.row.tags" :key="tag">{{ tag }}</el-tag>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-tag>无</el-tag>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('global.operate')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="editRow(scope)">{{ $t('global.edit') }}</el-button>
|
||||
<el-button type="text" size="small" @click="deleteRule(scope)">{{ $t('global.delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<edit-rule ref="addRule" :rule-list="ruleList" @submit="handleRuleSubmit" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import editRule from './editRule'
|
||||
import editRule from './editRule';
|
||||
|
||||
export default {
|
||||
name: 'Rule',
|
||||
components: {
|
||||
editRule,
|
||||
},
|
||||
props: {
|
||||
examData: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
ruleList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return []
|
||||
},
|
||||
},
|
||||
isEditMode: {
|
||||
type: Boolean,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentTotalScore: 0,
|
||||
operationTypeMap: {},
|
||||
trainingOperateTypeMap: {},
|
||||
trainingTypeNums: {}, // 实训类型的实训数量
|
||||
operationTypeNums: {}, // 操作类型实训数量
|
||||
trainingTypeList: [], // 实训类型列表
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
types() {
|
||||
return ['', '理论题', '实训题']
|
||||
},
|
||||
subtypes() {
|
||||
return ['', '单选题', '多选题', '判断题', '单操实训', '场景实训']
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
handleAdd() {
|
||||
this.$refs.addRule.show()
|
||||
},
|
||||
handleRuleSubmit(formData, isEdit) {
|
||||
const data = {
|
||||
type: formData.type,
|
||||
subtype: formData.subtype,
|
||||
amount: formData.amount,
|
||||
score: formData.score,
|
||||
topicNum: formData.topicNum,
|
||||
tags: [formData.tags],
|
||||
}
|
||||
if (isEdit) {
|
||||
this.$set(this.ruleList, this.editingIndex, data)
|
||||
} else {
|
||||
this.ruleList.push(data)
|
||||
}
|
||||
},
|
||||
deleteRule(data) {
|
||||
const index = data.$index
|
||||
this.ruleList.splice(index, 1)
|
||||
},
|
||||
name: 'Rule',
|
||||
components: {
|
||||
editRule
|
||||
},
|
||||
props: {
|
||||
examData: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
ruleList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
isEditMode: {
|
||||
type: Boolean
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentTotalScore: 0,
|
||||
operationTypeMap: {},
|
||||
trainingOperateTypeMap: {},
|
||||
trainingTypeNums: {}, // 实训类型的实训数量
|
||||
operationTypeNums: {}, // 操作类型实训数量
|
||||
trainingTypeList: [] // 实训类型列表
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
types() {
|
||||
return ['', '理论题', '实训题'];
|
||||
},
|
||||
subtypes() {
|
||||
return ['', '单选题', '多选题', '判断题', '单操实训', '场景实训'];
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
handleAdd() {
|
||||
this.$refs.addRule.show();
|
||||
},
|
||||
handleRuleSubmit(formData, isEdit) {
|
||||
const data = {
|
||||
type: formData.type,
|
||||
subtype: formData.subtype,
|
||||
amount: formData.amount,
|
||||
score: formData.score,
|
||||
topicNum: formData.topicNum,
|
||||
tags: [formData.tags]
|
||||
};
|
||||
if (isEdit) {
|
||||
this.$set(this.ruleList, this.editingIndex, data);
|
||||
} else {
|
||||
this.ruleList.push(data);
|
||||
}
|
||||
},
|
||||
deleteRule(data) {
|
||||
const index = data.$index;
|
||||
this.ruleList.splice(index, 1);
|
||||
},
|
||||
|
||||
checkTotolScores() {
|
||||
return this.currentTotalScore === this.examData.fullScore
|
||||
},
|
||||
editRow(data) {
|
||||
this.editingIndex = data.$index
|
||||
const list = JSON.stringify(data.row)
|
||||
const detail = JSON.parse(list)
|
||||
this.$refs.addRule.show({ ...detail, index: data.$index })
|
||||
},
|
||||
getSummaries({ columns, data }) {
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计'
|
||||
return
|
||||
} else if (index === 2) {
|
||||
const values = data.map(item => Number(item.amount))
|
||||
sums[2] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
} else if (index === 3) {
|
||||
const values = data.map(item => Number(item.amount) * Number(item.score))
|
||||
this.currentTotalScore = sums[3] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
})
|
||||
return sums
|
||||
},
|
||||
},
|
||||
}
|
||||
checkTotalScores() {
|
||||
return this.currentTotalScore === this.examData.fullScore;
|
||||
},
|
||||
editRow(data) {
|
||||
this.editingIndex = data.$index;
|
||||
const list = JSON.stringify(data.row);
|
||||
const detail = JSON.parse(list);
|
||||
this.$refs.addRule.show({ ...detail, index: data.$index });
|
||||
},
|
||||
getSummaries({ columns, data }) {
|
||||
const sums = [];
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计';
|
||||
return;
|
||||
} else if (index === 2) {
|
||||
const values = data.map(item => Number(item.amount));
|
||||
sums[2] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr;
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
} else if (index === 3) {
|
||||
const values = data.map(item => Number(item.amount) * Number(item.score));
|
||||
this.currentTotalScore = sums[3] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr;
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
return sums;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.exam-rule {
|
||||
|
Loading…
Reference in New Issue
Block a user