|
@@ -113,6 +113,11 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<a-divider />
|
|
<a-divider />
|
|
|
|
|
+ <a-row justify="space-between" align="bottom" class="mb-2">
|
|
|
|
|
+ <a-typography-title :level="4" class="mb-0">自评总分</a-typography-title>
|
|
|
|
|
+ <span class="total-points">{{ totalPoints }} 分</span>
|
|
|
|
|
+ </a-row>
|
|
|
|
|
+ <a-divider />
|
|
|
<DynamicForm
|
|
<DynamicForm
|
|
|
ref="tailFormRef"
|
|
ref="tailFormRef"
|
|
|
:model="currentForm"
|
|
:model="currentForm"
|
|
@@ -332,6 +337,39 @@ const tailFormOptionsComputed = computed<IDynamicFormOptions>(() => ({
|
|
|
},
|
|
},
|
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
|
|
+const checkItemMap = computed(() => {
|
|
|
|
|
+ const m = new Map<number, CheckItemInfo & { parent: CheckItemInfo; }>();
|
|
|
|
|
+ for (const n of props.checkItemList) {
|
|
|
|
|
+ m.set(n.id, n);
|
|
|
|
|
+ if (n.children?.length) {
|
|
|
|
|
+ for (const child of n.children) {
|
|
|
|
|
+ child.parent = n;
|
|
|
|
|
+ m.set(child.id, child);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return m;
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const totalPoints = computed(() => {
|
|
|
|
|
+ const groupMap = new Map<number, number>();
|
|
|
|
|
+ for (const item of props.currentFormCheckItems) {
|
|
|
|
|
+ const checkItem = checkItemMap.value.get(item.id);
|
|
|
|
|
+ if (!checkItem || checkItem.isTitle || !checkItem.parent)
|
|
|
|
|
+ continue;
|
|
|
|
|
+ const parentId = checkItem.parent.id;
|
|
|
|
|
+ const score = (item.points ?? 0) * (item.count ?? 1);
|
|
|
|
|
+ groupMap.set(parentId, (groupMap.get(parentId) ?? 0) + score);
|
|
|
|
|
+ }
|
|
|
|
|
+ let total = 0;
|
|
|
|
|
+ for (const [parentId, groupScore] of groupMap) {
|
|
|
|
|
+ const parent = checkItemMap.value.get(parentId);
|
|
|
|
|
+ const maxPoints = parent?.points ?? Infinity;
|
|
|
|
|
+ total += Math.min(groupScore, maxPoints);
|
|
|
|
|
+ }
|
|
|
|
|
+ return total;
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
function getCheckModeText(checkMode: number) {
|
|
function getCheckModeText(checkMode: number) {
|
|
|
switch (checkMode) {
|
|
switch (checkMode) {
|
|
|
case 1:
|
|
case 1:
|