소스 검색

ccccccccccccc

shaogen1995 4 달 전
부모
커밋
673e243b5a

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

@@ -3,9 +3,7 @@ import styles from './index.module.scss'
 import { Table } from 'antd'
 import ImageLazy from '../ImageLazy'
 import classNames from 'classnames'
-import { treeLastIdFindFatherFu } from '@/pages/Z_system/Z6user/data'
-import { useSelector } from 'react-redux'
-import { RootState } from '@/store'
+import { resJiLianFu } from '@/utils/history'
 
 type Props = {
   yHeight?: number //设置表格的高度
@@ -99,24 +97,6 @@ function MyTable({
     [onChange]
   )
 
-  const { dictAll } = useSelector((state: RootState) => state.Z1dict)
-  // 级联回显
-  const resJiLian = useCallback(
-    (idTemp: string) => {
-      if (idTemp) {
-        const idArr = idTemp.split(',')
-        const id = idArr[idArr.length - 1]
-        let arr = treeLastIdFindFatherFu(dictAll, id, 'name')
-
-        if (arr.length >= 3) arr = [arr[2]]
-
-        if (arr && arr.length) return arr.join(' / ')
-        else return isNull
-      } else return isNull
-    },
-    [dictAll, isNull]
-  )
-
   const dataChangeFu = useCallback(
     (v: any) => {
       /**
@@ -135,9 +115,11 @@ function MyTable({
           ) : (
             item[v[2]] || isNull
           ),
+        // 多个字段拼接
+        ping: (item: any) => item[v[2]] + resJiLianFu(item[v[3]]) || isNull,
         // 这个模块特有的级联控制
         txtC: (item: any) =>
-          v[1] === '年代' && item[v[2]] === '其他' ? '其他' : resJiLian(item[v[2]]),
+          v[1] === '年代' && item[v[2]] === '其他' ? '其他' : resJiLianFu(item[v[2]]),
         img: (item: any) =>
           v[3] && !item[v[2]] ? (
             <div dangerouslySetInnerHTML={{ __html: v[3] }}></div>
@@ -176,7 +158,7 @@ function MyTable({
 
       return Reflect.get(obj, v[0])
     },
-    [isNull, pageNum, pageSize, resJiLian, tableComObj]
+    [isNull, pageNum, pageSize, tableComObj]
   )
 
   const columns = useMemo(() => {

+ 5 - 1
src/pages/B_enterTibet/B3_4page/B3edit/main.tsx

@@ -157,7 +157,11 @@ function B3editMain({ pageSta }: Props) {
       })
 
       if (res.code === 0) {
-        editBtnOk(obj, resData.formData.id)
+        MessageFu.success('审批成功')
+        // editBtnOk(obj, resData.formData.id)
+        // 跳详情页
+        const url = Reflect.get(B3TiaoObjUrl, pageKey)
+        history.push(`${url}_edit/4/${resData.formData.id}/${pageKey}`)
       }
 
       // 编辑逻辑

+ 5 - 23
src/pages/B_enterTibet/B3flowTable/index.tsx

@@ -1,10 +1,11 @@
-import React, { useCallback, useMemo, useState } from 'react'
+import React, { useMemo, useState } from 'react'
 import styles from './index.module.scss'
 // import { useParams } from 'react-router-dom'
 import MyTable from '@/components/MyTable'
 import { Button } from 'antd'
 import { B3FtableC } from '@/utils/tableData'
 import X2lookText from '@/pages/X_stock/X2lookText'
+import { textFu } from '@/utils/history'
 
 export type B3flowTableType = {
   createTime: string
@@ -25,33 +26,14 @@ type Props = {
 function B3flowTable({ tableArr }: Props) {
   // const { key, id } = useParams<any>()
 
-  const text = useCallback((val: string) => {
-    let TxtRes = ''
-    try {
-      if (val) {
-        let txt = JSON.parse(val)
-
-        if (txt.txtArr && txt.txtArr.length) {
-          let txt2: string = txt.txtArr[0].txt
-          if (txt2) {
-            const txt3 = txt2.replaceAll('<p></p>', '')
-            if (txt3) TxtRes = txt2
-          }
-        }
-      }
-    } catch (error) {}
-
-    return TxtRes
-  }, [])
-
   const tableLastBtn = useMemo(() => {
     return [
       {
         title: '审批意见',
         render: (item: B3flowTableType) => {
-          if (text(item.rtfOpinion)) {
+          if (textFu(item.rtfOpinion)) {
             return (
-              <Button size='small' type='text' onClick={() => setLook(text(item.rtfOpinion))}>
+              <Button size='small' type='text' onClick={() => setLook(textFu(item.rtfOpinion))}>
                 查看
               </Button>
             )
@@ -59,7 +41,7 @@ function B3flowTable({ tableArr }: Props) {
         }
       }
     ]
-  }, [text])
+  }, [])
 
   //查看富文本信息
   const [look, setLook] = useState('')

+ 1 - 1
src/pages/B_enterTibet/B3goodsTable/B3GaddNew/index.tsx

@@ -186,7 +186,7 @@ function B3GaddNew({ nowSta, closeFu, succFu }: Props) {
           <Cascader
             options={cascaderObj['附件用途']}
             value={item.effect ? item.effect.split(',') : []}
-            onChange={e => tableFu('effect', item.id, e.join(','))}
+            onChange={e => tableFu('effect', item.id, e ? e.join(',') : '')}
             placeholder='请选择'
             fieldNames={{ label: 'name', value: 'id', children: 'children' }}
           />

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 73
src/pages/B_enterTibet/B3goodsTable/index.tsx


+ 1 - 0
src/pages/C_goodsManage/C1ledger/type.d.ts

@@ -50,6 +50,7 @@ export type C1GoodType = {
   dictTorn: string
   dictType: string
   // display?: any;
+  file: GoodFileType[]
   fileIds: string
   historyUndergo: string
   historyWork: string

+ 14 - 11
src/pages/C_goodsManage/C2files/index.tsx

@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { Button, Cascader, Checkbox, DatePicker, Input, Select } from 'antd'
 import MyPopconfirm from '@/components/MyPopconfirm'
-import Y33setType from '@/pages/Y_goodsDetails/Y2look/Y33setType'
+import Y33setType, { infoType } from '@/pages/Y_goodsDetails/Y2look/Y33setType'
 import { C2baseFormData, C2InputKeyArr } from './data'
 import { C2InputKeyType } from './type'
 import dayjs from 'dayjs'
@@ -101,7 +101,8 @@ function C2files() {
   )
 
   // 批量和单个设置
-  const [typeMo, setTypeMo] = useState({ leiXin: '', yongTu: '', flag: '', show: false })
+
+  const [typeMo, setTypeMo] = useState({} as infoType)
 
   const startBtn = useMemo(() => {
     let arr: any = [
@@ -155,10 +156,10 @@ function C2files() {
                   type='text'
                   onClick={() =>
                     setTypeMo({
-                      leiXin: item.type,
-                      yongTu: '',
-                      flag: '单个',
-                      show: true
+                      ids: [item.id],
+                      type: item.type,
+                      effect: item.effect,
+                      flag: '单个'
                     })
                   }
                 >
@@ -201,10 +202,10 @@ function C2files() {
             disabled={checkArr.length === 0}
             onClick={() =>
               setTypeMo({
-                leiXin: '',
-                yongTu: '',
-                flag: '批量',
-                show: true
+                ids: checkArr,
+                type: '',
+                effect: '',
+                flag: '多个'
               })
             }
           >
@@ -288,7 +289,9 @@ function C2files() {
         onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
       />
 
-      {typeMo.show ? <Y33setType info={typeMo} closeFu={() => setTypeMo({} as any)} /> : null}
+      {typeMo.flag ? (
+        <Y33setType succFu={getListFu} info={typeMo} closeFu={() => setTypeMo({} as infoType)} />
+      ) : null}
     </div>
   )
 }

+ 13 - 13
src/pages/Y_goodsDetails/Y1cathet/Y11com.tsx

@@ -2,8 +2,13 @@ import ImageLazy from '@/components/ImageLazy'
 import React from 'react'
 import classNames from 'classnames'
 import { Y11infoArr1, Y11infoArr2, Y11infoArr3, Y11infoArr4, Y11infoArr5 } from './data'
+import { C1GoodType } from '@/pages/C_goodsManage/C1ledger/type'
 
-function Y11com() {
+type Props = {
+  info: C1GoodType
+}
+
+function Y11com({ info }: Props) {
   return (
     <div className='Y1rowZ'>
       <div className='Y1tit'>档案信息</div>
@@ -12,15 +17,12 @@ function Y11com() {
           {Y11infoArr1.map((v, i) => (
             <div className='Y1row' key={v.name}>
               <div className='Y1rowll'>{v.name}:</div>
-              <div className='Y1rowrr'>
-                这是一段文本
-                {i}
-              </div>
+              <div className='Y1rowrr'>{info[v.key] || '(空)'}</div>
             </div>
           ))}
         </div>
         <div className='Y1rowZrr'>
-          <ImageLazy width={200} height={200} srcBig={''} src={''} />
+          <ImageLazy width={200} height={200} srcBig={info.thumbPc} src={info.thumb} />
         </div>
       </div>
 
@@ -30,10 +32,8 @@ function Y11com() {
           {Y11infoArr2.map((v, i) => (
             <div className={classNames('y1z2_1row1', v.full ? 'y1z2_1row1Full' : '')} key={v.name}>
               <div className='y1z2_1r11'>{v.name}:</div>
-              <div className='y1z2_1r12'>
-                这是一段文本
-                {i}
-              </div>
+
+              <div className='y1z2_1r12'>{v.backFu ? v.backFu(info) : info[v.key] || '(空)'}</div>
             </div>
           ))}
         </div>
@@ -45,7 +45,7 @@ function Y11com() {
           {Y11infoArr3.map((v, i) => (
             <div className={classNames('y1z2_1row1', v.full ? 'y1z2_1row1Full' : '')} key={v.name}>
               <div className='y1z2_1r11'>{v.name}:</div>
-              <div className='y1z2_1r12'>这是一段文本{i}</div>
+              <div className='y1z2_1r12'>{v.backFu ? v.backFu(info) : info[v.key] || '(空)'}</div>
             </div>
           ))}
         </div>
@@ -57,7 +57,7 @@ function Y11com() {
           {Y11infoArr4.map((v, i) => (
             <div className={classNames('y1z2_1row1', v.full ? 'y1z2_1row1Full' : '')} key={v.name}>
               <div className='y1z2_1r11'>{v.name}:</div>
-              <div className='y1z2_1r12'>这是一段文本{i}</div>
+              <div className='y1z2_1r12'>{v.backFu ? v.backFu(info) : info[v.key] || '(空)'}</div>
             </div>
           ))}
         </div>
@@ -71,7 +71,7 @@ function Y11com() {
               <div className={classNames('y1z2_1r11', v.name.length >= 7 ? 'y1z2_1r11long' : '')}>
                 {v.name}:
               </div>
-              <div className='y1z2_1r12'>这是一段文本{i}</div>
+              <div className='y1z2_1r12'>{v.backFu ? v.backFu(info) : info[v.key] || '(空)'}</div>
             </div>
           ))}
         </div>

+ 24 - 9
src/pages/Y_goodsDetails/Y1cathet/Y1main.tsx

@@ -1,9 +1,11 @@
-import React, { useState } from 'react'
+import React, { useCallback, useEffect, useState } from 'react'
 import classNames from 'classnames'
 import Y11com from './Y11com'
 import Y22com from './Y22com'
 import Y33com from './Y33com'
 import Y44com from './Y44com'
+import { API_goodsInfo } from '@/store/action/C1ledger'
+import { C1GoodType } from '@/pages/C_goodsManage/C1ledger/type'
 
 export type Y1TabArrType = '藏品信息' | '库存信息' | '藏品附件' | '藏品日志'
 
@@ -13,11 +15,22 @@ type Props = {
   sId: number
 }
 
-// 待完善 没有接入接口
-
 function Y1main({ sId }: Props) {
   const [tabAc, setTabAc] = useState<Y1TabArrType>('藏品信息')
 
+  const [info, setInfo] = useState({} as C1GoodType)
+
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await API_goodsInfo(id)
+    if (res.code === 0) {
+      setInfo(res.data)
+    }
+  }, [])
+
+  useEffect(() => {
+    getInfoFu(sId)
+  }, [getInfoFu, sId])
+
   return (
     <div className='Y1main'>
       <div className='Y1tab'>
@@ -32,12 +45,14 @@ function Y1main({ sId }: Props) {
         ))}
       </div>
 
-      <div className='Y1info'>
-        {tabAc === '藏品信息' ? <Y11com /> : null}
-        {tabAc === '库存信息' ? <Y22com /> : null}
-        {tabAc === '藏品附件' ? <Y33com /> : null}
-        {tabAc === '藏品日志' ? <Y44com /> : null}
-      </div>
+      {info.id ? (
+        <div className='Y1info'>
+          {tabAc === '藏品信息' ? <Y11com info={info} /> : null}
+          {tabAc === '库存信息' ? <Y22com info={info} /> : null}
+          {tabAc === '藏品附件' ? <Y33com sId={sId} /> : null}
+          {tabAc === '藏品日志' ? <Y44com info={info} /> : null}
+        </div>
+      ) : null}
     </div>
   )
 }

+ 4 - 1
src/pages/Y_goodsDetails/Y1cathet/Y22com.tsx

@@ -1,14 +1,17 @@
 import MyTable from '@/components/MyTable'
+import { C1GoodType } from '@/pages/C_goodsManage/C1ledger/type'
 import { Y22tableC } from '@/utils/tableData'
 import React from 'react'
 
 type Props = {
   isLook?: boolean
+  info: C1GoodType
 }
 
-function Y22com({ isLook }: Props) {
+function Y22com({ isLook, info }: Props) {
   return (
     <div className='Y22com'>
+      {/* 待完善 */}
       <div className='Y22sta'>库存状态:待入库</div>
 
       {/* 表格 */}

+ 103 - 46
src/pages/Y_goodsDetails/Y1cathet/Y33com.tsx

@@ -1,21 +1,51 @@
-import React, { useCallback, useMemo, useState } from 'react'
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
 import { Button, Checkbox } from 'antd'
 import MyTable from '@/components/MyTable'
 import { Y33tableC } from '@/utils/tableData'
 import ImageLazy from '@/components/ImageLazy'
 import MyPopconfirm from '@/components/MyPopconfirm'
-import Y33setType from '../Y2look/Y33setType'
+import Y33setType, { infoType } from '../Y2look/Y33setType'
 import YtableVideo from '@/components/YtableVideo'
 import { GoodFileType } from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew/type'
 import { selectObj } from '@/utils/select'
 import { fileImgArr, fileVideoArr } from '@/store/action/layout'
+import { resJiLianFu } from '@/utils/history'
+import { baseURL } from '@/utils/http'
+import { API_C2dels, API_C2downS, API_goodFileList } from '@/store/action/C2files'
+import { MessageFu } from '@/utils/message'
 
 type Props = {
   isLook?: boolean
+  sId: number
 }
 
-function Y33com({ isLook }: Props) {
-  const [btnAc, setBtnAc] = useState('全部')
+function Y33com({ isLook, sId }: Props) {
+  const [fileList, setFileList] = useState<GoodFileType[]>([])
+
+  const getListFu = useCallback(async () => {
+    const res = await API_goodFileList(sId)
+    if (res.code === 0) {
+      setFileList(res.data || [])
+    }
+  }, [sId])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  // 附件表格对象
+  const tableObj = useMemo(() => {
+    let obj: any = {
+      '': fileList
+    }
+    fileList.forEach(v => {
+      if (obj[v.type]) obj[v.type].push(v)
+      else obj[v.type] = [v]
+    })
+    return obj
+  }, [fileList])
+
+  const [btnAc, setBtnAc] = useState('')
 
   // 多选
   const [checkArr, setCheckArr] = useState<number[]>([])
@@ -40,8 +70,9 @@ function Y33com({ isLook }: Props) {
         )
       })
 
-    if (['全部', '图像', '视频'].includes(btnAc))
-      arr.push({
+    return [
+      ...arr,
+      {
         width: 100,
         title: '缩略图/视频',
         render: (item: GoodFileType) => {
@@ -58,20 +89,39 @@ function Y33com({ isLook }: Props) {
             ' - '
           )
         }
-      })
-
-    return arr
-  }, [btnAc, checkArr, checkFu, isLook])
+      },
+      {
+        title: '附件类型',
+        render: (item: GoodFileType) => selectObj['附件类型'].find(v => v.key === item.type)?.name
+      },
+      {
+        title: '附件用途',
+        render: (item: GoodFileType) => (item.effect ? resJiLianFu(item.effect) : '(空)')
+      }
+    ]
+  }, [checkArr, checkFu, isLook])
+
+  // 点击删除
+  const delFu = useCallback(
+    async (data: number[]) => {
+      const res = await API_C2dels(data)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
       {
         title: '操作',
-        render: (item: any) => {
+        render: (item: GoodFileType) => {
           return (
             <>
               <Button size='small' type='text'>
-                <a href={item.src} download target='_blank' rel='noreferrer'>
+                <a href={baseURL + item.filePath} download target='_blank' rel='noreferrer'>
                   下载
                 </a>
               </Button>
@@ -82,16 +132,16 @@ function Y33com({ isLook }: Props) {
                     type='text'
                     onClick={() =>
                       setTypeMo({
-                        leiXin: item.type,
-                        yongTu: '',
-                        flag: '单个',
-                        show: true
+                        ids: [item.id],
+                        type: item.type,
+                        effect: item.effect,
+                        flag: '单个'
                       })
                     }
                   >
                     设置
                   </Button>
-                  <MyPopconfirm txtK='删除' onConfirm={() => {}} />
+                  <MyPopconfirm txtK='删除' onConfirm={() => delFu([item.id])} />
                 </>
               ) : null}
             </>
@@ -99,9 +149,29 @@ function Y33com({ isLook }: Props) {
         }
       }
     ]
-  }, [isLook])
-
-  const [typeMo, setTypeMo] = useState({ leiXin: '', yongTu: '', flag: '', show: false })
+  }, [delFu, isLook])
+
+  const [typeMo, setTypeMo] = useState({} as infoType)
+
+  // 点击批量下载
+  const downsFu = useCallback(async () => {
+    const res = await API_C2downS(checkArr)
+    if (res.code === 0) {
+      MessageFu.success('下载成功')
+      // 动态创建 a 标签
+      const link = document.createElement('a')
+      link.href = baseURL + res.data
+      link.style.display = 'none'
+
+      // 插入 DOM 并触发点击
+      document.body.appendChild(link)
+      link.click()
+
+      // 清理
+      document.body.removeChild(link)
+      setCheckArr([])
+    }
+  }, [checkArr])
 
   return (
     <div className='Y33com'>
@@ -109,9 +179,9 @@ function Y33com({ isLook }: Props) {
         <div className='Y33topll'>
           {[{ name: '全部', key: '' }, ...selectObj['附件类型']].map(v => (
             <Button
-              key={v.name}
-              onClick={() => setBtnAc(v.name)}
-              type={btnAc === v.name ? 'primary' : 'default'}
+              key={v.key}
+              onClick={() => setBtnAc(v.key)}
+              type={btnAc === v.key ? 'primary' : 'default'}
             >
               {v.name}
             </Button>
@@ -119,7 +189,7 @@ function Y33com({ isLook }: Props) {
         </div>
         {isLook ? (
           <div className='Y33toprr'>
-            <Button type='primary' disabled={checkArr.length === 0}>
+            <Button type='primary' disabled={checkArr.length === 0} onClick={downsFu}>
               批量下载
             </Button>
             &emsp;
@@ -128,10 +198,10 @@ function Y33com({ isLook }: Props) {
               disabled={checkArr.length === 0}
               onClick={() =>
                 setTypeMo({
-                  leiXin: '',
-                  yongTu: '',
-                  flag: '批量',
-                  show: true
+                  ids: checkArr,
+                  type: '',
+                  effect: '',
+                  flag: '多个'
                 })
               }
             >
@@ -145,29 +215,16 @@ function Y33com({ isLook }: Props) {
       <MyTable
         classKey='Y33comTable'
         yHeight={isLook ? 640 : 666}
-        list={[
-          {
-            id: 1,
-            type: '图像',
-            fileName: 'https://houseoss.4dkankan.com/project/DEMO/staticResource/touxiang.jpg'
-          },
-          {
-            id: 2,
-            type: '视频',
-            fileName: 'https://houseoss.4dkankan.com/project/DEMO/staticResource/loop.mp4'
-          },
-          {
-            id: 3,
-            type: '3D'
-          }
-        ]}
-        columnsTemp={Y33tableC('详情')}
+        list={tableObj[btnAc] || []}
+        columnsTemp={Y33tableC('新增')}
         lastBtn={tableLastBtn}
         startBtn={startBtn}
         pagingInfo={false}
       />
 
-      {typeMo.show ? <Y33setType info={typeMo} closeFu={() => setTypeMo({} as any)} /> : null}
+      {typeMo.flag ? (
+        <Y33setType succFu={getListFu} info={typeMo} closeFu={() => setTypeMo({} as infoType)} />
+      ) : null}
     </div>
   )
 }

+ 3 - 1
src/pages/Y_goodsDetails/Y1cathet/Y44com.tsx

@@ -5,6 +5,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import { TypeY44form } from './type'
 import { B3_4inputKeyArr } from '@/pages/B_enterTibet/B3_4page'
 import dayjs from 'dayjs'
+import { C1GoodType } from '@/pages/C_goodsManage/C1ledger/type'
 const { RangePicker } = DatePicker
 
 type InputKeyType = 'aaaa' | 'bbbb' | 'cccc' | 'dddd'
@@ -25,9 +26,10 @@ const baseFormData: TypeY44form = {
 
 type Props = {
   isLook?: boolean
+  info: C1GoodType
 }
 
-function Y44com({ isLook }: Props) {
+function Y44com({ isLook, info }: Props) {
   const [formData, setFormData] = useState(baseFormData)
   const formDataRef = useRef(baseFormData)
 

+ 0 - 55
src/pages/Y_goodsDetails/Y1cathet/data.ts

@@ -1,55 +0,0 @@
-export const Y11infoArr1 = [
-  { name: '编号类型', key: '' },
-  { name: '藏品编号', key: '' },
-  { name: '制档人', key: '' },
-  { name: '分类号', key: '' },
-  { name: '制档日期', key: '' }
-]
-
-export const Y11infoArr2 = [
-  { name: '藏品名称', key: '' },
-  { name: '藏品原名', key: '' },
-  { name: '文物级别', key: '' },
-  { name: '文物类别', key: '' },
-  { name: '年代', key: '' },
-  { name: '制作时间', key: '' },
-  { name: '作者', key: '' },
-  { name: '作者介绍', key: '' },
-  { name: '数量', key: '' },
-  { name: '实际数量', key: '' },
-  { name: '质地', key: '' },
-  { name: '保存状态', key: '' },
-  { name: '完残程度', key: '' },
-  { name: '完残情况', key: '' },
-  { name: '色泽', key: '' },
-  { name: '用途', key: '' },
-  { name: '形状描述', key: '' },
-  { name: '著者', key: '' },
-  { name: '版本', key: '' },
-  { name: '存卷', key: '' },
-  { name: '备注', key: '', full: true }
-]
-
-export const Y11infoArr3 = [
-  { name: '尺寸', key: '' },
-  { name: '具体尺寸', key: '', full: false },
-  { name: '质量范围', key: '' },
-  { name: '具体质量', key: '' }
-]
-
-export const Y11infoArr4 = [
-  { name: '入馆凭证号', key: '' },
-  { name: '入藏凭证号', key: '' },
-  { name: '入藏日期', key: '' },
-  { name: '入藏日期范围', key: '' },
-  { name: '来源', key: '' },
-  { name: '来源详情', key: '' },
-  { name: '征集经过', key: '' },
-  { name: '铭记题跋', key: '' },
-  { name: '鉴藏印记', key: '', full: true }
-]
-
-export const Y11infoArr5 = [
-  { name: '著作及有关书目', key: '' },
-  { name: '流传经历', key: '' }
-]

+ 150 - 0
src/pages/Y_goodsDetails/Y1cathet/data.tsx

@@ -0,0 +1,150 @@
+import { C1GoodType } from '@/pages/C_goodsManage/C1ledger/type'
+import { resJiLianFu, textFu } from '@/utils/history'
+
+type ArrKeyType = {
+  name: string
+  key: keyof C1GoodType
+  full?: boolean
+  backFu?: (info: C1GoodType) => any
+}[]
+
+export const Y11infoArr1: ArrKeyType = [
+  { name: '编号类型', key: 'numName' },
+  { name: '藏品编号', key: 'num' },
+  { name: '制档人', key: 'creatorName' },
+  { name: '分类号', key: 'numType' },
+  { name: '制档日期', key: 'createTime' }
+]
+
+export const Y11infoArr2: ArrKeyType = [
+  { name: '藏品名称', key: 'name' },
+  { name: '藏品原名', key: 'namePrimitive' },
+  { name: '文物级别', key: 'dictLevel' },
+  {
+    name: '文物类别',
+    key: 'dictType',
+    backFu: info => {
+      return resJiLianFu(info.dictType)
+    }
+  },
+  {
+    name: '年代',
+    key: 'dictAge',
+    backFu: info => {
+      return info.dictAge === '其他' ? '其他 - ' + info.ageInfo : resJiLianFu(info.dictAge)
+    }
+  },
+  { name: '制作时间', key: 'dateMaking' },
+  { name: '作者', key: 'author' },
+  { name: '作者介绍', key: 'authorDesc' },
+  {
+    name: '数量',
+    key: 'pcs',
+    backFu: info => {
+      return info.pcs + resJiLianFu(info.pcsUnit)
+    }
+  },
+  { name: '实际数量', key: 'pcsActual' },
+  {
+    name: '质地',
+    key: 'dictTexture1',
+    backFu: info => {
+      let txt1 = resJiLianFu(info.dictTexture1)
+      let txt2 = resJiLianFu(info.dictTexture2)
+      let txt3 = resJiLianFu(info.dictTexture3)
+
+      txt1 = txt1 ? txt1 + ' - ' : ''
+      txt2 = txt2 ? txt2 + ' - ' : ''
+
+      return txt1 + txt2 + txt3
+    }
+  },
+  { name: '保存状态', key: 'preserveState' },
+  {
+    name: '完残程度',
+    key: 'dictTorn',
+    backFu: info => {
+      return resJiLianFu(info.dictTorn)
+    }
+  },
+  { name: '完残情况', key: 'torn' },
+  { name: '色泽', key: 'color' },
+  { name: '用途', key: 'uses' },
+  { name: '形状描述', key: 'shape' },
+  { name: '著者', key: 'pressAuthor' },
+  { name: '版本', key: 'pressVersion' },
+  { name: '存卷', key: 'pressFile' },
+  {
+    name: '备注',
+    key: 'rtf',
+    full: true,
+    backFu: info => {
+      let txt = textFu(info.rtf)
+      return txt ? <div dangerouslySetInnerHTML={{ __html: txt }}></div> : '(空)'
+    }
+  }
+]
+
+export const Y11infoArr3: ArrKeyType = [
+  {
+    name: '尺寸',
+    key: 'sizeL',
+    backFu: info => {
+      let danWei = resJiLianFu(info.sizeUnit, ' ')
+
+      let txt1 = `通长${info.sizeL || '(空)'}`
+      let txt2 = `通宽${info.sizeW || '(空)'}`
+      let txt3 = `通高${info.sizeH || '(空)'}`
+
+      txt1 = txt1 ? `${txt1 + danWei} - ` : ''
+      txt2 = txt2 ? `${txt2 + danWei} - ` : ''
+      txt3 = txt3 ? `${txt3 + danWei}` : ''
+
+      return txt1 + txt2 + txt3
+    }
+  },
+  { name: '具体尺寸', key: 'sizeInfo' },
+  {
+    name: '质量范围',
+    key: 'qualityDictScope',
+    backFu: info => {
+      return resJiLianFu(info.qualityDictScope)
+    }
+  },
+  {
+    name: '具体质量',
+    key: 'quality',
+    backFu: info => {
+      return info.quality + resJiLianFu(info.qualityUnit)
+    }
+  }
+]
+
+export const Y11infoArr4: ArrKeyType = [
+  { name: '入馆凭证号', key: 'inHouseNum' },
+  { name: '入藏凭证号', key: 'inGoodsNum' },
+  { name: '入藏日期', key: 'inGoodsDate' },
+  {
+    name: '入藏日期范围',
+    key: 'inDictDateScope',
+    backFu: info => {
+      return resJiLianFu(info.inDictDateScope)
+    }
+  },
+  {
+    name: '来源',
+    key: 'source',
+    backFu: info => {
+      return resJiLianFu(info.source)
+    }
+  },
+  { name: '来源详情', key: 'sourceInfo' },
+  { name: '征集经过', key: 'sourcePass' },
+  { name: '铭记题跋', key: 'sourcePreface' },
+  { name: '鉴藏印记', key: 'sourceStamp', full: true }
+]
+
+export const Y11infoArr5: ArrKeyType = [
+  { name: '著作及有关书目', key: 'historyWork' },
+  { name: '流传经历', key: 'historyUndergo' }
+]

+ 1 - 0
src/pages/Y_goodsDetails/Y1cathet/index.module.scss

@@ -99,6 +99,7 @@
             }
             .Y1rowZrr {
               display: flex;
+              justify-content: center;
               align-items: center;
               width: 48%;
             }

+ 49 - 19
src/pages/Y_goodsDetails/Y2look/Y33setType.tsx

@@ -1,30 +1,36 @@
-import React, { useCallback, useEffect, useRef, useState } from 'react'
+import React, { useCallback, useEffect, useMemo, useRef } from 'react'
 import styles from './index.module.scss'
 import { Button, Cascader, Form, FormInstance, Modal, Select } from 'antd'
 import MyPopconfirm from '@/components/MyPopconfirm'
-import { TypeZ1dict } from '@/pages/Z_system/Z1dict/type'
 import { selectObj } from '@/utils/select'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { cascaderArr } from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew/data'
+import { API_C2setFile } from '@/store/action/C2files'
+import { MessageFu } from '@/utils/message'
+
+export type infoType = {
+  ids: number[]
+  type: string
+  effect: string | null
+  flag: '单个' | '多个'
+}
 
 type Props = {
-  info: any
+  info: infoType
   closeFu: () => void
+  succFu: () => void
 }
 
-function Y33setType({ info, closeFu }: Props) {
-  // 待完善 获取用途树-后面统一写一个函数从总数据里面拿
-
-  const [treeArr, setTreeArr] = useState<TypeZ1dict[]>([])
-
+function Y33setType({ info, closeFu, succFu }: Props) {
   useEffect(() => {
-    console.log('待完善', setTreeArr)
-
     if (info.flag === '单个') {
       FormBoxRef.current?.setFieldsValue({
-        aaaa: info.leiXin
-        // 待完善 设置回显级联
+        ...info,
+        effect: info.effect ? info.effect.split(',') : []
       })
     }
-  }, [info.flag, info.leiXin])
+  }, [info])
 
   // 设置表单初始数据(区分编辑和新增)
   const FormBoxRef = useRef<FormInstance>(null)
@@ -35,9 +41,33 @@ function Y33setType({ info, closeFu }: Props) {
   }, [])
 
   // 通过校验点击确定
-  const onFinish = useCallback(async (values: any) => {
-    console.log(123, values)
-  }, [])
+  const onFinish = useCallback(
+    async (values: any) => {
+      const obj = {
+        effect: values.effect ? values.effect.join(',') : '',
+        type: values.type,
+        ids: info.ids
+      }
+      const res = await API_C2setFile(obj)
+      if (res.code === 0) {
+        MessageFu.success('设置成功')
+        succFu()
+        closeFu()
+      }
+    },
+    [closeFu, info.ids, succFu]
+  )
+
+  const { dictAll } = useSelector((state: RootState) => state.Z1dict)
+
+  // 所有级联的数据平铺
+  const cascaderObj = useMemo(() => {
+    let obj: any = {}
+    if (dictAll && dictAll.length) {
+      obj = cascaderArr(dictAll)
+    }
+    return obj
+  }, [dictAll])
 
   return (
     <Modal
@@ -59,7 +89,7 @@ function Y33setType({ info, closeFu }: Props) {
           onFinishFailed={onFinishFailed}
           autoComplete='off'
         >
-          <Form.Item label='类型' name='aaaa' rules={[{ required: true, message: '请输入类型!' }]}>
+          <Form.Item label='类型' name='type' rules={[{ required: true, message: '请输入类型!' }]}>
             <Select
               options={selectObj['附件类型']}
               fieldNames={{ label: 'name', value: 'key' }}
@@ -67,11 +97,11 @@ function Y33setType({ info, closeFu }: Props) {
             />
           </Form.Item>
 
-          <Form.Item label='用途' name='bbbb'>
+          <Form.Item label='用途' name='effect'>
             <Cascader
               changeOnSelect
               fieldNames={{ label: 'name', value: 'id', children: 'children' }}
-              options={treeArr}
+              options={cascaderObj['附件用途']}
               placeholder='请选择'
             />
           </Form.Item>

+ 22 - 9
src/pages/Y_goodsDetails/Y2look/index.tsx

@@ -1,4 +1,4 @@
-import React, { useEffect, useMemo, useState } from 'react'
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
 import styles from './index.module.scss'
 import { useParams } from 'react-router-dom'
 import { Y1tabArr, Y1TabArrType } from '../Y1cathet/Y1main'
@@ -10,13 +10,24 @@ import Y11com from '../Y1cathet/Y11com'
 import Y22com from '../Y1cathet/Y22com'
 import Y33com from '../Y1cathet/Y33com'
 import Y44com from '../Y1cathet/Y44com'
+import { C1GoodType } from '@/pages/C_goodsManage/C1ledger/type'
+import { API_goodsInfo } from '@/store/action/C1ledger'
 
 function Y2look() {
   const { id: sId } = useParams<any>()
 
+  const [info, setInfo] = useState({} as C1GoodType)
+
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await API_goodsInfo(id)
+    if (res.code === 0) {
+      setInfo(res.data)
+    }
+  }, [])
+
   useEffect(() => {
-    console.log('获取ID', sId)
-  }, [sId])
+    getInfoFu(sId)
+  }, [getInfoFu, sId])
 
   const [tabAc, setTabAc] = useState<Y1TabArrType>('藏品信息')
 
@@ -119,12 +130,14 @@ function Y2look() {
         </div>
       </div>
 
-      <div className='Y2info'>
-        {tabAc === '藏品信息' ? <Y11com /> : null}
-        {tabAc === '库存信息' ? <Y22com isLook={true} /> : null}
-        {tabAc === '藏品附件' ? <Y33com isLook={true} /> : null}
-        {tabAc === '藏品日志' ? <Y44com isLook={true} /> : null}
-      </div>
+      {info.id ? (
+        <div className='Y2info'>
+          {tabAc === '藏品信息' ? <Y11com info={info} /> : null}
+          {tabAc === '库存信息' ? <Y22com info={info} isLook={true} /> : null}
+          {tabAc === '藏品附件' ? <Y33com sId={sId} isLook={true} /> : null}
+          {tabAc === '藏品日志' ? <Y44com info={info} isLook={true} /> : null}
+        </div>
+      ) : null}
     </div>
   )
 }

+ 23 - 2
src/store/action/C2files.ts

@@ -3,6 +3,27 @@ import http from '@/utils/http'
 /**
  * 删除附件
  */
-export const API_C2dels = (ids: number[]) => {
-  return http.post('cms/goodsFile/removes', ids)
+export const API_C2dels = (data: number[]) => {
+  return http.post('cms/goodsFile/removes', data)
+}
+
+/**
+ * 藏品详情-附件列表(没有分页,给详情用)
+ */
+export const API_goodFileList = (id: number) => {
+  return http.get(`cms/goods/file/${id}`)
+}
+
+/**
+ * 批量下载
+ */
+export const API_C2downS = (data: number[]) => {
+  return http.post('cms/goodsFile/downloadBatch', data)
+}
+
+/**
+ * 设置-批量设置
+ */
+export const API_C2setFile = (data: any) => {
+  return http.post('cms/goodsFile/setting', data)
 }

+ 43 - 0
src/utils/history.ts

@@ -1,3 +1,6 @@
+import { TypeZ1dict } from '@/pages/Z_system/Z1dict/type'
+import { treeLastIdFindFatherFu } from '@/pages/Z_system/Z6user/data'
+import store from '@/store'
 import { createHashHistory } from 'history'
 const history = createHashHistory()
 export default history
@@ -6,3 +9,43 @@ export default history
 export const openGoodsInfoFu = (id: number, src?: string) => {
   window.open(src ? src : `/#/goodsLook/${id}`, '_blank')
 }
+
+let dictAll: TypeZ1dict[] = []
+
+// 级联回显
+export const resJiLianFu = (idTemp: string, isNull?: string) => {
+  if (idTemp) {
+    if (dictAll && dictAll.length === 0) {
+      dictAll = store.getState().Z1dict.dictAll
+    }
+
+    const idArr = idTemp.split(',')
+    const id = idArr[idArr.length - 1]
+    let arr = treeLastIdFindFatherFu(dictAll, id, 'name')
+
+    if (arr.length >= 3) arr = arr.slice(2)
+
+    if (arr && arr.length) return arr.join(' / ')
+    else return isNull || '(空)'
+  } else return isNull || '(空)'
+}
+
+// 富文本回显
+export const textFu = (val: string) => {
+  let TxtRes = ''
+  try {
+    if (val) {
+      let txt = JSON.parse(val)
+
+      if (txt.txtArr && txt.txtArr.length) {
+        let txt2: string = txt.txtArr[0].txt
+        if (txt2) {
+          const txt3 = txt2.replaceAll('<p></p>', '')
+          if (txt3) TxtRes = txt2
+        }
+      }
+    }
+  } catch (error) {}
+
+  return TxtRes
+}

+ 1 - 1
src/utils/tableData.ts

@@ -39,7 +39,7 @@ export const B3eTableC = [
   ['txt', '文物级别', 'dictLevel'],
   ['txtC', '文物类别', 'dictType'],
   ['txtC', '年代', 'dictAge'],
-  ['txt', '数量', 'pcs'],
+  ['ping', '数量', 'pcs', 'pcsUnit'],
   ['txtC', '质地', 'dictTexture3'],
   ['txtC', '完残程度', 'dictTorn'],
   ['txtC', '来源', 'source']