jinx пре 1 недеља
родитељ
комит
d4e6443c1f
2 измењених фајлова са 36 додато и 76 уклоњено
  1. 5 55
      src/pages/A1check/A4collect/data.ts
  2. 31 21
      src/pages/A1check/A4collect/index.tsx

+ 5 - 55
src/pages/A1check/A4collect/data.ts

@@ -1,63 +1,13 @@
-import { resDictStr } from '@/utils/select'
-
 export const A4topArr = [
 export const A4topArr = [
   {
   {
-    key: 'numName',
-    placeholder: '编号类型',
-    type: 'Select',
-    options: resDictStr('编号类型')
+    key: 'cityBase',
+    placeholder: '请选择 省、自治区、直辖市',
+    type: 'Cascader'
   },
   },
   {
   {
-    key: 'num',
-    placeholder: '请输入编号',
+    key: 'collectionUnit',
+    placeholder: '请搜索收藏单位',
     type: 'Input'
     type: 'Input'
-  },
-  {
-    key: 'name',
-    placeholder: '请搜索名称或原名',
-    type: 'Input'
-  },
-  {
-    key: 'level',
-    placeholder: '级别',
-    type: 'Select',
-    options: resDictStr('文物级别')
-  },
-  {
-    key: 'type',
-    placeholder: '类别',
-    type: 'Select',
-    options: resDictStr('类别')
-  },
-  {
-    key: 'status',
-    placeholder: '盘点状态',
-    type: 'Select',
-    options: resDictStr('盘点状态')
-  },
-  {
-    key: 'conform',
-    placeholder: '相符情况',
-    type: 'Select',
-    options: resDictStr('相符情况')
-  },
-  {
-    key: 'unInfo',
-    placeholder: '不符情形',
-    type: 'Select',
-    options: resDictStr('不符情形')
-  },
-  {
-    key: 'reasonInfo',
-    placeholder: '不符原因',
-    type: 'Select',
-    options: resDictStr('不符原因')
-  },
-  {
-    key: 'effect',
-    placeholder: '生效状态',
-    type: 'Select',
-    options: resDictStr('生效状态')
   }
   }
 ]
 ]
 
 

+ 31 - 21
src/pages/A1check/A4collect/index.tsx

@@ -2,27 +2,23 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
 import { A4columnsTemp, A4topArr, A4widthSet } from './data'
 import { A4columnsTemp, A4topArr, A4widthSet } from './data'
 import AAbtn from '@/pages/ZcomPage/AAbtn'
 import AAbtn from '@/pages/ZcomPage/AAbtn'
-import { Input, Select, Button } from 'antd'
+import { Cascader, Input, Button } from 'antd'
 import MyTable from '@/components/MyTable'
 import MyTable from '@/components/MyTable'
 import ExportJsonExcel from 'js-export-excel'
 import ExportJsonExcel from 'js-export-excel'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
 import { MessageFu } from '@/utils/message'
 import { MessageFu } from '@/utils/message'
 import { getTokenInfo } from '@/utils/storage'
 import { getTokenInfo } from '@/utils/storage'
 import { baseUrlTemp, envFlag } from '@/utils/http'
 import { baseUrlTemp, envFlag } from '@/utils/http'
+import { cityArr } from '@/pages/Z_system/Z4organization/data'
 
 
 type FormStateType = {
 type FormStateType = {
   pageNum: number
   pageNum: number
   pageSize: number
   pageSize: number
-  numName?: string
-  num?: string
-  name?: string
-  level?: string
-  type?: string
-  status?: string
-  conform?: string
-  unInfo?: string
-  reasonInfo?: string
-  effect?: string
+  province?: string
+  city?: string
+  region?: string
+  cityBase?: string[]
+  collectionUnit?: string
 }
 }
 
 
 type CollectRowType = {
 type CollectRowType = {
@@ -123,6 +119,11 @@ const silentPost = async (url: string, data: any) => {
   }
   }
 }
 }
 
 
+const buildQueryPayload = (form: FormStateType): FormStateType => {
+  const { cityBase: _cityBase, ...rest } = form
+  return rest
+}
+
 function A4collect() {
 function A4collect() {
   const [formData, setFormData] = useState<FormStateType>({
   const [formData, setFormData] = useState<FormStateType>({
     pageNum: 1,
     pageNum: 1,
@@ -252,15 +253,24 @@ function A4collect() {
         <div className='A4searchRow'>
         <div className='A4searchRow'>
           {A4topArr.map(item => (
           {A4topArr.map(item => (
             <div className='A4searchItem' key={item.key}>
             <div className='A4searchItem' key={item.key}>
-              {item.type === 'Select' ? (
-                <Select
+              {item.type === 'Cascader' ? (
+                <Cascader
                   allowClear
                   allowClear
+                  changeOnSelect
+                  options={myCity}
                   placeholder={item.placeholder}
                   placeholder={item.placeholder}
-                  options={item.options}
-                  value={(searchForm as any)[item.key] || null}
-                  onChange={value =>
-                    setSearchForm(prev => ({ ...prev, [item.key]: value || undefined }))
-                  }
+                  value={(searchForm as any)[item.key] || []}
+                  onChange={value => {
+                    const nextValue = (value || []) as string[]
+                    const nextState: FormStateType = {
+                      ...searchForm,
+                      cityBase: nextValue.length ? nextValue : undefined
+                    }
+                    cityArr.forEach((field, index) => {
+                      ;(nextState as any)[field] = nextValue[index] || undefined
+                    })
+                    setSearchForm(nextState)
+                  }}
                 />
                 />
               ) : (
               ) : (
                 <Input
                 <Input
@@ -283,18 +293,18 @@ function A4collect() {
           <AAbtn
           <AAbtn
             txt={1}
             txt={1}
             onClick={() =>
             onClick={() =>
-              setFormData({
+              setFormData(buildQueryPayload({
                 ...searchForm,
                 ...searchForm,
                 pageNum: 1,
                 pageNum: 1,
                 pageSize: formData.pageSize
                 pageSize: formData.pageSize
-              })
+              }))
             }
             }
             tit='查询'
             tit='查询'
           />
           />
           <AAbtn
           <AAbtn
             txt={2}
             txt={2}
             onClick={() => {
             onClick={() => {
-              const resetForm = { pageNum: 1, pageSize: formData.pageSize }
+              const resetForm: FormStateType = { pageNum: 1, pageSize: formData.pageSize }
               setSearchForm(resetForm)
               setSearchForm(resetForm)
               setFormData(resetForm)
               setFormData(resetForm)
             }}
             }}