Sfoglia il codice sorgente

小组多选下拉框场景下,“全部”选项的交互修改

刘洋 1 anno fa
parent
commit
7b6158f9db

+ 15 - 1
src/hooks/useOptions.ts

@@ -73,7 +73,21 @@ const useOptions = (
   const changeModelValue = <T extends keyof DataModel>(key: T) => {
   const changeModelValue = <T extends keyof DataModel>(key: T) => {
     return (v: DataModel[T]) => {
     return (v: DataModel[T]) => {
       console.log('changeModelValue', key, v)
       console.log('changeModelValue', key, v)
-      dataModel[key] = v
+      // dataModel[key] = v
+
+      if (multGroup && key === 'group') {
+        if (v.includes(undefined)) {
+          if (dataModel[key]?.length === groupListWithAll.value.length) {
+            dataModel[key] = v.filter((item: any) => !!item)
+          } else {
+            dataModel[key] = groupListWithAll.value.map((item: any) => item.value)
+          }
+        } else {
+          dataModel[key] = v.filter((item: any) => !!item)
+        }
+      } else {
+        dataModel[key] = v
+      }
     }
     }
   }
   }
 
 

+ 12 - 12
src/modules/admin-data/task-setting/index.vue

@@ -123,16 +123,16 @@ const customGroupChange = (v: any) => {
   }
   }
 }
 }
 const transGroupOptions = computed(() => {
 const transGroupOptions = computed(() => {
-  return (taskSettingModel.markingGroupNumbers || []).includes(undefined)
-    ? (groupListWithAll.value || []).map((item: any) => {
-        item.value != undefined && (item.disabled = true)
-        return item
-      })
-    : groupListWithAll.value.map((item: any) => {
-        item.disabled = false
-        return item
-      })
-  // return groupListWithAll.value || []
+  // return (taskSettingModel.markingGroupNumbers || []).includes(undefined)
+  //   ? (groupListWithAll.value || []).map((item: any) => {
+  //       item.value != undefined && (item.disabled = true)
+  //       return item
+  //     })
+  //   : groupListWithAll.value.map((item: any) => {
+  //       item.disabled = false
+  //       return item
+  //     })
+  return groupListWithAll.value || []
 })
 })
 
 
 const items = computed<EpFormItem[]>(() => [
 const items = computed<EpFormItem[]>(() => [
@@ -170,10 +170,10 @@ const items = computed<EpFormItem[]>(() => [
     hidden: !isGroupSetting.value,
     hidden: !isGroupSetting.value,
     slot: {
     slot: {
       // options: groupList.value,
       // options: groupList.value,
-      // onChange: changeModelValue('group'),
+      onChange: changeModelValue('group'),
       // multiple: true,
       // multiple: true,
       options: transGroupOptions.value,
       options: transGroupOptions.value,
-      onChange: customGroupChange,
+      // onChange: customGroupChange,
       multiple: true,
       multiple: true,
     },
     },
   }),
   }),

+ 12 - 11
src/modules/analysis/group-monitoring/hooks/useFormFilter.ts

@@ -81,16 +81,16 @@ const useFormFilter = () => {
     }
     }
   }
   }
   const transGroupOptions = computed(() => {
   const transGroupOptions = computed(() => {
-    return (model.markingGroupNumbers || []).includes(undefined)
-      ? (groupListWithAll.value || []).map((item: any) => {
-          item.value != undefined && (item.disabled = true)
-          return item
-        })
-      : groupListWithAll.value.map((item: any) => {
-          item.disabled = false
-          return item
-        })
-    // return groupListWithAll.value || []
+    // return (model.markingGroupNumbers || []).includes(undefined)
+    //   ? (groupListWithAll.value || []).map((item: any) => {
+    //       item.value != undefined && (item.disabled = true)
+    //       return item
+    //     })
+    //   : groupListWithAll.value.map((item: any) => {
+    //       item.disabled = false
+    //       return item
+    //     })
+    return groupListWithAll.value || []
   })
   })
   const items = computed<EpFormItem[]>(() => [
   const items = computed<EpFormItem[]>(() => [
     OneRowSpan5({
     OneRowSpan5({
@@ -119,7 +119,8 @@ const useFormFilter = () => {
       slotType: 'select',
       slotType: 'select',
       slot: {
       slot: {
         options: transGroupOptions.value,
         options: transGroupOptions.value,
-        onChange: customGroupChange,
+        // onChange: customGroupChange,
+        onChange: changeModelValue('group'),
         multiple: true,
         multiple: true,
       },
       },
     }),
     }),

+ 3 - 2
src/modules/analysis/monitoring/index.vue

@@ -156,7 +156,7 @@ const formItems = computed<EpFormItem[]>(() => [
   {
   {
     label: '小组',
     label: '小组',
     slotType: 'select',
     slotType: 'select',
-    prop: 'markingGroupNumber',
+    prop: 'markingGroupNumbers',
     slot: {
     slot: {
       options: groupListWithAll.value,
       options: groupListWithAll.value,
       onChange: changeModelValue('group'),
       onChange: changeModelValue('group'),
@@ -366,7 +366,8 @@ const onRefresh = () => {
   day < 10 && (day = '0' + day)
   day < 10 && (day = '0' + day)
   if (fetchModel.subjectCode && fetchModel.questionMainNumber) {
   if (fetchModel.subjectCode && fetchModel.questionMainNumber) {
     fetch({
     fetch({
-      ...omit(fetchModel, 'refresh'),
+      ...omit(fetchModel, ['refresh', 'markingGroupNumbers']),
+      markingGroupNumbers: [fetchModel.markingGroupNumbers],
       // startTime: `${year}${month}${day}000000`,
       // startTime: `${year}${month}${day}000000`,
       // endTime: `${year}${month}${day}235959`,
       // endTime: `${year}${month}${day}235959`,
       curDay: `${year}${month}${day}`,
       curDay: `${year}${month}${day}`,

+ 11 - 11
src/modules/analysis/personnel-compare/hooks/useCompareFilter.ts

@@ -66,16 +66,16 @@ const useCompareFilter = () => {
     }
     }
   }
   }
   const transGroupOptions = computed(() => {
   const transGroupOptions = computed(() => {
-    return (model.markingGroupNumber || []).includes(undefined)
-      ? (groupListWithAll.value || []).map((item: any) => {
-          item.value != undefined && (item.disabled = true)
-          return item
-        })
-      : groupListWithAll.value.map((item: any) => {
-          item.disabled = false
-          return item
-        })
-    // return groupListWithAll.value || []
+    // return (model.markingGroupNumber || []).includes(undefined)
+    //   ? (groupListWithAll.value || []).map((item: any) => {
+    //       item.value != undefined && (item.disabled = true)
+    //       return item
+    //     })
+    //   : groupListWithAll.value.map((item: any) => {
+    //       item.disabled = false
+    //       return item
+    //     })
+    return groupListWithAll.value || []
   })
   })
 
 
   const items = computed(() => [
   const items = computed(() => [
@@ -108,7 +108,7 @@ const useCompareFilter = () => {
       labelWidth: '52px',
       labelWidth: '52px',
       slot: {
       slot: {
         options: transGroupOptions.value,
         options: transGroupOptions.value,
-        onChange: customGroupChange,
+        onChange: changeModelValue('group'),
         multiple: true,
         multiple: true,
       },
       },
     }),
     }),

+ 0 - 1
src/modules/analysis/personnel-compare/index.vue

@@ -158,7 +158,6 @@ const allTableData = computed(() => {
       let g = groups[i]
       let g = groups[i]
       arr.push(...g.markerCompares)
       arr.push(...g.markerCompares)
     }
     }
-    console.log('allTableData', arr)
     return arr
     return arr
   } else {
   } else {
     return []
     return []

+ 11 - 11
src/modules/analysis/personnel-statistics/hooks/useStatisticsFilter.ts

@@ -144,16 +144,16 @@ const useStatisticsFilter = () => {
     }
     }
   }
   }
   const transGroupOptions = computed(() => {
   const transGroupOptions = computed(() => {
-    return (model.markingGroupNumber || []).includes(undefined)
-      ? (groupListWithAll.value || []).map((item: any) => {
-          item.value != undefined && (item.disabled = true)
-          return item
-        })
-      : groupListWithAll.value.map((item: any) => {
-          item.disabled = false
-          return item
-        })
-    // return groupListWithAll.value || []
+    // return (model.markingGroupNumber || []).includes(undefined)
+    //   ? (groupListWithAll.value || []).map((item: any) => {
+    //       item.value != undefined && (item.disabled = true)
+    //       return item
+    //     })
+    //   : groupListWithAll.value.map((item: any) => {
+    //       item.disabled = false
+    //       return item
+    //     })
+    return groupListWithAll.value || []
   })
   })
 
 
   const items = computed<EpFormItem[]>(() => [
   const items = computed<EpFormItem[]>(() => [
@@ -186,7 +186,7 @@ const useStatisticsFilter = () => {
       slotType: 'select',
       slotType: 'select',
       slot: {
       slot: {
         options: transGroupOptions.value,
         options: transGroupOptions.value,
-        onChange: customGroupChange,
+        onChange: changeModelValue('group'),
         multiple: true,
         multiple: true,
         disabled: isDeputy.value,
         disabled: isDeputy.value,
       },
       },

+ 5 - 1
src/modules/analysis/personnel-statistics/index.vue

@@ -218,7 +218,11 @@ function onSearch() {
     searchMarkerId.value = model.markerId
     searchMarkerId.value = model.markerId
     searchOnline.value = model.online
     searchOnline.value = model.online
     if (deputyHasInit.value) {
     if (deputyHasInit.value) {
-      let params: any = { ...omit(fetchModel.value, 'expand', 'markerId', 'online'), markingGroupNumber: '' }
+      // let params: any = { ...omit(fetchModel.value, 'expand', 'markerId', 'online'), markingGroupNumber: '' }
+      let params: any = {
+        ...omit(fetchModel.value, 'expand', 'markerId', 'online', 'markingGroupNumber'),
+        markingGroupNumbers: fetchModel.value.markingGroupNumber.filter(Boolean),
+      }
       if (fetchModel.value.curDay == 'notIncludeCurDay') {
       if (fetchModel.value.curDay == 'notIncludeCurDay') {
         params.curDay = ''
         params.curDay = ''
         params.includeCurDay = false
         params.includeCurDay = false

+ 11 - 11
src/modules/marking/inquiry/index.vue

@@ -282,16 +282,16 @@ const customGroupChange = (v: any) => {
   }
   }
 }
 }
 const transGroupOptions = computed(() => {
 const transGroupOptions = computed(() => {
-  return (model.markingGroupNumbers || []).includes(undefined)
-    ? (groupListWithAll.value || []).map((item: any) => {
-        item.value != undefined && (item.disabled = true)
-        return item
-      })
-    : groupListWithAll.value.map((item: any) => {
-        item.disabled = false
-        return item
-      })
-  // return groupListWithAll.value || []
+  // return (model.markingGroupNumbers || []).includes(undefined)
+  //   ? (groupListWithAll.value || []).map((item: any) => {
+  //       item.value != undefined && (item.disabled = true)
+  //       return item
+  //     })
+  //   : groupListWithAll.value.map((item: any) => {
+  //       item.disabled = false
+  //       return item
+  //     })
+  return groupListWithAll.value || []
 })
 })
 
 
 const items = computed<EpFormItem[]>(() => [
 const items = computed<EpFormItem[]>(() => [
@@ -324,7 +324,7 @@ const items = computed<EpFormItem[]>(() => [
     slot: {
     slot: {
       placeholder: '评卷小组',
       placeholder: '评卷小组',
       options: transGroupOptions.value,
       options: transGroupOptions.value,
-      onChange: customGroupChange,
+      onChange: changeModelValue('group'),
       multiple: true,
       multiple: true,
     },
     },
   }),
   }),

+ 11 - 11
src/modules/monitor/training-monitoring/hooks/useFormFilter.ts

@@ -134,16 +134,16 @@ const useFormFilter = () => {
     }
     }
   }
   }
   const transGroupOptions = computed(() => {
   const transGroupOptions = computed(() => {
-    return (model.markingGroupNumbers || []).includes(undefined)
-      ? (groupListWithAll.value || []).map((item: any) => {
-          item.value != undefined && (item.disabled = true)
-          return item
-        })
-      : groupListWithAll.value.map((item: any) => {
-          item.disabled = false
-          return item
-        })
-    // return groupListWithAll.value || []
+    // return (model.markingGroupNumbers || []).includes(undefined)
+    //   ? (groupListWithAll.value || []).map((item: any) => {
+    //       item.value != undefined && (item.disabled = true)
+    //       return item
+    //     })
+    //   : groupListWithAll.value.map((item: any) => {
+    //       item.disabled = false
+    //       return item
+    //     })
+    return groupListWithAll.value || []
   })
   })
 
 
   const items = computed<EpFormItem[]>(() => {
   const items = computed<EpFormItem[]>(() => {
@@ -177,7 +177,7 @@ const useFormFilter = () => {
         labelWidth: '50px',
         labelWidth: '50px',
         slot: {
         slot: {
           options: transGroupOptions.value,
           options: transGroupOptions.value,
-          onChange: customGroupChange,
+          onChange: changeModelValue('group'),
           multiple: true,
           multiple: true,
         },
         },
       }),
       }),

+ 11 - 11
src/modules/quality/self-check/index.vue

@@ -108,16 +108,16 @@ const customGroupChange = (v: any) => {
   }
   }
 }
 }
 const transGroupOptions = computed(() => {
 const transGroupOptions = computed(() => {
-  return (model.markingGroupNumbers || []).includes(undefined)
-    ? (groupListWithAll.value || []).map((item: any) => {
-        item.value != undefined && (item.disabled = true)
-        return item
-      })
-    : groupListWithAll.value.map((item: any) => {
-        item.disabled = false
-        return item
-      })
-  // return groupListWithAll.value || []
+  // return (model.markingGroupNumbers || []).includes(undefined)
+  //   ? (groupListWithAll.value || []).map((item: any) => {
+  //       item.value != undefined && (item.disabled = true)
+  //       return item
+  //     })
+  //   : groupListWithAll.value.map((item: any) => {
+  //       item.disabled = false
+  //       return item
+  //     })
+  return groupListWithAll.value || []
 })
 })
 
 
 const items = computed<EpFormItem[]>(() => {
 const items = computed<EpFormItem[]>(() => {
@@ -143,7 +143,7 @@ const items = computed<EpFormItem[]>(() => {
       label: '小组',
       label: '小组',
       slotType: 'select',
       slotType: 'select',
       prop: 'markingGroupNumbers',
       prop: 'markingGroupNumbers',
-      slot: { options: transGroupOptions.value, onChange: customGroupChange, multiple: true },
+      slot: { options: transGroupOptions.value, onChange: changeModelValue('group'), multiple: true },
     }),
     }),
     OneRowSpan6({
     OneRowSpan6({
       label: '时间',
       label: '时间',