shaogen1995 2 miesięcy temu
rodzic
commit
6addd2e9e5

+ 9 - 1
src/pages/Bresource/B1overview/B1import/index.tsx

@@ -7,6 +7,7 @@ import { getKuListByOpenFu } from '@/pages/Zother/data'
 import { useParams } from 'react-router-dom'
 import { MessageFu } from '@/utils/message'
 import B1tab1 from '../B1tab1'
+import B1tab2 from '../B1tab2'
 
 const tabArr = ['导入资源数据', '导入封面', '导入附件']
 
@@ -62,7 +63,14 @@ function B1import() {
           </div>
           {tabAc === '导入资源数据' ? (
             <B1tab1 fId={fId} kuList={kuList} isLook={closeFlag} />
-          ) : null}
+          ) : (
+            <B1tab2
+              type={tabAc === '导入封面' ? 'thumb' : 'zip'}
+              fId={fId}
+              kuList={kuList}
+              isLook={closeFlag}
+            />
+          )}
         </>
       )}
     </div>

+ 4 - 5
src/pages/Bresource/B1overview/B1res/index.tsx

@@ -29,7 +29,8 @@ function B1res({ upFile, closeFu, anewFu, succApi, succFu, fId, type, tableArr }
       ...upFile,
       formDefId: fId,
       type,
-      formData: upFile.formData.filter((v: any) => v.isTrue === 1)
+      [type === 'excel' ? 'formData' : 'files']: upFile.formData.filter((v: any) => v.isTrue === 1),
+      errorMsg: JSON.stringify(upFile)
     }
     const res = await succApi(obj)
 
@@ -177,7 +178,7 @@ function B1res({ upFile, closeFu, anewFu, succApi, succFu, fId, type, tableArr }
         </div>
 
         <MyTable
-          rowKey='rowNum'
+          rowKey={type === 'excel' ? 'rowNum' : 'filePath'}
           yHeight={550}
           classKey='B1res'
           list={list}
@@ -192,9 +193,7 @@ function B1res({ upFile, closeFu, anewFu, succApi, succFu, fId, type, tableArr }
           <Button onClick={closeFu}>关闭</Button>
         ) : (
           <>
-            <Button type='primary' onClick={anewFu}>
-              重新上传表格
-            </Button>
+            <Button onClick={anewFu}>重新上传表格</Button>
             <Button type='primary' onClick={succBtn}>
               导入校验成功的数据
             </Button>

+ 11 - 18
src/pages/Bresource/B1overview/B1tab1/index.tsx

@@ -16,6 +16,7 @@ import { B1handeUpFu } from '../data'
 import MyTable from '@/components/MyTable'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import B1res from '../B1res'
+import { B2imTableC } from '@/utils/tableData'
 
 type Props = {
   fId: number
@@ -90,16 +91,15 @@ function B1tab1({ fId, kuList, isLook }: Props) {
   )
 
   // 点击查看
-  const lookFu = useCallback(
-    async (id: number) => {
-      const res = await APIlookImExcel(id, fId)
-      if (res.code === 0) {
-        // 待完善
-        console.log('-------', res)
-      }
-    },
-    [fId]
-  )
+  const lookFu = useCallback(async (id: number) => {
+    const res = await APIlookImExcel(id)
+    if (res.code === 0) {
+      const infoTemp = res.data.errorMsg
+      const info = JSON.parse(infoTemp || '{}')
+      info.myType = '查看'
+      setUpFile(info)
+    }
+  }, [])
 
   const tableLastBtn = useMemo(() => {
     return [
@@ -155,14 +155,7 @@ function B1tab1({ fId, kuList, isLook }: Props) {
         yHeight={660}
         classKey='B1tab1'
         list={tableInfo.list}
-        columnsTemp={[
-          ['txt', '文件名称', 'fileName'],
-          ['txt', '导入数据', 'pcsTotal'],
-          ['txt', '成功数据', 'pcsSuccess'],
-          ['txt', '失败数据', 'pcsError'],
-          ['txt', '导入日期', 'updateTime'],
-          ['txt', '导入用户', 'creatorName']
-        ]}
+        columnsTemp={B2imTableC}
         lastBtn={tableLastBtn}
         pageNum={formData.pageNum}
         pageSize={formData.pageSize}

+ 13 - 0
src/pages/Bresource/B1overview/B1tab2/index.module.scss

@@ -0,0 +1,13 @@
+.B1tab2 {
+  :global {
+    .B1IrightTop {
+      font-size: 14px;
+      .B1IrightTopRow {
+        margin-right: 50px;
+        span {
+          font-weight: 700;
+        }
+      }
+    }
+  }
+}

+ 185 - 0
src/pages/Bresource/B1overview/B1tab2/index.tsx

@@ -0,0 +1,185 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { antdSelectType } from '@/utils/dataChange'
+import {
+  APIdelImZip,
+  APIimEZip,
+  APIlookImZip,
+  APIsuccZip
+} from '@/store/action/Bresource/B1overview'
+import { B1handeUpFu } from '../data'
+import { MessageFu } from '@/utils/message'
+import { Button } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import MyTable from '@/components/MyTable'
+import { B2imTableC } from '@/utils/tableData'
+import B1res from '../B1res'
+
+type Props = {
+  fId: number
+  kuList: antdSelectType[]
+  isLook: boolean
+  type: 'zip' | 'thumb'
+}
+
+function B1tab2({ fId, kuList, isLook, type }: Props) {
+  const [formData, setFormData] = useState({ pageNum: 1, pageSize: 10 })
+
+  const [tableInfo, setTableInfo] = useState<any>({ list: [], total: 0 })
+
+  const getList = useCallback(async () => {
+    const res = await APIimEZip(formData, type, fId)
+    if (res.code === 0) {
+      setTableInfo({ list: res.data.records || [], total: res.data.total })
+    }
+  }, [fId, formData, type])
+
+  useEffect(() => {
+    getList()
+  }, [getList])
+
+  const myInput = useRef<HTMLInputElement>(null)
+
+  const [upFile, setUpFile] = useState<any>({})
+
+  // 上传单个zip
+  const handeUpPhoto = useCallback(
+    async (e: React.ChangeEvent<HTMLInputElement>) => {
+      B1handeUpFu(
+        e,
+        fId,
+        500,
+        'zip',
+        type === 'thumb' ? 'cms/importZip/uploadThumbZip' : 'cms/importZip/uploadZip',
+        info => {
+          setUpFile({ ...info, myType: '编辑' })
+        }
+      )
+    },
+    [fId, type]
+  )
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+    },
+    [formData]
+  )
+
+  // 点击删除
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res: any = await APIdelImZip(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getList()
+      }
+    },
+    [getList]
+  )
+
+  // 点击查看
+  const lookFu = useCallback(async (id: number) => {
+    const res = await APIlookImZip(id)
+    if (res.code === 0) {
+      const infoTemp = res.data.errorMsg
+      const info = JSON.parse(infoTemp || '{}')
+      info.myType = '查看'
+      setUpFile(info)
+    }
+  }, [])
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: any) => (
+          <>
+            <Button size='small' type='text' onClick={() => lookFu(item.id)}>
+              查看
+            </Button>
+            {isLook ? null : (
+              <MyPopconfirm
+                txtK='删除'
+                onConfirm={() => delTableFu(item.id)}
+                Dom={
+                  <Button danger disabled={isLook} size='small' type='text'>
+                    删除记录
+                  </Button>
+                }
+              />
+            )}
+          </>
+        )
+      }
+    ]
+  }, [delTableFu, isLook, lookFu])
+
+  return (
+    <div className={styles.B1tab2}>
+      <input
+        id='upInput'
+        type='file'
+        ref={myInput}
+        onChange={handeUpPhoto}
+        multiple
+        accept='.zip'
+        style={{ display: 'none' }}
+      />
+      <div className='B1IrightTop'>
+        <div className='B1IrightTopRow'>
+          <p>
+            {type === 'thumb' ? '图片' : '附件'}以zip压缩包格式上传,500M以内,
+            {type === 'thumb' ? '请勿嵌套' : '压缩包里面放 资源编码 命名的文件夹'}
+          </p>
+          <p>
+            {type === 'thumb' ? '压缩包里面图片' : ''}
+            命名规则:资源编码(如
+            <span>AA018701</span>){type === 'zip' ? ';文件夹里的附件任意命名' : ''}
+          </p>
+        </div>
+        <div className='B1IrightTopRow'>
+          <p>
+            {type === 'thumb'
+              ? '图片的格式:jpg/png/bmp/gif'
+              : '附件格式:pdf/epub/mp4/avi/mp3/wav/jpg/png'}
+          </p>
+        </div>
+        <Button disabled={isLook} type='primary' onClick={() => myInput.current?.click()}>
+          上传压缩包(ZIP格式)
+        </Button>
+      </div>
+
+      <MyTable
+        yHeight={660}
+        classKey='B1tab2'
+        list={tableInfo.list}
+        columnsTemp={B2imTableC}
+        lastBtn={tableLastBtn}
+        pageNum={formData.pageNum}
+        pageSize={formData.pageSize}
+        total={tableInfo.total}
+        onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+      />
+
+      {/* 上传成功之后 */}
+      {upFile.myType ? (
+        <B1res
+          upFile={upFile}
+          fId={Number(fId)}
+          closeFu={() => setUpFile({})}
+          anewFu={() => myInput.current?.click()}
+          succApi={APIsuccZip}
+          type={type}
+          tableArr={[{ name: `${type === 'thumb' ? '图片' : '附件'}名称`, key: 'fileName' }]}
+          succFu={getList}
+        />
+      ) : null}
+    </div>
+  )
+}
+
+const MemoB1tab2 = React.memo(B1tab2)
+
+export default MemoB1tab2

+ 19 - 0
src/pages/Bresource/B2resFile/B2set/index.module.scss

@@ -0,0 +1,19 @@
+.B2set {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 10;
+  border: 1px solid #d1d3d3;
+  background-color: var(--boxBcaColor);
+  border-radius: 10px;
+  :global {
+    .b2top {
+      padding: 15px;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+    }
+  }
+}

+ 236 - 0
src/pages/Bresource/B2resFile/B2set/index.tsx

@@ -0,0 +1,236 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { antdSelectType } from '@/utils/dataChange'
+import { useDispatch, useSelector } from 'react-redux'
+import { B2selectTopBase } from '..'
+import { B2_APIgetList } from '@/store/action/Bresource/B2resFile'
+import { RootState } from '@/store'
+import { Button, Checkbox, Input, Select } from 'antd'
+import { ziyuanAcSet } from '@/utils/storage'
+import MyTable from '@/components/MyTable'
+import { fileTableC } from '@/utils/tableData'
+import B2setMo, { B2setRoleType } from '../B2setMo'
+
+type Props = {
+  kuList: antdSelectType[]
+  formDefId: number
+  closeFu: () => void
+}
+
+function B2set({ kuList, formDefId, closeFu }: Props) {
+  const fomrDataObj = useMemo(() => {
+    return { ...B2selectTopBase, formDefId, includeType: ['epub', 'txt', 'docx', 'doc'] }
+  }, [formDefId])
+
+  const dispatch = useDispatch()
+
+  const [formData, setFormData] = useState({ ...fomrDataObj })
+  const formDataRef = useRef({ ...fomrDataObj })
+
+  useEffect(() => {
+    formDataRef.current = { ...formData }
+  }, [formData])
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(0)
+
+  // 选择
+  const [checkIds, setCheckIds] = useState<number[]>([])
+
+  // 点击搜索
+  const clickSearch = useCallback(() => {
+    setFormData({ ...formData, pageNum: 1 })
+    setCheckIds([])
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [formData])
+
+  // 点击重置
+  const resetSelectFu = useCallback(
+    (formDefId?: number) => {
+      setFormData({ ...fomrDataObj, formDefId: formDefId || formData.formDefId })
+      setCheckIds([])
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [fomrDataObj, formData.formDefId]
+  )
+
+  // 封装发送请求的函数
+  const getList = useCallback(async () => {
+    const obj = {
+      ...formDataRef.current
+    }
+    dispatch(B2_APIgetList(obj, undefined, 'B2/getList2'))
+  }, [dispatch])
+
+  useEffect(() => {
+    getList()
+  }, [getList, timeKey])
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [formData]
+  )
+
+  // 表格数据
+  const tableInfo = useSelector((state: RootState) => state.B2resFile.tableInfo2)
+
+  // 表格操作按钮
+  const staBtn = useMemo(() => {
+    let arr: any[] = [
+      {
+        title: '选择',
+        width: 70,
+        render: (item: any) => (
+          <div className='tableAuto'>
+            <Checkbox
+              checked={checkIds.includes(item.id)}
+              onChange={() => {
+                setCheckIds(
+                  checkIds.includes(item.id)
+                    ? checkIds.filter(v => v !== item.id)
+                    : [...checkIds, item.id]
+                )
+              }}
+            ></Checkbox>
+          </div>
+        )
+      },
+      {
+        title: '权限级/复制比例',
+        render: (item: any) => {
+          let txt = '(空)'
+          if (item.rtf) {
+            const obj = JSON.parse(item.rtf || '{}')
+            if (obj.role && obj.bai) {
+              txt = `${obj.role} / ${obj.bai}%`
+            }
+          }
+          return txt
+        }
+      }
+    ]
+
+    return arr
+  }, [checkIds])
+
+  const tabBtnArr = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        width: 'auto',
+        render: (item: any) => {
+          return (
+            <>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => setSetRole({ type: 1, rtf: item.rtf || '{}', ids: [item.id] })}
+              >
+                配置复制权限
+              </Button>
+            </>
+          )
+        }
+      }
+    ]
+  }, [])
+
+  // 输入框的改变
+  const txtChangeFu = useCallback(
+    (txt: string, key: any) => {
+      setFormData({
+        ...formData,
+        [key]: txt
+      })
+    },
+    [formData]
+  )
+
+  // 点击批量配置
+  const [setRole, setSetRole] = useState<B2setRoleType>({ type: 0, rtf: '', ids: [] })
+
+  return (
+    <div className={styles.B2set}>
+      <div className='b2top'>
+        <div>
+          <Input
+            style={{ width: 300 }}
+            value={formData.searchKey}
+            maxLength={30}
+            showCount
+            placeholder='请输入附件名称/资源编码/资源名称'
+            onChange={e => txtChangeFu(e.target.value, 'searchKey')}
+          />
+          &emsp;
+          <Button type='primary' onClick={clickSearch}>
+            查询
+          </Button>
+          &emsp;
+          <Button onClick={() => resetSelectFu()}>重置</Button>&emsp;
+          <Button
+            type='primary'
+            disabled={checkIds.length === 0}
+            onClick={() => setSetRole({ type: 2, rtf: '', ids: checkIds })}
+          >
+            批量配置
+          </Button>
+          &emsp; {checkIds.length ? <>已选中 {checkIds.length} 条数据</> : null}
+        </div>
+        <div className='Z0ku'>
+          资源库:
+          <Select
+            style={{ maxWidth: 200, minWidth: 120 }}
+            value={formData.formDefId}
+            onChange={e => {
+              setFormData({ ...formData, pageNum: 1, formDefId: e })
+              ziyuanAcSet(e)
+              resetSelectFu(e)
+            }}
+            options={kuList}
+          />
+          &emsp;
+          <Button onClick={closeFu}>返回</Button>
+        </div>
+      </div>
+
+      <MyTable
+        yHeight={660}
+        classKey='B2set'
+        list={tableInfo.list}
+        columnsTemp={fileTableC(true, true)}
+        lastBtn={tabBtnArr}
+        pageNum={formData.pageNum}
+        pageSize={formData.pageSize}
+        total={tableInfo.total}
+        staBtn={staBtn}
+        onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+      />
+
+      {/* 配置复制权限 */}
+      {setRole.type ? (
+        <B2setMo
+          infoTemp={setRole}
+          closeFu={() => setSetRole({ type: 0, rtf: '', ids: [] })}
+          succFu={() => {
+            setCheckIds([])
+            getList()
+          }}
+        />
+      ) : null}
+    </div>
+  )
+}
+
+const MemoB2set = React.memo(B2set)
+
+export default MemoB2set

+ 34 - 0
src/pages/Bresource/B2resFile/B2setMo/index.module.scss

@@ -0,0 +1,34 @@
+.B2setMo {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .ant-modal-body {
+      border-top: 1px solid #ccc;
+    }
+
+    .B2Smain {
+      padding-top: 20px;
+      .B2Srow {
+        margin-bottom: 24px;
+        display: flex;
+        .B2Srowll {
+          width: 110px;
+          text-align: right;
+          line-height: 31px;
+          & > span {
+            color: #ff4d4f;
+          }
+        }
+        .B2Srowrr {
+          width: calc(100% - 110px);
+        }
+      }
+    }
+
+    .B2Sbtn {
+      margin-top: 30px;
+      text-align: center;
+    }
+  }
+}

+ 105 - 0
src/pages/Bresource/B2resFile/B2setMo/index.tsx

@@ -0,0 +1,105 @@
+import React, { useCallback, useEffect, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, InputNumber, Modal, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { selectObj } from '@/utils/dataChange'
+import { MessageFu } from '@/utils/message'
+import { B2_APIsets } from '@/store/action/Bresource/B2resFile'
+
+export type B2setRoleType = {
+  type: number
+  rtf: string
+  ids: number[]
+}
+
+type Props = {
+  infoTemp: B2setRoleType
+  closeFu: () => void
+  succFu: () => void
+}
+
+function B2setMo({ infoTemp, closeFu, succFu }: Props) {
+  const [info, setInfo] = useState<any>({})
+
+  useEffect(() => {
+    if (infoTemp.rtf) {
+      const obj = JSON.parse(infoTemp.rtf)
+      if (obj.bai && obj.role) setInfo(obj)
+    }
+  }, [infoTemp.rtf])
+
+  const btnOk = useCallback(async () => {
+    if (!info.role) return MessageFu.warning('请选择权限级')
+    if (!info.bai && info.bai !== 0) return MessageFu.warning('请输入复制比例')
+
+    const obj = {
+      ids: infoTemp.ids,
+      rtf: JSON.stringify(info)
+    }
+
+    const res = await B2_APIsets(obj)
+    if (res.code === 0) {
+      MessageFu.success('设置成功')
+      closeFu()
+      succFu()
+    }
+  }, [closeFu, info, infoTemp.ids, succFu])
+
+  return (
+    <Modal
+      getContainer={() => document.querySelector('#root')!}
+      wrapClassName={styles.B2setMo}
+      open={true}
+      title={`${infoTemp.type === 2 ? '批量' : ''}配置复制权限`}
+      footer={
+        [] // 设置footer为空,去掉 取消 确定默认按钮
+      }
+    >
+      <div className='B2Smain'>
+        <div className='B2Srow'>
+          <div className='B2Srowll'>
+            <span>* </span>权限级:
+          </div>
+          <div className='B2Srowrr'>
+            <Select
+              style={{ width: 300 }}
+              placeholder='请选择'
+              options={selectObj['权限级']}
+              value={info.role || null}
+              onChange={e => setInfo({ ...info, role: e })}
+            />
+          </div>
+        </div>
+
+        <div className='B2Srow'>
+          <div className='B2Srowll'>
+            <span>* </span>复制比例:
+          </div>
+          <div className='B2Srowrr'>
+            <InputNumber
+              style={{ width: 300 }}
+              value={info.bai}
+              onChange={e => setInfo({ ...info, bai: e })}
+              min={0}
+              max={100}
+              precision={0}
+              placeholder='请输入0-100的整数'
+            />
+          </div>
+        </div>
+      </div>
+
+      <div className='B2Sbtn'>
+        <Button type='primary' onClick={btnOk}>
+          提交
+        </Button>
+        &emsp;
+        <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+      </div>
+    </Modal>
+  )
+}
+
+const MemoB2setMo = React.memo(B2setMo)
+
+export default MemoB2setMo

+ 14 - 0
src/pages/Bresource/B2resFile/index.module.scss

@@ -1,4 +1,18 @@
 .A2resFile {
   :global {
+    .B2main {
+      .b2top {
+        padding: 15px;
+        display: flex;
+        justify-content: space-between;
+        .b2top1 {
+          display: flex;
+          align-items: center;
+          & > div {
+            margin-right: 15px;
+          }
+        }
+      }
+    }
   }
 }

+ 305 - 2
src/pages/Bresource/B2resFile/index.tsx

@@ -1,9 +1,312 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
+import { antdSelectType, selectObj } from '@/utils/dataChange'
+import { useDispatch, useSelector } from 'react-redux'
+import { getKuListByOpenFu } from '@/pages/Zother/data'
+import { ziyuanAcGet, ziyuanAcSet } from '@/utils/storage'
+import { B2_APIdowns, B2_APIgetList } from '@/store/action/Bresource/B2resFile'
+import { RootState } from '@/store'
+import { openLink } from '@/utils/history'
+import { downloadFileByUrl, fileImgArr } from '@/utils'
+import { Button, Checkbox, Input, Select } from 'antd'
+import { FileListType } from '@/components/Z3upFiles/data'
+import ImageLazy from '@/components/ImageLazy'
+import YtableVideo from '@/components/YtableVideo'
+import { baseURL } from '@/utils/http'
+import MyTable from '@/components/MyTable'
+import { fileTableC } from '@/utils/tableData'
+import B2set from './B2set'
+
+export const B2selectTopBase: any = {
+  searchKey: '',
+  pageNum: 1,
+  pageSize: 10,
+  type: '',
+  formDefId: ''
+}
+
 function A2resFile() {
+  const [kuList, setKuList] = useState<antdSelectType[]>([])
+
+  const [loding, setLoding] = useState(false)
+
+  const dispatch = useDispatch()
+
+  const [formData, setFormData] = useState({ ...B2selectTopBase })
+  const formDataRef = useRef({ ...B2selectTopBase })
+
+  useEffect(() => {
+    formDataRef.current = { ...formData }
+  }, [formData])
+
+  useEffect(() => {
+    getKuListByOpenFu(data => {
+      setLoding(true)
+      if (data && data.length) {
+        setKuList(data)
+        const ziyuanAcTxt = ziyuanAcGet()
+        let objRes = data.find(v => v.value === ziyuanAcTxt)
+
+        const resFid = objRes ? ziyuanAcTxt : data[0].value
+        const fId = resFid
+        const obj = { ...B2selectTopBase, formDefId: fId }
+        setFormData(obj)
+        setTimeout(() => {
+          setTimeKey(Date.now())
+        }, 50)
+      }
+    })
+  }, [dispatch])
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(0)
+
+  // 选择
+  const [checkIds, setCheckIds] = useState<number[]>([])
+
+  // 点击搜索
+  const clickSearch = useCallback(() => {
+    setFormData({ ...formData, pageNum: 1 })
+    setCheckIds([])
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [formData])
+
+  // 点击重置
+  const resetSelectFu = useCallback(
+    (formDefId?: number) => {
+      setFormData({ ...B2selectTopBase, formDefId: formDefId || formData.formDefId })
+      setCheckIds([])
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [formData.formDefId]
+  )
+  // 封装发送请求的函数
+  const getList = useCallback(async () => {
+    const obj = {
+      ...formDataRef.current
+    }
+    dispatch(B2_APIgetList(obj))
+  }, [dispatch])
+
+  useEffect(() => {
+    if (timeKey) getList()
+  }, [getList, timeKey])
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, pageNum, pageSize })
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [formData]
+  )
+
+  // 表格数据
+  const tableInfo = useSelector((state: RootState) => state.B2resFile.tableInfo)
+
+  // 点击批量下载
+  const downFu = useCallback(async () => {
+    const res = await B2_APIdowns({ ids: checkIds })
+
+    if (res.code === 0) {
+      downloadFileByUrl(res.data)
+      setCheckIds([])
+    }
+  }, [checkIds])
+
+  // 表格操作按钮
+  const staBtn = useMemo(() => {
+    let arr: any[] = [
+      {
+        title: '选择',
+        width: 70,
+        render: (item: any) => (
+          <div className='tableAuto'>
+            <Checkbox
+              checked={checkIds.includes(item.id)}
+              onChange={() => {
+                setCheckIds(
+                  checkIds.includes(item.id)
+                    ? checkIds.filter(v => v !== item.id)
+                    : [...checkIds, item.id]
+                )
+              }}
+            ></Checkbox>
+          </div>
+        )
+      },
+      {
+        title: '缩略图/查看',
+        render: (item: FileListType) => {
+          const lastNameArr = item.fileName.split('.')
+          let lastName = lastNameArr[lastNameArr.length - 1]
+          lastName = lastName.toLocaleLowerCase()
+
+          if (fileImgArr.includes(lastName)) {
+            return (
+              <div className='tableImgAuto'>
+                <ImageLazy
+                  width={60}
+                  height={60}
+                  src={item.thumb || item.filePath}
+                  srcBig={item.filePath || item.thumb}
+                />
+              </div>
+            )
+          } else if (item.type === 'video') {
+            return <YtableVideo src={item.filePath} />
+          } else {
+            const lastNameArr = item.fileName.split('.')
+            let laseName = lastNameArr[lastNameArr.length - 1]
+            laseName = laseName.toLocaleLowerCase()
+            if (['pdf', 'txt'].includes(laseName)) {
+              return (
+                <Button
+                  size='small'
+                  type='text'
+                  onClick={() => {
+                    window.open(baseURL + item.filePath)
+                  }}
+                >
+                  查看
+                </Button>
+              )
+            } else return <div className='tableImgAuto'>-</div>
+          }
+        }
+      }
+    ]
+
+    return arr
+  }, [checkIds])
+
+  const tabBtnArr = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        width: 'auto',
+        render: (item: any) => {
+          return (
+            <>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => openLink(`/goodsLook/${item.moduleId}/${formData.formDefId}`)}
+              >
+                查看
+              </Button>
+              <Button
+                size='small'
+                type='text'
+                onClick={async () => downloadFileByUrl(item.filePath)}
+              >
+                下载
+              </Button>
+            </>
+          )
+        }
+      }
+    ]
+  }, [formData.formDefId])
+
+  // 输入框的改变
+  const txtChangeFu = useCallback(
+    (txt: string, key: any) => {
+      setFormData({
+        ...formData,
+        [key]: txt
+      })
+    },
+    [formData]
+  )
+
+  // 复制管理
+  const [fuZhi, setFuZhi] = useState(false)
+
   return (
     <div className={styles.A2resFile}>
-      <h1>A2resFile</h1>
+      <div className='pageTitle'>资源附件{fuZhi ? '-复制管理' : ''}</div>
+
+      {formData.formDefId ? (
+        <div className='B2main'>
+          <div className='b2top'>
+            <div className='b2top1'>
+              <div>
+                <Input
+                  style={{ width: 300 }}
+                  value={formData.searchKey}
+                  maxLength={30}
+                  showCount
+                  placeholder='请输入附件名称/资源编码/资源名称'
+                  onChange={e => txtChangeFu(e.target.value, 'searchKey')}
+                />
+              </div>
+              <div>
+                <Select
+                  placeholder='附件类型'
+                  style={{ width: 200 }}
+                  options={selectObj['附件类型']}
+                  value={formData.type || null}
+                  onChange={e => txtChangeFu(e, 'type')}
+                />
+              </div>
+              <Button type='primary' onClick={clickSearch}>
+                查询
+              </Button>
+              &emsp;
+              <Button onClick={() => resetSelectFu()}>重置</Button>&emsp;
+              <Button type='primary' disabled={checkIds.length === 0} onClick={downFu}>
+                批量下载
+              </Button>
+              &emsp; {checkIds.length ? <>已选中 {checkIds.length} 条数据</> : null}
+            </div>
+
+            <div className='Z0ku'>
+              资源库:
+              <Select
+                style={{ maxWidth: 200, minWidth: 120 }}
+                value={formData.formDefId}
+                onChange={e => {
+                  setFormData({ ...formData, pageNum: 1, formDefId: e })
+                  ziyuanAcSet(e)
+                  resetSelectFu(e)
+                }}
+                options={kuList}
+              />
+              &emsp;
+              <Button type='primary' onClick={() => setFuZhi(true)}>
+                复制管理
+              </Button>
+            </div>
+          </div>
+
+          <MyTable
+            yHeight={660}
+            classKey='A2resFile'
+            list={tableInfo.list}
+            columnsTemp={fileTableC(true)}
+            lastBtn={tabBtnArr}
+            pageNum={formData.pageNum}
+            pageSize={formData.pageSize}
+            total={tableInfo.total}
+            staBtn={staBtn}
+            onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+          />
+        </div>
+      ) : (
+        <div hidden={!loding} className='Z0null'>
+          请先在 系统管理-资源库管理 添加数据 或 开启资源库状态
+        </div>
+      )}
+      {fuZhi ? (
+        <B2set kuList={kuList} formDefId={formData.formDefId} closeFu={() => setFuZhi(false)} />
+      ) : null}
     </div>
   )
 }

+ 4 - 5
src/pages/Zother/Z1formSet/index.tsx

@@ -84,7 +84,6 @@ function Z1formSet({ sId, closeFu }: Props) {
             新增字段
           </Button>
           &emsp;
-          {/* 待完善保存模板 */}
           <Button onClick={closeFu}>返回</Button>
         </div>
       </div>
@@ -101,7 +100,7 @@ function Z1formSet({ sId, closeFu }: Props) {
                 {item.tag === '封面' ? (
                   <div className='formRightImg'>
                     <div>
-                      <PlusOutlined />
+                      <PlusOutlined rev={undefined} />
                     </div>
                     <p>格式要求:支持.png,.jpg格式。最大支持5M,最多一张</p>
                   </div>
@@ -154,18 +153,18 @@ function Z1formSet({ sId, closeFu }: Props) {
                       onClick={() => sortMove(index, 1)}
                       disabled={index === info.fields.length - 1}
                       title='下移'
-                      icon={<CaretDownOutlined />}
+                      icon={<CaretDownOutlined rev={undefined} />}
                     ></Button>
                     <Button
                       onClick={() => sortMove(index, -1)}
                       disabled={index === 5}
                       title='上移'
-                      icon={<CaretUpOutlined />}
+                      icon={<CaretUpOutlined rev={undefined} />}
                     ></Button>
                     <MyPopconfirm
                       txtK='删除'
                       onConfirm={() => delTableFu(item.id!)}
-                      Dom={<Button danger icon={<DeleteOutlined />}></Button>}
+                      Dom={<Button danger icon={<DeleteOutlined rev={undefined} />}></Button>}
                     />
                   </div>
                 )}

+ 2 - 8
src/pages/Zother/ZgoodsInfo/Zg2file/index.tsx

@@ -2,12 +2,12 @@ import React, { useMemo } from 'react'
 import styles from './index.module.scss'
 import { FileListType } from '@/components/Z3upFiles/data'
 import MyTable from '@/components/MyTable'
-import { selectObj } from '@/utils/dataChange'
 import { Button } from 'antd'
 import { downloadFileByUrl, fileImgArr } from '@/utils'
 import ImageLazy from '@/components/ImageLazy'
 import { baseURL } from '@/utils/http'
 import YtableVideo from '@/components/YtableVideo'
+import { fileTableC } from '@/utils/tableData'
 
 type Props = {
   list: FileListType[]
@@ -83,13 +83,7 @@ function Zg2file({ list }: Props) {
         classKey='Zg2file'
         yHeight={600}
         list={list}
-        columnsTemp={[
-          ['select', '附件类型', 'type', selectObj['附件类型']],
-          ['txt', '附件名称', 'fileName'],
-          ['dateRes', '上传日期', 'createTime'],
-          ['txt', '上传人', 'creatorName'],
-          ['sizeNum', '文件大小(mb)', 'fileSize', 1024]
-        ]}
+        columnsTemp={fileTableC()}
         lastBtn={tableLastBtn}
         staBtn={staBtn}
         pagingInfo={false}

+ 25 - 1
src/pages/Zother/ZgoodsInfo/Zg3log/index.tsx

@@ -1,6 +1,30 @@
-import React from 'react'
+import React, { useCallback, useEffect, useState } from 'react'
 import styles from './index.module.scss'
+import { APIgetLogList } from '@/store/action/Bresource/B1overview'
+import { useParams } from 'react-router-dom'
+
 function Zg3log() {
+  const { id, fId } = useParams<any>()
+
+  const [formData, setFormData] = useState({ pageNum: 1, pageSize: 10, type: '' })
+
+  const getListFu = useCallback(async () => {
+    const obj = {
+      ...formData,
+      formDefId: fId,
+      formDataId: id
+    }
+    const res = await APIgetLogList(obj)
+    if (res.code === 0) {
+      console.log(123456, res)
+      console.log('-----', setFormData)
+    }
+  }, [fId, formData, id])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
   return (
     <div className={styles.Zg3log}>
       <h1>开发中</h1>

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

@@ -215,7 +215,7 @@ function ZgoodsInfo() {
                     <Dropdown key={item.id} menu={{ items: item.son }} trigger={['click']}>
                       <Button type='primary'>
                         {item.name}
-                        <CaretDownOutlined />
+                        <CaretDownOutlined rev={undefined} />
                       </Button>
                     </Dropdown>
                   ))

+ 17 - 2
src/pages/Zsystem/Z3ipSet/Z3edit/index.tsx

@@ -1,10 +1,11 @@
 import React, { useCallback, useEffect, useState } from 'react'
 import styles from './index.module.scss'
-import { Button, Input, Modal } from 'antd'
+import { Button, Input, Modal, Radio } from 'antd'
 import TextArea from 'antd/es/input/TextArea'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import { MessageFu } from '@/utils/message'
 import { Z3_APIsave } from '@/store/action/Zsystem/Z3ipSet'
+import { selectObj } from '@/utils/dataChange'
 
 type Props = {
   sInfo: any
@@ -21,7 +22,7 @@ function Z3edit({ sInfo, closeFu, addTableFu, editTableFu }: Props) {
   }, [sInfo])
 
   const formChange = useCallback(
-    (key: 'ip' | 'remark', val: any) => {
+    (key: 'ip' | 'remark' | 'levelPerm', val: any) => {
       setInfo({
         ...info,
         [key]: val
@@ -72,6 +73,20 @@ function Z3edit({ sInfo, closeFu, addTableFu, editTableFu }: Props) {
         </div>
 
         <div className='Z3Arow'>
+          <div className='Z3Arow1'>
+            <span> * </span> 权限级:
+          </div>
+
+          <div className='Z3Arow2'>
+            <Radio.Group
+              value={info.levelPerm || '公开级'}
+              onChange={e => formChange('levelPerm', e.target.value)}
+              options={selectObj['权限级']}
+            />
+          </div>
+        </div>
+
+        <div className='Z3Arow'>
           <div className='Z3Arow1'>备注:</div>
           <div className='Z3Arow2'>
             <TextArea

+ 1 - 1
src/pages/Zsystem/Z3ipSet/index.tsx

@@ -10,7 +10,6 @@ import MyTable from '@/components/MyTable'
 import Z3edit from './Z3edit'
 function Z3ipSet() {
   const dispatch = useDispatch()
-  // 待完善
   // 顶部筛选
   const [fromData, setFromData] = useState({
     pageNum: 1,
@@ -88,6 +87,7 @@ function Z3ipSet() {
           columnsTemp={[
             ['txt', 'ID', 'id'],
             ['txt', 'IP地址', 'ip'],
+            ['txt', '权限级', 'levelPerm'],
             ['text', '备注', 'remark', 100]
           ]}
           lastBtn={tableLastBtn}

+ 33 - 7
src/pages/Zsystem/Z6roleSet/Z6edit.tsx

@@ -3,11 +3,12 @@ import styles from './index.module.scss'
 import { Button, Checkbox, Form, FormInstance, Input, InputNumber, Modal, Radio } from 'antd'
 import TextArea from 'antd/es/input/TextArea'
 import MyPopconfirm from '@/components/MyPopconfirm'
-import classNmaes from 'classnames'
+// import classNmaes from 'classnames'
 import { MessageFu } from '@/utils/message'
 import { TypeZ6Role } from './data'
 import { Z6_APIgetAddTreeList, Z6_APIgetInfo, Z6_APIsave } from '@/store/action/Zsystem/Z6roleSet'
 import { useKuList } from '@/pages/Zuse/UseKuList'
+import { selectObj } from '@/utils/dataChange'
 
 type Props = {
   sId: number
@@ -29,6 +30,9 @@ function Z6edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
   //资源可见权限
   const [scopeStorage, setScopeStorage] = useState(0)
 
+  // 展示端资源可见权限
+  const [levelPerm, setLevelPerm] = useState('公开级')
+
   // 资源库
   const { kList } = useKuList()
 
@@ -49,6 +53,8 @@ function Z6edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
 
       setScopeStorage(roleInfo.scopeStorage || 1)
 
+      setLevelPerm(roleInfo.levelPerm || '公开级')
+
       const txt: string = roleInfo.scopeStorageIds || ''
       if (txt) setScopeStorageIds(txt.split(',').map(v => Number(v)))
     }
@@ -115,7 +121,7 @@ function Z6edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
   // 通过校验点击确定
   const onFinish = useCallback(
     async (values: any) => {
-      if (checkIds.length < 1) return MessageFu.warning('至少选中一个侧边栏')
+      // if (checkIds.length < 1) return MessageFu.warning('至少选中一个侧边栏')
 
       if (scopeStorage === 2) {
         if (!scopeStorageIds || scopeStorageIds.length === 0)
@@ -128,7 +134,8 @@ function Z6edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
         resources: checkIds,
         scopeStorage,
         scopeStorageIds: scopeStorageIds.join(','),
-        dataScope
+        dataScope,
+        levelPerm
       }
 
       const res = await Z6_APIsave(obj)
@@ -139,7 +146,17 @@ function Z6edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
         closeFu()
       }
     },
-    [addTableFu, checkIds, closeFu, dataScope, editTableFu, sId, scopeStorage, scopeStorageIds]
+    [
+      addTableFu,
+      checkIds,
+      closeFu,
+      dataScope,
+      editTableFu,
+      levelPerm,
+      sId,
+      scopeStorage,
+      scopeStorageIds
+    ]
   )
 
   return (
@@ -189,7 +206,7 @@ function Z6edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
             <div className='Z6eboxll'>功能权限:</div>
             <div className='Z6eboxrr'>
               <div className='Z6eboxrrBox'>
-                <div className='Z6eboxrrTit'>侧边栏</div>
+                <div className='Z6eboxrrTit'>后台管理侧边栏</div>
                 {roleArr.map(v => (
                   <div key={v.id} className='Z6eRow'>
                     <div className='Z6eRow1'>
@@ -229,9 +246,9 @@ function Z6edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
                     </div>
                   </div>
                 ))}
-                <div className={classNmaes('Z6eErr', checkIds.length <= 0 ? 'Z6eErrAc' : '')}>
+                {/* <div className={classNmaes('Z6eErr', checkIds.length <= 0 ? 'Z6eErrAc' : '')}>
                   至少选中一个
-                </div>
+                </div> */}
               </div>
             </div>
           </div>
@@ -284,6 +301,15 @@ function Z6edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
                   </div>
                 )}
               </div>
+
+              <div className='Z6eboxrrBox Z6eboxrrBox2'>
+                <div className='Z6eboxrrTit'>展示端资源可见权限</div>
+                <Radio.Group
+                  value={levelPerm}
+                  onChange={e => setLevelPerm(e.target.value)}
+                  options={selectObj['权限级']}
+                />
+              </div>
             </div>
           </div>
 

+ 8 - 2
src/store/action/Bresource/B1overview.ts

@@ -16,6 +16,11 @@ export const APIgetFileList = (ids: string[]) => {
   return http.post(`cms/file/getList`, ids)
 }
 
+// 根据id查看日志
+export const APIgetLogList = (data: any) => {
+  return http.post('cms/form/data/log', data)
+}
+
 // 根据 关联资源JSON 查看详情
 export const APIgetZiYuanInfo = (data: any) => {
   return http.post(`cms/form/data/findDataMap`, data)
@@ -92,8 +97,8 @@ export const APIdelImZip = (id: number) => {
 /**
  * 资源总览-导入 -查看
  */
-export const APIlookImExcel = (id: number, formDefId: number) => {
-  return http.get(`cms/importExcel/detail/${id}/${formDefId}`)
+export const APIlookImExcel = (id: number) => {
+  return http.get(`cms/importExcel/detail/${id}`)
 }
 
 export const APIlookImZip = (id: number) => {
@@ -107,6 +112,7 @@ export const APIsuccExcel = (data: any) => {
   return http.post('cms/importExcel/addData', data)
 }
 
+// 附件
 export const APIsuccZip = (data: any) => {
   return http.post('cms/importZip/addData', data)
 }

+ 38 - 0
src/store/action/Bresource/B2resFile.ts

@@ -0,0 +1,38 @@
+import { AppDispatch } from '@/store'
+import http from '@/utils/http'
+
+/**
+ * 资源附件 -获取分页列表
+ */
+export const B2_APIgetList = (data: any, flag?: boolean, type?: 'B2/getList2'): any => {
+  const url = 'cms/resourceFile/pageList'
+
+  if (flag) return http.post(url, data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post(url, data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+
+        dispatch({ type: type || 'B2/getList', payload: obj })
+      }
+    }
+  }
+}
+
+/**
+ * 资源附件 -批量下载
+ */
+export const B2_APIdowns = (data: any) => {
+  return http.post('cms/file/downloadBatch', data)
+}
+
+/**
+ * 资源附件 -批量设置复制权限
+ */
+export const B2_APIsets = (data: any) => {
+  return http.post('cms/resourceFile/updateRtf', data)
+}

+ 37 - 0
src/store/reducer/Bresource/B2resFile.ts

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

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

@@ -4,6 +4,7 @@ import { combineReducers } from 'redux'
 // 导入 登录 模块的 reducer
 import A0Layout from './layout'
 import B1overview from './Bresource/B1overview'
+import B2resFile from './Bresource/B2resFile'
 import B3resTag from './Bresource/B3resTag'
 import C1resIn from './CinStorage/C1resIn'
 import D1resIssue from './Dissue/D1resIssue'
@@ -20,6 +21,7 @@ import Z8sysLog from './Zsystem/Z8sysLog'
 const rootReducer = combineReducers({
   A0Layout,
   B1overview,
+  B2resFile,
   B3resTag,
   C1resIn,
   D1resIssue,

+ 1 - 1
src/utils/index.ts

@@ -26,7 +26,7 @@ const fileObj: FileObjType = {
   video: fileVideoArr,
   model: ['4dage', 'obj', 'stl', 'fbx', 'gltf', '3ds', 'blend', 'dae', 'step'],
   audio: ['mp3', 'wav', 'flac', 'aac', 'ogg', 'm4a'],
-  doc: ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'csv', 'md', 'html']
+  doc: ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'csv', 'md', 'html', 'epub']
   // 'other':[]
 }
 

+ 34 - 0
src/utils/tableData.ts

@@ -14,6 +14,8 @@
 //     ["text", "创建日期",'description', 50,A],
 //   ];
 
+import { selectObj } from './dataChange'
+
 export const I3tableC = [
   ['txt', '编号类型', 'name'],
   ['txt', '前缀', 'prefix'],
@@ -33,3 +35,35 @@ export const Z5tableC2 = [
   ['txt', '排序值', 'sort'],
   ['txtChange', '办理人', 'type', { user: '指定用户', role: '按角色' }]
 ]
+
+export const B2imTableC = [
+  ['txt', '文件名称', 'fileName'],
+  ['txt', '导入数据', 'pcsTotal'],
+  ['txt', '成功数据', 'pcsSuccess'],
+  ['txt', '失败数据', 'pcsError'],
+  ['txt', '导入日期', 'updateTime'],
+  ['txt', '导入用户', 'creatorName']
+]
+
+export const fileTableC = (flag?: boolean, noType?: boolean) => {
+  let arr: any[] = noType ? [] : [['select', '附件类型', 'type', selectObj['附件类型']]]
+
+  arr.push(['txt', '附件名称', 'fileName'])
+
+  if (flag) {
+    arr = [
+      ...arr,
+      ['txt', '资源编码', 'joinNum'],
+      ['txt', '资源名称', 'joinName'],
+      ['txt', '责任者', 'createBy']
+    ]
+  }
+  arr = [
+    ...arr,
+    ['dateRes', '上传日期', 'createTime'],
+    ['txt', '上传人', 'creatorName'],
+    ['sizeNum', '文件大小(mb)', 'fileSize', 1024]
+  ]
+
+  return arr
+}