Selaa lähdekoodia

入库出库开始

shaogen1995 3 kuukautta sitten
vanhempi
commit
b172b7e0eb

+ 5 - 0
src/pages/A3_ledger/C1ledger/type.d.ts

@@ -139,4 +139,9 @@ export type C1GoodType = {
 
 
   // 是否在编辑状态isEdit
   // 是否在编辑状态isEdit
   isEdit: 0 | 1
   isEdit: 0 | 1
+
+  // 出库
+  date: string
+  txt4: string
+  beiZhu: string
 }
 }

+ 7 - 0
src/pages/B_enterTibet/B1collect/type.d.ts

@@ -101,4 +101,11 @@ export type FourTableType = {
 
 
   // 现状
   // 现状
   sonUser: string
   sonUser: string
+
+  // 出库
+  sonUnit: string
+  borrowInUnit: string
+  effect: string
+  receiveUnit: string
+  returnUnit: string
 }
 }

+ 2 - 2
src/pages/D_storeManage/D2storSet/D2site/D2Sarea.tsx

@@ -100,7 +100,7 @@ function D2Sarea({ sId, closeFu, succFu }: Props) {
             maxLength={30}
             maxLength={30}
             showCount
             showCount
             value={item.name}
             value={item.name}
-            onChange={e => inputChangeFu(item.id, e.target.value, 'name')}
+            onChange={e => inputChangeFu(item.id, e.target.value.trim(), 'name')}
           />
           />
         )
         )
       },
       },
@@ -112,7 +112,7 @@ function D2Sarea({ sId, closeFu, succFu }: Props) {
             maxLength={30}
             maxLength={30}
             showCount
             showCount
             value={item.description}
             value={item.description}
-            onChange={e => inputChangeFu(item.id, e.target.value, 'description')}
+            onChange={e => inputChangeFu(item.id, e.target.value.trim(), 'description')}
           />
           />
         )
         )
       },
       },

+ 18 - 9
src/pages/D_storeManage/D4impStor/D4edit/index.tsx

@@ -73,16 +73,16 @@ function D4edit() {
   const creatFu = useCallback(async () => {
   const creatFu = useCallback(async () => {
     const res = await D4_APIcreate()
     const res = await D4_APIcreate()
     if (res.code === 0) {
     if (res.code === 0) {
-      setTopInfo(res.data)
       // 从藏品详情点击按钮进来
       // 从藏品详情点击按钮进来
       const urlAll = window.location.href
       const urlAll = window.location.href
       if (urlAll.includes('?id=')) {
       if (urlAll.includes('?id=')) {
         const urlId = urlAll.split('?id=')[1]
         const urlId = urlAll.split('?id=')[1]
         const res2 = await API_goodsInfo(Number(urlId))
         const res2 = await API_goodsInfo(Number(urlId))
         if (res2.code === 0) {
         if (res2.code === 0) {
+          setTopInfo({ ...res.data, storageId: res2.data.storageId })
           setSnaps([res2.data])
           setSnaps([res2.data])
         }
         }
-      }
+      } else setTopInfo(res.data)
     }
     }
   }, [])
   }, [])
 
 
@@ -272,20 +272,23 @@ function D4edit() {
             <span style={{ color: '#ff4d4f' }}> * </span>藏品分库号
             <span style={{ color: '#ff4d4f' }}> * </span>藏品分库号
           </div>
           </div>
         ),
         ),
+        width: 160,
         render: (item: C1GoodType) => (
         render: (item: C1GoodType) => (
           <InputNumber
           <InputNumber
+            style={{ width: 140 }}
+            disabled={!topInfo.storageId}
             readOnly={['3', '4'].includes(key)}
             readOnly={['3', '4'].includes(key)}
             min={1}
             min={1}
             max={99999999}
             max={99999999}
             precision={0}
             precision={0}
             value={item.siteNum}
             value={item.siteNum}
             onChange={e => tableInputChange(item.id, e, 'siteNum')}
             onChange={e => tableInputChange(item.id, e, 'siteNum')}
-            placeholder='请输入'
+            placeholder={!topInfo.storageId ? '请先选择分库缩写' : '请输入'}
           />
           />
         )
         )
       }
       }
     ]
     ]
-  }, [cathet, key, tableInputChange])
+  }, [cathet, key, tableInputChange, topInfo.storageId])
 
 
   const tableLastBtn = useMemo(() => {
   const tableLastBtn = useMemo(() => {
     return [
     return [
@@ -296,15 +299,15 @@ function D4edit() {
           <TextArea
           <TextArea
             readOnly={['3', '4'].includes(key)}
             readOnly={['3', '4'].includes(key)}
             placeholder={
             placeholder={
-              ['3', '4'].includes(key) && !item.txt1 ? '(空)' : '请输入内容,不超过200字'
+              ['3', '4'].includes(key) && !item.beiZhu ? '(空)' : '请输入内容,不超过200字'
             }
             }
             maxLength={200}
             maxLength={200}
-            value={item.txt1}
+            value={item.beiZhu}
             onChange={e =>
             onChange={e =>
               setSnaps(
               setSnaps(
                 snaps.map(v => ({
                 snaps.map(v => ({
                   ...v,
                   ...v,
-                  txt1: v.id === item.id ? e.target.value : v.txt1
+                  beiZhu: v.id === item.id ? e.target.value.trim() : v.beiZhu
                 }))
                 }))
               )
               )
             }
             }
@@ -471,6 +474,7 @@ function D4edit() {
 
 
   // 点击自动分配空置分库号
   // 点击自动分配空置分库号
   const autoFu = useCallback(async () => {
   const autoFu = useCallback(async () => {
+    if (!topInfo.storageId) return MessageFu.warning('请先选择分库缩写')
     const res = await D4_APIgetStorageNum(snaps.length, topInfo.storageId!)
     const res = await D4_APIgetStorageNum(snaps.length, topInfo.storageId!)
     if (res.code === 0) {
     if (res.code === 0) {
       setSnaps(
       setSnaps(
@@ -559,7 +563,12 @@ function D4edit() {
                 allowClear={false}
                 allowClear={false}
                 value={topInfo.storageId || null}
                 value={topInfo.storageId || null}
                 onChange={e => {
                 onChange={e => {
-                  setSnaps([])
+                  setSnaps(
+                    snaps.map(v => ({
+                      ...v,
+                      siteNum: null
+                    }))
+                  )
                   setTopInfo({ ...topInfo, storageId: e ? e : null })
                   setTopInfo({ ...topInfo, storageId: e ? e : null })
                 }}
                 }}
               />
               />
@@ -632,7 +641,7 @@ function D4edit() {
                   <Button
                   <Button
                     type='primary'
                     type='primary'
                     onClick={() => {
                     onClick={() => {
-                      if (!topInfo.storageId) return MessageFu.warning('请先选择分库缩写')
+                      // if (!topInfo.storageId) return MessageFu.warning('请先选择分库缩写')
                       setNowSta({
                       setNowSta({
                         key: '藏品入库',
                         key: '藏品入库',
                         id: 'cms/orderIn/goods/getList'
                         id: 'cms/orderIn/goods/getList'

+ 36 - 0
src/pages/D_storeManage/D6putsStor/D6edit/D6batchInput/index.module.scss

@@ -0,0 +1,36 @@
+.D6batchInput {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .ant-modal {
+      width: 600px !important;
+    }
+    .ant-modal-body {
+      border-top: 1px solid #ccc;
+
+      .D6mbMain {
+        margin-top: 15px;
+
+        .D6mbRow {
+          display: flex;
+          margin-bottom: 20px;
+          .D6mbRowll {
+            position: relative;
+            top: 3px;
+            width: 80px;
+            text-align: right;
+          }
+          .D6mbRowrr {
+            width: calc(100% - 80px);
+          }
+        }
+
+        .D6mbBtn {
+          margin-top: 15px;
+          text-align: center;
+        }
+      }
+    }
+  }
+}

+ 110 - 0
src/pages/D_storeManage/D6putsStor/D6edit/D6batchInput/index.tsx

@@ -0,0 +1,110 @@
+import React, { useCallback, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, DatePicker, Modal } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import TextArea from 'antd/es/input/TextArea'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+
+export type D6vatchValueType = {
+  key: 'txt1' | 'txt2' | 'date' | 'txt3' | 'txt4' | 'beiZhu'
+  value: string
+}
+type Props = {
+  type: '1' | '2' | '3'
+  closeFu: () => void
+  succFu: (arr: D6vatchValueType[]) => void
+}
+
+function D6batchInput({ type, closeFu, succFu }: Props) {
+  const [value1, setValue1] = useState('')
+  const [value2, setValue2] = useState('')
+  const [value3, setValue3] = useState('')
+  const [value4, setValue4] = useState('')
+
+  const btnOk = useCallback(() => {
+    const arr: D6vatchValueType[] = []
+    if (value1) arr.push({ key: type === '1' ? 'txt1' : 'txt3', value: value1 })
+    if (value2) arr.push({ key: type === '1' ? 'txt2' : 'txt4', value: value2 })
+    if (value3) arr.push({ key: 'date', value: value3 })
+    if (value4) arr.push({ key: 'beiZhu', value: value4 })
+
+    if (arr.length === 0) return MessageFu.warning('至少输入一个内容')
+    MessageFu.success('批量填写成功')
+    succFu(arr)
+    closeFu()
+  }, [closeFu, succFu, type, value1, value2, value3, value4])
+  return (
+    <Modal
+      wrapClassName={styles.D6batchInput}
+      destroyOnClose
+      open={true}
+      title='批量填写'
+      footer={[]}
+    >
+      <div className='D6mbMain'>
+        <div className='D6mbRow'>
+          <div className='D6mbRowll'>{type === '1' ? '退还人' : '退回者'}:</div>
+          <div className='D6mbRowrr'>
+            <TextArea
+              placeholder='请输入'
+              maxLength={200}
+              showCount
+              value={value1}
+              onChange={e => setValue1(e.target.value.trim())}
+            />
+          </div>
+        </div>
+
+        <div className='D6mbRow'>
+          <div className='D6mbRowll'>{type === '1' ? '点收人' : '库保员'}:</div>
+          <div className='D6mbRowrr'>
+            <TextArea
+              placeholder='请输入'
+              maxLength={200}
+              showCount
+              value={value2}
+              onChange={e => setValue2(e.target.value.trim())}
+            />
+          </div>
+        </div>
+
+        <div className='D6mbRow'>
+          <div className='D6mbRowll'>{type === '1' ? '退库时间' : '退库日期'}:</div>
+          <div className='D6mbRowrr'>
+            <DatePicker
+              allowClear={true}
+              value={value3 ? dayjs(value3) : null}
+              onChange={e => setValue3(e ? dayjs(e).format('YYYY-MM-DD') : '')}
+            />
+          </div>
+        </div>
+
+        <div className='D6mbRow'>
+          <div className='D6mbRowll'>备注:</div>
+          <div className='D6mbRowrr'>
+            <TextArea
+              placeholder='请输入'
+              maxLength={200}
+              showCount
+              value={value4}
+              onChange={e => setValue4(e.target.value.trim())}
+            />
+          </div>
+        </div>
+
+        <div className='D6mbBtn'>
+          <Button type='primary' onClick={btnOk}>
+            确定
+          </Button>
+          &emsp;
+          <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+        </div>
+      </div>
+    </Modal>
+  )
+}
+
+const MemoD6batchInput = React.memo(D6batchInput)
+
+export default MemoD6batchInput

+ 127 - 0
src/pages/D_storeManage/D6putsStor/D6edit/index.module.scss

@@ -1,4 +1,131 @@
 .D6edit {
 .D6edit {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 15px 24px 0px;
   :global {
   :global {
+    .D6Tit {
+      font-size: 18px;
+      font-weight: 700;
+      padding-bottom: 10px;
+      padding-left: 18px;
+      border-bottom: 1px solid #ccc;
+      margin-bottom: 17px;
+      color: var(--themeColor);
+      .ant-btn {
+        margin-left: 15px;
+        pointer-events: none;
+      }
+    }
+
+    .D6Tit2 {
+      margin-top: 24px;
+      display: flex;
+      justify-content: space-between;
+      border-bottom: 1px solid #ccc;
+      margin-bottom: 20px;
+      .D6Tit2ll {
+        font-size: 18px;
+        font-weight: 700;
+        padding-left: 18px;
+        margin-bottom: 17px;
+        color: var(--themeColor);
+      }
+      .D6Tit2rr {
+        position: relative;
+        z-index: 2;
+        .ant-btn {
+          margin-left: 15px;
+        }
+      }
+    }
+
+    .D6main {
+      width: 100%;
+      height: calc(100% - 70px);
+      overflow-y: auto;
+      padding-bottom: 40px;
+
+      .D6rowAll {
+        display: flex;
+        justify-content: space-between;
+        align-items: self-start;
+        font-size: 16px;
+        flex-wrap: wrap;
+        .D6row {
+          width: 48%;
+          display: flex;
+          align-items: center;
+          margin-bottom: 20px;
+          min-height: 32px;
+          .D6rowll {
+            width: 170px;
+            text-align: right;
+            font-weight: 700;
+            & > span {
+              color: #ff4d6f;
+            }
+          }
+          .D6rowrr {
+            width: calc(100% - 170px);
+            .ant-input-affix-wrapper {
+              width: 300px;
+            }
+            .ant-select {
+              width: 300px;
+            }
+          }
+        }
+        .D6row2 {
+          align-items: self-start;
+          .D6rowll {
+            position: relative;
+            top: 3px;
+          }
+        }
+        .D6row3 {
+          position: relative;
+          top: 4px;
+        }
+
+        .D6rowFull {
+          width: 100%;
+          align-items: self-start;
+          margin-bottom: 0;
+          .D6rowll {
+            position: relative;
+            top: 3px;
+          }
+        }
+      }
+
+      // 藏品清单
+      .D6googsBox {
+        padding-right: 20px;
+      }
+    }
+
+    .D6btn {
+      position: absolute;
+      bottom: 20px;
+      left: 134px;
+      .ant-btn {
+        margin-right: 20px;
+      }
+    }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
+  }
+}
+
+.D6editMo {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .D6editMoBtn {
+      margin-top: 40px;
+      text-align: center;
+    }
   }
   }
 }
 }

+ 912 - 2
src/pages/D_storeManage/D6putsStor/D6edit/index.tsx

@@ -1,9 +1,919 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
+import { useParams } from 'react-router-dom'
+import { FourTableType } from '@/pages/B_enterTibet/B1collect/type'
+import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
+import {
+  D6_APIcreate,
+  D6_APIdel,
+  D6_APIgetInfo,
+  D6_APIrevocation,
+  D6_APIsaveApply,
+  D6_APIsaveAudit,
+  D6_APIsaveCreate,
+  D6_APIsaveDraft
+} from '@/store/action/D6putsStor'
+import { API_goodsInfo } from '@/store/action/C1ledger'
+import { pageTitTxtObj } from '../../D4impStor/D4edit'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+import history, { btnFlagFu2, openGoodsInfoFu } from '@/utils/history'
+import classNames from 'classnames'
+import TextArea from 'antd/es/input/TextArea'
+import { Button, DatePicker, Input, Modal, Radio, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { EXbtnFu } from '@/utils/EXBtn'
+import X3auditInfo from '@/pages/X_stock/X3auditInfo'
+import { D6tableCgoods, statusObj } from '@/utils/tableData'
+import { useDispatch, useSelector } from 'react-redux'
+import { D2_APIgetList } from '@/store/action/D2storSet'
+import { RootState } from '@/store'
+import MyTable from '@/components/MyTable'
+import ZflowTable from '@/components/ZflowTable'
+import ZupFileTable from '@/components/ZupFileTable'
+import Y1cathet from '@/pages/Y_goodsDetails/Y1cathet'
+import ZGaddNow from '@/components/ZGaddNow'
+import D6batchInput from './D6batchInput'
+
 function D6edit() {
 function D6edit() {
+  // 获取库房设置列表/入馆凭证号-用于分库缩写下拉
+  const dispatch = useDispatch()
+
+  useEffect(() => {
+    dispatch(D2_APIgetList({ pageNum: 1, pageSize: 99999 }))
+  }, [dispatch])
+
+  const { list: storageIdArr } = useSelector((state: RootState) => state.D2storSet.tableInfo)
+
+  const { key, id } = useParams<any>()
+  // key:1 新增 2编辑 3审批 4查看
+  // 滚到顶部
+  const sollrDom = useRef<HTMLDivElement>(null)
+  // 顶部数据
+  const [topInfo, setTopInfo] = useState({} as FourTableType)
+
+  // 藏品清单快照数据
+  const [snaps, setSnaps] = useState<C1GoodType[]>([])
+  const delSnapIdsRef = useRef<number[]>([])
+
+  const snapsID2ref = useRef<{ goodsId: number; id: number }[]>([])
+
+  // 创建订单
+  const creatFu = useCallback(async () => {
+    const res = await D6_APIcreate()
+    if (res.code === 0) {
+      // 从藏品详情点击按钮进来
+      const urlAll = window.location.href
+      if (urlAll.includes('?id=')) {
+        const urlId = urlAll.split('?id=')[1]
+        const res2 = await API_goodsInfo(Number(urlId))
+        if (res2.code === 0) {
+          setTopInfo({ ...res.data, storageId: res2.data.storageId, sonTypeName: '1' })
+          setSnaps([res2.data])
+        }
+      } else setTopInfo({ ...res.data, sonTypeName: '1' })
+    }
+  }, [])
+
+  // 获取详情
+  const getInfoFu = useCallback(async () => {
+    const res = await D6_APIgetInfo(id)
+    if (res.code === 0) {
+      const data = res.data
+      setTopInfo(data)
+      // 藏品清单快照信息id对比
+      const arrTemp: any = []
+      const snapsTemp = data.snaps || []
+
+      snapsTemp.forEach((v: any) => {
+        snapsID2ref.current.push({ goodsId: v.goodsId, id: v.id })
+
+        const obj = JSON.parse(v.snap || '{}')
+        if (obj.id) obj.id2 = v.id
+
+        arrTemp.push(obj)
+      })
+      setSnaps(arrTemp)
+    }
+  }, [id])
+
+  useEffect(() => {
+    if (key === '1') creatFu()
+    else getInfoFu()
+
+    if (sollrDom.current) sollrDom.current.scrollTop = 0
+  }, [creatFu, getInfoFu, key])
+
+  const pageTitTxt = useMemo(() => {
+    return Reflect.get(pageTitTxtObj, key)
+  }, [key])
+
+  const timeChange = useCallback(
+    (e: any, key: 'date' | 'returnDate') => {
+      setTopInfo({ ...topInfo, [key]: dayjs(e).format('YYYY-MM-DD') })
+    },
+    [topInfo]
+  )
+
+  // 审批意见的ref
+  const ZAuditRef = useRef<any>(null)
+
+  // 审批的sta
+  const [auditSta, setAuDitSta] = useState('')
+
+  // 字段的校验
+  const checkFu = useCallback(() => {
+    if (!topInfo.sonTypeName) {
+      MessageFu.warning('请选择提退类型')
+      return true
+    }
+    if (!topInfo.num) {
+      MessageFu.warning('请输入提退单编号')
+      return true
+    }
+
+    if (topInfo.sonTypeName === '3' && !topInfo.borrowInUnit) {
+      MessageFu.warning('请输入借出单位')
+      return true
+    }
+
+    if (!topInfo.sonUnit) {
+      MessageFu.warning(
+        `请输入${
+          topInfo.sonTypeName === '1'
+            ? '提用单位(部门)'
+            : topInfo.sonTypeName === '2'
+            ? '提用部门'
+            : '借入单位'
+        }`
+      )
+      return true
+    }
+    if (!topInfo.date) {
+      MessageFu.warning(`请选择${topInfo.sonTypeName === '3' ? '借用日期' : '提用日期'}`)
+      return true
+    }
+
+    if (topInfo.sonTypeName === '3') {
+      if (!topInfo.returnDate) {
+        MessageFu.warning('请选择归还日期')
+        return true
+      }
+      if (!topInfo.receiveUnit) {
+        MessageFu.warning('请输入接收单位')
+        return true
+      }
+      if (!topInfo.returnUnit) {
+        MessageFu.warning('请输入归还单位')
+        return true
+      }
+    } else {
+      if (!topInfo.effect) {
+        MessageFu.warning(`请输入${topInfo.sonTypeName === '2' ? '提用原因' : '提用目的'}`)
+        return true
+      }
+    }
+
+    if (!topInfo.storageId) {
+      MessageFu.warning('请输入请选择分库缩写')
+      return true
+    }
+  }, [topInfo])
+
+  // 新增的底部按钮点击
+  const btnClickFu = useCallback(
+    async (val: '草稿' | '创建' | '保存' | '审批') => {
+      if (checkFu()) {
+        if (sollrDom.current) sollrDom.current.scrollTop = 0
+        return
+      }
+
+      if (val !== '草稿') {
+        if (snaps.length === 0) return MessageFu.warning('请添加藏品')
+      }
+
+      if (val === '审批') {
+        // console.log('审批信息富文本', rtf2)
+        if (!auditSta) {
+          if (sollrDom.current) sollrDom.current.scrollTop = 0
+          return MessageFu.warning('请选择审批结果')
+        }
+        const rtf2 = ZAuditRef.current?.resData()
+
+        const res: any = await D6_APIsaveAudit({
+          orderId: topInfo.id,
+          rtfOpinion: rtf2,
+          status: auditSta === '同意' ? 1 : 2
+        })
+
+        if (res.code === 0) {
+          MessageFu.success('审批成功')
+          // 跳详情页
+          history.push(`/putsStor_edit/4/${topInfo.id}`)
+        }
+      } else {
+        const obj = {
+          ...topInfo,
+          goodsIds: snaps.map(v => v.id).join(','),
+          delSnapIds: delSnapIdsRef.current.length ? delSnapIdsRef.current : '',
+          snaps: snaps.map(v => ({
+            goodsId: v.id,
+            id: v.id2 ? v.id2 : null,
+            orderId: topInfo.id,
+            snap: JSON.stringify(v)
+          }))
+        }
+        // console.log(123, obj.snaps)
+
+        // if (1 + 1 === 2) return
+
+        if (val === '草稿') {
+          // 存草稿 当前页保存 不跳转
+          const res = await D6_APIsaveDraft(obj)
+          if (res.code === 0) {
+            MessageFu.success('草稿保存成功')
+          }
+        } else {
+          const res: any = val === '创建' ? await D6_APIsaveCreate(obj) : await D6_APIsaveApply(obj)
+          if (res.code === 0) {
+            MessageFu.success(`${val}成功`)
+            // 跳到详情页
+            history.push(`/putsStor_edit/4/${topInfo.id}`)
+          }
+        }
+      }
+    },
+    [auditSta, checkFu, snaps, topInfo]
+  )
+
+  // 打开侧边栏
+  const [cathet, setCathet] = useState(0)
+
+  const startBtn = useMemo(() => {
+    const arr: any[] = [
+      {
+        title: '藏品编号',
+        render: (item: C1GoodType) => {
+          return (
+            <span
+              onClick={() => setCathet(item.id)}
+              className={classNames('D1GtNum', item.id === cathet ? 'D1GtNumAc' : '')}
+            >
+              {item.num || '(空)'}
+            </span>
+          )
+        }
+      },
+      {
+        title: '编号类型',
+        render: (item: C1GoodType) => item.numName || '(空)'
+      }
+    ]
+
+    if (topInfo.sonTypeName === '1') {
+      arr.push({
+        title: '藏品分库号',
+        render: (item: C1GoodType) => item.siteNum
+      })
+    }
+
+    return arr
+  }, [cathet, topInfo.sonTypeName])
+
+  const tableLastBtn = useMemo(() => {
+    const arr: any[] = []
+
+    if (topInfo.sonTypeName !== '3') {
+      arr.push({
+        title: `${topInfo.sonTypeName === '1' ? '退还人' : '退回者'}`,
+        width: 150,
+        render: (item: C1GoodType) => {
+          const keyTxt = topInfo.sonTypeName === '1' ? 'txt1' : 'txt3'
+
+          return (
+            <TextArea
+              readOnly={['3', '4'].includes(key)}
+              placeholder={
+                ['3', '4'].includes(key) && !item[keyTxt] ? '(空)' : '请输入内容,不超过200字'
+              }
+              maxLength={200}
+              value={item[keyTxt]}
+              onChange={e =>
+                setSnaps(
+                  snaps.map(v => ({
+                    ...v,
+                    [keyTxt]: v.id === item.id ? e.target.value.trim() : v[keyTxt]
+                  }))
+                )
+              }
+            />
+          )
+        }
+      })
+      arr.push({
+        title: `${topInfo.sonTypeName === '1' ? '点收人' : '库保员'}`,
+        width: 150,
+        render: (item: C1GoodType) => {
+          const keyTxt = topInfo.sonTypeName === '1' ? 'txt2' : 'txt4'
+          return (
+            <TextArea
+              readOnly={['3', '4'].includes(key)}
+              placeholder={
+                ['3', '4'].includes(key) && !item[keyTxt] ? '(空)' : '请输入内容,不超过200字'
+              }
+              maxLength={200}
+              value={item[keyTxt]}
+              onChange={e =>
+                setSnaps(
+                  snaps.map(v => ({
+                    ...v,
+                    [keyTxt]: v.id === item.id ? e.target.value.trim() : v[keyTxt]
+                  }))
+                )
+              }
+            />
+          )
+        }
+      })
+      arr.push({
+        title: `${topInfo.sonTypeName === '1' ? '退库时间' : '退库日期'}`,
+        width: 130,
+        render: (item: C1GoodType) => (
+          <DatePicker
+            placeholder={['3', '4'].includes(key) ? '(空)' : '请选择'}
+            disabled={['3', '4'].includes(key)}
+            allowClear={true}
+            value={item.date ? dayjs(item.date) : null}
+            onChange={e =>
+              setSnaps(
+                snaps.map(v => ({
+                  ...v,
+                  date: v.id === item.id ? (e ? dayjs(e).format('YYYY-MM-DD') : '') : v.date
+                }))
+              )
+            }
+          />
+        )
+      })
+    }
+
+    arr.push({
+      title: '备注',
+      width: 150,
+      render: (item: C1GoodType) => (
+        <TextArea
+          readOnly={['3', '4'].includes(key)}
+          placeholder={
+            ['3', '4'].includes(key) && !item.beiZhu ? '(空)' : '请输入内容,不超过200字'
+          }
+          maxLength={200}
+          value={item.beiZhu}
+          onChange={e =>
+            setSnaps(
+              snaps.map(v => ({
+                ...v,
+                beiZhu: v.id === item.id ? e.target.value.trim() : v.beiZhu
+              }))
+            )
+          }
+        />
+      )
+    })
+    arr.push({
+      title: '操作',
+      render: (item: C1GoodType) => {
+        return (
+          <>
+            <Button size='small' type='text' onClick={() => openGoodsInfoFu(item.id)}>
+              查看
+            </Button>
+            {['3', '4'].includes(key) ? null : (
+              <MyPopconfirm
+                txtK='删除'
+                onConfirm={() => {
+                  if (item.id2 && !delSnapIdsRef.current.includes(item.id2))
+                    delSnapIdsRef.current.push(item.id2)
+                  setSnaps(snaps.filter(v => v.id !== item.id))
+                }}
+              />
+            )}
+          </>
+        )
+      }
+    })
+
+    return arr
+  }, [key, snaps, topInfo.sonTypeName])
+
+  // 点击添加按钮
+  const [nowSta, setNowSta] = useState({ key: '', id: '' })
+
+  // 查看的按钮创建-提交-撤回
+  const lookBtnFu = useCallback(
+    async (val: '创建' | '提交' | '撤回') => {
+      if (val !== '撤回') {
+        if (snaps.length === 0) return MessageFu.warning('请添加藏品')
+      }
+      const obj = {
+        ...topInfo,
+        goodsIds: snaps.map(v => v.id).join(','),
+        delSnapIds: delSnapIdsRef.current.length ? delSnapIdsRef.current : '',
+        snaps: snaps.map(v => ({
+          goodsId: v.id,
+          id: v.id2 ? v.id2 : null,
+          orderId: topInfo.id,
+          snap: JSON.stringify(v)
+        }))
+      }
+
+      // console.log(123, obj.snaps)
+
+      // if (1 + 1 === 2) return
+
+      const res =
+        val === '创建'
+          ? await D6_APIsaveCreate(obj)
+          : val === '提交'
+          ? await D6_APIsaveApply(obj)
+          : await D6_APIrevocation(id)
+
+      if (res.code === 0) {
+        if (sollrDom.current) sollrDom.current.scrollTop = 0
+        MessageFu.success(val + '成功')
+        getInfoFu()
+      }
+    },
+    [getInfoFu, id, snaps, topInfo]
+  )
+
+  // 查看模式点击删除
+  const delFu = useCallback(async () => {
+    const res = await D6_APIdel(id)
+    if (res.code === 0) {
+      MessageFu.success('删除成功')
+      history.push('/putsStor')
+    }
+  }, [id])
+
+  // 查看模式点击审批 编辑
+  const lookJumpFu = useCallback(
+    (val: '审批' | '编辑') => {
+      history.push(`/putsStor_edit/${val === '审批' ? 3 : 2}/${id}`)
+      MessageFu.success(`已跳转至${val}页面`)
+    },
+    [id]
+  )
+
+  // 查看模式下的按钮
+  const lookBtn = useMemo(() => {
+    return (
+      <>
+        {btnFlagFu2(topInfo)['创建'] ? (
+          <Button type='primary' onClick={() => lookBtnFu('创建')}>
+            创建
+          </Button>
+        ) : null}
+        {btnFlagFu2(topInfo)['提交'] ? (
+          <Button type='primary' onClick={() => lookBtnFu('提交')}>
+            提交
+          </Button>
+        ) : null}
+
+        {btnFlagFu2(topInfo)['撤回'] ? (
+          <MyPopconfirm
+            txtK='撤回'
+            onConfirm={() => lookBtnFu('撤回')}
+            Dom={
+              <Button type='primary' danger>
+                撤回
+              </Button>
+            }
+          />
+        ) : null}
+
+        {btnFlagFu2(topInfo)['审批'] ? (
+          <Button type='primary' onClick={() => lookJumpFu('审批')}>
+            审批
+          </Button>
+        ) : null}
+        {btnFlagFu2(topInfo)['编辑'] ? (
+          <Button type='primary' onClick={() => lookJumpFu('编辑')}>
+            编辑
+          </Button>
+        ) : null}
+
+        {btnFlagFu2(topInfo)['重新提交'] ? (
+          <Button type='primary' onClick={() => lookBtnFu('提交')}>
+            重新提交
+          </Button>
+        ) : null}
+
+        {EXbtnFu(topInfo)}
+
+        {btnFlagFu2(topInfo)['删除'] ? (
+          <MyPopconfirm
+            txtK='删除'
+            onConfirm={() => delFu()}
+            Dom={
+              <Button type='primary' danger>
+                删除
+              </Button>
+            }
+          />
+        ) : null}
+
+        <Button onClick={() => history.push('/putsStor')}>返回</Button>
+      </>
+    )
+  }, [delFu, lookBtnFu, lookJumpFu, topInfo])
+
+  // 申请记录
+  const [auditsShow, setAuditsShow] = useState(false)
+
+  // 变更分库缩写 清空 藏品清单
+  const [isModalOpen, setIsModalOpen] = useState(0)
+
+  // 批量填写
+  const [batch, setBatch] = useState(false)
+
   return (
   return (
     <div className={styles.D6edit}>
     <div className={styles.D6edit}>
-      <h1>D6edit</h1>
+      <div className='pageTitle'>藏品出库-{pageTitTxt}</div>
+
+      <div className='D6main' ref={sollrDom}>
+        {['3'].includes(key) ? (
+          <X3auditInfo
+            dirCode='D6putsStor'
+            myUrl='cms/goodsFile/upload'
+            auditSta={auditSta}
+            auditStaFu={val => setAuDitSta(val)}
+            ref={ZAuditRef}
+          />
+        ) : null}
+
+        {/* 表单字段、附件等 */}
+        <div className='D6Tit'>
+          申请信息
+          {key === '1' ? null : (
+            <Button type='dashed'>{Reflect.get(statusObj, topInfo.status)}</Button>
+          )}
+        </div>
+
+        <div className='D6rowAll'>
+          <div className='D6row'>
+            <div className='D6rowll'>
+              <span> * </span>提退类型:
+            </div>
+            <div className='D6rowrr'>
+              <Radio.Group
+                value={topInfo.sonTypeName}
+                disabled={['3', '4'].includes(key)}
+                onChange={e => {
+                  setTopInfo({
+                    ...topInfo,
+                    sonTypeName: e.target.value
+                  })
+                }}
+                options={[
+                  { value: '1', label: '分库藏品提退' },
+                  { value: '2', label: '藏品馆内提退' },
+                  { value: '3', label: '借用藏品点交' }
+                ]}
+              />
+            </div>
+          </div>
+
+          {['1', '2'].includes(topInfo.sonTypeName) ? (
+            <div className='D6row'>
+              <div className='D6rowll'>
+                <span> * </span>提退单编号:
+              </div>
+              <div className='D6rowrr'>
+                <Input
+                  value={topInfo.num}
+                  onChange={e => setTopInfo({ ...topInfo, num: e.target.value.trim() })}
+                  readOnly={['3', '4'].includes(key)}
+                  placeholder='请输入内容'
+                  maxLength={30}
+                  showCount
+                />
+              </div>
+            </div>
+          ) : null}
+
+          {topInfo.sonTypeName === '3' ? (
+            <div className='D6row'>
+              <div className='D6rowll'>
+                <span> * </span>借出单位:
+              </div>
+              <div className='D6rowrr'>
+                <Input
+                  value={topInfo.borrowInUnit}
+                  onChange={e => setTopInfo({ ...topInfo, borrowInUnit: e.target.value.trim() })}
+                  readOnly={['3', '4'].includes(key)}
+                  placeholder='请输入内容'
+                  maxLength={30}
+                  showCount
+                />
+              </div>
+            </div>
+          ) : null}
+
+          <div className='D6row'>
+            <div className='D6rowll'>
+              <span> * </span>
+              {topInfo.sonTypeName === '1'
+                ? '提用单位(部门)'
+                : topInfo.sonTypeName === '1'
+                ? '提用部门'
+                : '借入单位'}
+              :
+            </div>
+            <div className='D6rowrr'>
+              <Input
+                value={topInfo.sonUnit}
+                onChange={e => setTopInfo({ ...topInfo, sonUnit: e.target.value.trim() })}
+                readOnly={['3', '4'].includes(key)}
+                placeholder='请输入内容'
+                maxLength={30}
+                showCount
+              />
+            </div>
+          </div>
+
+          <div className='D6row'>
+            <div className='D6rowll'>
+              <span> * </span>
+              {topInfo.sonTypeName === '3' ? '借用日期' : '提用日期'}:
+            </div>
+            <div className='D6rowrr'>
+              <DatePicker
+                disabled={['3', '4'].includes(key)}
+                allowClear={false}
+                value={topInfo.date ? dayjs(topInfo.date) : null}
+                onChange={e => timeChange(e, 'date')}
+              />
+            </div>
+          </div>
+
+          {['1', '2'].includes(topInfo.sonTypeName) ? (
+            <div className='D6row'>
+              <div className='D6rowll'>
+                <span> * </span>
+                {topInfo.sonTypeName === '2' ? '提用原因' : '提用目的'}:
+              </div>
+              <div className='D6rowrr'>
+                <Input
+                  value={topInfo.effect}
+                  onChange={e => setTopInfo({ ...topInfo, effect: e.target.value.trim() })}
+                  readOnly={['3', '4'].includes(key)}
+                  placeholder='请输入内容'
+                  maxLength={30}
+                  showCount
+                />
+              </div>
+            </div>
+          ) : (
+            <>
+              <div className='D6row'>
+                <div className='D6rowll'>
+                  <span> * </span>
+                  归还日期:
+                </div>
+                <div className='D6rowrr'>
+                  <DatePicker
+                    disabled={['3', '4'].includes(key)}
+                    allowClear={false}
+                    value={topInfo.returnDate ? dayjs(topInfo.returnDate) : null}
+                    onChange={e => timeChange(e, 'returnDate')}
+                  />
+                </div>
+              </div>
+              <div className='D6row'>
+                <div className='D6rowll'>
+                  <span> * </span>
+                  接收单位:
+                </div>
+                <div className='D6rowrr'>
+                  <Input
+                    value={topInfo.receiveUnit}
+                    onChange={e => setTopInfo({ ...topInfo, receiveUnit: e.target.value.trim() })}
+                    readOnly={['3', '4'].includes(key)}
+                    placeholder='请输入内容'
+                    maxLength={30}
+                    showCount
+                  />
+                </div>
+              </div>
+              <div className='D6row'>
+                <div className='D6rowll'>
+                  <span> * </span>
+                  归还单位:
+                </div>
+                <div className='D6rowrr'>
+                  <Input
+                    value={topInfo.returnUnit}
+                    onChange={e => setTopInfo({ ...topInfo, returnUnit: e.target.value.trim() })}
+                    readOnly={['3', '4'].includes(key)}
+                    placeholder='请输入内容'
+                    maxLength={30}
+                    showCount
+                  />
+                </div>
+              </div>
+            </>
+          )}
+
+          <div className='D6row'>
+            <div className='D6rowll'>
+              <span> * </span>分库缩写:
+            </div>
+            <div className='D6rowrr'>
+              <Select
+                disabled={['3', '4'].includes(key)}
+                placeholder='请搜索选择'
+                showSearch
+                filterOption={(input, option) => {
+                  const txt = option!.label
+                  return txt.toLowerCase().includes(input.toLowerCase())
+                }}
+                options={storageIdArr.map(v => ({ label: v.num + ' - ' + v.name, value: v.id }))}
+                // fieldNames={{ label: 'num', value: 'num' }}
+                allowClear={false}
+                value={topInfo.storageId || null}
+                onChange={e => {
+                  if (topInfo.storageId && topInfo.storageId !== e && snaps.length) {
+                    setIsModalOpen(e)
+                  } else setTopInfo({ ...topInfo, storageId: e ? e : null })
+                }}
+              />
+            </div>
+          </div>
+        </div>
+
+        {/* 藏品清单 */}
+        <div className='D6googsBox'>
+          <div className='D6Tit2'>
+            <div className='D6Tit2ll'>藏品清单</div>
+            <div className='D6Tit2rr'>
+              {['3', '4'].includes(key) ? null : (
+                <>
+                  {['1', '2'].includes(topInfo.sonTypeName) ? (
+                    <>
+                      <Button
+                        type='primary'
+                        disabled={snaps.length === 0}
+                        onClick={() => setBatch(true)}
+                      >
+                        批量填写
+                      </Button>
+                      &emsp;
+                    </>
+                  ) : null}
+
+                  <Button
+                    type='primary'
+                    onClick={() => {
+                      if (!topInfo.storageId) return MessageFu.warning('请先选择分库缩写')
+                      setNowSta({
+                        key: '藏品入库',
+                        id: 'cms/orderOut/goods/getList'
+                      })
+                    }}
+                  >
+                    新增
+                  </Button>
+                </>
+              )}
+            </div>
+          </div>
+
+          {/* 表格 */}
+          <MyTable
+            list={snaps}
+            columnsTemp={D6tableCgoods(topInfo.sonTypeName as '1')}
+            startBtn={startBtn}
+            lastBtn={tableLastBtn}
+            pagingInfo={false}
+          />
+        </div>
+
+        {/* 申请流程 */}
+        {auditsShow ? (
+          <ZflowTable tableArr={topInfo.audits || []} closeFu={() => setAuditsShow(false)} />
+        ) : null}
+
+        {/* 底部按钮 */}
+        <div className='D6btn'>
+          {['3', '4'].includes(key) && topInfo.audits && topInfo.audits.length ? (
+            <Button type='primary' onClick={() => setAuditsShow(true)}>
+              申请记录
+            </Button>
+          ) : null}
+
+          {key === '4' ? (
+            lookBtn
+          ) : (
+            <>
+              {key === '3' ? (
+                <Button type='primary' onClick={() => btnClickFu('审批')}>
+                  审批
+                </Button>
+              ) : (
+                <Button type='primary' onClick={() => btnClickFu(key === '1' ? '创建' : '保存')}>
+                  {key === '1' ? '创建' : '保存'}
+                </Button>
+              )}
+
+              {key === '1' ? (
+                <Button type='primary' onClick={() => btnClickFu('草稿')}>
+                  存草稿
+                </Button>
+              ) : null}
+
+              <MyPopconfirm txtK='取消' onConfirm={() => history.push('/putsStor')} />
+            </>
+          )}
+        </div>
+
+        {/* 附件归档 */}
+        {topInfo.status === 4 ? (
+          <ZupFileTable
+            listTemp={topInfo.filing || []}
+            dirCode='D6putsStor'
+            myUrl='cms/orderOut/upload'
+            fromData={{ moduleId: topInfo.id }}
+          />
+        ) : null}
+      </div>
+
+      {/* 打开侧边栏 */}
+      <Y1cathet sId={cathet} closeFu={() => setCathet(0)} />
+
+      {nowSta.id ? (
+        <ZGaddNow
+          canObj={{ storageId: topInfo.storageId }}
+          nowSta={nowSta}
+          closeFu={() => setNowSta({ key: '', id: '' })}
+          dataResFu={data => {
+            const dataTemp = [...data]
+            dataTemp.forEach(v => {
+              // id2表示的是自己这条数据的id id才是goodsId
+              const obj = snapsID2ref.current.find(c => c.goodsId === v.id)
+
+              if (obj) v.id2 = obj.id
+            })
+            setSnaps(dataTemp)
+          }}
+          oldCheckArr={snaps}
+        />
+      ) : null}
+
+      {/* 分库缩写改变的时候校验一下 */}
+      <Modal
+        wrapClassName={styles.D6editMo}
+        title='变更分库后,将清空当前的藏品清单'
+        open={!!isModalOpen}
+        footer={[]}
+      >
+        <div className='D6editMoBtn'>
+          <Button
+            type='primary'
+            onClick={() => {
+              setTopInfo({ ...topInfo, storageId: isModalOpen })
+
+              snaps.forEach(v => {
+                if (!delSnapIdsRef.current.includes(v.id)) delSnapIdsRef.current.push(v.id)
+              })
+              setSnaps([])
+              setIsModalOpen(0)
+            }}
+          >
+            继续
+          </Button>
+          &emsp;
+          <Button onClick={() => setIsModalOpen(0)}>取消</Button>
+        </div>
+      </Modal>
+
+      {/* 批量填写 */}
+      {batch ? (
+        <D6batchInput
+          type={topInfo.sonTypeName as '1'}
+          closeFu={() => setBatch(false)}
+          succFu={arr => {
+            setSnaps(
+              snaps.map(v => {
+                // 动态合并所有 arr 中的键值对
+                return {
+                  ...v,
+                  ...Object.fromEntries(arr.map(item => [item.key, item.value]))
+                }
+              })
+            )
+          }}
+        />
+      ) : null}
     </div>
     </div>
   )
   )
 }
 }

+ 3 - 2
src/pages/D_storeManage/D6putsStor/index.tsx

@@ -241,7 +241,8 @@ function D6putsStor() {
           <div>
           <div>
             <span>提用单位(部门):</span>
             <span>提用单位(部门):</span>
             <Input
             <Input
-              placeholder='全部'
+              style={{ width: 186 }}
+              placeholder='请输入提用单位(部门)'
               maxLength={30}
               maxLength={30}
               value={formData.sonUnit}
               value={formData.sonUnit}
               onChange={e => txtChangeFu(e.target.value, 'sonUnit')}
               onChange={e => txtChangeFu(e.target.value, 'sonUnit')}
@@ -253,7 +254,7 @@ function D6putsStor() {
             批量导出
             批量导出
           </Button>
           </Button>
           &emsp;
           &emsp;
-          <Button type='primary' onClick={() => history.push('//putsStor_edit/1/null')}>
+          <Button type='primary' onClick={() => history.push('/putsStor_edit/1/null')}>
             新增
             新增
           </Button>
           </Button>
         </div>
         </div>

+ 1 - 1
src/pages/D_storeManage/D8cancel/D8edit/index.tsx

@@ -232,7 +232,7 @@ function D8edit() {
               }
               }
               maxLength={200}
               maxLength={200}
               value={item[v.key as 'txt1']}
               value={item[v.key as 'txt1']}
-              onChange={e => tableInputChange(item.id, e.target.value, v.key as 'txt1')}
+              onChange={e => tableInputChange(item.id, e.target.value.trim(), v.key as 'txt1')}
             />
             />
           )
           )
         }
         }

+ 1 - 1
src/pages/E_goodsStorage/E4repair/E4edit/index.tsx

@@ -264,7 +264,7 @@ function E4edit() {
               }
               }
               maxLength={200}
               maxLength={200}
               value={item[v.key as 'txt1']}
               value={item[v.key as 'txt1']}
-              onChange={e => tableInputChange(item.id, e.target.value, v.key as 'txt1')}
+              onChange={e => tableInputChange(item.id, e.target.value.trim(), v.key as 'txt1')}
             />
             />
           )
           )
         }
         }

+ 37 - 11
src/utils/tableData.ts

@@ -245,17 +245,6 @@ D6typeArr.forEach(v => {
   businessTypeObj[v.value] = v.label
   businessTypeObj[v.value] = v.label
 })
 })
 
 
-export const D6tableC = [
-  ['txt', '提用日期', 'date'],
-  ['txtChange', '提退类型', 'sonTypeName', businessTypeObj],
-  ['txt', '提退单编号', 'num'],
-  ['txt', '提用单位(部门)', 'sonUnit'],
-  ['txt', '分库缩写', 'sonNum'],
-  ['txt', '发起人', 'creatorName'],
-  ['txt', '发起日期', 'createTime'],
-  ['txtChange', '申请状态', 'status', statusObj]
-]
-
 // 旧版的入库里面的表单 -太多地方用了 不改了
 // 旧版的入库里面的表单 -太多地方用了 不改了
 export const D4goodsTableC = [
 export const D4goodsTableC = [
   ['img', '封面图', 'thumb'],
   ['img', '封面图', 'thumb'],
@@ -274,6 +263,43 @@ export const D4tableCgoods = [
   ['txtC', '完残情况', 'dictTorn']
   ['txtC', '完残情况', 'dictTorn']
 ]
 ]
 
 
+export const D6tableC = [
+  ['txt', '提用日期', 'date'],
+  ['txtChange', '提退类型', 'sonTypeName', businessTypeObj],
+  ['txt', '提退单编号', 'num'],
+  ['txt', '提用单位(部门)', 'sonUnit'],
+  ['txt', '分库缩写', 'sonNum'],
+  ['txt', '发起人', 'creatorName'],
+  ['txt', '发起日期', 'createTime'],
+  ['txtChange', '申请状态', 'status', statusObj]
+]
+export const D6tableCgoods = (val: '1' | '2' | '3') => {
+  let arr = [['txt', '名称', 'name']]
+  if (val === '1') {
+    arr = [
+      ...arr,
+      ['txtC', '年代', 'dictAge'],
+      ['txtC', '质地', 'dictTexture3'],
+      ['ping', '计件数量', 'pcs', 'pcsUnit'],
+      ['txt', '级别', 'dictLevel'],
+      ['txtC', '文物现状', 'dictTorn']
+    ]
+  } else if (val === '2') {
+    arr = [...arr, ['ping', '数量/单位', 'pcs', 'pcsUnit'], ['txtC', '完残程度', 'dictTorn']]
+  } else {
+    arr = [
+      ...arr,
+      ['img', '封面图', 'thumb'],
+      ['txtC', '时代', 'dictAge'],
+      ['ping', '数量/单位', 'pcs', 'pcsUnit'],
+      ['txtC', '质地', 'dictTexture3'],
+      ['txtC', '完残情况', 'dictTorn'],
+      ['txt', '级别', 'dictLevel']
+    ]
+  }
+  return arr
+}
+
 export const D8tableC = [
 export const D8tableC = [
   ['txt', '业务单号', 'num'],
   ['txt', '业务单号', 'num'],
   ['txt', '发起部门', 'deptName'],
   ['txt', '发起部门', 'deptName'],