|
@@ -11,21 +11,7 @@
|
|
|
@open="visibleChange"
|
|
|
>
|
|
|
<div class="mb-2 box-justify">
|
|
|
- <div class="box-grow mr-2">
|
|
|
- <span v-for="(target, index) in treeData" :key="target.id">
|
|
|
- <span>{{ target.name }}占比</span>
|
|
|
- <span
|
|
|
- v-if="targetRates[target.id]"
|
|
|
- :class="[
|
|
|
- 'mlr-1',
|
|
|
- targetRates[target.id].valid ? 'color-success' : 'color-danger',
|
|
|
- ]"
|
|
|
- >{{ targetRates[target.id].rate }}%</span
|
|
|
- >
|
|
|
- <span>({{ target.totalWeight || 0 }}%)</span>
|
|
|
- <span>{{ index === treeData.length - 1 ? "。" : "," }}</span>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
+ <div class="box-grow mr-2"></div>
|
|
|
<el-button type="primary" :loading="loading" @click="toSync"
|
|
|
>同步</el-button
|
|
|
>
|
|
@@ -90,7 +76,6 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { calcSum } from "@/plugins/utils";
|
|
|
import {
|
|
|
endScorePaperPositiveDetail,
|
|
|
endScorePaperPositiveSave,
|
|
@@ -118,7 +103,6 @@ export default {
|
|
|
curRow: {},
|
|
|
selectedData: [],
|
|
|
treeData: [],
|
|
|
- targetRates: {},
|
|
|
loading: false,
|
|
|
};
|
|
|
},
|
|
@@ -139,11 +123,12 @@ export default {
|
|
|
this.treeData = (data || []).map((item) => {
|
|
|
return {
|
|
|
id: item.id,
|
|
|
+ kid: item.id,
|
|
|
name: item.targetName,
|
|
|
totalWeight: item.totalWeight,
|
|
|
disabled: false,
|
|
|
children: item.dimensionList.map((elem) => {
|
|
|
- return { ...elem, disabled: false };
|
|
|
+ return { ...elem, kid: `${item.id}_${elem.id}`, disabled: false };
|
|
|
}),
|
|
|
};
|
|
|
});
|
|
@@ -154,7 +139,6 @@ export default {
|
|
|
courseId: this.course.courseId,
|
|
|
});
|
|
|
this.dataList = res || [];
|
|
|
- this.updateTargetRates();
|
|
|
},
|
|
|
visibleChange() {
|
|
|
this.getBlueDetail();
|
|
@@ -189,16 +173,6 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- const unvalidTargets = [];
|
|
|
- Object.keys(this.targetRates).forEach((tid) => {
|
|
|
- const target = this.targetRates[tid];
|
|
|
- if (!target.valid) unvalidTargets.push(target.name);
|
|
|
- });
|
|
|
- if (unvalidTargets.length) {
|
|
|
- this.$message.error(`${unvalidTargets.join("、")}占比不符合要求`);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
return true;
|
|
|
},
|
|
|
toLink(row) {
|
|
@@ -206,7 +180,7 @@ export default {
|
|
|
this.selectedData = [];
|
|
|
row.targetList.forEach((target) => {
|
|
|
target.dimensionList.forEach((dimension) => {
|
|
|
- this.selectedData.push(dimension.dimensionId);
|
|
|
+ this.selectedData.push(`${target.targetId}_${dimension.dimensionId}`);
|
|
|
});
|
|
|
});
|
|
|
this.$refs.SelectBlueDimensionDialog.open();
|
|
@@ -214,29 +188,6 @@ export default {
|
|
|
dimensionSelected(targetList) {
|
|
|
this.curRow.targetList = targetList;
|
|
|
this.curRow.courseTargetName = targetList[0].targetName;
|
|
|
- this.updateTargetRates();
|
|
|
- },
|
|
|
- updateTargetRates() {
|
|
|
- const scoreData = {};
|
|
|
- this.dataList.forEach((item) => {
|
|
|
- if (!item.targetList || !item.targetList.length) return;
|
|
|
- const targetId = item.targetList[0].targetId;
|
|
|
- if (!scoreData[targetId]) scoreData[targetId] = 0;
|
|
|
- scoreData[targetId] += item.score;
|
|
|
- });
|
|
|
- const totalScore = calcSum(this.dataList.map((item) => item.score));
|
|
|
-
|
|
|
- const targetRates = {};
|
|
|
- this.treeData.forEach((target) => {
|
|
|
- const targetScore = scoreData[target.id] || 0;
|
|
|
- const rate = !totalScore ? 0 : (100 * targetScore) / totalScore;
|
|
|
- targetRates[target.id] = {
|
|
|
- rate: Number.isInteger(rate) ? rate : rate.toFixed(2),
|
|
|
- valid: rate == target.totalWeight,
|
|
|
- name: target.name,
|
|
|
- };
|
|
|
- });
|
|
|
- this.targetRates = targetRates;
|
|
|
},
|
|
|
async submit() {
|
|
|
if (!this.checkData()) {
|