|
@@ -1,12 +1,20 @@
|
|
|
<template>
|
|
|
<base-dialog
|
|
|
title="设置工作量"
|
|
|
+ v-bind="attrs"
|
|
|
:width="useVW(500)"
|
|
|
:footer="false"
|
|
|
destroy-on-close
|
|
|
@update:model-value="(v) => emit('update:modelValue', v)"
|
|
|
>
|
|
|
- <base-form ref="formRef" :rules="rules" :items="items" :model="model" :label-width="useVW(110)" :disabled="loading">
|
|
|
+ <base-form
|
|
|
+ ref="formRef"
|
|
|
+ :rules="rules"
|
|
|
+ :items="items"
|
|
|
+ :model="model"
|
|
|
+ :label-width="useVW(110)"
|
|
|
+ :disabled="loading || setting"
|
|
|
+ >
|
|
|
<template #form-item-markerName>
|
|
|
{{ data?.markerName }}
|
|
|
</template>
|
|
@@ -21,7 +29,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="SetWorkload">
|
|
|
-import { reactive } from 'vue'
|
|
|
+import { reactive, useAttrs, watch } from 'vue'
|
|
|
import { ElFormItem, ElMessage } from 'element-plus'
|
|
|
import BaseDialog from '@/components/element/BaseDialog.vue'
|
|
|
import BaseForm from '@/components/element/BaseForm.vue'
|
|
@@ -33,20 +41,35 @@ import ConfirmButton from '@/components/common/ConfirmButton.vue'
|
|
|
import type { EpFormItem, EpFormRules } from 'global-type'
|
|
|
import type { ExtractApiParams, ExtractApiResponse } from '@/api/api'
|
|
|
|
|
|
+const attrs = useAttrs()
|
|
|
+
|
|
|
const props = defineProps<{ data?: ExtractArrayValue<ExtractApiResponse<'getStatisticsByGroup'>> }>()
|
|
|
|
|
|
const emit = defineEmits(['update:modelValue'])
|
|
|
|
|
|
-const { fetch: markerSetCount, loading } = useFetch('markerSetCount')
|
|
|
+const { fetch: getUserInfo, result: userInfo, loading } = useFetch('getUserInfo')
|
|
|
+
|
|
|
+watch([() => attrs.modelValue, () => props.data?.markerId], () => {
|
|
|
+ if (attrs.modelValue && props.data?.markerId) {
|
|
|
+ getUserInfo({ id: props.data.markerId })
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const { fetch: markerSetCount, loading: setting } = useFetch('markerSetCount')
|
|
|
|
|
|
const { formRef, elFormRef } = useForm()
|
|
|
|
|
|
const model = reactive<ExtractApiParams<'markerSetCount'>>({
|
|
|
- markDayCount: void 0,
|
|
|
- markTotalCount: void 0,
|
|
|
+ markDayCount: 0,
|
|
|
+ markTotalCount: 0,
|
|
|
userId: [],
|
|
|
})
|
|
|
|
|
|
+watch(userInfo, () => {
|
|
|
+ model.markDayCount = userInfo?.value?.markDayCount || 0
|
|
|
+ model.markTotalCount = userInfo?.value?.markTotalCount || 0
|
|
|
+})
|
|
|
+
|
|
|
const rules: EpFormRules = {
|
|
|
markTotalCount: [{ required: true, message: '请填写评卷员工作量' }],
|
|
|
markDayCount: [{ required: true, message: '请填写评卷员每日工作量' }],
|
|
@@ -59,12 +82,12 @@ const items: EpFormItem[] = [
|
|
|
},
|
|
|
{
|
|
|
label: '工作量',
|
|
|
- slotType: 'input',
|
|
|
+ slotType: 'inputNumber',
|
|
|
prop: 'markTotalCount',
|
|
|
},
|
|
|
{
|
|
|
label: '每日工作量',
|
|
|
- slotType: 'input',
|
|
|
+ slotType: 'inputNumber',
|
|
|
prop: 'markDayCount',
|
|
|
},
|
|
|
]
|