소스 검색

藏品详情-藏品信息

shaogen1995 4 일 전
부모
커밋
2ee59c4d53

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

@@ -106,7 +106,11 @@ function MyTable({
           return res
           return res
         },
         },
         // 多个字段拼接
         // 多个字段拼接
-        ping: (item: any) => (item[v[2]] || '') + (resJiLianFu(item[v[3]]) || '') || isNull,
+        ping: (item: any) => {
+          let jlTxt = resJiLianFu(item[v[3]])
+          jlTxt = jlTxt === isNull ? '' : jlTxt
+          return item[v[2]] && jlTxt ? item[v[2]] + jlTxt : isNull
+        },
         // 这个模块特有的级联控制
         // 这个模块特有的级联控制
         txtC: (item: any) => resJiLianFu(item[v[2]]),
         txtC: (item: any) => resJiLianFu(item[v[2]]),
         txtCTag: (item: any) => {
         txtCTag: (item: any) => {

+ 56 - 0
src/pages/ZgoodsInfo/GItab1/index.module.scss

@@ -1,4 +1,60 @@
 .GItab1 {
 .GItab1 {
+  display: flex;
+  justify-content: space-between;
   :global {
   :global {
+    .GI1left {
+      width: calc(100% - 320px);
+      display: flex;
+      flex-wrap: wrap;
+      align-content: flex-start;
+      .GI1Lrow {
+        // margin-bottom: 2px;
+        display: flex;
+        font-size: 16px;
+        width: 50%;
+        border: 1px solid #ccc;
+        // border-right: 0;
+        & > div {
+          text-align: center;
+          font-weight: 700;
+          width: 110px;
+          background-color: #eaeaea;
+          padding: 5px 0;
+        }
+        & > p {
+          padding: 5px 0;
+          padding-left: 10px;
+          width: calc(100% - 110px);
+          word-wrap: break-word;
+        }
+      }
+      .GI1LrowFull {
+        width: 100%;
+      }
+    }
+    .GI1Right {
+      width: 240px;
+      .GI1Right1 {
+        border-radius: 10px;
+        overflow: hidden;
+      }
+      .GI1Right2 {
+        margin-top: 10px;
+        display: flex;
+        flex-wrap: wrap;
+        justify-content: flex-start;
+        align-content: flex-start;
+        .GI1Rrow {
+          border: 3px solid transparent;
+          border-radius: 6px;
+          overflow: hidden;
+          cursor: pointer;
+          margin: 5px;
+        }
+        .GI1RrowAc {
+          border-color: var(--txtColor);
+        }
+      }
+    }
   }
   }
 }
 }

+ 53 - 36
src/pages/ZgoodsInfo/GItab1/index.tsx

@@ -1,49 +1,66 @@
-import React, { useEffect } from 'react'
+import React, { useMemo, useState } from 'react'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
 import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
 import { GoodsType } from '@/pages/Zother/SonGoodsList/data'
+import { FileListType } from '@/components/Z3upFiles/data'
+import ImageLazy from '@/components/ImageLazy'
+import classNames from 'classnames'
+import { GIrowArr } from '../data'
 
 
 type Props = {
 type Props = {
   info: GoodsType
   info: GoodsType
+  fileList: FileListType[]
 }
 }
 
 
-function GItab1({ info }: Props) {
-  useEffect(() => {
-    console.log('GItab1')
-  }, [])
+function GItab1({ info, fileList }: Props) {
+  const imgList = useMemo(() => {
+    return fileList.filter(v => v.type === 'img')
+  }, [fileList])
+  const [imgAc, setImgAc] = useState(0)
+  const imgAcObj = useMemo(() => {
+    let res: any = ''
+    if (imgList.length && imgList[imgAc]) res = imgList[imgAc]
+    return res
+  }, [imgAc, imgList])
 
 
   return (
   return (
     <div className={styles.GItab1}>
     <div className={styles.GItab1}>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
-      <h1>GItab1</h1>
+      <div className='GI1left'>
+        {GIrowArr.map(item => (
+          <div key={item.key} className={classNames('GI1Lrow', item.full ? 'GI1LrowFull' : '')}>
+            <div>{item.name}</div>
+            <p>{item.resFu ? item.resFu(info) : info[item.key as 'num'] || '(空)'}</p>
+          </div>
+        ))}
+      </div>
+      <div className='GI1Right'>
+        <div className='GI1Right1'>
+          {imgAcObj ? (
+            <ImageLazy
+              width={240}
+              height={220}
+              src={imgAcObj.thumb || imgAcObj.filePath}
+              srcBig={imgAcObj.filePath || imgAcObj.thumb}
+            />
+          ) : null}
+        </div>
+        <div className='GI1Right2'>
+          {imgList.map((item, index) => (
+            <div
+              onClick={() => setImgAc(index)}
+              className={classNames('GI1Rrow', imgAc === index ? 'GI1RrowAc' : '')}
+              key={item.id}
+            >
+              <ImageLazy
+                width={64}
+                height={64}
+                src={item.thumb || item.filePath}
+                srcBig={item.filePath || item.thumb}
+                noLook={true}
+              />
+            </div>
+          ))}
+        </div>
+      </div>
     </div>
     </div>
   )
   )
 }
 }

+ 69 - 0
src/pages/ZgoodsInfo/data.ts

@@ -0,0 +1,69 @@
+import dayjs from 'dayjs'
+import { GoodsType } from '../Zother/SonGoodsList/data'
+import { myTableTransferSize, resJiLianFu } from '@/utils/dataChange'
+
+const isNull = '(空)'
+
+export const GIrowArr = [
+  { key: 'num', name: '藏品登记号' },
+  { key: 'oldName', name: '藏品原名' },
+  {
+    key: 'makeDate',
+    name: '制档日期',
+    resFu: (info: GoodsType) => dayjs(info.makeDate).format('YYYY-MM-DD') || isNull
+  },
+  { key: 'makeUser', name: '制档人' },
+  { key: 'level', name: '藏品级别' },
+  { key: 'typeDictId', name: '藏品类别', resFu: (info: GoodsType) => resJiLianFu(info.typeDictId) },
+  { key: 'ageDictId', name: '藏品年代', resFu: (info: GoodsType) => resJiLianFu(info.ageDictId) },
+  { key: 'ageInfo', name: '具体年代' },
+  {
+    key: 'pcs',
+    name: '实际数量',
+    resFu: (info: GoodsType) => {
+      let jlTxt = resJiLianFu(info.pcsUnitDictId)
+      jlTxt = jlTxt === isNull ? '' : jlTxt
+      return info.pcs && jlTxt ? info.pcs + jlTxt : isNull
+    }
+  },
+  {
+    key: 'textureDictId',
+    name: '质地',
+    resFu: (info: GoodsType) => resJiLianFu(info.textureDictId)
+  },
+  { key: 'tornLevel', name: '完残程度' },
+  { key: 'tornInfo', name: '完残状况' },
+  { key: 'keep', name: '保存状态', full: true },
+  { key: 'keepInfo', name: '保护修复情况', full: true },
+  { key: 'sizeL', name: '尺寸(cm)', resFu: (info: GoodsType) => myTableTransferSize(info) },
+  { key: 'sizeInfo', name: '具体尺寸' },
+  { key: 'qualityScope', name: '质量范围' },
+  {
+    key: 'quality',
+    name: '具体质量',
+    resFu: (info: GoodsType) => {
+      let jlTxt = resJiLianFu(info.qualityUnitDictId)
+      jlTxt = jlTxt === isNull ? '' : jlTxt
+      return info.quality && jlTxt ? info.quality + jlTxt : isNull
+    }
+  },
+  {
+    key: 'inGoodYear',
+    name: '入藏年度',
+    resFu: (info: GoodsType) => dayjs(info.inGoodYear).format('YYYY') || isNull
+  },
+  { key: 'inGoodYearScope', name: '入藏时间范围' },
+  { key: 'source', name: '文物来源' },
+  { key: 'born', name: '产地' },
+
+  {
+    key: 'qualityLevelDictId',
+    name: '质量等级',
+    resFu: (info: GoodsType) => resJiLianFu(info.qualityLevelDictId)
+  },
+  { key: 'pressAuthor', name: '著者' },
+  { key: 'pressFile', name: '存卷' },
+  { key: 'pressVersion', name: '版本' },
+  { key: 'intro', name: '藏品简介', full: true },
+  { key: 'remark', name: '备注', full: true }
+]

+ 4 - 2
src/pages/ZgoodsInfo/index.module.scss

@@ -9,10 +9,12 @@
       height: 52px;
       height: 52px;
       & > h2 {
       & > h2 {
         display: inline-block;
         display: inline-block;
-        margin-right: 20px;
         position: relative;
         position: relative;
         top: 3px;
         top: 3px;
       }
       }
+      i {
+        margin-right: 20px;
+      }
       .ant-tag {
       .ant-tag {
         display: inline-block;
         display: inline-block;
         line-height: 30px;
         line-height: 30px;
@@ -53,7 +55,7 @@
       }
       }
     }
     }
     .GImain {
     .GImain {
-      margin-top: 10px;
+      margin-top: 20px;
       width: 100%;
       width: 100%;
       height: calc(100% - 110px);
       height: calc(100% - 110px);
       & > div {
       & > div {

+ 37 - 18
src/pages/ZgoodsInfo/index.tsx

@@ -17,6 +17,8 @@ import GItab3 from './GItab3'
 import GItab4 from './GItab4'
 import GItab4 from './GItab4'
 import GItab5 from './GItab5'
 import GItab5 from './GItab5'
 import { MessageFu } from '@/utils/message'
 import { MessageFu } from '@/utils/message'
+import { FileListType } from '@/components/Z3upFiles/data'
+import { API_getFileListByIds } from '@/store/action/Cledger/C4file'
 
 
 type tabArr1Type = {
 type tabArr1Type = {
   id: number
   id: number
@@ -29,12 +31,22 @@ type tabArr1Type = {
 
 
 function ZgoodsInfo() {
 function ZgoodsInfo() {
   const { id } = useParams<any>()
   const { id } = useParams<any>()
-  // 获取藏品详情
+  // 藏品详情
   const [info, getInfo] = useState({} as GoodsType)
   const [info, getInfo] = useState({} as GoodsType)
+  // 藏品附件
+  const [fileList, setFileList] = useState<FileListType[]>([])
   const getInfoFu = useCallback(async () => {
   const getInfoFu = useCallback(async () => {
     const res = await API_getGoodsInfo(id)
     const res = await API_getGoodsInfo(id)
     if (res.code === 0) {
     if (res.code === 0) {
       getInfo(res.data)
       getInfo(res.data)
+      // 获取附件信息
+      const fileIds = res.data.fileIds || ''
+      if (fileIds) {
+        const res22 = await API_getFileListByIds(fileIds.split(',').map((v: string) => Number(v)))
+        if (res22.code === 0) {
+          setFileList(res22.data)
+        }
+      }
     }
     }
   }, [id])
   }, [id])
   useEffect(() => {
   useEffect(() => {
@@ -43,13 +55,19 @@ function ZgoodsInfo() {
 
 
   const tabArr1Temp = useMemo(() => {
   const tabArr1Temp = useMemo(() => {
     return [
     return [
-      { id: 331, name: '藏品信息', done: false, show: false, Dom: <GItab1 info={info} /> },
+      {
+        id: 331,
+        name: '藏品信息',
+        done: false,
+        show: false,
+        Dom: <GItab1 info={info} fileList={fileList} />
+      },
       { id: 332, name: '库存信息', done: false, show: false, Dom: <GItab2 /> },
       { id: 332, name: '库存信息', done: false, show: false, Dom: <GItab2 /> },
       { id: 333, name: '藏品附件', done: false, show: false, Dom: <GItab3 /> },
       { id: 333, name: '藏品附件', done: false, show: false, Dom: <GItab3 /> },
       { id: 334, name: '藏品故事', done: false, show: false, Dom: <GItab4 /> },
       { id: 334, name: '藏品故事', done: false, show: false, Dom: <GItab4 /> },
       { id: 335, name: '藏品日志', done: false, show: false, Dom: <GItab5 /> }
       { id: 335, name: '藏品日志', done: false, show: false, Dom: <GItab5 /> }
     ]
     ]
-  }, [info])
+  }, [fileList, info])
 
 
   // 点击的时候校验前置状态和页面权限
   // 点击的时候校验前置状态和页面权限
   const tabArr2Temp = useMemo(() => {
   const tabArr2Temp = useMemo(() => {
@@ -75,8 +93,8 @@ function ZgoodsInfo() {
               if ([3, 6].includes(info.status)) {
               if ([3, 6].includes(info.status)) {
                 authorityFu(430, '藏品注销', () => history.push(`/writeOff_edit/1/null?gId=${id}`))
                 authorityFu(430, '藏品注销', () => history.push(`/writeOff_edit/1/null?gId=${id}`))
               } else {
               } else {
-                const txt = Reflect.get(selectObj['藏品入藏状态'], info.status) || '草稿'
-                MessageFu.warning(`当前藏品为 ${txt} 状态,不可 注销`)
+                const txtObj = selectObj['藏品入藏状态'].find(v => v.value === info.status)
+                MessageFu.warning(`当前藏品为 ${txtObj ? txtObj.label : '草稿'} 状态,不可 注销`)
               }
               }
             }
             }
           }
           }
@@ -97,8 +115,8 @@ function ZgoodsInfo() {
                   history.push(`/inStorage_edit/1/null?gId=${id}`)
                   history.push(`/inStorage_edit/1/null?gId=${id}`)
                 )
                 )
               } else {
               } else {
-                const txt = Reflect.get(selectObj['藏品库存状态'], info.siteStatus) || '草稿'
-                MessageFu.warning(`当前藏品为 ${txt} 状态,不可 入库`)
+                const txtObj = selectObj['藏品库存状态'].find(v => v.value === info.siteStatus)
+                MessageFu.warning(`当前藏品为 ${txtObj ? txtObj.label : '草稿'} 状态,不可 入库`)
               }
               }
             }
             }
           },
           },
@@ -111,8 +129,8 @@ function ZgoodsInfo() {
                   history.push(`/moveStorage_edit/1/null?gId=${id}`)
                   history.push(`/moveStorage_edit/1/null?gId=${id}`)
                 )
                 )
               } else {
               } else {
-                const txt = Reflect.get(selectObj['藏品库存状态'], info.siteStatus) || '草稿'
-                MessageFu.warning(`当前藏品为 ${txt} 状态,不可 移库`)
+                const txtObj = selectObj['藏品库存状态'].find(v => v.value === info.siteStatus)
+                MessageFu.warning(`当前藏品为 ${txtObj ? txtObj.label : '未入库'} 状态,不可 移库`)
               }
               }
             }
             }
           },
           },
@@ -125,8 +143,8 @@ function ZgoodsInfo() {
                   history.push(`/outStorage_edit/1/null?gId=${id}`)
                   history.push(`/outStorage_edit/1/null?gId=${id}`)
                 )
                 )
               } else {
               } else {
-                const txt = Reflect.get(selectObj['藏品库存状态'], info.siteStatus) || '草稿'
-                MessageFu.warning(`当前藏品为 ${txt} 状态,不可 出库`)
+                const txtObj = selectObj['藏品库存状态'].find(v => v.value === info.siteStatus)
+                MessageFu.warning(`当前藏品为 ${txtObj ? txtObj.label : '未入库'} 状态,不可 出库`)
               }
               }
             }
             }
           }
           }
@@ -215,18 +233,19 @@ function ZgoodsInfo() {
     [tabArr1]
     [tabArr1]
   )
   )
 
 
-  // const pageFlag =useCallback((id:number)=>{
-  //   let flag =[false,false]
-  //   const obj =tabArr1.find(v=>v.id===id)
-  //   if(obj){
-
-  //   }
-  // },[])
+  // 藏品状态
+  const goodsStatus = useMemo(() => {
+    let txt = '草稿'
+    const obj = selectObj['藏品入藏状态'].find(v => v.value === info.status)
+    if (obj) txt = obj.label
+    return txt
+  }, [info.status])
 
 
   return (
   return (
     <div className={styles.ZgoodsInfo}>
     <div className={styles.ZgoodsInfo}>
       <div className='GITot'>
       <div className='GITot'>
         <h2>{info.name || ''}</h2>
         <h2>{info.name || ''}</h2>
+        {info.id ? <i>({goodsStatus})</i> : null}
         {tagDom}
         {tagDom}
       </div>
       </div>
       <div className='GItab'>
       <div className='GItab'>

+ 1 - 1
src/pages/Zother/EditTop/index.tsx

@@ -110,7 +110,7 @@ function EditTop({ rowArr, pageTxt, APIobj, fileUpInfo, moreDom }: Props) {
 
 
           const flag = v.pageType === 'clue' && !v.clueId
           const flag = v.pageType === 'clue' && !v.clueId
           if (obj.id === null || obj.isNew || flag)
           if (obj.id === null || obj.isNew || flag)
-            obj.id = pageTxt === '藏品登记' ? v.goodId : Date.now() + i
+            obj.id = ['藏品登记', '藏品入馆'].includes(pageTxt) ? v.goodId : Date.now() + i
 
 
           obj.idTemp = obj.id
           obj.idTemp = obj.id
 
 

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

@@ -41,7 +41,7 @@ export type GoodsType = {
   siteDateOut?: any
   siteDateOut?: any
   siteId?: any
   siteId?: any
   siteLoc?: any
   siteLoc?: any
-  siteStatus?: any
+  siteStatus: number
   sizeH: number
   sizeH: number
   sizeInfo: string
   sizeInfo: string
   sizeL: number
   sizeL: number