|
@@ -17,7 +17,12 @@
|
|
|
</template>
|
|
|
</base-form>
|
|
|
<div class="m-t-base">
|
|
|
- <component :is="TableComponent" v-bind="taskSettingModel"></component>
|
|
|
+ <component
|
|
|
+ :is="TableComponent"
|
|
|
+ v-bind="taskSettingModel"
|
|
|
+ :key="refresh"
|
|
|
+ @user-list="onUserListChange"
|
|
|
+ ></component>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -25,8 +30,8 @@
|
|
|
|
|
|
<script setup lang="ts" name="DataTaskSetting">
|
|
|
/** 任务设置 */
|
|
|
-import { reactive, nextTick, computed, watch } from 'vue'
|
|
|
-import { ElButton } from 'element-plus'
|
|
|
+import { ref, reactive, computed, watch } from 'vue'
|
|
|
+import { ElButton, ElMessage } from 'element-plus'
|
|
|
import useFetch from '@/hooks/useFetch'
|
|
|
import useOptions from '@/hooks/useOptions'
|
|
|
import useForm from '@/hooks/useForm'
|
|
@@ -35,12 +40,14 @@ import BaseForm from '@/components/element/BaseForm.vue'
|
|
|
import GroupSetting from './components/GroupSetting.vue'
|
|
|
import MarkerSetting from './components/MarkerSetting.vue'
|
|
|
|
|
|
-import type { ExtractApiParams } from 'api-type'
|
|
|
+import type { ExtractApiParams, ExtractMultipleApiResponse } from 'api-type'
|
|
|
import type { EpFormRules, EpFormItem } from 'global-type'
|
|
|
|
|
|
type FormParams = ExtractApiParams<'markerSetCount'> &
|
|
|
ExtractApiParams<'markGroupUpdateCount'> & { settingType: 'group' | 'marker' }
|
|
|
|
|
|
+const refresh = ref<number>(0)
|
|
|
+
|
|
|
const { formRef, elFormRef, defineColumn, _ } = useForm()
|
|
|
|
|
|
const taskSettingModel = reactive<FormParams>({
|
|
@@ -175,9 +182,20 @@ const rules = computed<EpFormRules>(() => {
|
|
|
return obj
|
|
|
})
|
|
|
|
|
|
+const userList = ref<ExtractMultipleApiResponse<'getUserList'>[]>([])
|
|
|
+
|
|
|
+const userIds = computed(() => {
|
|
|
+ return userList.value?.map((u) => u.id) || []
|
|
|
+})
|
|
|
+
|
|
|
+const onUserListChange = (list: ExtractMultipleApiResponse<'getUserList'>[]) => {
|
|
|
+ userList.value = list || []
|
|
|
+}
|
|
|
+
|
|
|
/** 按评卷员设置 */
|
|
|
const onMarkerSetCount = async () => {
|
|
|
try {
|
|
|
+ taskSettingModel.userId = userIds.value
|
|
|
await useFetch('markerSetCount').fetch(taskSettingModel)
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
@@ -198,8 +216,14 @@ const onSubmit = async () => {
|
|
|
try {
|
|
|
const valid = await elFormRef?.value?.validate()
|
|
|
if (valid) {
|
|
|
- isGroupSetting.value ? onMarkGroupUpdateCount() : onMarkerSetCount()
|
|
|
+ await (isGroupSetting.value ? onMarkGroupUpdateCount() : onMarkerSetCount())
|
|
|
}
|
|
|
+ ElMessage.success('设置成功')
|
|
|
+ Object.assign(taskSettingModel, { markCount: void 0, markDayCount: void 0, markTotalCount: void 0, userId: [] })
|
|
|
+ setTimeout(() => {
|
|
|
+ elFormRef?.value?.clearValidate()
|
|
|
+ refresh.value++
|
|
|
+ })
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
|
}
|