mo 2 years ago
parent
commit
4ff37c5c69

+ 7 - 6
src/views/unit-test/unit-list/index.tsx

@@ -27,7 +27,7 @@ export default defineComponent({
       statusText: '班级类型',
       params: {
         keyword: null,
-        status: null,
+        classTypeCode: null,
         page: 1,
         rows: 20
       },
@@ -57,9 +57,9 @@ export default defineComponent({
         form.list = res.data.rows
         form.listState.dataShow = form.list.length > 0
         loading.value = false
-        form.listState.finished = true
+        // form.listState.finished = true
 
-        // finished.value = res.data.current >= res.data.pages
+        form.listState.finished = res.data.current >= res.data.pages
       } catch (e: any) {
         // console.log(e, 'e')
         const message = e.message
@@ -76,6 +76,7 @@ export default defineComponent({
       getList()
     }
     const onSearch = () => {
+      console.log('🚀 ~ file: index.tsx:79 ~ onSearch ~ onSearch', onSearch)
       form.params.page = 1
       form.list = []
       form.listState.dataShow = true // 判断是否有数据
@@ -94,7 +95,7 @@ export default defineComponent({
       <div class={styles.unitTest}>
         <OSticky position="top">
           {/* */}
-          <OHeader>
+          <OHeader isBack>
             {{
               right: () => <Icon name={iconAdd} size={19} onClick={createUnit} />
             }}
@@ -132,7 +133,7 @@ export default defineComponent({
               finished={form.listState.finished}
               finishedText=" "
               class={[styles.liveList]}
-              onLoad={getList}
+              // onLoad={getList}
               immediateCheck={false}
             >
               {form.list.map((item: any) => (
@@ -157,7 +158,7 @@ export default defineComponent({
           }
           onSelect={(val: any) => {
             form.statusText = val.name
-            form.params.status = val.id === 'ALL' ? null : val.id
+            form.params.classTypeCode = val.id === 'ALL' ? null : val.id
             form.oPopover = false
             onSearch()
           }}

+ 59 - 13
src/views/unit-test/unit-list/models/unit-student-list.tsx

@@ -26,9 +26,9 @@ import { unitTestStatus } from '@/constant'
 export default defineComponent({
   name: 'unit-student-list',
   props: {
-    item: {
-      type: Object,
-      default: () => {}
+    type: {
+      type: Number,
+      default: 1
     }
   },
   setup(props) {
@@ -47,7 +47,8 @@ export default defineComponent({
         finished: false,
         refreshing: false,
         height: 0 // 页面头部高度,为了处理下拉刷新用的
-      }
+      },
+      oldValue: ''
     })
     const gotoMsg = () => {
       postMessage({
@@ -76,14 +77,15 @@ export default defineComponent({
         if (form.list.length > 0 && result.current === 1) {
           return
         }
-        form.list = form.list.concat(result[1] || [])
-        form.listState.finished = result.current >= result.pages
-        searchList.page = result.current + 1
+        form.list = form.list = result[1] || []
+        // form.listState.finished = result.current >= result.pages
+        // searchList.page = result.current + 1
         form.listState.dataShow = form.list.length > 0
+        form.listState.finished = true
       } catch {
         form.listState.dataShow = false
         form.listState.finished = true
-        form.listState.refreshing = false
+        // form.listState.refreshing = false
       }
     }
 
@@ -95,9 +97,27 @@ export default defineComponent({
       form.listState.finished = false
       getList()
     }
+
+    const chisoStudent = (val) => {
+      getList()
+    }
+    const checkRadio = (val) => {
+      if (val == form.oldValue) {
+        searchList.status = ''
+        form.oldValue = ''
+      } else {
+        form.oldValue = val
+      }
+    }
+
     return () => (
       <div class={styles.unitList}>
-        <RadioGroup checked-color="#FF8057" v-model={searchList.status} direction="horizontal">
+        <RadioGroup
+          checked-color="#FF8057"
+          v-model={searchList.status}
+          direction="horizontal"
+          onChange={chisoStudent}
+        >
           <Tag
             size="large"
             type="primary"
@@ -105,9 +125,14 @@ export default defineComponent({
             textColor={searchList.status !== 'A_PASS' ? '#AAA' : '#FFF'}
             class={styles.radioSection}
           >
-            <Radio class={styles.radioItem} name={'A_PASS'}></Radio>
+            <Radio
+              class={styles.radioItem}
+              name={'A_PASS'}
+              onClick={() => checkRadio('A_PASS')}
+            ></Radio>
             {unitTestStatus['A_PASS']}
           </Tag>
+
           <Tag
             size="large"
             type="primary"
@@ -115,17 +140,39 @@ export default defineComponent({
             textColor={searchList.status !== 'B_NO_PASS' ? '#AAA' : '#FFF'}
             class={styles.radioSection}
           >
-            <Radio class={styles.radioItem} name={'B_NO_PASS'}></Radio>{' '}
+            <Radio
+              class={styles.radioItem}
+              name={'B_NO_PASS'}
+              onClick={() => checkRadio('B_NO_PASS')}
+            ></Radio>{' '}
             {unitTestStatus['B_NO_PASS']}
           </Tag>
           <Tag
             size="large"
             type="primary"
+            color={searchList.status !== 'C_ING' ? '#EAEAEA' : '#FF8057'}
+            textColor={searchList.status !== 'C_ING' ? '#AAA' : '#FFF'}
+            class={styles.radioSection}
+          >
+            <Radio
+              class={styles.radioItem}
+              name={'C_ING'}
+              onClick={() => checkRadio('C_ING')}
+            ></Radio>{' '}
+            {unitTestStatus['C_ING']}
+          </Tag>
+          <Tag
+            size="large"
+            type="primary"
             color={searchList.status !== 'D_NO_SUBMIT' ? '#EAEAEA' : '#FF8057'}
             textColor={searchList.status !== 'D_NO_SUBMIT' ? '#AAA' : '#FFF'}
             class={styles.radioSection}
           >
-            <Radio class={styles.radioItem} name={'D_NO_SUBMIT'}></Radio>
+            <Radio
+              class={styles.radioItem}
+              name={'D_NO_SUBMIT'}
+              onClick={() => checkRadio('D_NO_SUBMIT')}
+            ></Radio>
             {unitTestStatus['D_NO_SUBMIT']}
           </Tag>
         </RadioGroup>
@@ -142,7 +189,6 @@ export default defineComponent({
               finished={form.listState.finished}
               finishedText=" "
               class={[styles.liveList]}
-              onLoad={getList}
               immediateCheck={false}
             >
               {form.list.map((item: any) => (

+ 3 - 3
src/views/unit-test/unit-list/unitDetail.tsx

@@ -68,13 +68,13 @@ export default defineComponent({
             shrink
           >
             <Tab name="one" title="I类学生">
-              <UnitStudentList></UnitStudentList>
+              <UnitStudentList type={1}></UnitStudentList>
             </Tab>
             <Tab name="two" title="II类学生">
-              <UnitStudentList></UnitStudentList>
+              <UnitStudentList type={2}></UnitStudentList>
             </Tab>
             <Tab name="three" title="III类学生">
-              <UnitStudentList></UnitStudentList>
+              <UnitStudentList type={3}></UnitStudentList>
             </Tab>
           </Tabs>
         </div>