Quellcode durchsuchen

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

lanxin vor 2 Wochen
Ursprung
Commit
d217531d80

+ 4 - 0
src/pages/Benter/B2enterGuan/B2edit/index.module.scss

@@ -0,0 +1,4 @@
+// .B2edit {
+//   :global {
+//   }
+// }

+ 50 - 0
src/pages/Benter/B2enterGuan/B2edit/index.tsx

@@ -0,0 +1,50 @@
+import React from 'react'
+import styles from './index.module.scss'
+import { rowArrTemp } from '@/pages/Zother/data'
+import { InfoProvider } from '@/pages/Zother/InfoContext'
+import EditTop from '@/pages/Zother/EditTop'
+import { B2_APIgetClueList, B2_APIgoodsSave, B2API_obj } from '@/store/action/Benter/B2enterGuan'
+import EditBtn from '@/pages/Zother/EditBtn'
+import SonGoodsList from '@/pages/Zother/SonGoodsList'
+
+const rowArr = rowArrTemp('入馆')
+
+function B2edit() {
+  return (
+    <InfoProvider>
+      <div className={styles.B2edit} id='editBox'>
+        <div className='editMain'>
+          {/* 顶部 */}
+          <EditTop
+            pageTxt='藏品入馆'
+            rowArr={rowArr}
+            APIobj={B2API_obj}
+            fileUpInfo={{ myUrl: 'cms/order/house/upload', dirCode: 'enterGuan' }}
+          />
+
+          {/* 藏品清单 */}
+          <SonGoodsList
+            fileUpInfo={{ myUrl: 'cms/order/house/son/upload', dirCode: 'enterGuanGoods' }}
+            selectApi={B2_APIgetClueList}
+            addGoodsApi={B2_APIgoodsSave}
+            isClueSelect={true}
+          />
+
+          {/* 底部按钮 */}
+          <EditBtn
+            path='/enterGuan'
+            APIobj={B2API_obj}
+            checkListTxt='藏品'
+            verifyBackFu={() => {
+              return { flag: true, txt: 'xsafasfas' }
+            }}
+          />
+        </div>
+      </div>
+    </InfoProvider>
+  )
+}
+
+const MemoB2edit = React.memo(B2edit)
+
+export default MemoB2edit

+ 4 - 4
src/pages/Benter/B2enterGuan/index.module.scss

@@ -1,4 +1,4 @@
-.B2enterGuan {
-  :global {
-  }
-}
+// .B2enterGuan {
+//   :global {
+//   }
+// }

+ 24 - 0
src/pages/Benter/B2enterGuan/index.tsx

@@ -1,9 +1,33 @@
 import React from 'react'
 import React from 'react'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
+import { baseFormData, topSearch } from '@/pages/Zother/data'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import TableList from '@/pages/Zother/TableList'
+import { B2_APIgetList } from '@/store/action/Benter/B2enterGuan'
+import { baseTableC } from '@/utils/tableData'
+
+const B2search = topSearch('入馆')
+
+const B2baseFormData = baseFormData()
+
 function B2enterGuan() {
 function B2enterGuan() {
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.B2enterGuan.tableInfo)
+
   return (
   return (
     <div className={styles.B2enterGuan}>
     <div className={styles.B2enterGuan}>
       <div className='pageTitle'>藏品入馆</div>
       <div className='pageTitle'>藏品入馆</div>
+
+      <TableList
+        baseFormData={B2baseFormData}
+        getListAPI={B2_APIgetList}
+        pageKey='enterGuan'
+        tableInfo={tableInfo}
+        columnsTemp={baseTableC('入馆')}
+        yHeight={585}
+        searchDom={B2search}
+      />
     </div>
     </div>
   )
   )
 }
 }

+ 3 - 3
src/pages/Cledger/C1ledger/index.tsx

@@ -4,6 +4,7 @@ import http from '@/utils/http'
 import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
 import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
 import { selectObj } from '@/utils/dataChange'
 import { selectObj } from '@/utils/dataChange'
 
 
+// 临时查看数据 正式开发的时候都删掉
 const APITEMP = () => {
 const APITEMP = () => {
   return http.post('cms/good/ledger/page', { pageSize: 99999 })
   return http.post('cms/good/ledger/page', { pageSize: 99999 })
 }
 }
@@ -14,7 +15,6 @@ function C1ledger() {
   const tmepFu = useCallback(async () => {
   const tmepFu = useCallback(async () => {
     const res = await APITEMP()
     const res = await APITEMP()
     if (res.code === 0) {
     if (res.code === 0) {
-      console.log(123456, res)
       setList(res.data.records || [])
       setList(res.data.records || [])
     }
     }
   }, [])
   }, [])
@@ -32,8 +32,8 @@ function C1ledger() {
       <div style={{ height: '90%', overflow: 'auto' }}>
       <div style={{ height: '90%', overflow: 'auto' }}>
         {list.map(v => (
         {list.map(v => (
           <div key={v.id}>
           <div key={v.id}>
-            藏品名称:{v.name}--------------藏品编号:{v.num}-------------藏品状态:{v.status}
-            {selectObj['藏品状态'].find(c => c.value === v.status)?.label}
+            藏品名称:{v.name}--------------藏品编号:{v.num}-------------藏品入藏状态:{v.status}
+            {selectObj['藏品入藏状态'].find(c => c.value === v.status)?.label}
           </div>
           </div>
         ))}
         ))}
       </div>
       </div>

+ 5 - 2
src/pages/Dmanage/D1register/D1edit/index.tsx

@@ -2,7 +2,7 @@ import React from 'react'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
 import EditTop from '@/pages/Zother/EditTop'
 import EditTop from '@/pages/Zother/EditTop'
 import EditBtn from '@/pages/Zother/EditBtn'
 import EditBtn from '@/pages/Zother/EditBtn'
-import { D1API_obj } from '@/store/action/Dmanage/D1register'
+import { D1_APIgetClueList, D1_APIgoodsSave, D1API_obj } from '@/store/action/Dmanage/D1register'
 import { InfoProvider } from '@/pages/Zother/InfoContext'
 import { InfoProvider } from '@/pages/Zother/InfoContext'
 import { rowArrTemp } from '@/pages/Zother/data'
 import { rowArrTemp } from '@/pages/Zother/data'
 import SonGoodsList from '@/pages/Zother/SonGoodsList'
 import SonGoodsList from '@/pages/Zother/SonGoodsList'
@@ -25,10 +25,13 @@ function D1edit() {
           {/* 藏品清单 */}
           {/* 藏品清单 */}
           <SonGoodsList
           <SonGoodsList
             fileUpInfo={{ myUrl: 'cms/order/register/son/upload', dirCode: 'registerGoods' }}
             fileUpInfo={{ myUrl: 'cms/order/register/son/upload', dirCode: 'registerGoods' }}
+            selectApi={D1_APIgetClueList}
+            addGoodsApi={D1_APIgoodsSave}
+            isClueSelect={true}
           />
           />
 
 
           {/* 底部按钮 */}
           {/* 底部按钮 */}
-          <EditBtn path='/register' APIobj={D1API_obj} />
+          <EditBtn path='/register' APIobj={D1API_obj} checkListTxt='藏品' />
         </div>
         </div>
       </div>
       </div>
     </InfoProvider>
     </InfoProvider>

+ 6 - 0
src/pages/Layout/data.ts

@@ -324,6 +324,12 @@ export const routerSon: RouterTypeRow[] = [
     Com: React.lazy(() => import('../Benter/B1collect/B1edit'))
     Com: React.lazy(() => import('../Benter/B1collect/B1edit'))
   },
   },
   {
   {
+    id: 220,
+    name: '藏品入馆-详情页',
+    path: '/enterGuan_edit/:key/:id',
+    Com: React.lazy(() => import('../Benter/B2enterGuan/B2edit'))
+  },
+  {
     id: 410,
     id: 410,
     name: '藏品登记-详情页',
     name: '藏品登记-详情页',
     path: '/register_edit/:key/:id',
     path: '/register_edit/:key/:id',

+ 65 - 18
src/pages/Zother/EditBtn/index.tsx

@@ -15,10 +15,21 @@ import { GoodsType } from '../SonGoodsList/data'
 type Props = {
 type Props = {
   path: string
   path: string
   APIobj: API_objType
   APIobj: API_objType
+  // 是否至少需要添加一条数据,不需要校验的话不传 。传:藏品 则校验不通过提示(请至少添加一个藏品)
   checkListTxt?: string
   checkListTxt?: string
+  // 需要校验的字段和提示
+  verifyArr?: { key: string; txt: string }[]
+  // 其他需要校验的回调函数,返回 flag为true 表示校验不通过,txt为提示语
+  verifyBackFu?: () => { flag: true; txt: string }
 }
 }
 
 
-function EditBtn({ path, APIobj, checkListTxt = '藏品' }: Props) {
+function EditBtn({
+  path,
+  APIobj,
+  checkListTxt = '',
+  verifyArr = [{ key: 'num', txt: '请输入申请编号' }],
+  verifyBackFu
+}: Props) {
   const { info, snaps, delSnapIdsRef, setTimeKeyFu, auditInfo } = useInfo()
   const { info, snaps, delSnapIdsRef, setTimeKeyFu, auditInfo } = useInfo()
 
 
   const [btnCan, setBtnCan] = useState({ status: 0, creatorId: 0 })
   const [btnCan, setBtnCan] = useState({ status: 0, creatorId: 0 })
@@ -133,28 +144,51 @@ function EditBtn({ path, APIobj, checkListTxt = '藏品' }: Props) {
           let txt = ''
           let txt = ''
           if (isLook) txt = ',已为您跳转到编辑页面'
           if (isLook) txt = ',已为您跳转到编辑页面'
 
 
-          if (!info.num) {
-            if (isLook) history.replace(`${path}_edit/2/${info.id}`)
-            MessageFu.warning('请输入申请编号' + txt)
+          // 校验字段
+          let verifyFlag = false
+          verifyArr.forEach(cc => {
+            if (!info[cc.key as 'num']) {
+              verifyFlag = true
+              if (isLook) history.replace(`${path}_edit/2/${info.id}`)
+              MessageFu.warning(cc.txt + txt)
+              return
+            }
+          })
+
+          if (verifyFlag) return
 
 
-            return
+          // 是否至少需要添加一条数据
+          if (checkListTxt) {
+            if (snaps.length === 0) {
+              if (isLook) history.replace(`${path}_edit/2/${info.id}`)
+
+              MessageFu.warning(`请至少添加一个${checkListTxt}${txt}`)
+              return
+            } else if (['/register', '/enterGuan'].includes(path)) {
+              // 藏品登记/藏品入馆,需要校验
+
+              // 校验藏品登记号 为空 或者 重复
+              // console.log('-----', snaps, obj)
+              const flag = numFlag(snaps)
+
+              if (flag) {
+                MessageFu.warning(flag + txt)
+                if (isLook) history.replace(`${path}_edit/2/${info.id}`)
+                return
+              }
+            }
           }
           }
-          if (snaps.length === 0) {
-            if (isLook) history.replace(`${path}_edit/2/${info.id}`)
-
-            MessageFu.warning(`请至少添加一个${checkListTxt}${txt}`)
-            return
-          } else if (path === '/register') {
-            // 校验藏品登记号 为空 或者 重复
-            // console.log('-----', snaps, obj)
-            const flag = numFlag(snaps)
-
-            if (flag) {
-              MessageFu.warning(flag + txt)
+
+          // 其他自己制定的校验函数
+          if (verifyBackFu) {
+            const flagObj = verifyBackFu()
+            if (flagObj.flag) {
               if (isLook) history.replace(`${path}_edit/2/${info.id}`)
               if (isLook) history.replace(`${path}_edit/2/${info.id}`)
+              MessageFu.warning(flagObj.txt + txt)
               return
               return
             }
             }
           }
           }
+
           const res = await APIobj['发起'](obj)
           const res = await APIobj['发起'](obj)
           if (res.code === 0) {
           if (res.code === 0) {
             if (['1', '2'].includes(key)) {
             if (['1', '2'].includes(key)) {
@@ -189,7 +223,20 @@ function EditBtn({ path, APIobj, checkListTxt = '藏品' }: Props) {
         }
         }
       }
       }
     },
     },
-    [APIobj, auditInfo, checkListTxt, delSnapIdsRef, info, isLook, key, path, setTimeKeyFu, snaps]
+    [
+      APIobj,
+      auditInfo,
+      checkListTxt,
+      delSnapIdsRef,
+      info,
+      isLook,
+      key,
+      path,
+      setTimeKeyFu,
+      snaps,
+      verifyArr,
+      verifyBackFu
+    ]
   )
   )
 
 
   // 申请记录的显示
   // 申请记录的显示

+ 13 - 6
src/pages/Zother/SonGoodsList/index.tsx

@@ -6,7 +6,6 @@ import MyPopconfirm from '@/components/MyPopconfirm'
 import AddGoods from '../AddGoods'
 import AddGoods from '../AddGoods'
 import { useInfo } from '../InfoContext'
 import { useInfo } from '../InfoContext'
 import { GoodsType, sgBaseFormData, sgTopSelectDom } from './data'
 import { GoodsType, sgBaseFormData, sgTopSelectDom } from './data'
-import { D1_APIgetClueList, D1_APIgoodsSave } from '@/store/action/Dmanage/D1register'
 import { goodsSelectCuleC, goodsSonTableC } from '@/utils/tableData'
 import { goodsSelectCuleC, goodsSonTableC } from '@/utils/tableData'
 import { useParams } from 'react-router-dom'
 import { useParams } from 'react-router-dom'
 import { openLink } from '@/utils/history'
 import { openLink } from '@/utils/history'
@@ -16,9 +15,15 @@ import SelectGoods from '../SelectGoods'
 type Props = {
 type Props = {
   // 上传附件的信息
   // 上传附件的信息
   fileUpInfo: FileUpInfoType
   fileUpInfo: FileUpInfoType
+  // 从征集中添加的api
+  selectApi: any
+  // 新增藏品的api
+  addGoodsApi: any
+  // 需要从征集里面选择数据(现在是藏品登记/藏品入馆 需要 藏品入藏不需要)
+  isClueSelect: boolean
 }
 }
 
 
-function SonGoodsList({ fileUpInfo }: Props) {
+function SonGoodsList({ fileUpInfo, selectApi, addGoodsApi, isClueSelect }: Props) {
   const { info, snaps, setSnapsFu, delSnapIdsRef, snapsID2ref } = useInfo()
   const { info, snaps, setSnapsFu, delSnapIdsRef, snapsID2ref } = useInfo()
 
 
   const { key } = useParams<any>()
   const { key } = useParams<any>()
@@ -94,7 +99,7 @@ function SonGoodsList({ fileUpInfo }: Props) {
       {openInfo.id ? (
       {openInfo.id ? (
         <AddGoods
         <AddGoods
           fileUpInfo={fileUpInfo}
           fileUpInfo={fileUpInfo}
-          APIsave={D1_APIgoodsSave}
+          APIsave={addGoodsApi}
           info={openInfo}
           info={openInfo}
           isEdit={false}
           isEdit={false}
           closeFu={() => setOpenInfo({} as GoodsType)}
           closeFu={() => setOpenInfo({} as GoodsType)}
@@ -121,7 +126,7 @@ function SonGoodsList({ fileUpInfo }: Props) {
       {/* 从藏品征集中添加 */}
       {/* 从藏品征集中添加 */}
       {clueShow ? (
       {clueShow ? (
         <SelectGoods
         <SelectGoods
-          API_getList={D1_APIgetClueList}
+          API_getList={selectApi}
           baseFormData={sgBaseFormData}
           baseFormData={sgBaseFormData}
           topSelectDom={sgTopSelectDom}
           topSelectDom={sgTopSelectDom}
           columnsTemp={goodsSelectCuleC}
           columnsTemp={goodsSelectCuleC}
@@ -136,8 +141,10 @@ function SonGoodsList({ fileUpInfo }: Props) {
             })
             })
 
 
             dataRes.forEach(v => {
             dataRes.forEach(v => {
-              // 因为征集和藏品表分开的,所以在藏品里面拿征集信息,自己加上这个标识
-              v.pageType = 'clue'
+              if (isClueSelect) {
+                // 因为征集和藏品表分开的,所以在藏品里面拿征集信息,自己加上这个标识
+                v.pageType = 'clue'
+              }
 
 
               // id2表示的是自己这条数据的id id才是goodsId
               // id2表示的是自己这条数据的id id才是goodsId
               const obj = snapsID2ref.current.find(c => c.goodsId === v.id)
               const obj = snapsID2ref.current.find(c => c.goodsId === v.id)

+ 2 - 1
src/pages/Zother/data.ts

@@ -31,7 +31,8 @@ export const baseFormData = (can?: { [x: string]: string }) => {
 export const topSearch = (txt: string, can?: { [x: number]: string | string[] }) => {
 export const topSearch = (txt: string, can?: { [x: number]: string | string[] }) => {
   const txtObj = {
   const txtObj = {
     征集: '或线索名称',
     征集: '或线索名称',
-    登记: '、藏品编号或名称'
+    登记: '、藏品编号或名称',
+    入馆: '、藏品编号或名称'
   }
   }
   const txt2Res = Reflect.get(txtObj, txt)
   const txt2Res = Reflect.get(txtObj, txt)
 
 

+ 45 - 0
src/store/action/Benter/B2enterGuan.ts

@@ -0,0 +1,45 @@
+import { AppDispatch } from '@/store'
+import http from '@/utils/http'
+import { APIbase } from '../layout'
+
+/**
+ * 藏品入馆 -获取分页列表
+ */
+export const B2_APIgetList = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/order/house/page', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+
+      dispatch({ type: 'B2/getList', payload: obj })
+    }
+  }
+}
+
+/**
+ * 藏品入馆-藏品新增|编辑
+ */
+export const B2_APIgoodsSave = (data: any) => {
+  return http.post('cms/order/house/add', data)
+}
+
+/**
+ * 藏品入馆-获取藏品征集列表
+ */
+export const B2_APIgetClueList = (data: any) => {
+  return http.post('cms/order/house/collect/getList', data)
+}
+
+export const B2API_obj = {
+  创建订单: () => APIbase('get', 'cms/order/house/create'),
+  获取详情: (id: number) => APIbase('get', `cms/order/house/detail/${id}`),
+  草稿: (data: any) => APIbase('post', `cms/order/house/saveDraft`, data),
+  发起: (data: any) => APIbase('post', `cms/order/house/saveApply`, data),
+  重新发起: (id: number) => APIbase('get', `cms/order/house/reissue/${id}`),
+  审批: (data: any) => APIbase('post', `cms/order/house/audit`, data),
+  撤回: (id: number) => APIbase('get', `cms/order/house/revocation/${id}`),
+  删除: (id: number) => APIbase('get', `cms/order/house/remove/${id}`)
+}

+ 28 - 0
src/store/reducer/Benter/B2enterGuan.ts

@@ -0,0 +1,28 @@
+import { Typetable } from '@/pages/Zother/data'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as Typetable[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'B2/getList'
+  payload: { list: Typetable[]; total: number }
+}
+
+// reducer
+export default function Reducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'B2/getList':
+      return { ...state, tableInfo: action.payload }
+
+    default:
+      return state
+  }
+}

+ 2 - 0
src/store/reducer/index.ts

@@ -4,6 +4,7 @@ import { combineReducers } from 'redux'
 // 导入 登录 模块的 reducer
 // 导入 登录 模块的 reducer
 import A0Layout from './layout'
 import A0Layout from './layout'
 import B1collect from './Benter/B1collect'
 import B1collect from './Benter/B1collect'
+import B2enterGuan from './Benter/B2enterGuan'
 import D1register from './Dmanage/D1register'
 import D1register from './Dmanage/D1register'
 import E1tag from './Eculture/E1tag'
 import E1tag from './Eculture/E1tag'
 import E2story from './Eculture/E2story'
 import E2story from './Eculture/E2story'
@@ -20,6 +21,7 @@ import I8log from './Isystem/I8log'
 const rootReducer = combineReducers({
 const rootReducer = combineReducers({
   A0Layout,
   A0Layout,
   B1collect,
   B1collect,
+  B2enterGuan,
   D1register,
   D1register,
   E1tag,
   E1tag,
   E2story,
   E2story,

+ 14 - 1
src/utils/dataChange.ts

@@ -55,7 +55,7 @@ export const selectObj = {
     { value: 3, label: '审批不通过' },
     { value: 3, label: '审批不通过' },
     { value: 4, label: '已完成' }
     { value: 4, label: '已完成' }
   ],
   ],
-  藏品状态: [
+  藏品入藏状态: [
     { value: 1, label: '入馆中' },
     { value: 1, label: '入馆中' },
     { value: 2, label: '待入馆' },
     { value: 2, label: '待入馆' },
     { value: 3, label: '已入馆' },
     { value: 3, label: '已入馆' },
@@ -65,6 +65,19 @@ export const selectObj = {
     { value: 7, label: '注销中' },
     { value: 7, label: '注销中' },
     { value: 8, label: '已删除' }
     { value: 8, label: '已删除' }
   ],
   ],
+  藏品库存状态: [
+    { value: 1, label: '待入库' },
+    { value: 2, label: '入库中' },
+    { value: 3, label: '已入库' },
+    { value: 4, label: '出库中' },
+    { value: 5, label: '已出库' },
+    { value: 6, label: '移库中' },
+    { value: 7, label: '盘点中' }
+  ],
+  藏品属性状态: [
+    { value: 0, label: '可编辑' },
+    { value: 1, label: '修改中' }
+  ],
   启用状态: [
   启用状态: [
     { value: 1, label: '启用' },
     { value: 1, label: '启用' },
     { value: 0, label: '禁用' }
     { value: 0, label: '禁用' }