shaogen1995 3 月之前
父节点
当前提交
9bfb654332

+ 19 - 11
src/pages/D_storeManage/D1storage/D1goods/index.tsx

@@ -51,7 +51,7 @@ function D1goods({ lookData, TreeDom, tableId }: Props) {
     }, 50)
   }, [formData])
 
-  // 待完善 看下返回的字段在表格中显示对不对
+  //看下返回的字段在表格中显示对不对
   const [table, setTable] = useState({
     list: [],
     total: 0
@@ -59,16 +59,18 @@ function D1goods({ lookData, TreeDom, tableId }: Props) {
 
   // 封装发送请求的函数
   const getListFu = useCallback(async () => {
-    const res = await D1_APIgetGoodsList({
-      ...formDataRef.current,
-      storageId: tableId,
-      ...siteCan.current
-    })
-    if (res.code === 0) {
-      setTable({
-        list: res.data.records,
-        total: res.data.total
+    if (tableId) {
+      const res = await D1_APIgetGoodsList({
+        ...formDataRef.current,
+        storageId: tableId,
+        ...siteCan.current
       })
+      if (res.code === 0) {
+        setTable({
+          list: res.data.records,
+          total: res.data.total
+        })
+      }
     }
   }, [tableId])
 
@@ -113,6 +115,12 @@ function D1goods({ lookData, TreeDom, tableId }: Props) {
   const startBtn = useMemo(() => {
     return [
       {
+        title: '库位号',
+        render: (item: any) => {
+          return '待完善'
+        }
+      },
+      {
         title: '藏品编号',
         render: (item: any) => {
           return (
@@ -152,7 +160,7 @@ function D1goods({ lookData, TreeDom, tableId }: Props) {
             allowClear={true}
             options={selectObj['藏品编号类型']}
             style={{ width: 160 }}
-            value={formData.numName}
+            value={formData.numName ? formData.numName : null}
             placeholder='全部'
             onChange={e => setFormData({ ...formData, numName: e })}
           />

+ 17 - 13
src/pages/D_storeManage/D1storage/index.tsx

@@ -13,7 +13,7 @@ type TypeTopBtn = '按库位查看' | '按藏品查看'
 const topBtnArr: TypeTopBtn[] = ['按库位查看', '按藏品查看']
 
 function D1storage() {
-  const [topAc, setTopAc] = useState<TypeTopBtn>('按库位查看')
+  const [topAc, setTopAc] = useState<TypeTopBtn>('按藏品查看')
 
   // 库位传递参数给藏品
   const lookData = useRef({} as D1canType)
@@ -144,18 +144,22 @@ function D1storage() {
       <div className='pageTitle'>分库管理</div>
       <div className='D1top'>
         <span className='D1topllTxt'>仓库列表</span>
-        {topBtnArr.map(v => (
-          <Button
-            onClick={() => {
-              lookData.current = {} as D1canType
-              setTopAc(v)
-            }}
-            key={v}
-            type={topAc === v ? 'primary' : 'default'}
-          >
-            {v}
-          </Button>
-        ))}
+        {1 + 1 !== 2 ? (
+          <>
+            {topBtnArr.map(v => (
+              <Button
+                onClick={() => {
+                  lookData.current = {} as D1canType
+                  setTopAc(v)
+                }}
+                key={v}
+                type={topAc === v ? 'primary' : 'default'}
+              >
+                {v}
+              </Button>
+            ))}
+          </>
+        ) : null}
       </div>
       <div className='D1main'>
         {topAc === '按库位查看' ? (

+ 30 - 14
src/pages/D_storeManage/D2storSet/D2edit.tsx

@@ -13,9 +13,10 @@ type Props = {
   sId: number
   succToLookFu: (id: number) => void
   closeFu: () => void
+  isLook: boolean
 }
 
-function D2edit({ sId, succToLookFu, closeFu }: Props) {
+function D2edit({ sId, succToLookFu, closeFu, isLook }: Props) {
   // 获取用户列表
   const dispatch = useDispatch()
   useEffect(() => {
@@ -75,7 +76,7 @@ function D2edit({ sId, succToLookFu, closeFu }: Props) {
     <Modal
       wrapClassName={styles.D2edit}
       open={true}
-      title={sId > 0 ? '编辑' : '新增'}
+      title={isLook ? '查看' : sId > 0 ? '编辑' : '新增'}
       footer={
         [] // 设置footer为空,去掉 取消 确定默认按钮
       }
@@ -95,15 +96,15 @@ function D2edit({ sId, succToLookFu, closeFu }: Props) {
             name='name'
             rules={[{ required: true, message: '请输入仓库名称' }]}
           >
-            <Input maxLength={30} showCount placeholder='请输入内容' />
+            <Input readOnly={isLook} maxLength={30} showCount placeholder='请输入内容' />
           </Form.Item>
 
           <Form.Item
-            label='仓库编码'
+            label='分库缩写'
             name='num'
-            rules={[{ required: true, message: '请输入仓库编码' }]}
+            rules={[{ required: true, message: '请输入分库缩写' }]}
           >
-            <Input maxLength={30} showCount placeholder='请输入内容' />
+            <Input readOnly={isLook} maxLength={30} showCount placeholder='请输入内容' />
           </Form.Item>
 
           <Form.Item
@@ -112,6 +113,7 @@ function D2edit({ sId, succToLookFu, closeFu }: Props) {
             rules={[{ required: true, message: '请选择仓库负责人' }]}
           >
             <Select
+              disabled={isLook}
               placeholder='请选择'
               options={userList.map(v => ({ value: v.id, label: v.realName || v.userName }))}
             />
@@ -120,21 +122,27 @@ function D2edit({ sId, succToLookFu, closeFu }: Props) {
           {/* 库保员 */}
           <Form.Item label='库保员' name='memberUserIds'>
             <Select
+              disabled={isLook}
               showSearch={false}
               mode='multiple'
               allowClear
               style={{ width: '100%' }}
-              placeholder='请选择'
+              placeholder={isLook ? '(空)' : '请选择'}
               options={userList.map(v => ({ value: v.id, label: v.realName || v.userName }))}
             />
           </Form.Item>
 
           <Form.Item label='仓库说明' name='description'>
-            <TextArea maxLength={500} showCount placeholder='请输入内容' />
+            <TextArea
+              readOnly={isLook}
+              maxLength={500}
+              showCount
+              placeholder={isLook ? '(空)' : '请输入内容'}
+            />
           </Form.Item>
 
           <Form.Item label='仓库状态' name='enable' rules={[{ required: true, message: '' }]}>
-            <Radio.Group>
+            <Radio.Group disabled={isLook}>
               <Radio value={1}>启用</Radio>
               <Radio value={0}>禁用</Radio>
             </Radio.Group>
@@ -143,11 +151,19 @@ function D2edit({ sId, succToLookFu, closeFu }: Props) {
           {/* 确定和取消按钮 */}
           <br />
           <Form.Item wrapperCol={{ offset: 9, span: 16 }}>
-            <Button type='primary' htmlType='submit'>
-              提交
-            </Button>
-            &emsp;
-            <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+            {isLook ? (
+              <Button style={{ marginLeft: 50 }} onClick={closeFu}>
+                关闭
+              </Button>
+            ) : (
+              <>
+                <Button type='primary' htmlType='submit'>
+                  提交
+                </Button>
+                &emsp;
+                <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+              </>
+            )}
           </Form.Item>
         </Form>
       </div>

+ 6 - 1
src/pages/D_storeManage/D2storSet/D2look/index.tsx

@@ -107,7 +107,12 @@ function D2look() {
 
       {/* 编辑弹窗 */}
       {editId ? (
-        <D2edit sId={editId} succToLookFu={() => getInfoFu()} closeFu={() => setEditId(0)} />
+        <D2edit
+          sId={editId}
+          isLook={true}
+          succToLookFu={() => getInfoFu()}
+          closeFu={() => setEditId(0)}
+        />
       ) : null}
     </div>
   )

+ 21 - 9
src/pages/D_storeManage/D2storSet/index.tsx

@@ -104,18 +104,29 @@ function D2storSet() {
               <Button
                 size='small'
                 type='text'
-                onClick={() => history.push(`/storSet_look/${item.id}`)}
+                onClick={() => setEditId({ id: item.id, txt: '查看' })}
               >
                 查看
               </Button>
-              <Button
+              {/* <Button
+                size='small'
+                type='text'
+                onClick={() => history.push(`/storSet_look/${item.id}`)}
+              >
+                查看
+              </Button> */}
+              {/* <Button
                 size='small'
                 type='text'
                 onClick={() => history.push(`/storSet_site/${item.id}/${item.name}`)}
               >
                 库位设置
-              </Button>
-              <Button size='small' type='text' onClick={() => setEditId(item.id)}>
+              </Button> */}
+              <Button
+                size='small'
+                type='text'
+                onClick={() => setEditId({ id: item.id, txt: '编辑' })}
+              >
                 编辑
               </Button>
               <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
@@ -127,7 +138,7 @@ function D2storSet() {
   }, [delTableFu])
 
   // 新增和编辑
-  const [editId, setEditId] = useState(0)
+  const [editId, setEditId] = useState({ id: 0, txt: '' })
 
   return (
     <div className={styles.D2storSet}>
@@ -172,7 +183,7 @@ function D2storSet() {
           />
         </div>
         <div className='D2toprr'>
-          <Button type='primary' onClick={() => setEditId(-1)}>
+          <Button type='primary' onClick={() => setEditId({ id: -1, txt: '新增' })}>
             新增
           </Button>
           &emsp;
@@ -198,11 +209,12 @@ function D2storSet() {
       </div>
 
       {/* 新增和编辑弹窗 */}
-      {editId ? (
+      {editId.id ? (
         <D2edit
-          sId={editId}
+          isLook={editId.txt === '查看'}
+          sId={editId.id}
           succToLookFu={id => history.push(`/storSet_look/${id}`)}
-          closeFu={() => setEditId(0)}
+          closeFu={() => setEditId({ id: 0, txt: '' })}
         />
       ) : null}
     </div>

+ 8 - 8
src/utils/tableData.ts

@@ -138,16 +138,16 @@ export const B3FtableC = [
 ]
 
 export const D1GtableC = [
-  ['img', '封面图', 'thumb'],
   ['txt', '编号类型', 'numName'],
+  // ['img', '封面图', 'thumb'],
   ['txt', '藏品名称', 'name'],
   ['ping', '数量', 'pcs', 'pcsUnit'],
-  ['txtChange', '库存状态', 'statusStorage', statusStorageObj],
-  ['txt', '区域名称', 'regionName'],
-  ['txt', '排架', 'layer1'],
-  ['txt', '层数', 'layer2'],
-  ['txt', '层格', 'layer3'],
-  ['txt', '库位说明', 'description']
+  ['txtChange', '库存状态', 'statusStorage', statusStorageObj]
+  // ['txt', '区域名称', 'regionName'],
+  // ['txt', '排架', 'layer1'],
+  // ['txt', '层数', 'layer2'],
+  // ['txt', '层格', 'layer3'],
+  // ['txt', '库位说明', 'description']
 ]
 
 export const B3tableC = [
@@ -213,7 +213,7 @@ export const D1tableC = [
 
 export const D2tableC = [
   ['txt', '仓库名称', 'name'],
-  ['txt', '仓库编码', 'num'],
+  ['txt', '分库缩写', 'num'],
   ['txt', '仓库负责人', 'managerUser'],
   ['text', '仓库说明', 'description', 100],
   ['txtChange', '仓库状态', 'enable', { 0: '禁用', 1: '启用' }]