Explorar o código

Merge branch 'master' of http://192.168.0.115:3000/shaogen1995/qingDao_goods into master

shaogen1995 hai 2 semanas
pai
achega
dc7ebc409e

+ 1 - 1
src/pages/Cledger/C1ledger/index.module.scss

@@ -2,7 +2,7 @@
   :global {
     .TableListToprr {
       justify-content: start !important;
-      gap: 0 7%;
+      gap: 0 4%;
     }
   }
 }

+ 113 - 35
src/pages/Cledger/C1ledger/index.tsx

@@ -1,22 +1,21 @@
-import React, { useCallback, useEffect, useState } from 'react'
+import React, { useMemo } from 'react'
 import styles from './index.module.scss'
-import http from '@/utils/http'
-import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
+import { authorityFu } from '@/utils/authority'
 import { selectObj, getDictFu } from '@/utils/dataChange'
+import history from '@/utils/history'
 import TableList from '@/pages/Zother/TableList'
 import { useSelector } from 'react-redux'
 import { RootState } from '@/store'
 import { API_getGoodsList } from '@/store/action/Cledger/C1ledger'
-import { baseFormData, topSearch } from '@/pages/Zother/data'
-import { baseTableC } from '@/utils/tableData'
-import history from '@/utils/history'
+import { baseFormData } from '@/pages/Zother/data'
+import { goodsSonTableC } from '@/utils/tableData'
 import { Button, Dropdown } from 'antd'
 
 const C1topSearch = [
   {
     type: 'input',
     key: 'searchKey',
-    placeholder: '搜索藏品登记号、藏品名称,不超过30个字'
+    placeholder: '搜索藏品登记号、藏品名称'
   },
   {
     type: 'input',
@@ -56,7 +55,7 @@ const C1topSearch = [
   // TODO
   {
     type: 'select',
-    key: 'xxx',
+    key: 'status',
     placeholder: '入藏状态',
     options: selectObj['藏品入藏状态']
   },
@@ -67,35 +66,93 @@ const C1topSearch = [
     options: selectObj['藏品库存状态']
   },
   {
-    type: 'input',
-    key: 'xxx',
+    type: 'select',
+    key: 'xxxx',
     placeholder: `搜索库房位置`
   }
 ]
 
-const rightBtnOptions = {
-  dangan: [
-    {
-      key: '1',
-      label: '登记',
-      value: '1'
-    },
-    {
-      key: '2',
-      label: '注销',
-      value: '2'
-    }
-  ]
+const C1baseFormData = {
+  ...baseFormData,
+  typeDictId: '',
+  ageDictId: '',
+  textureDictId: ''
 }
 
+const columnsTempAdd = [
+  ...goodsSonTableC(false),
+  ['select', '入藏状态', 'status', selectObj['藏品入藏状态']],
+  ['txt', '库存状态', 'xxx'],
+  ['txt', '库房位置', 'xxx']
+]
+
 function C1ledger() {
-  const tableInfo = useSelector((state: RootState) => state.D1register.tableInfo)
+  const tableInfo = useSelector((state: RootState) => state.C1ledger.tableInfo)
+
+  const rightBtnOptions = useMemo(() => {
+    return {
+      dangan: [
+        {
+          key: '1',
+          label: '登记',
+          onClick: () => authorityFu(410, '您没有藏品登记权限!', () => history.push(`/register`))
+        },
+        {
+          key: '2',
+          label: '注销',
+          onClick: () => authorityFu(430, '您没有藏品注销权限!', () => history.push(`/writeOff`))
+        }
+      ],
+      kufang: [
+        {
+          key: '1',
+          label: '入库',
+          onClick: () => authorityFu(420, '您没有藏品入库权限!', () => history.push(`/inStorage`))
+        },
+        {
+          key: '2',
+          label: '移库',
+          onClick: () =>
+            authorityFu(421, '您没有藏品移库权限!', () => history.push(`/moveStorage`))
+        },
+        {
+          key: '3',
+          label: '出库',
+          onClick: () => authorityFu(422, '您没有藏品出库权限!', () => history.push(`/outStorage`))
+        }
+      ],
+      weihu: [
+        {
+          key: '1',
+          label: '鉴定登记',
+          onClick: () => authorityFu(440, '您没有藏品鉴定登记权限!', () => history.push(`/auth`))
+        },
+        {
+          key: '2',
+          label: '事故登记',
+          onClick: () =>
+            authorityFu(441, '您没有藏品事故登记权限!', () => history.push(`/accident`))
+        },
+        {
+          key: '3',
+          label: '现状登记',
+          onClick: () =>
+            authorityFu(442, '您没有藏品现状登记权限!', () => history.push(`/actuality`))
+        },
+        {
+          key: '4',
+          label: '修复登记',
+          onClick: () => authorityFu(443, '您没有藏品修复登记权限!', () => history.push(`/repair`))
+        }
+      ]
+    }
+  }, [])
 
   const dataExport = () => {
     console.log('数据导出了')
   }
 
-  // 故事管理定制右侧内容
+  // 故事管理/藏品总账定制右侧内容
   const storyTableListToprr = ({
     clickSearch,
     resetSelectFu
@@ -105,15 +162,15 @@ function C1ledger() {
   }) => {
     return (
       <>
-        {/* <Dropdown menu={{ items: rightBtnOptions['dangan'] }} trigger={['click']}>
-          档案管理
-        </Dropdown>
         <Dropdown menu={{ items: rightBtnOptions['dangan'] }} trigger={['click']}>
-          库房管理
+          <Button type='primary'>档案管理</Button>
+        </Dropdown>
+        <Dropdown menu={{ items: rightBtnOptions['kufang'] }} trigger={['click']}>
+          <Button type='primary'>库房管理</Button>
+        </Dropdown>
+        <Dropdown menu={{ items: rightBtnOptions['weihu'] }} trigger={['click']}>
+          <Button type='primary'>藏品维护</Button>
         </Dropdown>
-        <Dropdown menu={{ items: rightBtnOptions['dangan'] }} trigger={['click']}>
-          藏品维护
-        </Dropdown> */}
         <Button type='primary' onClick={dataExport}>
           数据导入
         </Button>
@@ -128,21 +185,42 @@ function C1ledger() {
     )
   }
 
+  // 故事管理/藏品总账定制右侧操作按钮
+  const storyTableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: any) => (
+          <Button
+            size='small'
+            type='text'
+            onClick={() =>
+              authorityFu(440, '您没有查看藏品信息权限!', () => history.push(`/goodsInfo`))
+            }
+          >
+            查看
+          </Button>
+        )
+      }
+    ]
+  }, [])
+
   return (
     <div className={styles.C1ledger}>
       <div className='pageTitle'>藏品总账</div>
 
       <TableList
-        baseFormData={baseFormData}
+        baseFormData={C1baseFormData}
         getListAPI={API_getGoodsList}
         pageKey='ledger'
         tableInfo={tableInfo}
-        columnsTemp={baseTableC('总账')}
-        rightBtnWidth={390}
+        columnsTemp={columnsTempAdd}
+        rightBtnWidth={350}
         leftRowWidth={'20%'}
         yHeight={585}
         searchDom={C1topSearch}
         storyTableListToprr={storyTableListToprr}
+        storyTableLastBtn={storyTableLastBtn}
       />
     </div>
   )

+ 1 - 1
src/pages/Eculture/E2story/E2edit/index.tsx

@@ -75,7 +75,7 @@ function E2edit() {
     console.log(obj)
     const res = await E2_APIsave(obj)
     if (res.code === 0) {
-      backPageFu('-1')
+      backPageFu('/story')
     }
   }, [storyInfo])
 

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

@@ -20,9 +20,9 @@ type Props = {
   rightBtnWidth?: number
   // 左侧每个输入框盒子的宽度
   leftRowWidth?: string
-  // 故事管理定制右侧内容
+  // 故事管理/藏品总账定制右侧内容
   storyTableListToprr?: (props: any) => React.ReactNode
-  // 故事管理定制操作栏
+  // 故事管理/藏品总账定制操作栏
   storyTableLastBtn?: any
 }
 
@@ -180,6 +180,7 @@ function TableList({
                   allowClear={true}
                   placeholder={item.placeholder}
                   style={item.style || ''}
+                  value={formData[item.key] ? formData[item.key] : null}
                   fieldNames={{ label: 'name', value: 'id', children: 'children' }}
                   onChange={e => setFormData({ ...formData, [item.key]: e })}
                   options={item.options}

+ 1 - 1
src/store/action/Cledger/C1ledger.ts

@@ -20,7 +20,7 @@ export const API_getGoodsList = (data: any): any => {
         total: res.data.total
       }
 
-      dispatch({ type: 'E2/getList', payload: obj })
+      dispatch({ type: 'C1/getList', payload: obj })
     }
   }
 }