shaogen1995 před 3 měsíci
rodič
revize
2476dd703b

+ 1 - 1
src/pages/E_goodsStorage/E2damaged/index.tsx

@@ -17,7 +17,7 @@ import { selectObj } from '@/utils/select'
 import MyTable from '@/components/MyTable'
 const { RangePicker } = DatePicker
 
-const E2baseFormData: TypeE2Form = {
+export const E2baseFormData: TypeE2Form = {
   pageSize: 10,
   pageNum: 1,
   num: '',

+ 130 - 0
src/pages/E_goodsStorage/E3actuality/E3edit/index.module.scss

@@ -0,0 +1,130 @@
+.E3edit {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 15px 24px 0px;
+  :global {
+    .E2Tit {
+      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;
+      }
+    }
+    .E2Tit2 {
+      margin-top: 24px;
+      display: flex;
+      justify-content: space-between;
+      padding-bottom: 10px;
+      border-bottom: 1px solid #ccc;
+      margin-bottom: 20px;
+      .E2Tit2ll {
+        font-size: 18px;
+        font-weight: 700;
+        padding-left: 18px;
+        margin-bottom: 17px;
+        color: var(--themeColor);
+      }
+      .E2Tit2rr {
+        position: relative;
+        z-index: 2;
+        .ant-btn {
+          margin-left: 15px;
+        }
+      }
+    }
+
+    .E2main {
+      width: 100%;
+      height: calc(100% - 70px);
+      overflow-y: auto;
+      padding-bottom: 40px;
+
+      .E2rowAll {
+        display: flex;
+        justify-content: space-between;
+        align-items: self-start;
+        font-size: 16px;
+        flex-wrap: wrap;
+        .E2row {
+          width: 48%;
+          display: flex;
+          align-items: center;
+          margin-bottom: 20px;
+          .E2rowll {
+            width: 110px;
+            text-align: right;
+            font-weight: 700;
+            & > span {
+              color: #ff4e2f;
+            }
+          }
+          .E2rowrr {
+            width: calc(100% - 110px);
+            .ant-input-affix-wrapper {
+              width: 300px;
+            }
+            .ant-select {
+              width: 300px;
+            }
+          }
+        }
+        .E2row2 {
+          align-items: self-start;
+          .E2rowll {
+            position: relative;
+            top: 3px;
+          }
+        }
+        .E2row3 {
+          position: relative;
+          top: 4px;
+        }
+
+        .E2rowFull {
+          width: 100%;
+          margin-top: -20px;
+          align-items: self-start;
+          margin-bottom: 0;
+          .E2rowll {
+            position: relative;
+            top: 3px;
+          }
+        }
+      }
+      // 藏品清单
+      .E2googsBox {
+        padding-right: 20px;
+        .D1GtNum {
+          cursor: pointer;
+          text-decoration: underline;
+          // &:hover {
+          //   color: var(--themeColor);
+          // }
+        }
+
+        .D1GtNumAc {
+          color: var(--themeColor);
+        }
+      }
+    }
+
+    .E2btn {
+      position: absolute;
+      bottom: 20px;
+      left: 134px;
+      .ant-btn {
+        margin-right: 20px;
+      }
+    }
+
+    .ant-table-cell {
+      padding: 8px !important;
+    }
+  }
+}

+ 548 - 0
src/pages/E_goodsStorage/E3actuality/E3edit/index.tsx

@@ -0,0 +1,548 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { useParams } from 'react-router-dom'
+import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
+import {
+  E3_APIcreate,
+  E3_APIdel,
+  E3_APIgetInfo,
+  E3_APIrevocation,
+  E3_APIsaveApply,
+  E3_APIsaveAudit,
+  E3_APIsaveCreate,
+  E3_APIsaveDraft
+} from '@/store/action/E3actuality'
+import { pageTitTxtObj } from '@/pages/D_storeManage/D4impStor/D4edit'
+import dayjs from 'dayjs'
+import { MessageFu } from '@/utils/message'
+import history, { btnFlagFu2, openGoodsInfoFu } from '@/utils/history'
+import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
+import classNames from 'classnames'
+import { Button, DatePicker, Input, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { EXbtnFu } from '@/utils/EXBtn'
+import X3auditInfo from '@/pages/X_stock/X3auditInfo'
+import { D4goodsTableC, statusObj } from '@/utils/tableData'
+import { B3aForm1 } from '@/pages/B_enterTibet/B3_4page/B3edit/data'
+import Z3upFiles from '@/components/Z3upFiles'
+import ZRichTexts from '@/components/ZRichTexts'
+import MyTable from '@/components/MyTable'
+import B3flowTable from '@/pages/B_enterTibet/B3flowTable'
+import Y1cathet from '@/pages/Y_goodsDetails/Y1cathet'
+import B3GaddNow from '@/pages/B_enterTibet/B3goodsTable/B3GaddNow'
+
+function E3edit() {
+  const { key, id } = useParams<any>()
+  // key:1 新增 2编辑 3审批 4查看
+
+  // 滚到顶部
+  const sollrDom = useRef<HTMLDivElement>(null)
+
+  // 顶部数据
+  const [topInfo, setTopInfo] = useState({} as FourTableType)
+
+  // 创建订单
+  const creatFu = useCallback(async () => {
+    const res = await E3_APIcreate()
+    if (res.code === 0) {
+      setTopInfo(res.data)
+    }
+  }, [])
+
+  // 获取详情
+  const getInfoFu = useCallback(async () => {
+    const res = await E3_APIgetInfo(id)
+    if (res.code === 0) {
+      setTopInfo(res.data)
+
+      // 设置富文本
+      ZRichTextRef.current?.ritxtShowFu(JSON.parse(res.data.rtf || '{}'))
+    }
+  }, [id])
+
+  useEffect(() => {
+    if (key === '1') creatFu()
+    else getInfoFu()
+
+    if (sollrDom.current) sollrDom.current.scrollTop = 0
+  }, [creatFu, getInfoFu, key])
+
+  // 上传附件的ref
+  const filesRef = useRef<any>(null)
+  // const filesRes = filesRef.current.filesIdRes();
+
+  // 富文本的ref
+  const ZRichTextRef = useRef<any>(null)
+
+  // 审批意见的ref
+  const ZAuditRef = useRef<any>(null)
+
+  const pageTitTxt = useMemo(() => {
+    return Reflect.get(pageTitTxtObj, key)
+  }, [key])
+
+  const timeChange = useCallback(
+    (e: any) => {
+      setTopInfo({ ...topInfo, date: dayjs(e).format('YYYY-MM-DD') })
+    },
+    [topInfo]
+  )
+  // 审批的sta
+  const [auditSta, setAuDitSta] = useState('')
+
+  // 新增的底部按钮点击
+  const btnClickFu = useCallback(
+    async (val: '草稿' | '创建' | '保存' | '审批') => {
+      if (!topInfo.name) return MessageFu.warning('申请名称不能为空')
+
+      if (val !== '草稿') {
+        if (!topInfo.goods || (topInfo.goods && topInfo.goods.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 = await E3_APIsaveAudit({
+          orderId: topInfo.id,
+          rtfOpinion: rtf2,
+          status: auditSta === '同意' ? 1 : 2
+        })
+
+        if (res.code === 0) {
+          MessageFu.success('审批成功')
+          // 跳详情页
+          history.push(`/actuality_edit/4/${topInfo.id}`)
+        }
+      } else {
+        const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
+        // console.log('申请信息富文本', JSON.stringify(rtf1.val || ''))
+
+        // 上传附件
+        const filesRes = filesRef.current.filesIdRes()
+
+        const obj = {
+          ...topInfo,
+          fileIds: filesRes.join(','),
+          rtf: JSON.stringify(rtf1.val || ''),
+          goodsIds: (topInfo.goods || []).map(v => v.id).join(',')
+        }
+        // console.log(123, obj)
+
+        // if (1 + 1 === 2) return
+
+        if (val === '草稿') {
+          // 存草稿 当前页保存 不跳转
+          const res = await E3_APIsaveDraft(obj)
+          if (res.code === 0) {
+            MessageFu.success('草稿保存成功')
+          }
+        } else {
+          const res = val === '创建' ? await E3_APIsaveCreate(obj) : await E3_APIsaveApply(obj)
+          if (res.code === 0) {
+            MessageFu.success(`${val}成功`)
+            // 跳到详情页
+            history.push(`/actuality_edit/4/${topInfo.id}`)
+          }
+        }
+      }
+    },
+    [auditSta, topInfo]
+  )
+
+  // 打开侧边栏
+  const [cathet, setCathet] = useState(0)
+
+  const startBtn = useMemo(() => {
+    return [
+      {
+        title: '藏品编号',
+        render: (item: C1GoodType) => {
+          return (
+            <span
+              onClick={() => setCathet(item.id)}
+              className={classNames('D1GtNum', item.id === cathet ? 'D1GtNumAc' : '')}
+            >
+              {item.num}
+            </span>
+          )
+        }
+      }
+    ]
+  }, [cathet])
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '存放位置',
+        width: 200,
+        render: (item: C1GoodType) => {
+          return item.siteStr ? item.siteStr.replaceAll(',', ' / ') : '(空)'
+        }
+      },
+      {
+        title: '操作',
+        render: (item: C1GoodType) => {
+          return (
+            <>
+              <Button size='small' type='text' onClick={() => openGoodsInfoFu(item.id)}>
+                查看
+              </Button>
+              {['3', '4'].includes(key) ? null : (
+                <MyPopconfirm
+                  txtK='删除'
+                  onConfirm={() =>
+                    setTopInfo({
+                      ...topInfo,
+                      goods: topInfo.goods.filter(v => v.id !== item.id)
+                    })
+                  }
+                />
+              )}
+            </>
+          )
+        }
+      }
+    ]
+  }, [key, topInfo])
+
+  // 新增和从已关注的藏品中添加
+  const [nowSta, setNowSta] = useState({ key: '', id: '' })
+
+  // 查看的按钮创建-提交-撤回
+  const lookBtnFu = useCallback(
+    async (val: '创建' | '提交' | '撤回') => {
+      if (val !== '撤回') {
+        if (!topInfo.goods || (topInfo.goods && topInfo.goods.length === 0)) {
+          return MessageFu.warning('请添加藏品')
+        }
+      }
+
+      const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
+      // console.log('申请信息富文本', JSON.stringify(rtf1.val || ''))
+
+      // 上传附件
+      const filesRes = filesRef.current.filesIdRes()
+      const obj = {
+        ...topInfo,
+        fileIds: filesRes.join(','),
+        rtf: JSON.stringify(rtf1.val || ''),
+        goodsIds: (topInfo.goods || []).map(v => v.id).join(','),
+        goods: topInfo.goods.map(v => ({
+          goodsId: v.id,
+          siteId: v.siteId
+        }))
+      }
+
+      const res =
+        val === '创建'
+          ? await E3_APIsaveCreate(obj)
+          : val === '提交'
+          ? await E3_APIsaveApply(obj)
+          : await E3_APIrevocation(id)
+
+      if (res.code === 0) {
+        if (sollrDom.current) sollrDom.current.scrollTop = 0
+        MessageFu.success(val + '成功')
+        getInfoFu()
+      }
+    },
+    [getInfoFu, id, topInfo]
+  )
+
+  // 查看模式点击删除
+  const delFu = useCallback(async () => {
+    const res = await E3_APIdel(id)
+    if (res.code === 0) {
+      MessageFu.success('删除成功')
+      history.push('/actuality')
+    }
+  }, [id])
+
+  // 查看模式点击审批 编辑
+  const lookJumpFu = useCallback(
+    (val: '审批' | '编辑') => {
+      history.push(`/actuality_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('/actuality')}>返回</Button>
+      </>
+    )
+  }, [delFu, lookBtnFu, lookJumpFu, topInfo])
+
+  return (
+    <div className={styles.E3edit}>
+      <div className='pageTitle'>现状登记-{pageTitTxt}</div>
+      <div className='E2main' ref={sollrDom}>
+        {['3'].includes(key) ? (
+          <X3auditInfo
+            dirCode='E3actuality'
+            myUrl='cms/orderPreserveCurrent/upload'
+            auditSta={auditSta}
+            auditStaFu={val => setAuDitSta(val)}
+            ref={ZAuditRef}
+          />
+        ) : null}
+
+        {/* 表单字段、附件等 */}
+        <div className='E2Tit'>
+          申请信息
+          {key === '1' ? null : (
+            <Button type='dashed'>{Reflect.get(statusObj, topInfo.status)}</Button>
+          )}
+        </div>
+        <div className='E2rowAll'>
+          <div className='E2row'>
+            <div className='E2rowll'>
+              <span> * </span>申请名称:
+            </div>
+            <div className='E2rowrr'>
+              <Input
+                value={topInfo.name}
+                onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
+                readOnly={['3', '4'].includes(key)}
+                placeholder='请输入内容'
+                maxLength={30}
+                showCount
+              />
+            </div>
+          </div>
+
+          {B3aForm1.map(v => (
+            <div className='E2row' key={v.name}>
+              <div className='E2rowll'>{v.name}:</div>
+              <div className='E2rowrr'>
+                {topInfo[v.key as 'name']}
+                {['3', '4'].includes(key) && v.name === '发起人'
+                  ? ' - ' + topInfo.createTime || ''
+                  : ''}
+              </div>
+            </div>
+          ))}
+
+          <div className='E2row'>
+            <div className='E2rowll'>
+              <span> * </span>业务日期:
+            </div>
+            <div className='E2rowrr'>
+              <DatePicker
+                disabled={['3', '4'].includes(key)}
+                allowClear={false}
+                value={dayjs(topInfo.date)}
+                onChange={timeChange}
+              />
+            </div>
+          </div>
+
+          <div className='E2row'>
+            <div className='E2rowll'>相关盘点:</div>
+            {/* 待完善 */}
+            <div className='E2rowrr'>
+              <Select
+                disabled={['3', '4'].includes(key)}
+                placeholder={['3', '4'].includes(key) ? '(空)' : '请搜索编码'}
+                showSearch
+                options={[]}
+                fieldNames={{ label: 'num', value: 'num' }}
+                allowClear={true}
+                // value={topInfo.relatedOrderNum || null}
+                // onChange={e => setTopInfo({ ...topInfo, relatedOrderNum: e ? e : '' })}
+              />
+            </div>
+          </div>
+          <div className='E2row'>
+            <div className='E2rowll'>原因事由:</div>
+            <div className='E2rowrr'>
+              <Input
+                value={topInfo.reason}
+                onChange={e => setTopInfo({ ...topInfo, reason: e.target.value })}
+                readOnly={['3', '4'].includes(key)}
+                placeholder='请输入内容'
+                maxLength={30}
+                showCount
+              />
+            </div>
+          </div>
+
+          <div className='E2row E2row2'>
+            <div className='E2rowll'>附件:</div>
+            <div className='E2rowrr'>
+              <Z3upFiles
+                max={10}
+                isLook={['3', '4'].includes(key)}
+                ref={filesRef}
+                fileCheck={false}
+                dirCode='E3actuality'
+                myUrl='cms/orderPreserveCurrent/upload'
+                lookData={topInfo.files || []}
+                size={500}
+                fromData={{ moduleId: topInfo.id }}
+              />
+            </div>
+          </div>
+
+          <div className='E2row E2rowFull'>
+            <div className='E2rowll'>备注:</div>
+            <div className='E2rowrr'>
+              <ZRichTexts
+                check={false}
+                dirCode='E3actuality'
+                myUrl='cms/orderPreserveCurrent/upload'
+                isLook={['3', '4'].includes(key)}
+                ref={ZRichTextRef}
+                isOne={true}
+                upAudioBtnNone={true}
+              />
+            </div>
+          </div>
+        </div>
+
+        {/* 藏品清单 */}
+        <div className='E2googsBox'>
+          <div className='E2Tit2'>
+            <div className='E2Tit2ll'>藏品清单</div>
+            <div className='E2Tit2rr'>
+              {['3', '4'].includes(key) ? null : (
+                <Button
+                  type='primary'
+                  onClick={() =>
+                    setNowSta({
+                      key: 'E2',
+                      id: 'cms/orderPreserveCurrent/goods/getList'
+                    })
+                  }
+                >
+                  新增
+                </Button>
+              )}
+            </div>
+          </div>
+
+          {/* 表格 */}
+          <MyTable
+            list={topInfo.goods || []}
+            columnsTemp={D4goodsTableC}
+            startBtn={startBtn}
+            lastBtn={tableLastBtn}
+            pagingInfo={false}
+          />
+        </div>
+
+        {/* 申请流程 */}
+        {['3', '4'].includes(key) ? <B3flowTable tableArr={topInfo.audits || []} /> : null}
+      </div>
+
+      {/* 底部按钮 */}
+      <div className='E2btn'>
+        {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('/actuality')} />
+          </>
+        )}
+      </div>
+
+      {/* 打开侧边栏 */}
+      <Y1cathet sId={cathet} closeFu={() => setCathet(0)} />
+
+      {nowSta.id ? (
+        <B3GaddNow
+          nowSta={nowSta}
+          closeFu={() => setNowSta({ key: '', id: '' })}
+          dataResFu={data => setTopInfo({ ...topInfo, goods: data })}
+          oldCheckArr={topInfo.goods || []}
+          // 待完善
+          // canObj={{ storageId: topInfo.storageId }}
+        />
+      ) : null}
+    </div>
+  )
+}
+
+const MemoE3edit = React.memo(E3edit)
+
+export default MemoE3edit

+ 31 - 0
src/pages/E_goodsStorage/E3actuality/index.module.scss

@@ -1,4 +1,35 @@
 .E3actuality {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 15px 24px 0;
   :global {
+    .D4top {
+      display: flex;
+      justify-content: space-between;
+      margin-bottom: 15px;
+      .D4topll {
+        display: flex;
+        & > div {
+          position: relative;
+          margin-right: 15px;
+          display: flex;
+          align-items: center;
+          .ant-input {
+            width: 194px;
+          }
+        }
+      }
+      .ant-select-selection-placeholder {
+        color: black;
+      }
+    }
+    .D4top0 {
+      .ant-input {
+        width: 148px !important;
+      }
+    }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
   }
 }

+ 306 - 2
src/pages/E_goodsStorage/E3actuality/index.tsx

@@ -1,10 +1,314 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
+import { Button, DatePicker, Input, Select } from 'antd'
+import { useDispatch, useSelector } from 'react-redux'
+import { E2baseFormData } from '../E2damaged'
+import { E3_APIdel, E3_APIgetList } from '@/store/action/E3actuality'
+import { E2InputKeyType } from '../E2damaged/type'
+import { MessageFu } from '@/utils/message'
+import history, { btnFlagFu } from '@/utils/history'
+import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { RootState } from '@/store'
+import dayjs from 'dayjs'
+import { E2tableC, statusObj } from '@/utils/tableData'
+import ExportJsonExcel from 'js-export-excel'
+import { B3_4inputKeyArr } from '@/pages/B_enterTibet/B3_4page'
+import { selectObj } from '@/utils/select'
+import MyTable from '@/components/MyTable'
+const { RangePicker } = DatePicker
+
 function E3actuality() {
+  const dispatch = useDispatch()
+
+  const [formData, setFormData] = useState(E2baseFormData)
+  const formDataRef = useRef(E2baseFormData)
+  const formDataOldRef = useRef(E2baseFormData)
+
+  useEffect(() => {
+    formDataRef.current = formData
+  }, [formData])
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(0)
+
+  // 点击搜索
+  const clickSearch = useCallback(() => {
+    setFormData({ ...formData, pageNum: 1 })
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [formData])
+
+  // 时间选择器改变
+  const timeChange = useCallback(
+    (date: any, dateString: any) => {
+      let startTime = ''
+      let endTime = ''
+      if (dateString[0] && dateString[1]) {
+        startTime = dateString[0] + ' 00:00:00'
+        endTime = dateString[1] + ' 23:59:59'
+      }
+      setFormData({ ...formData, startTime, endTime })
+    },
+    [formData]
+  )
+
+  // 封装发送请求的函数
+  const getListFu = useCallback(() => {
+    formDataOldRef.current = { ...formDataRef.current }
+    dispatch(E3_APIgetList(formDataRef.current))
+  }, [dispatch])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu, timeKey])
+
+  // 输入框的改变
+  const txtChangeFu = useCallback(
+    (txt: string, key: E2InputKeyType) => {
+      setFormData({
+        ...formData,
+        [key]: txt
+      })
+    },
+    [formData]
+  )
+
+  // 点击重置
+  const resetSelectFu = useCallback(() => {
+    setFormData(E2baseFormData)
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [])
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [formData]
+  )
+
+  // 点击删除
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await E3_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
+  // 点击操作按钮
+  const tableBtnFu = useCallback((id: number, key: string) => {
+    history.push(`/actuality_edit/${key}/${id}`)
+  }, [])
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: FourTableType) => {
+          let obj = btnFlagFu(item)
+          return !Object.values(obj).some(Boolean) ? (
+            '-'
+          ) : (
+            <>
+              {obj['编辑'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '2')}>
+                  编辑
+                </Button>
+              ) : null}
+
+              {obj['审批'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '3')}>
+                  审批
+                </Button>
+              ) : null}
+              {obj['查看'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '4')}>
+                  查看
+                </Button>
+              ) : null}
+
+              {obj['删除'] ? (
+                <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+              ) : null}
+            </>
+          )
+        }
+      }
+    ]
+  }, [delTableFu, tableBtnFu])
+
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.E3actuality.tableInfo)
+
+  // 点击导出
+  const deriveFu = useCallback(async () => {
+    const name = '现状登记' + dayjs(new Date()).format('YYYY-MM-DD HH:mm')
+
+    const res = await E3_APIgetList(
+      {
+        ...formDataOldRef.current,
+        pageNum: 1,
+        pageSize: 99999
+      },
+      true
+    )
+
+    if (res.code === 0) {
+      if (res.data.records.length <= 0) return MessageFu.warning('当前搜索条件没有数据!')
+
+      const option = {
+        fileName: name,
+        datas: [
+          {
+            sheetData: res.data.records.map((v: FourTableType) => ({
+              ...v,
+              status: statusObj[v.status as 1]
+            })),
+            sheetName: name,
+            sheetFilter: [
+              'num',
+              'name',
+              'storageName',
+              'deptName',
+              'creatorName',
+              'createTime',
+              'status',
+              // 待完善
+              'xxxxx'
+            ],
+            sheetHeader: [
+              '业务单号',
+              '申请名称',
+              '关联库房',
+              '发起部门',
+              '发送人',
+              '发起日期',
+              '申请状态',
+              '相关盘点'
+            ],
+            columnWidths: [10, 10, 10, 10, 10, 10, 10]
+          }
+        ]
+      }
+
+      const toExcel = new ExportJsonExcel(option) //new
+      toExcel.saveExcel() //保存
+    }
+  }, [])
+
   return (
     <div className={styles.E3actuality}>
       <div className='pageTitle'>现状登记</div>
-      <p>待开发</p>
+      <div className='D4top D4top0'>
+        <div className='D4topll'>
+          {B3_4inputKeyArr.map(item => (
+            <div key={item.name}>
+              <span>{item.name}:</span>
+              <Input
+                placeholder={`请输入${item.name}`}
+                maxLength={30}
+                value={formData[item.key]}
+                onChange={e => txtChangeFu(e.target.value, item.key)}
+              />
+            </div>
+          ))}
+          <div>
+            <span>库房名称:</span>
+            <Input
+              placeholder={`请输入库房名称`}
+              maxLength={30}
+              value={formData.storageName}
+              onChange={e => txtChangeFu(e.target.value, 'storageName')}
+            />
+          </div>
+        </div>
+        <div className='D4toprr'>
+          <Button type='primary' onClick={deriveFu}>
+            批量导出
+          </Button>
+          &emsp;
+          <Button type='primary' onClick={() => history.push('/actuality_edit/1/null')}>
+            新增
+          </Button>
+        </div>
+      </div>
+      <div className='D4top'>
+        <div className='D4topll'>
+          <div>
+            <span>发起日期范围:</span>
+            <RangePicker
+              value={
+                formData.startTime ? [dayjs(formData.startTime), dayjs(formData.endTime)] : null
+              }
+              onChange={timeChange}
+            />
+          </div>
+
+          <div>
+            <span>申请状态:</span>
+            <Select
+              allowClear={true}
+              placeholder='全部'
+              style={{ width: 150 }}
+              value={formData.status}
+              onChange={e => setFormData({ ...formData, status: e })}
+              options={selectObj['申请状态'].filter(v => v.label !== '待盘点')}
+            />
+          </div>
+
+          <div>
+            <span>选择角色:</span>
+            <Select
+              allowClear={true}
+              style={{ width: 150 }}
+              placeholder='全部'
+              options={selectObj['角色']}
+              // fieldNames={{ value: 'id', label: 'roleName' }}
+              value={formData.userType}
+              onChange={e => setFormData({ ...formData, userType: e })}
+            />
+          </div>
+
+          <div>
+            <span>盘点编码:</span>
+            <Input
+              placeholder={`请输入盘点编码`}
+              maxLength={30}
+              value={formData.checkNum}
+              onChange={e => txtChangeFu(e.target.value, 'checkNum')}
+            />
+          </div>
+        </div>
+        <div className='D4toprr'>
+          <Button type='primary' onClick={clickSearch}>
+            查询
+          </Button>
+          &emsp;<Button onClick={resetSelectFu}>重置</Button>
+        </div>
+      </div>
+
+      {/* 表格 */}
+      <MyTable
+        yHeight={610}
+        list={tableInfo.list}
+        columnsTemp={E2tableC}
+        lastBtn={tableLastBtn}
+        pageNum={formData.pageNum}
+        pageSize={formData.pageSize}
+        total={tableInfo.total}
+        onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+      />
     </div>
   )
 }

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

@@ -403,5 +403,13 @@ export const routerSon: RouterTypeRow[] = [
     name: '残损登记-新增/编辑/审批/查看',
     path: '/damaged_edit/:key/:id',
     Com: React.lazy(() => import('../E_goodsStorage/E2damaged/E2edit'))
+  },
+
+  // ------------现状登记------------------
+  {
+    id: 12,
+    name: '现状登记-新增/编辑/审批/查看',
+    path: '/actuality_edit/:key/:id',
+    Com: React.lazy(() => import('../E_goodsStorage/E3actuality/E3edit'))
   }
 ]

+ 77 - 0
src/store/action/E3actuality.ts

@@ -0,0 +1,77 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+/**
+ * 现状登记 - 获取分页列表
+ */
+export const E3_APIgetList = (data: any, exportFlag?: boolean): any => {
+  if (exportFlag) return http.post('cms/orderPreserveCurrent/page', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/orderPreserveCurrent/page', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+
+        dispatch({ type: 'E3/getList', payload: obj })
+      }
+    }
+  }
+}
+
+/**
+ * 现状登记-删除
+ */
+export const E3_APIdel = (id: number) => {
+  return http.get(`cms/orderPreserveCurrent/remove/${id}`)
+}
+
+/**
+ * 现状登记-创建订单
+ */
+export const E3_APIcreate = () => {
+  return http.get('cms/orderPreserveCurrent/create')
+}
+
+/**
+ * 现状登记-获取详情
+ */
+export const E3_APIgetInfo = (id: number) => {
+  return http.get(`cms/orderPreserveCurrent/detail/${id}`)
+}
+
+/**
+ * 现状登记-存草稿
+ */
+export const E3_APIsaveDraft = (data: any) => {
+  return http.post('cms/orderPreserveCurrent/saveDraft', data)
+}
+
+/**
+ * 现状登记-创建
+ */
+export const E3_APIsaveCreate = (data: any) => {
+  return http.post('cms/orderPreserveCurrent/saveCreate', data)
+}
+
+/**
+ * 现状登记-编辑保存
+ */
+export const E3_APIsaveApply = (data: any) => {
+  return http.post('cms/orderPreserveCurrent/saveApply', data)
+}
+
+/**
+ * 现状登记-审批
+ */
+export const E3_APIsaveAudit = (data: any) => {
+  return http.post('cms/orderPreserveCurrent/audit', data)
+}
+
+/**
+ * 现状登记-撤回订单
+ */
+export const E3_APIrevocation = (id: number) => {
+  return http.get(`cms/orderPreserveCurrent/revocation/${id}`)
+}

+ 28 - 0
src/store/reducer/E3actuality.ts

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

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

@@ -15,6 +15,7 @@ import D2storSet from './D2storSet'
 import D4impStor from './D4impStor'
 import D6putsStor from './D6putsStor'
 import E2damaged from './E2damaged'
+import E3actuality from './E3actuality'
 import Z1dict from './Z1dict'
 import Z2numRule from './Z2numRule'
 import Z3flowSet from './Z3flowSet'
@@ -38,6 +39,7 @@ const rootReducer = combineReducers({
   D4impStor,
   D6putsStor,
   E2damaged,
+  E3actuality,
   Z1dict,
   Z2numRule,
   Z3flowSet,