Ver código fonte

图书审核

shaogen1995 10 meses atrás
pai
commit
e1c1904111

+ 47 - 34
src/pages/A1manage/A1add/index.tsx

@@ -10,6 +10,7 @@ import TextArea from 'antd/es/input/TextArea'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
 import { A2tableType, A2TreeType } from '@/types'
 import { A2tableType, A2TreeType } from '@/types'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import MyPopconfirm from '@/components/MyPopconfirm'
+import { A5_APIgetInfo } from '@/store/action/A5bookAudit'
 
 
 type Props = {
 type Props = {
   editInfo: A1EditInfoType
   editInfo: A1EditInfoType
@@ -18,9 +19,18 @@ type Props = {
   editTableFu: () => void
   editTableFu: () => void
   storageArr: A2TreeType[]
   storageArr: A2TreeType[]
   exhibitTypeArr: A2tableType[]
   exhibitTypeArr: A2tableType[]
+  isAudit?: boolean //从图书审核页面进来
 }
 }
 
 
-function A1add({ editInfo, closeFu, addTableFu, editTableFu, storageArr, exhibitTypeArr }: Props) {
+function A1add({
+  editInfo,
+  closeFu,
+  addTableFu,
+  editTableFu,
+  storageArr,
+  exhibitTypeArr,
+  isAudit
+}: Props) {
   // 表单的ref
   // 表单的ref
   const FormBoxRef = useRef<FormInstance>(null)
   const FormBoxRef = useRef<FormInstance>(null)
 
 
@@ -31,37 +41,40 @@ function A1add({ editInfo, closeFu, addTableFu, editTableFu, storageArr, exhibit
   const ZupTxtRef = useRef<any>(null)
   const ZupTxtRef = useRef<any>(null)
 
 
   // 编辑/查看 进入页面 获取信息
   // 编辑/查看 进入页面 获取信息
-  const getInfoFu = useCallback(async (id: number) => {
-    const res = await A1_APIgetInfo(id)
-    if (res.code === 0) {
-      const data = res.data
-
-      let storageIds = []
-      if (data.ancestor) storageIds = data.ancestor.split(',').map((v: string) => Number(v))
-      storageIds.push(Number(data.storageId))
-
-      const obj = {
-        ...data,
-        storageIds,
-        exhibitTypeId: Number(data.exhibitTypeId),
-        year: data.year ? data.year : null
+  const getInfoFu = useCallback(
+    async (id: number) => {
+      const res = isAudit ? await A5_APIgetInfo(id) : await A1_APIgetInfo(id)
+      if (res.code === 0) {
+        const data = res.data
+
+        let storageIds = []
+        if (data.ancestor) storageIds = data.ancestor.split(',').map((v: string) => Number(v))
+        storageIds.push(Number(data.storageId))
+
+        const obj = {
+          ...data,
+          storageIds,
+          exhibitTypeId: Number(data.exhibitTypeId),
+          year: data.year ? data.year : null
+        }
+
+        FormBoxRef.current?.setFieldsValue(obj)
+
+        // 设置封面图
+        ZupThumbRef.current?.setFileComFileFu({
+          fileName: '',
+          filePath: data.thumb
+        })
+
+        // 设置附件
+        ZupTxtRef.current?.setFileComFileFu({
+          fileName: data.fileName,
+          filePath: data.filePath
+        })
       }
       }
-
-      FormBoxRef.current?.setFieldsValue(obj)
-
-      // 设置封面图
-      ZupThumbRef.current?.setFileComFileFu({
-        fileName: '',
-        filePath: data.thumb
-      })
-
-      // 设置txt
-      ZupTxtRef.current?.setFileComFileFu({
-        fileName: data.fileName,
-        filePath: data.filePath
-      })
-    }
-  }, [])
+    },
+    [isAudit]
+  )
 
 
   // 附件 是否 已经点击过确定
   // 附件 是否 已经点击过确定
   const [fileCheck, setFileCheck] = useState(false)
   const [fileCheck, setFileCheck] = useState(false)
@@ -107,7 +120,7 @@ function A1add({ editInfo, closeFu, addTableFu, editTableFu, storageArr, exhibit
 
 
       const obj = {
       const obj = {
         ...values,
         ...values,
-        id: editInfo.id > 0 ? editInfo.id : null,
+        id: isAudit ? null : editInfo.id > 0 ? editInfo.id : null,
         thumb: coverUrl1.filePath,
         thumb: coverUrl1.filePath,
         storageId,
         storageId,
         fileName,
         fileName,
@@ -122,12 +135,12 @@ function A1add({ editInfo, closeFu, addTableFu, editTableFu, storageArr, exhibit
       const res = await A1_APIsave(obj)
       const res = await A1_APIsave(obj)
 
 
       if (res.code === 0) {
       if (res.code === 0) {
-        MessageFu.success(`${editInfo.txt}成功!`)
+        MessageFu.success(isAudit ? '创建成功!' : `${editInfo.txt}成功!`)
         editInfo.id > 0 ? editTableFu() : addTableFu()
         editInfo.id > 0 ? editTableFu() : addTableFu()
         closeFu()
         closeFu()
       }
       }
     },
     },
-    [addTableFu, closeFu, editInfo.id, editInfo.txt, editTableFu]
+    [addTableFu, closeFu, editInfo.id, editInfo.txt, editTableFu, isAudit]
   )
   )
 
 
   // 年份
   // 年份

+ 125 - 0
src/pages/A5bookAudit/A5look/index.module.scss

@@ -0,0 +1,125 @@
+.A5look {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 24px;
+  :global {
+    .A5lMain {
+      padding-right: 400px;
+      width: 100%;
+      height: 100%;
+      overflow: auto;
+    }
+
+    .A5lBtn {
+      font-size: 16px;
+      position: absolute;
+      right: 200px;
+      top: 50%;
+      transform: translateY(-50%);
+      text-align: center;
+    }
+
+    .A5lRow {
+      display: flex;
+      margin-bottom: 20px;
+      font-size: 16px;
+      .A5lLeft {
+        font-weight: 700;
+        width: 120px;
+        text-align: right;
+      }
+      .A5lLeft2 {
+        position: relative;
+        top: 6px;
+      }
+      .A5lRight {
+        width: calc(100% - 120px);
+        .ant-select {
+          pointer-events: none;
+          .ant-select-selector {
+            font-size: 16px;
+            border: none;
+            padding: 0;
+          }
+          .ant-select-arrow {
+            display: none;
+          }
+        }
+      }
+    }
+    .A5lRow2 {
+      margin-bottom: 15px;
+    }
+
+    .A5Ladd {
+      position: absolute;
+      top: 0;
+      left: 0;
+      width: 100%;
+      height: 100%;
+      z-index: 10;
+      padding: 50px 100px;
+      background-color: rgba(0, 0, 0, 0.6);
+      border-radius: 10px;
+      & > div {
+        width: 100%;
+        height: 100%;
+        position: relative;
+      }
+    }
+  }
+}
+
+// 审核
+.A5lAduit {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .ant-modal {
+      width: 800px !important;
+      // top: 30%;
+    }
+    .ant-modal-body {
+      border-top: 1px solid #ccc;
+      padding-top: 15px !important;
+    }
+
+    .formRow {
+      display: flex;
+      // align-items: center;
+      margin-bottom: 24px;
+
+      .formLeft {
+        width: 80px;
+        text-align: right;
+
+        & > span {
+          color: #ff4d4f;
+        }
+      }
+      .formLeft2 {
+        position: relative;
+        top: 4px;
+      }
+
+      .formRight {
+        width: calc(100% - 80px);
+        position: relative;
+        .ant-btn {
+          margin-right: 15px;
+        }
+      }
+    }
+
+    .A5lAduitBtn {
+      text-align: center;
+      margin-top: 50px;
+    }
+  }
+}

+ 318 - 0
src/pages/A5bookAudit/A5look/index.tsx

@@ -0,0 +1,318 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A5tableType } from '@/types'
+import ZupOne from '@/components/ZupOne'
+import { Button, Cascader, Input, Modal } from 'antd'
+import { A2_APIgetList1, A2_APIgetList2 } from '@/store/action/A2classify'
+import { useDispatch, useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { A5selArr1 } from '../data'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { A5_APIaudit, A5_APIgetInfo } from '@/store/action/A5bookAudit'
+import { MessageFu } from '@/utils/message'
+import A1add from '@/pages/A1manage/A1add'
+const { TextArea } = Input
+
+type Props = {
+  info: A5tableType
+  closeFuOne: () => void
+  editTableFu: () => void
+}
+
+function A5look({ info, closeFuOne, editTableFu }: Props) {
+  const dispatch = useDispatch()
+  // 占位ref
+  const imgRef = useRef<any>(null)
+  const ZupTxtRef = useRef<any>(null)
+
+  // 获取中图法分类 和 展示分类
+  useEffect(() => {
+    dispatch(A2_APIgetList1())
+    dispatch(A2_APIgetList2({ pageNum: 1, pageSize: 9999, searchKey: '' }))
+  }, [dispatch])
+
+  const { treeData: storageArr, tableInfo: exhibitTypeObj } = useSelector(
+    (state: RootState) => state.A2classify
+  )
+
+  const [storageIds, setStorageIds] = useState<any>([])
+
+  // 审核状态外面页面
+  const [auditStatus, setAuditStatus] = useState<'' | 0 | 1 | 2>('')
+
+  const auditStatusTxt = useMemo(() => {
+    let txt = ''
+    let obj = A5selArr1.find(v => v.value === auditStatus)
+    if (obj) txt = obj.label
+    return txt
+  }, [auditStatus])
+
+  // 审核状态-里面
+  const [auditStatus2, setAuditStatus2] = useState<'' | 0 | 1 | 2>('')
+
+  // 审核人
+  const [auditBy, setAuditBy] = useState('')
+
+  // 审核时间
+  const [auditTime, setAuditTime] = useState('')
+
+  // 审核备注
+  const [auditDesc, setAuditDesc] = useState('')
+
+  useEffect(() => {
+    // 设置封面图
+    imgRef.current?.setFileComFileFu({
+      fileName: '',
+      filePath: info.thumb
+    })
+
+    // 设置附件
+    ZupTxtRef.current?.setFileComFileFu({
+      fileName: info.fileName,
+      filePath: info.filePath
+    })
+
+    let storageIds: number[] = []
+    if (info.ancestor) storageIds = info.ancestor.split(',').map((v: string) => Number(v))
+    storageIds.push(Number(info.storageId))
+
+    setStorageIds(storageIds)
+
+    // 设置审核状态
+    setAuditStatus(info.auditStatus)
+
+    setAuditBy(info.creatorName)
+    setAuditTime(info.auditTime)
+    setAuditDesc(info.auditDesc)
+  }, [info])
+
+  // 审核页面
+  const [aduitShow, setAduitShow] = useState(false)
+
+  useEffect(() => {
+    if (aduitShow) setAuditStatus2(auditStatus)
+    else setAuditStatus2('')
+  }, [aduitShow, auditStatus, info.auditStatus])
+
+  // 审核点击确定
+  const btnOk = useCallback(async () => {
+    const obj = {
+      id: info.id,
+      auditDesc,
+      auditStatus: auditStatus2
+    }
+    const res = await A5_APIaudit(obj)
+    if (res.code === 0) {
+      MessageFu.success('审核成功!')
+      const res2 = await A5_APIgetInfo(info.id)
+      if (res2.code === 0) {
+        const data: A5tableType = res2.data
+
+        setAuditStatus(data.auditStatus)
+        setAuditBy(data.creatorName)
+        setAuditTime(data.auditTime)
+        setAuditDesc(data.auditDesc)
+        setAduitShow(false)
+
+        editTableFu()
+      }
+    }
+  }, [auditDesc, auditStatus2, editTableFu, info.id])
+
+  // 点击创建图书
+  const [creatorShow, setCreatorShow] = useState(false)
+
+  return (
+    <div className={styles.A5look}>
+      <div className='A5lMain'>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>书名:</div>
+          <div className='A5lRight'>{info.name || '(空)'}</div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>简介:</div>
+          <div className='A5lRight'>{info.description || '(空)'}</div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>作者:</div>
+          <div className='A5lRight'>{info.author || '(空)'}</div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>出版社:</div>
+          <div className='A5lRight'>{info.press || '(空)'}</div>
+        </div>
+        <div className='A5lRow A5lRow2'>
+          <div className='A5lLeft'>出版年份:</div>
+          <div className='A5lRight'>{info.year || '(空)'}</div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft A5lLeft2'>封面:</div>
+          <div className='A5lRight'>
+            <ZupOne
+              ref={imgRef}
+              isLook={true}
+              fileCheck={false}
+              size={5}
+              dirCode={'A1manage'}
+              myUrl='cms/book/upload'
+              format={['image/jpeg', 'image/png']}
+              formatTxt='png、jpg和jpeg'
+              checkTxt='请上传封面图!'
+              upTxt='最多1张'
+              myType='thumb'
+            />
+          </div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft A5lLeft2'>中图法分类:</div>
+          <div className='A5lRight'>
+            <Cascader
+              allowClear={false}
+              changeOnSelect
+              style={{ width: 300 }}
+              options={storageArr}
+              fieldNames={{ label: 'name', value: 'id', children: 'children' }}
+              placeholder='请选择'
+              value={storageIds}
+            />
+          </div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>展示分类:</div>
+          <div className='A5lRight'>{info.exhibitTypeName || '(空)'}</div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>ISBN编号:</div>
+          <div className='A5lRight'>{info.num || '(空)'}</div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>附件:</div>
+          <div className='A5lRight'>
+            <ZupOne
+              ref={ZupTxtRef}
+              isLook={true}
+              fileCheck={false}
+              size={30}
+              dirCode='A1manage'
+              myUrl='cms/book/upload'
+              format={['']}
+              formatTxt='equb'
+              checkTxt='请上传equb附件!'
+              upTxt='最多1个'
+              myType='equb'
+            />
+          </div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>提交人:</div>
+          <div className='A5lRight'>{info.wxUserName || '(空)'}</div>
+        </div>
+        <div className='A5lRow'>
+          <div className='A5lLeft'>提交时间:</div>
+          <div className='A5lRight'>{info.createTime || '(空)'}</div>
+        </div>
+      </div>
+
+      {/* 右侧按钮 */}
+      <div className='A5lBtn'>
+        审核状态:{auditStatusTxt}
+        <br /> <br />
+        <Button type='primary' onClick={() => setAduitShow(true)}>
+          审核
+        </Button>
+        <br /> <br />
+        <Button type='primary' onClick={() => setCreatorShow(true)}>
+          创建图书
+        </Button>
+        <br /> <br />
+        <Button onClick={closeFuOne}>返回</Button>
+      </div>
+
+      {/* 审核出来的页面 */}
+      {aduitShow ? (
+        <Modal
+          wrapClassName={styles.A5lAduit}
+          open={true}
+          title='审核'
+          footer={
+            [] // 设置footer为空,去掉 取消 确定默认按钮
+          }
+        >
+          <div className='formRow'>
+            <div className='formLeft formLeft2'>审核状态:</div>
+            <div className='formRight'>
+              {A5selArr1.filter(v => v.label !== '全部').map(v => (
+                <Button
+                  onClick={() => setAuditStatus2(v.value as 0)}
+                  type={v.value === auditStatus2 ? 'primary' : 'default'}
+                  key={v.value}
+                >
+                  {v.label}
+                </Button>
+              ))}
+            </div>
+          </div>
+
+          <div className='formRow'>
+            <div className='formLeft'>
+              <span></span>审核人:
+            </div>
+            <div className='formRight'>{auditBy || '(空)'}</div>
+          </div>
+
+          <div className='formRow'>
+            <div className='formLeft'>
+              <span></span>审核时间:
+            </div>
+            <div className='formRight'>{auditTime || '(空)'}</div>
+          </div>
+
+          <div className='formRow'>
+            <div className='formLeft'>
+              <span></span>审核备注:
+            </div>
+            <div className='formRight'>
+              <TextArea
+                value={auditDesc}
+                onChange={e => setAuditDesc(e.target.value)}
+                rows={6}
+                placeholder='请输入内容'
+                maxLength={200}
+                showCount
+              />
+            </div>
+          </div>
+
+          <div className='A5lAduitBtn'>
+            <Button type='primary' onClick={btnOk}>
+              提交
+            </Button>
+            &emsp;
+            <MyPopconfirm txtK='取消' onConfirm={() => setAduitShow(false)} />
+          </div>
+        </Modal>
+      ) : null}
+
+      {/* 点击创建图书 */}
+      {creatorShow ? (
+        <div className='A5Ladd'>
+          <div>
+            <A1add
+              editInfo={{ id: info.id, txt: '编辑' }}
+              closeFu={() => setCreatorShow(false)}
+              addTableFu={() => {}}
+              editTableFu={() => {}}
+              storageArr={storageArr}
+              exhibitTypeArr={exhibitTypeObj.list}
+              isAudit={true}
+            />
+          </div>
+        </div>
+      ) : null}
+    </div>
+  )
+}
+
+const MemoA5look = React.memo(A5look)
+
+export default MemoA5look

+ 25 - 0
src/pages/A5bookAudit/data.ts

@@ -0,0 +1,25 @@
+export type A5FromDataType = {
+  auditStatus: '' | 0 | 1 | 2
+  searchKey: string
+  num: string
+  pageNum: number
+  pageSize: number
+}
+export const A5selArr1 = [
+  {
+    value: '',
+    label: '全部'
+  },
+  {
+    value: 0,
+    label: '待审核'
+  },
+  {
+    value: 1,
+    label: '审核通过'
+  },
+  {
+    value: 2,
+    label: '审核驳回'
+  }
+]

+ 28 - 3
src/pages/A5bookAudit/index.module.scss

@@ -1,5 +1,30 @@
-.A5bookAudit{
-  :global{
-
+.A5bookAudit {
+  position: relative;
+  :global {
+    .A5top {
+      border-radius: 10px;
+      background-color: #fff;
+      padding: 15px 24px;
+      display: flex;
+      justify-content: space-between;
+      & > div {
+        display: flex;
+        .A5TopRow {
+          display: flex;
+          align-items: center;
+          margin-right: 20px;
+          .ant-select-selection-placeholder {
+            color: black;
+          }
+        }
+      }
+    }
+    .A5tableBox {
+      border-radius: 10px;
+      overflow: hidden;
+      margin-top: 15px;
+      height: calc(100% - 77px);
+      background-color: #fff;
+    }
   }
   }
 }
 }

+ 153 - 6
src/pages/A5bookAudit/index.tsx

@@ -1,14 +1,161 @@
-import React from "react";
-import styles from "./index.module.scss";
- function A5bookAudit() {
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A5FromDataType, A5selArr1 } from './data'
+import { useDispatch, useSelector } from 'react-redux'
+import { A5_APIdel, A5_APIgetList } from '@/store/action/A5bookAudit'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { A5tableType } from '@/types'
+import { Button, Input, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import MyTable from '@/components/MyTable'
+import { A5tableC } from '@/utils/tableData'
+import A5look from './A5look'
+
+const fromDataBase: A5FromDataType = {
+  auditStatus: '',
+  searchKey: '',
+  num: '',
+  pageNum: 1,
+  pageSize: 10
+}
+
+function A5bookAudit() {
+  const dispatch = useDispatch()
+
+  const [fromData, setFromData] = useState(fromDataBase)
+
+  const getListFu = useCallback(() => {
+    dispatch(A5_APIgetList(fromData))
+  }, [dispatch, fromData])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  const [inputKey, setInputKey] = useState(1)
+
+  // 输入框的输入
+  const timeRef = useRef(-1)
+  const txtChangeFu = useCallback(
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'searchKey' | 'num') => {
+      clearTimeout(timeRef.current)
+      timeRef.current = window.setTimeout(() => {
+        setFromData({ ...fromData, [key]: e.target.value.replaceAll("'", ''), pageNum: 1 })
+      }, 500)
+    },
+    [fromData]
+  )
+
+  // 点击重置
+  const resetSelectFu = useCallback(() => {
+    setInputKey(Date.now())
+    setFromData({ ...fromDataBase })
+  }, [])
+
+  const tableInfo = useSelector((state: RootState) => state.A5bookAudit.tableInfo)
+
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await A5_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: A5tableType) => (
+          <>
+            <Button size='small' type='text' onClick={() => setLookInfo(item)}>
+              查看
+            </Button>
+
+            <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+          </>
+        )
+      }
+    ]
+  }, [delTableFu])
+
+  // 点击查看
+  const [lookInfo, setLookInfo] = useState({} as A5tableType)
 
 
   return (
   return (
     <div className={styles.A5bookAudit}>
     <div className={styles.A5bookAudit}>
-      <h1>A5bookAudit</h1>
+      <div className='pageTitle'>图书审核{lookInfo.id ? ' - 查看' : ''}</div>
+
+      {/* 顶部筛选 */}
+      <div className='A5top'>
+        <div>
+          <div className='A5TopRow'>
+            <span>搜索:</span>
+            <Input
+              key={inputKey}
+              maxLength={20}
+              style={{ width: 200 }}
+              placeholder='请输入书名/作者/出版社'
+              allowClear
+              onChange={e => txtChangeFu(e, 'searchKey')}
+            />
+            &nbsp;
+            <Input
+              key={inputKey + 1}
+              maxLength={20}
+              style={{ width: 200 }}
+              placeholder='请输入完整ISBN编号'
+              allowClear
+              onChange={e => txtChangeFu(e, 'num')}
+            />
+          </div>
+
+          <div className='A5TopRow'>
+            <span>审核状态:</span>
+            <Select
+              placeholder='全部'
+              style={{ width: 180 }}
+              value={fromData.auditStatus}
+              onChange={e => setFromData({ ...fromData, pageNum: 1, auditStatus: e })}
+              options={A5selArr1}
+            />
+          </div>
+        </div>
+        <div>
+          <Button onClick={resetSelectFu}>重置</Button>&emsp;
+        </div>
+      </div>
+
+      {/* 表格主体 */}
+      <div className='A5tableBox'>
+        <MyTable
+          yHeight={625}
+          list={tableInfo.list}
+          columnsTemp={A5tableC}
+          lastBtn={tableLastBtn}
+          pageNum={fromData.pageNum}
+          pageSize={fromData.pageSize}
+          total={tableInfo.total}
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
+        />
+      </div>
+
+      {/* 点击查看 */}
+      {lookInfo.id ? (
+        <A5look
+          info={lookInfo}
+          closeFuOne={() => setLookInfo({} as A5tableType)}
+          editTableFu={getListFu}
+        />
+      ) : null}
     </div>
     </div>
   )
   )
 }
 }
 
 
-const MemoA5bookAudit = React.memo(A5bookAudit);
+const MemoA5bookAudit = React.memo(A5bookAudit)
 
 
-export default MemoA5bookAudit;
+export default MemoA5bookAudit

+ 40 - 0
src/store/action/A5bookAudit.ts

@@ -0,0 +1,40 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+
+/**
+ *图书审核-列表
+ */
+
+export const A5_APIgetList = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/audit/pageList', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+      dispatch({ type: 'A5/getList', payload: obj })
+    }
+  }
+}
+
+/**
+ * 图书审核-删除
+ */
+export const A5_APIdel = (id: number) => {
+  return http.get(`cms/audit/remove/${id}`)
+}
+
+/**
+ * 图书审核-审核
+ */
+export const A5_APIaudit = (data: any) => {
+  return http.post('cms/audit/audit', data)
+}
+
+/**
+ * 图书推荐-获取详情
+ */
+export const A5_APIgetInfo = (id: number) => {
+  return http.get(`cms/audit/detail/${id}`)
+}

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

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

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

@@ -7,6 +7,7 @@ import A1manage from './A1manage'
 import A2classify from './A2classify'
 import A2classify from './A2classify'
 import A3recommend from './A3recommend'
 import A3recommend from './A3recommend'
 import A4iosUser from './A4iosUser'
 import A4iosUser from './A4iosUser'
+import A5bookAudit from './A5bookAudit'
 import Z1user from './Z1user'
 import Z1user from './Z1user'
 import Z2log from './Z2log'
 import Z2log from './Z2log'
 
 
@@ -17,6 +18,7 @@ const rootReducer = combineReducers({
   A2classify,
   A2classify,
   A3recommend,
   A3recommend,
   A4iosUser,
   A4iosUser,
+  A5bookAudit,
   Z1user,
   Z1user,
   Z2log
   Z2log
 })
 })

+ 28 - 0
src/types/api/A5bookAudit.ts

@@ -0,0 +1,28 @@
+export type A5tableType = {
+  ancestor: string
+  auditDesc: string
+  author: string
+  createTime: string
+  creatorId: number
+  creatorName: string
+  description: string
+  display: number
+  exhibitTypeId: string
+  exhibitTypeName: string
+  fileName: string
+  filePath: string
+  id: number
+  name: string
+  num: string
+  press: string
+  sort: number
+  storageId: string
+  storageName: string
+  thumb: string
+  updateTime: string
+  year: string
+  wxUserName: string
+  auditStatus: 0 | 1 | 2
+  auditBy: string
+  auditTime: string
+}

+ 1 - 0
src/types/index.d.ts

@@ -3,5 +3,6 @@ export * from './api/A1manage'
 export * from './api/A2classify'
 export * from './api/A2classify'
 export * from './api/A3recommend'
 export * from './api/A3recommend'
 export * from './api/A4iosUser'
 export * from './api/A4iosUser'
+export * from './api/A5bookAudit'
 export * from './api/Z1user'
 export * from './api/Z1user'
 export * from './api/Z2log'
 export * from './api/Z2log'

+ 12 - 0
src/utils/tableData.ts

@@ -72,6 +72,18 @@ export const A4tableC = [
   ['txt', '最近登录IP', 'lastIp']
   ['txt', '最近登录IP', 'lastIp']
 ]
 ]
 
 
+export const A5tableC = [
+  ['txt', '书名', 'name'],
+  ['img', '封面', 'thumb'],
+  ['txt', '作者', 'author'],
+  ['txt', '出版社', 'press'],
+  ['txt', 'ISBN编号', 'num'],
+  ['txt', '提交人', 'wxUserName'],
+  ['txt', '提交时间', 'createTime'],
+  ['txtChange', '审核状态', 'auditStatus', { 0: '待审核', 1: '审核通过', 2: '审核驳回' }],
+  ['text', '审核备注', 'auditDesc', 50]
+]
+
 export const Z1tableC = [
 export const Z1tableC = [
   ['txt', '用户名', 'userName'],
   ['txt', '用户名', 'userName'],
   ['txtChange', '角色', 'isAdmin', { 1: '管理员', 0: '普通成员' }],
   ['txtChange', '角色', 'isAdmin', { 1: '管理员', 0: '普通成员' }],