浏览代码

接口增加参数

刘洋 2 年之前
父节点
当前提交
c97e32a19e
共有 2 个文件被更改,包括 23 次插入17 次删除
  1. 1 1
      src/api/api-types/statistics.d.ts
  2. 22 16
      src/modules/analysis/marking-progress/components/TotalProgress.vue

+ 1 - 1
src/api/api-types/statistics.d.ts

@@ -168,7 +168,7 @@ export namespace Statistics {
   }
 
   type GetMarkProgressByGroup = BaseDefine<
-    { subjectCode: string; questionMainNumber?: number | string },
+    { subjectCode: string; questionMainNumber?: number | string; hasGroupLeaderScore?: boolean },
     MarkProgressByGroup[]
   >
 

+ 22 - 16
src/modules/analysis/marking-progress/components/TotalProgress.vue

@@ -85,7 +85,7 @@ const model = reactive<any>({
   subjectCode: dataModel.subject || '',
   //todo
   questionMainNumber: null,
-  // hasGroupLeaderScore: [],
+  hasGroupLeaderScore: [],
 })
 watch(
   dataModel,
@@ -120,17 +120,17 @@ const items = computed<EpFormItem[]>(() => [
     rowKey: 'row-1',
     colProp: { span: 5 },
   },
-  // {
-  //   prop: 'hasGroupLeaderScore',
-  //   label: '',
-  //   slotType: 'checkbox',
-  //   labelWidth: '20px',
-  //   slot: {
-  //     options: [{ label: 'true', slotLabel: '包含组长给分' }],
-  //   },
-  //   rowKey: 'row-1',
-  //   colProp: { span: 3 },
-  // },
+  {
+    prop: 'hasGroupLeaderScore',
+    label: '',
+    slotType: 'checkbox',
+    labelWidth: '20px',
+    slot: {
+      options: [{ label: 'true', slotLabel: '包含组长给分' }],
+    },
+    rowKey: 'row-1',
+    colProp: { span: 3 },
+  },
   {
     rowKey: 'row-1',
     slotName: 'button',
@@ -230,7 +230,9 @@ watch(
 //   { immediate: true }
 // )
 function onSearch() {
-  getMarkProgress(model)
+  currentMainQuestion.value = undefined
+  groupProgressResult.value = []
+  getMarkProgress({ ...model, hasGroupLeaderScore: !model.hasGroupLeaderScore.length ? false : true })
 }
 onOptionInit(onSearch)
 const currentMainQuestion = ref<TotalProgress>()
@@ -240,7 +242,7 @@ const currentMainName = computed(() => {
 })
 
 const onCurrentChange = (row: TotalProgress) => {
-  if (row.questionMainNumber !== 0) {
+  if (!!row && row.questionMainNumber !== 0) {
     currentMainQuestion.value = row
   }
 }
@@ -389,7 +391,7 @@ const { fetch: getMarkProgressByGroup, result: groupProgressResult } = useFetch(
 
 /** 将汇总行放到数组最后 */
 const groupProgressData = computed(() => {
-  if (!groupProgressResult?.value) return []
+  if (!groupProgressResult?.value || !groupProgressResult?.value.length) return []
   const arr = groupProgressResult.value.slice(0)
   const totalIndex = arr.findIndex((v) => v.markingGroupNumber === 0)
   const [total] = arr.splice(totalIndex, 1)
@@ -401,7 +403,11 @@ watch(
   currentMainQuestion,
   (v) => {
     v?.questionMainNumber &&
-      getMarkProgressByGroup({ subjectCode: model.subjectCode, questionMainNumber: v.questionMainNumber })
+      getMarkProgressByGroup({
+        subjectCode: model.subjectCode,
+        questionMainNumber: v.questionMainNumber,
+        hasGroupLeaderScore: !model.hasGroupLeaderScore.length ? false : true,
+      })
   },
   { immediate: true }
 )