|
@@ -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)
|
|
|
}}
|
|
}}
|