chenlei 2 months ago
parent
commit
17ec0d0380

+ 1 - 1
src/components/MyTable/index.tsx

@@ -221,7 +221,7 @@ const MyTable = forwardRef<MyTableMethods, MyTableProps>(
           datePicker: (item: any) => {
             return (
               <Form.Item noStyle name={`${item.id}-${v[2]}`}>
-                <DatePicker disabled={readOnly} />
+                <DatePicker disabled={readOnly} {...(v[3] || {})} />
               </Form.Item>
             )
           },

+ 139 - 18
src/pages/F_exhibition/F1exhibition/F1edit/index.tsx

@@ -5,7 +5,7 @@ import X3auditInfo from '@/pages/X_stock/X3auditInfo'
 import { Button, Input, Radio, Select } from 'antd'
 import { statusObj } from '@/utils/tableData'
 import MyTable, { MyTableMethods } from '@/components/MyTable'
-import { F1_GOOD_COLUMNS, F1_SON_TYPE_NAME_OPTS, F1_SON_TYPE_OPTS } from '../constants'
+import { F1_SON_TYPE_NAME_OPTS, F1_SON_TYPE_OPTS } from '../constants'
 import ZGaddNow from '@/components/ZGaddNow'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import history, { btnFlagFu2, infoPageBackFu, openGoodsInfoFu } from '@/utils/history'
@@ -26,10 +26,17 @@ import ZflowTable from '@/components/ZflowTable'
 import { pageTitTxtObj } from '@/pages/D_storeManage/D4impStor/D4edit'
 import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
 import { areAllCheckersFilled } from '@/utils/objects'
-import dayjs from 'dayjs'
+import dayjs, { Dayjs } from 'dayjs'
 import { EXPORT_WORD_ENUM } from '@/utils/exportTemplates'
+import { useDispatch, useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { D6_APIgetList } from '@/store/action/D6putsStor'
+import { D4_APIgetList } from '@/store/action/D4impStor'
 
 function F1edit() {
+  const dispatch = useDispatch()
+  const putsStor = useSelector((state: RootState) => state.D6putsStor.tableInfo)
+  const impStor = useSelector((state: RootState) => state.D4impStor.tableInfo)
   const { key, id } = useParams<any>()
   // 滚到顶部
   const sollrDom = useRef<HTMLDivElement>(null)
@@ -46,6 +53,96 @@ function F1edit() {
   // 藏品清单快照数据
   const [snaps, setSnaps] = useState<C1GoodType[]>([])
   const delSnapIdsRef = useRef<number[]>([])
+  const label1 = useMemo(
+    () => (topInfo.sonType === F1_SON_TYPE_ENUM.IN ? '借展部门' : '借展单位'),
+    [topInfo]
+  )
+  const goodColumns = useMemo(() => {
+    const temp = [
+      ['txt', '编号类型', 'numName'],
+      ['txt', '藏品编号', 'num'],
+      ['txt', '藏品名称', 'name'],
+      ['ping', '数量', 'pcs', 'pcsUnit'],
+      ['datePicker', '借出日期 *', 'lendDate'],
+      [
+        'input',
+        '出借经手人(甲方)',
+        'lenderA',
+        {
+          maxLength: 20,
+          placeholder: '请填写内容,不超过20字'
+        }
+      ],
+      [
+        'input',
+        '出借经手人(乙方)',
+        'lenderb',
+        {
+          maxLength: 20,
+          placeholder: '请填写内容,不超过20字'
+        }
+      ],
+      ['datePicker', '预计归还日期', 'expectedReturnDate'],
+      [
+        'datePicker',
+        '归还日期',
+        'returnDate',
+        {
+          disabledDate: (current?: Dayjs) => current && current > dayjs().endOf('day')
+        }
+      ],
+      [
+        'input',
+        '归还经手人(甲方)',
+        'handlerA',
+        {
+          maxLength: 20,
+          placeholder: '请填写内容,不超过20字'
+        }
+      ],
+      [
+        'input',
+        '归还经手人(乙方)',
+        'handlerB',
+        {
+          maxLength: 20,
+          placeholder: '请填写内容,不超过20字'
+        }
+      ],
+      [
+        'input',
+        '记录人',
+        'recorder',
+        {
+          maxLength: 20,
+          placeholder: '请填写内容,不超过20字'
+        }
+      ],
+      [
+        'input',
+        '备注',
+        'remark',
+        {
+          maxLength: 20,
+          placeholder: '请填写内容,不超过20字'
+        }
+      ]
+    ]
+
+    if (topInfo.sonType === F1_SON_TYPE_ENUM.IN) {
+      temp.splice(-1, 0, [
+        'input',
+        '放置位置',
+        'address',
+        {
+          maxLength: 20,
+          placeholder: '请填写内容,不超过20字'
+        }
+      ])
+    }
+
+    return temp
+  }, [topInfo.sonType])
 
   const snapsID2ref = useRef<{ goodsId: number; id: number }[]>([])
 
@@ -242,7 +339,7 @@ function F1edit() {
       return true
     }
     if (!topInfo.sonUnit) {
-      MessageFu.warning('借展部门不能为空')
+      MessageFu.warning(label1 + '不能为空')
       return true
     }
 
@@ -253,7 +350,7 @@ function F1edit() {
     }
 
     return false
-  }, [topInfo.sonUnit, topInfo.typeName])
+  }, [topInfo.sonUnit, topInfo.typeName, label1])
 
   // 新增的底部按钮点击
   const btnClickFu = useCallback(
@@ -344,6 +441,21 @@ function F1edit() {
     if (sollrDom.current) sollrDom.current.scrollTop = 0
   }, [creatFu, getInfoFu, key])
 
+  useEffect(() => {
+    dispatch(
+      D6_APIgetList({
+        pageNum: 1,
+        pageSize: 999
+      })
+    )
+    dispatch(
+      D4_APIgetList({
+        pageNum: 1,
+        pageSize: 999
+      })
+    )
+  }, [dispatch])
+
   return (
     <div className={style.F1edit}>
       <div className='pageTitle'>借展管理-{pageTitTxt}</div>
@@ -436,19 +548,24 @@ function F1edit() {
           <div className='D4row'>
             <div className='D4rowll'>提用审批单号:</div>
             <div className='D4rowrr'>
-              <Input
-                value={topInfo.sonNum}
-                onChange={e => setTopInfo({ ...topInfo, sonNum: e.target.value.trim() })}
-                readOnly={pageDisabled}
+              <Select
+                allowClear
+                showSearch
+                options={putsStor.list}
+                fieldNames={{
+                  label: 'num',
+                  value: 'num'
+                }}
                 placeholder='请输入内容'
-                maxLength={30}
-                showCount
+                value={topInfo.sonNum ? topInfo.sonNum : undefined}
+                onChange={e => setTopInfo({ ...topInfo, sonNum: e })}
               />
             </div>
           </div>
           <div className='D4row'>
             <div className='D4rowll'>
-              <span> * </span>借展部门:
+              <span> * </span>
+              {label1}:
             </div>
             <div className='D4rowrr'>
               <Input
@@ -464,13 +581,17 @@ function F1edit() {
           <div className='D4row'>
             <div className='D4rowll'>提退凭证号:</div>
             <div className='D4rowrr'>
-              <Input
-                value={topInfo.sonNum2}
-                onChange={e => setTopInfo({ ...topInfo, sonNum2: e.target.value.trim() })}
-                readOnly={pageDisabled}
+              <Select
+                allowClear
+                showSearch
+                options={[...impStor.list, ...putsStor.list]}
+                fieldNames={{
+                  label: 'num',
+                  value: 'num'
+                }}
                 placeholder='请输入内容'
-                maxLength={30}
-                showCount
+                value={topInfo.sonNum2 ? topInfo.sonNum2 : undefined}
+                onChange={e => setTopInfo({ ...topInfo, sonNum2: e })}
               />
             </div>
           </div>
@@ -499,7 +620,7 @@ function F1edit() {
           <MyTable
             ref={tableRef}
             list={snaps}
-            columnsTemp={F1_GOOD_COLUMNS}
+            columnsTemp={goodColumns}
             pagingInfo={false}
             lastBtn={tableLastBtn}
             readOnly={pageDisabled}

+ 5 - 65
src/pages/F_exhibition/F1exhibition/constants.ts

@@ -43,77 +43,17 @@ export const F1EXHIBITION_TABLE_COLUMNS = [
   ['txtChange', '申请状态', 'status', statusObj]
 ]
 
-export const F1_GOOD_COLUMNS = [
-  ['txt', '编号类型', 'numName'],
-  ['txt', '藏品编号', 'num'],
-  ['txt', '藏品名称', 'name'],
-  ['ping', '数量', 'pcs', 'pcsUnit'],
-  ['datePicker', '借出日期 *', 'lendDate'],
-  [
-    'input',
-    '出借经手人(甲方)',
-    'lenderA',
-    {
-      maxLength: 20,
-      placeholder: '请填写内容,不超过20字'
-    }
-  ],
-  [
-    'input',
-    '出借经手人(乙方)',
-    'lenderb',
-    {
-      maxLength: 20,
-      placeholder: '请填写内容,不超过20字'
-    }
-  ],
-  ['datePicker', '预计归还日期', 'expectedReturnDate'],
-  ['datePicker', '归还日期', 'returnDate'],
-  [
-    'input',
-    '归还经手人(甲方)',
-    'handlerA',
-    {
-      maxLength: 20,
-      placeholder: '请填写内容,不超过20字'
-    }
-  ],
-  [
-    'input',
-    '归还经手人(乙方)',
-    'handlerB',
-    {
-      maxLength: 20,
-      placeholder: '请填写内容,不超过20字'
-    }
-  ],
-  [
-    'input',
-    '记录人',
-    'recorder',
-    {
-      maxLength: 20,
-      placeholder: '请填写内容,不超过20字'
-    }
-  ],
-  [
-    'input',
-    '备注',
-    'remark',
-    {
-      maxLength: 20,
-      placeholder: '请填写内容,不超过20字'
-    }
-  ]
-]
-
 export const F1_SON_TYPE_NAME_OPTS = [
   {
     label: '临时展览',
     value: F1_SON_TYPE_NAME_ENUM.TEMP
   },
   {
-    label: '固定展览',
+    label: '主题展览',
+    value: F1_SON_TYPE_NAME_ENUM.THEME
+  },
+  {
+    label: '常设展览',
     value: F1_SON_TYPE_NAME_ENUM.FIXED
   }
 ]

+ 2 - 1
src/pages/F_exhibition/F1exhibition/types.ts

@@ -27,7 +27,8 @@ export interface IF1exhibitionParams {
 
 export enum F1_SON_TYPE_NAME_ENUM {
   TEMP = '1',
-  FIXED = '2'
+  FIXED = '2',
+  THEME = '3'
 }
 
 export enum F1_SON_TYPE_ENUM {