lanxin 3 dni temu
rodzic
commit
357ce1d1db

+ 33 - 29
src/pages/Fstorehouse/F1inStorage/index.tsx

@@ -25,6 +25,38 @@ function F1inStorage() {
       value: i.id
     }))
   }, [allWarehouseList])
+  const SEARCH_DOM = useMemo(
+    () => [
+      {
+        type: 'time',
+        key: ['startTime', 'endTime'],
+        placeholder: `入库日期`
+      },
+      {
+        type: 'select',
+        key: 'storageId',
+        placeholder: `库房名称`,
+        options: warehouseOptions
+      },
+      {
+        type: 'input',
+        key: 'searchKey',
+        placeholder: `请输入申请编号、发起人或藏品编号`
+      },
+      {
+        type: 'time',
+        key: ['businessStartTime', 'businessEndTime'],
+        placeholder: `发起日期`
+      },
+      {
+        type: 'select',
+        key: 'status',
+        placeholder: `申请状态`,
+        options: selectObj['藏品入库申请状态']
+      }
+    ],
+    [warehouseOptions]
+  )
 
   const dataExport = () => {
     console.log('数据导出了')
@@ -59,35 +91,7 @@ function F1inStorage() {
         columnsTemp={inStorageTableC}
         rightBtnWidth={340}
         yHeight={585}
-        searchDom={[
-          {
-            type: 'time',
-            key: ['startTime', 'endTime'],
-            placeholder: `入库日期`
-          },
-          {
-            type: 'select',
-            key: 'storageId',
-            placeholder: `库房名称`,
-            options: warehouseOptions
-          },
-          {
-            type: 'input',
-            key: 'searchKey',
-            placeholder: `请输入申请编号、发起人或藏品编号`
-          },
-          {
-            type: 'time',
-            key: ['businessStartTime', 'businessEndTime'],
-            placeholder: `发起日期`
-          },
-          {
-            type: 'select',
-            key: 'status',
-            placeholder: `申请状态`,
-            options: selectObj['藏品入库申请状态']
-          }
-        ]}
+        searchDom={SEARCH_DOM}
         storyTableListToprr={({ clickSearch, resetSelectFu }) => (
           <>
             <Button type='primary' ghost onClick={() => tableBtnFu(null, '1')}>

+ 3 - 2
src/pages/Zother/TableList/index.tsx

@@ -57,6 +57,7 @@ const TableList = forwardRef<any, Props>(function TableList(props, ref) {
     staBtn
   } = props
   const dispatch = useDispatch()
+  const _searchDom = useRef(searchDom)
 
   const [formData, setFormData] = useState({ ...baseFormData })
 
@@ -98,13 +99,13 @@ const TableList = forwardRef<any, Props>(function TableList(props, ref) {
       ...formDataRef.current,
       ...(extraParams || {})
     }
-    searchDom.forEach((item: any) => {
+    _searchDom.current.forEach((item: any) => {
       if (item.type === 'cascader' && item.key && Array.isArray(params[item.key])) {
         params[item.key] = params[item.key][params[item.key].length - 1]
       }
     })
     dispatch(getListAPI(params))
-  }, [dispatch, getListAPI, extraParams, searchDom])
+  }, [dispatch, getListAPI, extraParams])
 
   useEffect(() => {
     getListFu()