Parcourir la source

没见过v1版本没写原型就改到V5的。月底交个鸡巴

shaogen1995 il y a 4 mois
Parent
commit
f1cf985fe2

+ 1 - 1
src/components/ImageLazy/index.tsx

@@ -34,7 +34,7 @@ function ImageLazy({ width = 100, height = 100, src, srcBig, noLook, offline = f
   }, [offline, src, srcBig])
 
   return (
-    <div className={styles.ImageLazy} style={{ width: width, height: height }}>
+    <div className={styles.ImageLazy} style={{ width: width, height: height }} id='ImageLazy'>
       <div className='lazyBox'>
         <Image
           lazy

+ 1 - 1
src/components/MyTable/index.tsx

@@ -130,7 +130,7 @@ function MyTable({
               <ImageLazy
                 width={60}
                 height={60}
-                srcBig={item.thumbPc}
+                srcBig={item.thumbPc || item.filePath}
                 src={item[v[2]] || item.thumb}
                 offline={(item[v[2]] || item.thumb).includes('http')}
               />

+ 12 - 12
src/components/ZupOne/index.module.scss

@@ -4,7 +4,6 @@
   position: relative;
 
   :global {
-
     .file_upIcon {
       color: #a6a6a6;
       border-radius: 3px;
@@ -16,8 +15,6 @@
       display: flex;
       justify-content: center;
       align-items: center;
-
-
     }
 
     .file_img {
@@ -42,16 +39,14 @@
         align-items: center;
       }
 
-
-
       .file_lookBox {
         width: 100%;
-        background-color: rgba(0, 0, 0, .6);
+        background-color: rgba(0, 0, 0, 0.6);
         color: #fff;
         display: flex;
         justify-content: space-around;
 
-        &>a {
+        & > a {
           color: #fff !important;
         }
 
@@ -59,6 +54,13 @@
       }
     }
 
+    .file_imgYuan {
+      #ImageLazy {
+        border-radius: 50%;
+        overflow: hidden;
+      }
+    }
+
     .fileInfo {
       display: flex;
       align-items: center;
@@ -70,7 +72,7 @@
         font-size: 16px;
       }
 
-      &>a {
+      & > a {
         color: black;
       }
     }
@@ -80,15 +82,13 @@
       margin-top: 5px;
       font-size: 14px;
       color: rgb(126, 124, 124);
-
-
     }
 
     .noUpThumb {
       position: relative;
       overflow: hidden;
       opacity: 0;
-      transition: top .2s;
+      transition: top 0.2s;
       color: #ff4d4f;
       top: -10px;
     }
@@ -98,4 +98,4 @@
       opacity: 1;
     }
   }
-}
+}

+ 8 - 3
src/components/ZupOne/index.tsx

@@ -35,6 +35,7 @@ type Props = {
   isLook?: boolean //是不是查看
   fromData?: any
   ref: any //当前自己的ref,给父组件调用
+  isTouXiang?: boolean //圆形头像展示
 }
 
 function ZupOne(
@@ -49,7 +50,8 @@ function ZupOne(
     upTxt,
     myType,
     isLook = false,
-    fromData
+    fromData,
+    isTouXiang
   }: Props,
   ref: any
 ) {
@@ -207,7 +209,10 @@ function ZupOne(
 
       {/* 为图片的情况-------------- */}
       {myType === 'thumb' ? (
-        <div className='file_img' hidden={fileUrl.filePath === ''}>
+        <div
+          className={classNames('file_img', isTouXiang ? 'file_imgYuan' : '')}
+          hidden={fileUrl.filePath === ''}
+        >
           {fileUrl ? (
             <ImageLazy
               width={100}
@@ -228,7 +233,7 @@ function ZupOne(
           </div>
 
           {/* 预览 下载 */}
-          <div className='file_lookBox'>
+          <div className='file_lookBox' hidden={isTouXiang}>
             <EyeOutlined
               onClick={() =>
                 store.dispatch({

+ 35 - 0
src/pages/A_workbench/A2business/A2editUser/index.module.scss

@@ -0,0 +1,35 @@
+.A2editUser {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .ant-modal {
+      width: 800px !important;
+    }
+    .A2Emain {
+      border-top: 1px solid #999999;
+      padding-top: 15px;
+      width: 100%;
+
+      // 封面
+      .formRow {
+        display: flex;
+        margin-bottom: 24px;
+        .formLeft {
+          width: 100px;
+          text-align: right;
+          position: relative;
+          top: 4px;
+          & > span {
+            color: #ff4d4f;
+          }
+        }
+      }
+
+      .A2Ebtn {
+        margin-top: 20px;
+        text-align: center;
+      }
+    }
+  }
+}

+ 121 - 0
src/pages/A_workbench/A2business/A2editUser/index.tsx

@@ -0,0 +1,121 @@
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, Input, Modal } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import ZupOne from '@/components/ZupOne'
+import { UserTableListType } from '@/types'
+import { A2_APIeditUser } from '@/store/action/A2business'
+import { MessageFu } from '@/utils/message'
+
+type Props = {
+  closeFu: () => void
+  userInfo: UserTableListType
+  succFu: (obj: any) => void
+}
+
+function A2editUser({ closeFu, userInfo, succFu }: Props) {
+  const [realName, setRealName] = useState('')
+
+  // 头像的ref
+  const ZupThumbRef = useRef<any>(null)
+
+  useEffect(() => {
+    setRealName(userInfo.realName)
+    // 设置头像
+    ZupThumbRef.current?.setFileComFileFu({
+      fileName: '',
+      filePath: userInfo.thumb,
+      thumb: userInfo.thumb
+    })
+  }, [userInfo])
+
+  const [fileCheck, setFileCheck] = useState(false)
+
+  const btnOk = useCallback(async () => {
+    setFileCheck(true)
+
+    // 头像
+    const coverUrl1 = ZupThumbRef.current?.fileComFileResFu()
+
+    if (!coverUrl1.thumb) return
+
+    const obj = {
+      id: userInfo.id,
+      realName,
+      thumb: coverUrl1.thumb
+    }
+
+    const res = await A2_APIeditUser(obj)
+
+    if (res.code === 0) {
+      MessageFu.success('编辑成功')
+      succFu(obj)
+      closeFu()
+    }
+  }, [closeFu, realName, succFu, userInfo.id])
+
+  return (
+    <Modal
+      wrapClassName={styles.A2editUser}
+      destroyOnClose
+      open={true}
+      title='个人资料'
+      footer={
+        [] // 设置footer为空,去掉 取消 确定默认按钮
+      }
+    >
+      <div className='A2Emain'>
+        <div className='formRow'>
+          <div className='formLeft'>
+            <span> * </span>真实姓名:
+          </div>
+          <div className='formRight'>
+            <Input
+              style={{ width: 300 }}
+              maxLength={10}
+              showCount
+              placeholder='请输入内容'
+              value={realName}
+              onChange={e => setRealName(e.target.value.replace(/\s+/g, ''))}
+            />
+          </div>
+        </div>
+
+        {/* 封面 */}
+        <div className='formRow'>
+          <div className='formLeft'>
+            <span> * </span> 头像:
+          </div>
+          <div className='formRight'>
+            <ZupOne
+              ref={ZupThumbRef}
+              isLook={false}
+              fileCheck={fileCheck}
+              size={1}
+              dirCode='businessEditUser'
+              myUrl='sys/user/upload'
+              format={['image/jpeg', 'image/png']}
+              formatTxt='png、jpg和jpeg'
+              checkTxt='请上传头像!'
+              upTxt='最多1张'
+              myType='thumb'
+              isTouXiang={true}
+            />
+          </div>
+        </div>
+
+        <div className='A2Ebtn'>
+          <Button type='primary' onClick={btnOk}>
+            提交
+          </Button>
+          &emsp;
+          <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+        </div>
+      </div>
+    </Modal>
+  )
+}
+
+const MemoA2editUser = React.memo(A2editUser)
+
+export default MemoA2editUser

+ 30 - 4
src/pages/A_workbench/A2business/index.tsx

@@ -1,4 +1,4 @@
-import React, { useCallback, useEffect } from 'react'
+import React, { useCallback, useEffect, useState } from 'react'
 import styles from './index.module.scss'
 import { useDispatch, useSelector } from 'react-redux'
 import store, { RootState } from '@/store'
@@ -6,11 +6,12 @@ import { Button } from 'antd'
 import { baseURL } from '@/utils/http'
 import baseTouXiangImg from '@/assets/img/user.png'
 import { getUserInfoByIdAPI } from '@/store/action/Z6user'
-import { changGetFu, getTokenInfo, removeTokenInfo } from '@/utils/storage'
+import { changGetFu, getTokenInfo, removeTokenInfo, setTokenInfo } from '@/utils/storage'
 import { D4_APIgetTree } from '@/store/action/Z4organization'
 import { treeLastIdFindFatherFu } from '@/pages/Z_system/Z6user/data'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import history from '@/utils/history'
+import A2editUser from './A2editUser'
 
 const rrArr = [
   {
@@ -95,6 +96,26 @@ function A2business() {
     history.push('/login')
   }
 
+  // 点击编辑个人资料
+  const [editUser, setEditUser] = useState(false)
+
+  // 更新用户信息
+  const upUserInfoFu = useCallback(
+    (obj: any) => {
+      const userInfoOld = getTokenInfo()
+      setTokenInfo({
+        ...userInfoOld,
+        user: {
+          ...userInfoOld.user,
+          thumb: obj.thumb,
+          realName: obj.realName
+        }
+      })
+      getUserInfo(obj.id)
+    },
+    [getUserInfo]
+  )
+
   return (
     <div className={styles.A2business}>
       <div className='pageTitle'>业务中心</div>
@@ -115,7 +136,7 @@ function A2business() {
             </div>
           </div>
           <div className='A2ll1_2'>
-            <Button>编辑个人资料</Button>&emsp;
+            <Button onClick={() => setEditUser(true)}>编辑个人资料</Button>&emsp;
             <Button onClick={() => store.dispatch({ type: 'layout/passEditShow', payload: true })}>
               修改密码
             </Button>
@@ -138,7 +159,7 @@ function A2business() {
               </div>
             </div>
             <div className='A2ll2RowBox'>
-              {/* 待完善 编辑个人资料 和 设置常用功能 */}
+              {/* 待完善  设置常用功能 */}
               {['入藏管理', '藏品总账', '我的关注'].map((v, i) => (
                 <div key={i} className='A2ll2Row'>
                   {v}
@@ -213,6 +234,11 @@ function A2business() {
           </div>
         ))}
       </div>
+
+      {/* 编辑个人资料 */}
+      {editUser ? (
+        <A2editUser closeFu={() => setEditUser(false)} userInfo={userInfo} succFu={upUserInfoFu} />
+      ) : null}
     </div>
   )
 }

+ 3 - 8
src/pages/B_enterTibet/B1collect/B1edit/index.tsx

@@ -188,12 +188,7 @@ function B1edit() {
         ...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,
-          siteStr: v.siteStr,
-          siteId: v.siteId
-        }))
+        collectIds: clueArr.map(v => v.id).join(',')
       }
 
       const res =
@@ -209,7 +204,7 @@ function B1edit() {
         getInfoFu()
       }
     },
-    [getInfoFu, id, topInfo]
+    [clueArr, getInfoFu, id, topInfo]
   )
 
   // 查看模式点击删除
@@ -274,7 +269,7 @@ function B1edit() {
           </Button>
         ) : null}
 
-        {EXbtnFu()}
+        {EXbtnFu(topInfo)}
 
         {btnFlagFu2(topInfo)['删除'] ? (
           <MyPopconfirm

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

@@ -296,7 +296,9 @@ function B3GaddNew({ nowSta, closeFu, succFu, isEdit }: Props) {
         const fileNew = table.map(v => v.id).join(',')
         const fileOld = (objOld.current.file || []).map((v: any) => v.id).join(',')
 
-        if (fileNew !== fileOld) flag = true
+        if (fileNew !== fileOld) flag = false
+
+        // console.log(fileNew, fileOld)
 
         for (const k in obj) {
           if (!['fileIds', 'fileSet'].includes(k)) {

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

@@ -101,6 +101,7 @@ export type C1GoodType = {
   tempSiteStr: string
   thumb: string
   thumbPc: string
+  filePath: string
   torn: string
   updateTime: string
   uses: string

+ 60 - 31
src/pages/C_goodsManage/C2files/index.tsx

@@ -1,6 +1,6 @@
 import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
-import { Button, Cascader, Checkbox, DatePicker, Input, Select } from 'antd'
+import { Button, Cascader, Checkbox, DatePicker, Input, Popconfirm, Select } from 'antd'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import Y33setType, { infoType } from '@/pages/Y_goodsDetails/Y2look/Y33setType'
 import { C2baseFormData, C2InputKeyArr } from './data'
@@ -16,8 +16,7 @@ import { fileImgArr, fileVideoArr } from '@/store/action/layout'
 import { API_C2dels, API_C2downS, C2_APIgetList } from '@/store/action/C2files'
 import { useDispatch, useSelector } from 'react-redux'
 import { RootState } from '@/store'
-import { baseURL } from '@/utils/http'
-import { resJiLianFu } from '@/utils/history'
+import { downFileFu, resJiLianFu } from '@/utils/history'
 import { MessageFu } from '@/utils/message'
 const { RangePicker } = DatePicker
 
@@ -167,18 +166,54 @@ function C2files() {
     [getListFu]
   )
 
+  // 获取下载权限
+  const downImg = useSelector((state: RootState) => state.A0Layout.downImg)
+
+  // 点击批量下载
+  const downsFu = useCallback(
+    async (type: 1 | 2) => {
+      const res = await API_C2downS(checkArr, type)
+      if (res.code === 0) {
+        MessageFu.success('下载成功')
+        downFileFu(res.data, () => {
+          setCheckArr([])
+        })
+      }
+    },
+    [checkArr]
+  )
+
   const tableLastBtn = useMemo(() => {
     return [
       {
         title: '操作',
         render: (item: GoodFileType) => {
+          const fileNameArr = item.fileName.split('.')
+          const fileNameLast = fileNameArr[fileNameArr.length - 1]
           return (
             <>
-              <Button size='small' type='text'>
-                <a href={baseURL + item.filePath} download target='_blank' rel='noreferrer'>
+              {downImg['图片'] === '原图和缩略图' && fileImgArr.includes(fileNameLast) ? (
+                <Popconfirm
+                  title='请选择图片规格'
+                  onConfirm={() => downFileFu(item.filePath)}
+                  onCancel={() => downFileFu(item.thumb)}
+                  okText='原图'
+                  cancelText='缩略图'
+                >
+                  <Button size='small' type='text'>
+                    下载
+                  </Button>
+                </Popconfirm>
+              ) : (
+                <Button
+                  size='small'
+                  type='text'
+                  onClick={() => downFileFu(item.thumb || item.filePath)}
+                >
                   下载
-                </a>
-              </Button>
+                </Button>
+              )}
+
               <>
                 <Button
                   size='small'
@@ -201,27 +236,7 @@ function C2files() {
         }
       }
     ]
-  }, [delFu])
-
-  // 点击批量下载
-  const downsFu = useCallback(async () => {
-    const res = await API_C2downS(checkArr)
-    if (res.code === 0) {
-      MessageFu.success('下载成功')
-      // 动态创建 a 标签
-      const link = document.createElement('a')
-      link.href = baseURL + res.data
-      link.style.display = 'none'
-
-      // 插入 DOM 并触发点击
-      document.body.appendChild(link)
-      link.click()
-
-      // 清理
-      document.body.removeChild(link)
-      setCheckArr([])
-    }
-  }, [checkArr])
+  }, [delFu, downImg])
 
   return (
     <div className={styles.C2files}>
@@ -242,9 +257,23 @@ function C2files() {
         </div>
 
         <div className='C2toprr'>
-          <Button type='primary' disabled={checkArr.length === 0} onClick={downsFu}>
-            批量下载
-          </Button>
+          {downImg['图片'] === '原图和缩略图' ? (
+            <Popconfirm
+              title='请选择图片规格'
+              onConfirm={() => downsFu(1)}
+              onCancel={() => downsFu(2)}
+              okText='原图'
+              cancelText='缩略图'
+            >
+              <Button type='primary' disabled={checkArr.length === 0}>
+                批量下载
+              </Button>
+            </Popconfirm>
+          ) : (
+            <Button type='primary' disabled={checkArr.length === 0} onClick={() => downsFu(2)}>
+              批量下载
+            </Button>
+          )}
           &emsp;
           <Button
             type='primary'

+ 7 - 2
src/pages/C_goodsManage/C6edit/C6add/index.tsx

@@ -351,7 +351,7 @@ function C6add() {
           </Button>
         ) : null}
 
-        {EXbtnFu()}
+        {EXbtnFu(topInfo)}
 
         {btnFlagFu2(topInfo)['删除'] ? (
           <MyPopconfirm
@@ -397,7 +397,12 @@ function C6add() {
 
       return (
         <div className='tableImgAuto'>
-          <ImageLazy width={60} height={60} srcBig={info.thumbPc} src={info.thumb} />
+          <ImageLazy
+            width={60}
+            height={60}
+            srcBig={info.thumbPc || info.filePath}
+            src={info.thumb}
+          />
         </div>
       )
     } else return item[key] || '(空)'

+ 19 - 1
src/pages/D_storeManage/D2storSet/D2edit.tsx

@@ -35,6 +35,11 @@ function D2edit({ sId, succToLookFu, closeFu }: Props) {
 
   const getInfoFu = useCallback(async (id: number) => {
     const res = await D2_APIgetInfo(id)
+    const obj = res.data
+
+    if (obj.memberUserIds)
+      obj.memberUserIds = obj.memberUserIds.split(',').map((v: string) => Number(v))
+    else obj.memberUserIds = []
     if (res.code === 0) FormBoxRef.current?.setFieldsValue(res.data)
   }, [])
 
@@ -54,7 +59,8 @@ function D2edit({ sId, succToLookFu, closeFu }: Props) {
       const res = await D2_APIedit({
         ...values,
         id: sId > 0 ? sId : null,
-        level: 1
+        level: 1,
+        memberUserIds: values.memberUserIds ? values.memberUserIds.join(',') : ''
       })
       if (res.code === 0) {
         MessageFu.success(sId > 0 ? '编辑成功' : '新增成功')
@@ -111,6 +117,18 @@ function D2edit({ sId, succToLookFu, closeFu }: Props) {
             />
           </Form.Item>
 
+          {/* 库保员 */}
+          <Form.Item label='库保员' name='memberUserIds'>
+            <Select
+              showSearch={false}
+              mode='multiple'
+              allowClear
+              style={{ width: '100%' }}
+              placeholder='请选择'
+              options={userList.map(v => ({ value: v.id, label: v.realName || v.userName }))}
+            />
+          </Form.Item>
+
           <Form.Item label='仓库说明' name='description'>
             <TextArea maxLength={500} showCount placeholder='请输入内容' />
           </Form.Item>

+ 7 - 0
src/pages/D_storeManage/D2storSet/D2look/index.module.scss

@@ -21,9 +21,16 @@
         padding-top: 15px;
         border-top: 1px #ccc solid;
         font-size: 16px;
+        display: flex;
+        flex-wrap: wrap;
         .D2Ltop2_1 {
+          width: calc(50% - 15px);
+          margin-right: 30px;
           margin-bottom: 5px;
           display: flex;
+          &:nth-of-type(2n) {
+            margin-right: 0;
+          }
           & > div {
             width: 100px;
             text-align: right;

+ 4 - 1
src/pages/D_storeManage/D2storSet/D2look/index.tsx

@@ -88,7 +88,10 @@ function D2look() {
         <div className='D2Ltop1'>
           <div className='D2Ltop1_1'>库位信息</div>
           <div>
-            <Button type='primary' onClick={() => history.push(`/storSet_site/${sId}`)}>
+            <Button
+              type='primary'
+              onClick={() => history.push(`/storSet_site/${sId}/${info.name}`)}
+            >
               设置
             </Button>
           </div>

+ 22 - 2
src/pages/Layout/index.tsx

@@ -24,12 +24,32 @@ import { Z1_APIgetDict } from '@/store/action/Z1dict'
 import store, { RootState } from '@/store'
 import { baseURL } from '@/utils/http'
 import baseTouXiangImg from '@/assets/img/user.png'
+import { Z5_APIgetInfo } from '@/store/action/Z5role'
 
 function Layout() {
+  // 获取角色下载权限
+  const getDownRole = useCallback(async () => {
+    const info = getTokenInfo().user
+    if (info && info.roleId) {
+      const res = await Z5_APIgetInfo(info.roleId)
+      if (res.code === 0) {
+        const data = res.data.role
+        store.dispatch({
+          type: 'layout/downImg',
+          payload: {
+            可见: data.scopeGoodsFile === 1 ? '可见' : '不可见',
+            图片: data.scopeGoodsFileDownload === 1 ? '原图和缩略图' : '缩略图'
+          }
+        })
+      }
+    }
+  }, [])
+
   // 用户信息存到仓库
   useEffect(() => {
     store.dispatch({ type: 'layout/userInfo', payload: (getTokenInfo() || {}).user })
-  }, [])
+    getDownRole()
+  }, [getDownRole])
 
   // 获取用户信息
   const { userInfo, passEditShow } = useSelector((state: RootState) => state.A0Layout)
@@ -242,7 +262,7 @@ function Layout() {
             <div className='userNameBox' onClick={() => setIsUserBtnShow(true)}>
               <img src={userInfo.thumb ? baseURL + userInfo.thumb : baseTouXiangImg} alt='' />
 
-              {getTokenInfo().user.realName || getTokenInfo().user.userName || '匿名'}
+              {userInfo.realName || userInfo.userName || '匿名'}
 
               <div className='userInco userInco2'>
                 <CaretRightOutlined />

+ 6 - 1
src/pages/Y_goodsDetails/Y1cathet/Y11com.tsx

@@ -22,7 +22,12 @@ function Y11com({ info }: Props) {
           ))}
         </div>
         <div className='Y1rowZrr'>
-          <ImageLazy width={200} height={200} srcBig={info.thumbPc} src={info.thumb} />
+          <ImageLazy
+            width={200}
+            height={200}
+            srcBig={info.thumbPc || info.filePath}
+            src={info.thumb}
+          />
         </div>
       </div>
 

+ 121 - 78
src/pages/Y_goodsDetails/Y1cathet/Y33com.tsx

@@ -1,5 +1,5 @@
 import React, { useCallback, useEffect, useMemo, useState } from 'react'
-import { Button, Checkbox } from 'antd'
+import { Button, Checkbox, Popconfirm } from 'antd'
 import MyTable from '@/components/MyTable'
 import { Y33tableC } from '@/utils/tableData'
 import ImageLazy from '@/components/ImageLazy'
@@ -9,10 +9,11 @@ import YtableVideo from '@/components/YtableVideo'
 import { GoodFileType } from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew/type'
 import { selectObj } from '@/utils/select'
 import { fileImgArr, fileVideoArr } from '@/store/action/layout'
-import { resJiLianFu } from '@/utils/history'
-import { baseURL } from '@/utils/http'
+import { downFileFu, resJiLianFu } from '@/utils/history'
 import { API_C2dels, API_C2downS, API_goodFileList } from '@/store/action/C2files'
 import { MessageFu } from '@/utils/message'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
 
 type Props = {
   isLook?: boolean
@@ -114,19 +115,39 @@ function Y33com({ isLook, sId }: Props) {
     },
     [getListFu]
   )
+  // 获取下载权限
+  const downImg = useSelector((state: RootState) => state.A0Layout.downImg)
 
   const tableLastBtn = useMemo(() => {
     return [
       {
         title: '操作',
         render: (item: GoodFileType) => {
+          const fileNameArr = item.fileName.split('.')
+          const fileNameLast = fileNameArr[fileNameArr.length - 1]
           return (
             <>
-              <Button size='small' type='text'>
-                <a href={baseURL + item.filePath} download target='_blank' rel='noreferrer'>
+              {downImg['图片'] === '原图和缩略图' && fileImgArr.includes(fileNameLast) ? (
+                <Popconfirm
+                  title='请选择图片规格'
+                  onConfirm={() => downFileFu(item.filePath)}
+                  onCancel={() => downFileFu(item.thumb)}
+                  okText='原图'
+                  cancelText='缩略图'
+                >
+                  <Button size='small' type='text'>
+                    下载
+                  </Button>
+                </Popconfirm>
+              ) : (
+                <Button
+                  size='small'
+                  type='text'
+                  onClick={() => downFileFu(item.thumb || item.filePath)}
+                >
                   下载
-                </a>
-              </Button>
+                </Button>
+              )}
               {isLook ? (
                 <>
                   <Button
@@ -151,85 +172,107 @@ function Y33com({ isLook, sId }: Props) {
         }
       }
     ]
-  }, [delFu, isLook])
+  }, [delFu, downImg, isLook])
 
   const [typeMo, setTypeMo] = useState({} as infoType)
 
   // 点击批量下载
-  const downsFu = useCallback(async () => {
-    const res = await API_C2downS(checkArr)
-    if (res.code === 0) {
-      MessageFu.success('下载成功')
-      // 动态创建 a 标签
-      const link = document.createElement('a')
-      link.href = baseURL + res.data
-      link.style.display = 'none'
-
-      // 插入 DOM 并触发点击
-      document.body.appendChild(link)
-      link.click()
-
-      // 清理
-      document.body.removeChild(link)
-      setCheckArr([])
-    }
-  }, [checkArr])
+  const downsFu = useCallback(
+    async (type: 1 | 2) => {
+      const res = await API_C2downS(checkArr, type)
+      if (res.code === 0) {
+        MessageFu.success('下载成功')
+        downFileFu(res.data, () => {
+          setCheckArr([])
+        })
+      }
+    },
+    [checkArr]
+  )
 
   return (
     <div className='Y33com'>
-      <div className='Y33top'>
-        <div className='Y33topll'>
-          {[{ label: '全部', value: '' }, ...selectObj['附件类型']].map(v => (
-            <Button
-              key={v.value}
-              onClick={() => {
-                setBtnAc(v.value)
-                setCheckArr([])
-              }}
-              type={btnAc === v.value ? 'primary' : 'default'}
-            >
-              {v.label}
-            </Button>
-          ))}
-        </div>
-        {isLook ? (
-          <div className='Y33toprr'>
-            <Button type='primary' disabled={checkArr.length === 0} onClick={downsFu}>
-              批量下载
-            </Button>
-            &emsp;
-            <Button
-              type='primary'
-              disabled={checkArr.length === 0}
-              onClick={() =>
-                setTypeMo({
-                  ids: checkArr,
-                  type: '',
-                  effect: '',
-                  flag: '多个'
-                })
-              }
-            >
-              批量设置
-            </Button>
+      {downImg['可见'] === '可见' ? (
+        <>
+          <div className='Y33top'>
+            <div className='Y33topll'>
+              {[{ label: '全部', value: '' }, ...selectObj['附件类型']].map(v => (
+                <Button
+                  key={v.value}
+                  onClick={() => {
+                    setBtnAc(v.value)
+                    setCheckArr([])
+                  }}
+                  type={btnAc === v.value ? 'primary' : 'default'}
+                >
+                  {v.label}
+                </Button>
+              ))}
+            </div>
+            {isLook ? (
+              <div className='Y33toprr'>
+                {downImg['图片'] === '原图和缩略图' ? (
+                  <Popconfirm
+                    title='请选择图片规格'
+                    onConfirm={() => downsFu(1)}
+                    onCancel={() => downsFu(2)}
+                    okText='原图'
+                    cancelText='缩略图'
+                  >
+                    <Button type='primary' disabled={checkArr.length === 0}>
+                      批量下载
+                    </Button>
+                  </Popconfirm>
+                ) : (
+                  <Button
+                    type='primary'
+                    disabled={checkArr.length === 0}
+                    onClick={() => downsFu(2)}
+                  >
+                    批量下载
+                  </Button>
+                )}
+                &emsp;
+                <Button
+                  type='primary'
+                  disabled={checkArr.length === 0}
+                  onClick={() =>
+                    setTypeMo({
+                      ids: checkArr,
+                      type: '',
+                      effect: '',
+                      flag: '多个'
+                    })
+                  }
+                >
+                  批量设置
+                </Button>
+              </div>
+            ) : null}
           </div>
-        ) : null}
-      </div>
-
-      {/* 表格 */}
-      <MyTable
-        classKey='Y33comTable'
-        yHeight={isLook ? 640 : 666}
-        list={tableObj[btnAc] || []}
-        columnsTemp={Y33tableC}
-        lastBtn={tableLastBtn}
-        startBtn={startBtn}
-        pagingInfo={false}
-      />
-
-      {typeMo.flag ? (
-        <Y33setType succFu={getListFu} info={typeMo} closeFu={() => setTypeMo({} as infoType)} />
-      ) : null}
+
+          {/* 表格 */}
+          <MyTable
+            classKey='Y33comTable'
+            yHeight={isLook ? 640 : 666}
+            list={tableObj[btnAc] || []}
+            columnsTemp={Y33tableC}
+            lastBtn={tableLastBtn}
+            startBtn={startBtn}
+            pagingInfo={false}
+          />
+
+          {typeMo.flag ? (
+            <Y33setType
+              succFu={getListFu}
+              info={typeMo}
+              closeFu={() => setTypeMo({} as infoType)}
+            />
+          ) : null}
+        </>
+      ) : (
+        <div className='Y33no'>没有权限</div>
+      )}
     </div>
   )
 }

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

@@ -4,7 +4,7 @@
   right: -900px;
   width: 900px;
   height: 100%;
-  z-index: 9990;
+  z-index: 999;
   background-color: #fff;
   box-shadow: 1px 1px 4px 4px #ccc;
   padding: 24px;
@@ -197,6 +197,14 @@
               margin-right: 15px;
             }
           }
+          .Y33no {
+            font-size: 16px;
+            letter-spacing: 4px;
+            height: 200px;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+          }
         }
       }
     }

+ 9 - 0
src/pages/Y_goodsDetails/Y2look/index.module.scss

@@ -207,6 +207,15 @@
             }
           }
         }
+        .Y33no {
+          font-weight: 700;
+          font-size: 16px;
+          letter-spacing: 4px;
+          height: 200px;
+          display: flex;
+          align-items: center;
+          padding-left: 100px;
+        }
       }
 
       // ----------------藏品日志

+ 156 - 36
src/pages/Z_system/Z5role/Z5edit.tsx

@@ -1,12 +1,25 @@
 import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
-import { Button, Checkbox, Form, FormInstance, Input, InputNumber, Modal, Radio } from 'antd'
+import {
+  Button,
+  Checkbox,
+  Form,
+  FormInstance,
+  Input,
+  InputNumber,
+  Modal,
+  Radio,
+  Select
+} from 'antd'
 import TextArea from 'antd/es/input/TextArea'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import { Z5_APIgetAddTreeList, Z5_APIgetInfo, Z5_APIsave } from '@/store/action/Z5role'
 import { TypeZ5Role } from './type'
 import classNmaes from 'classnames'
 import { MessageFu } from '@/utils/message'
+import { useDispatch, useSelector } from 'react-redux'
+import { D2_APIgetList } from '@/store/action/D2storSet'
+import { RootState } from '@/store'
 
 type Props = {
   sId: number
@@ -23,8 +36,16 @@ function Z5edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
   const getInfoFu = useCallback(async (id: number) => {
     const res = await Z5_APIgetInfo(id)
     if (res.code === 0) {
-      FormBoxRef.current?.setFieldsValue(res.data.role)
-      setRoleArr(res.data.permission)
+      const data: any = res.data
+
+      FormBoxRef.current?.setFieldsValue(data.role)
+      setRoleArr(data.permission)
+
+      setScopeGoodsFile(data.role.scopeGoodsFile)
+      setScopeGoodsFileDownload(data.role.scopeGoodsFileDownload)
+      setScopeStorage(data.role.scopeStorage)
+      if (data.role.scopeStorageIds)
+        setScopeStorageIds(data.role.scopeStorageIds.split(',').map((v: string) => Number(v)))
     }
   }, [])
 
@@ -55,6 +76,9 @@ function Z5edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
     } else {
       FormBoxRef.current?.setFieldsValue({ sort: 999, dataScope: 2 })
       getAddInfoFu()
+      setScopeGoodsFile(1)
+      setScopeGoodsFileDownload(2)
+      setScopeStorage(1)
     }
   }, [getAddInfoFu, getInfoFu, sId])
 
@@ -93,13 +117,37 @@ function Z5edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
     // return MessageFu.warning("有表单不符号规则!");
   }, [])
 
+  // 藏品附件权限
+  const [scopeGoodsFile, setScopeGoodsFile] = useState(-1)
+  const [scopeGoodsFileDownload, setScopeGoodsFileDownload] = useState(-1)
+
+  // 库房权限
+  const [scopeStorage, setScopeStorage] = useState(-1)
+  // 指定库房数据
+  const [scopeStorageIds, setScopeStorageIds] = useState<number[]>([])
+  const dispatch = useDispatch()
+  useEffect(() => {
+    dispatch(D2_APIgetList({ pageNum: 1, pageSize: 99999 }))
+  }, [dispatch])
+
+  const { list: storSetList } = useSelector((state: RootState) => state.D2storSet.tableInfo)
+
   // 通过校验点击确定
   const onFinish = useCallback(
     async (values: any) => {
+      if (scopeStorage === 3) {
+        if (!scopeStorageIds || scopeStorageIds.length === 0)
+          return MessageFu.warning('至少选中一个指定库房')
+      }
+
       const obj = {
         ...values,
         id: sId > 0 ? sId : null,
-        resources: checkIds
+        resources: checkIds,
+        scopeGoodsFile,
+        scopeGoodsFileDownload,
+        scopeStorage,
+        scopeStorageIds: scopeStorageIds.join(',')
       }
 
       const res = await Z5_APIsave(obj)
@@ -110,7 +158,17 @@ function Z5edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
         closeFu()
       }
     },
-    [addTableFu, checkIds, closeFu, editTableFu, sId]
+    [
+      addTableFu,
+      checkIds,
+      closeFu,
+      editTableFu,
+      sId,
+      scopeGoodsFile,
+      scopeGoodsFileDownload,
+      scopeStorage,
+      scopeStorageIds
+    ]
   )
 
   return (
@@ -157,7 +215,42 @@ function Z5edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
             </div>
           </div>
 
-          <Form.Item label='数据权限' name='dataScope' rules={[{ required: true, message: '' }]}>
+          <div className='Z5ebox'>
+            <div className='Z5eboxll'>
+              <span> * </span> 功能权限:
+            </div>
+            <div className='Z5eboxrr'>
+              {roleArr.map(v => (
+                <div key={v.id} className='Z5eRow'>
+                  <div className='Z5eRow1'>{v.name}</div>
+                  <div className='Z5eRow2'>
+                    {v.children.map(c => (
+                      <Checkbox
+                        disabled={c.name === '角色管理'}
+                        key={c.id}
+                        checked={c.authority}
+                        onChange={e => onChange(e.target.checked, v.id, c.id)}
+                      >
+                        {c.name}
+                        {c.name === '角色管理' ? '(超级管理员才有)' : ''}
+                      </Checkbox>
+                    ))}
+                  </div>
+                </div>
+              ))}
+
+              <div className={classNmaes('Z5eErr', checkIds.length <= 0 ? 'Z5eErrAc' : '')}>
+                至少选中一个
+              </div>
+            </div>
+          </div>
+          <br />
+          <Form.Item
+            className='Z5ebox0'
+            label='数据权限'
+            name='dataScope'
+            rules={[{ required: true, message: '' }]}
+          >
             <Radio.Group>
               <Radio value={0} className='Z5Rtit'>
                 流程可见权限
@@ -167,6 +260,63 @@ function Z5edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
             </Radio.Group>
           </Form.Item>
 
+          <div className='Z5ebox Z5ebox1'>
+            <div className='Z5eboxll'>藏品附件权限</div>
+            <div className='Z5eboxrr'>
+              <div>
+                <Radio.Group
+                  value={scopeGoodsFile}
+                  onChange={e => setScopeGoodsFile(e.target.value)}
+                  options={[
+                    { value: 1, label: '可见' },
+                    { value: 0, label: '不可见' }
+                  ]}
+                />
+              </div>
+              <div className='Z5eboxrr_1'>
+                <Radio.Group
+                  disabled={scopeGoodsFile === 0}
+                  value={scopeGoodsFileDownload}
+                  onChange={e => setScopeGoodsFileDownload(e.target.value)}
+                  options={[
+                    { value: 1, label: '下载原图和缩略图' },
+                    { value: 2, label: '仅下载缩略图' }
+                  ]}
+                />
+              </div>
+            </div>
+          </div>
+          <br />
+          <div className='Z5ebox Z5ebox1'>
+            <div className='Z5eboxll'>库房权限</div>
+            <div className='Z5eboxrr'>
+              <div>
+                <Radio.Group
+                  value={scopeStorage}
+                  onChange={e => setScopeStorage(e.target.value)}
+                  options={[
+                    { value: 1, label: '全部库房' },
+                    { value: 2, label: '相关库房' },
+                    { value: 3, label: '指定库房' }
+                  ]}
+                />
+              </div>
+              <div className='Z5eboxrr_1' hidden={scopeStorage !== 3}>
+                <Select
+                  showSearch={false}
+                  mode='multiple'
+                  allowClear
+                  style={{ width: '100%' }}
+                  placeholder='请选择'
+                  value={scopeStorageIds}
+                  onChange={value => setScopeStorageIds(value)}
+                  options={storSetList}
+                  fieldNames={{ value: 'id', label: 'name' }}
+                />
+              </div>
+            </div>
+          </div>
+
           {/* 确定和取消按钮 */}
           <br />
           <Form.Item wrapperCol={{ offset: 9, span: 16 }} className='Z5eBtn'>
@@ -178,36 +328,6 @@ function Z5edit({ sId, closeFu, addTableFu, editTableFu }: Props) {
             <MyPopconfirm txtK='取消' onConfirm={closeFu} />
           </Form.Item>
         </Form>
-
-        <div className='Z5ebox Z5ebox0'>
-          <div className='Z5eboxll'>
-            <span> * </span> 功能权限:
-          </div>
-          <div className='Z5eboxrr'>
-            {roleArr.map(v => (
-              <div key={v.id} className='Z5eRow'>
-                <div className='Z5eRow1'>{v.name}</div>
-                <div className='Z5eRow2'>
-                  {v.children.map(c => (
-                    <Checkbox
-                      disabled={c.name === '角色管理'}
-                      key={c.id}
-                      checked={c.authority}
-                      onChange={e => onChange(e.target.checked, v.id, c.id)}
-                    >
-                      {c.name}
-                      {c.name === '角色管理' ? '(超级管理员才有)' : ''}
-                    </Checkbox>
-                  ))}
-                </div>
-              </div>
-            ))}
-
-            <div className={classNmaes('Z5eErr', checkIds.length <= 0 ? 'Z5eErrAc' : '')}>
-              至少选中一个
-            </div>
-          </div>
-        </div>
       </div>
     </Modal>
   )

+ 13 - 1
src/pages/Z_system/Z5role/index.module.scss

@@ -24,6 +24,7 @@
     }
 
     .ant-modal {
+      top: 30px !important;
       width: 1100px !important;
     }
 
@@ -71,7 +72,8 @@
       }
       .Z5Rtit {
         pointer-events: none;
-        margin: 0 30px 0 20px;
+        width: 142px;
+        text-align: center;
         .ant-radio {
           display: none;
         }
@@ -120,11 +122,21 @@
             opacity: 1;
             top: 0;
           }
+          .Z5eboxrr_1 {
+            margin-top: 5px;
+          }
         }
       }
       .Z5ebox0 {
         margin-top: -24px;
       }
+      .Z5ebox1 {
+        .Z5eboxll {
+          width: 150px;
+          text-align: left;
+        }
+        padding-left: 110px;
+      }
     }
   }
 }

+ 8 - 0
src/store/action/A2business.ts

@@ -0,0 +1,8 @@
+import http from '@/utils/http'
+
+/**
+ * 业务中心-编辑用户信息
+ */
+export const A2_APIeditUser = (data: any) => {
+  return http.post('sys/user/editInfo', data)
+}

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

@@ -35,8 +35,8 @@ export const API_goodFileList = (id: number) => {
 /**
  * 批量下载
  */
-export const API_C2downS = (data: number[]) => {
-  return http.post('cms/goodsFile/downloadBatch', data)
+export const API_C2downS = (data: number[], type: 1 | 2) => {
+  return http.post(`cms/goodsFile/downloadBatch?downloadType=${type}`, data)
 }
 
 /**

+ 15 - 1
src/store/reducer/layout.ts

@@ -1,6 +1,11 @@
 import { LookDomType, UserTableListType } from '@/types'
 import { MessageType } from '@/utils/message'
 
+type DownImgType = {
+  可见: '可见' | '不可见'
+  图片: '原图和缩略图' | '缩略图'
+}
+
 // 初始化状态
 const initState = {
   // 所有图片点击预览查看大图
@@ -28,7 +33,12 @@ const initState = {
   // 用户信息
   userInfo: {} as UserTableListType,
   // 修改密码
-  passEditShow: false
+  passEditShow: false,
+  // 下载图片的权限
+  downImg: {
+    可见: '不可见',
+    图片: '缩略图'
+  } as DownImgType
 }
 
 // 定义 action 类型
@@ -45,6 +55,7 @@ type LayoutActionType =
     }
   | { type: 'layout/userInfo'; payload: UserTableListType }
   | { type: 'layout/passEditShow'; payload: boolean }
+  | { type: 'layout/downImg'; payload: DownImgType }
 
 // 频道 reducer
 export default function layoutReducer(state = initState, action: LayoutActionType) {
@@ -68,6 +79,9 @@ export default function layoutReducer(state = initState, action: LayoutActionTyp
     // 修改密码
     case 'layout/passEditShow':
       return { ...state, passEditShow: action.payload }
+    // 下载图片的权限
+    case 'layout/downImg':
+      return { ...state, downImg: action.payload }
     default:
       return state
   }

+ 16 - 0
src/utils/history.ts

@@ -7,6 +7,7 @@ import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
 import { TypeZ4Tree } from '@/pages/Z_system/Z4organization/type'
 import { KuIsTreeType } from '@/pages/D_storeManage/D4impStor/type'
 import { cascaderArr } from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew/data'
+import { baseURL } from './http'
 const history = createHashHistory()
 export default history
 
@@ -347,3 +348,18 @@ export const cascaderObjFu = (): any => {
   }
   return obj
 }
+
+// --------------生成A标签下载--------------------
+export const downFileFu = (url: string, back?: () => void) => {
+  // 动态创建 a 标签
+  const link = document.createElement('a')
+  link.href = baseURL + url
+  link.target = '_blank'
+  link.style.display = 'none'
+  // 插入 DOM 并触发点击
+  document.body.appendChild(link)
+  link.click()
+  // 清理
+  document.body.removeChild(link)
+  if (back) back()
+}