Browse Source

写不动了

shaogen1995 4 months ago
parent
commit
7f1d1c2a9f

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

@@ -1,4 +1,141 @@
 .A2business {
+  display: flex;
+  justify-content: space-between;
+  font-size: 16px;
   :global {
+    .A2tit {
+      height: 52px;
+      font-weight: 700;
+      font-size: 18px;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      margin-bottom: 10px;
+    }
+    .A2none {
+      width: 100%;
+      height: 70px;
+      font-weight: 700;
+      font-size: 18px;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+    }
+
+    .A2ll {
+      width: calc(100% - 190px);
+      height: 100%;
+      overflow-y: auto;
+      margin-right: 20px;
+
+      .A2ll1 {
+        height: 100px;
+        background-color: #dddddd;
+        border-radius: 10px;
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        padding: 0 24px;
+        .A2ll1_1 {
+          display: flex;
+          img {
+            width: 70px;
+            height: 70px;
+            border-radius: 50%;
+          }
+          .A2ll1_1Txt {
+            margin-left: 30px;
+            & > h1 {
+              font-size: 18px;
+            }
+            & > p {
+              margin-top: 20px;
+            }
+          }
+        }
+      }
+
+      .A2ll2 {
+        margin-top: 15px;
+        display: flex;
+        justify-content: space-between;
+        min-height: 27.3%;
+
+        .A2ll2_1 {
+          width: calc(100% - 520px);
+          padding: 10px 20px 0px;
+          background-color: #fff;
+          border-radius: 10px;
+        }
+        .A2ll2_2 {
+          width: 500px;
+          margin-left: 20px;
+          padding: 10px 20px 0px;
+          background-color: #fff;
+          border-radius: 10px;
+        }
+
+        .A2ll2RowBox {
+          display: flex;
+          flex-wrap: wrap;
+          align-items: center;
+          .A2ll2Row {
+            border: 2px solid #dddddd;
+            cursor: pointer;
+            transition: all 0.3s;
+            margin-right: 20px;
+            margin-bottom: 20px;
+            height: 90px;
+            width: 100px;
+            background-color: #dddddd;
+            border-radius: 10px;
+            display: flex;
+            flex-direction: column;
+            justify-content: center;
+            align-items: center;
+            font-weight: 700;
+            &:hover {
+              border-color: var(--themeColor);
+            }
+            & > p {
+              margin-top: 10px;
+            }
+          }
+        }
+      }
+      .A2ll2Full {
+        background-color: #fff;
+        border-radius: 10px;
+        padding: 10px 20px 0px;
+        display: block;
+      }
+    }
+    .A2rr {
+      width: 170px;
+      background-color: #fff;
+      border-radius: 10px;
+      padding: 20px;
+      & > h1 {
+        font-size: 18px;
+      }
+      .A2rrRow {
+        margin-top: 36%;
+        width: 100%;
+        height: 12%;
+        background-color: #dddddd;
+        border-radius: 10px;
+        display: flex;
+        align-items: center;
+        & > div {
+          text-align: center;
+          &:nth-of-type(1) {
+            width: 60%;
+          }
+          &:nth-of-type(2) {
+            width: 40%;
+          }
+        }
+      }
+    }
   }
 }

+ 205 - 2
src/pages/A_workbench/A2business/index.tsx

@@ -1,10 +1,213 @@
-import React from 'react'
+import React, { useCallback, useEffect } from 'react'
 import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import store, { RootState } from '@/store'
+import { Button, Dropdown } 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 { D4_APIgetTree } from '@/store/action/Z4organization'
+import { treeLastIdFindFatherFu } from '@/pages/Z_system/Z6user/data'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import history from '@/utils/history'
+
+const rrArr = [
+  {
+    name: '草稿',
+    num: 6,
+    key: [
+      { key: 1, label: '藏品入馆 4' },
+      { key: 2, label: '藏品入藏 2' }
+    ]
+  },
+  {
+    name: '待提交',
+    num: 6,
+    key: [
+      { key: 1, label: '藏品入馆 4' },
+      { key: 2, label: '藏品入藏 2' }
+    ]
+  },
+  {
+    name: '待审批',
+    num: 6,
+    key: [
+      { key: 1, label: '藏品入馆 4' },
+      { key: 2, label: '藏品入藏 2' }
+    ]
+  },
+  {
+    name: '未通过',
+    num: 6,
+    key: [
+      { key: 1, label: '藏品入馆 4' },
+      { key: 2, label: '藏品入藏 2' }
+    ]
+  },
+  {
+    name: '已完成',
+    num: 6,
+    key: [
+      { key: 1, label: '藏品入馆 4' },
+      { key: 2, label: '藏品入藏 2' }
+    ]
+  }
+]
+
+const arr3 = [
+  { name: '藏品征集', num: 6 },
+  { name: '藏品鉴定', num: 6 },
+  { name: '藏品入馆', num: 6 },
+  { name: '藏品入藏', num: 6 },
+  { name: '藏品出库', num: 6 },
+  { name: '藏品移库', num: 6 }
+]
+
 function A2business() {
+  const getUserInfo = useCallback(async (id: number) => {
+    const res = await getUserInfoByIdAPI(id)
+    if (res.code === 0) {
+      store.dispatch({ type: 'layout/userInfo', payload: res.data })
+    }
+  }, [])
+
+  useEffect(() => {
+    const userInfo = getTokenInfo().user
+    if (userInfo && userInfo.id) getUserInfo(userInfo.id)
+  }, [getUserInfo])
+
+  // 获取组织管理列表
+  const dispatch = useDispatch()
+  useEffect(() => {
+    dispatch(D4_APIgetTree())
+  }, [dispatch])
+
+  const { treeData } = useSelector((state: RootState) => state.Z4organization)
+
+  const { userInfo } = useSelector((state: RootState) => state.A0Layout)
+
+  // 点击退出登录
+  const loginExit = () => {
+    removeTokenInfo()
+    history.push('/login')
+  }
+
   return (
     <div className={styles.A2business}>
       <div className='pageTitle'>业务中心</div>
-      <p>待开发</p>
+      <div className='A2ll'>
+        {/* 顶部盒子 */}
+        <div className='A2ll1'>
+          <div className='A2ll1_1'>
+            <img src={userInfo.thumb ? baseURL + userInfo.thumb : baseTouXiangImg} alt='' />
+            <div className='A2ll1_1Txt'>
+              <h1>{userInfo.realName || userInfo.userName || '匿名'}</h1>
+              <p>
+                {userInfo.userName}&emsp;
+                {userInfo.deptId
+                  ? treeLastIdFindFatherFu(treeData, userInfo.deptId + '', 'name').join(' / ')
+                  : '-'}
+                &emsp;|&emsp;{userInfo.roleName}
+              </p>
+            </div>
+          </div>
+          <div className='A2ll1_2'>
+            <Button>编辑个人资料</Button>&emsp;
+            <Button onClick={() => store.dispatch({ type: 'layout/passEditShow', payload: true })}>
+              修改密码
+            </Button>
+            &emsp;
+            <MyPopconfirm
+              txtK='退出登录'
+              onConfirm={loginExit}
+              Dom={<Button>退出登录</Button>}
+              loc='bottom'
+            />
+          </div>
+        </div>
+        <div className='A2ll2'>
+          {/* 常用功能*/}
+          <div className='A2ll2_1'>
+            <div className='A2tit'>
+              <div>常用功能</div>
+              <div>
+                <Button>设置</Button>
+              </div>
+            </div>
+            <div className='A2ll2RowBox'>
+              {/* 待完善 编辑个人资料 和 设置常用功能 */}
+              {['入藏管理', '藏品总账', '我的关注'].map((v, i) => (
+                <div key={i} className='A2ll2Row'>
+                  {v}
+                </div>
+              ))}
+            </div>
+          </div>
+          {/* 最近使用 */}
+          <div className='A2ll2_2'>
+            <div className='A2tit'>最近使用</div>
+            <div className='A2ll2RowBox'>
+              {changGetFu().length ? (
+                changGetFu().map((v, i) => (
+                  <div key={i} className='A2ll2Row' onClick={() => history.push(v.path)}>
+                    {v.name}
+                  </div>
+                ))
+              ) : (
+                <div className='A2none'>暂无信息</div>
+              )}
+            </div>
+          </div>
+        </div>
+
+        {/* 待审批 */}
+        <div className='A2ll2 A2ll2Full'>
+          <div className='A2tit'>待审批</div>
+          <div className='A2ll2RowBox'>
+            {arr3.length ? (
+              arr3.map((v, i) => (
+                <div key={i} className='A2ll2Row'>
+                  {v.name}
+                  <p>{v.num}</p>
+                </div>
+              ))
+            ) : (
+              <div className='A2none'>暂无信息</div>
+            )}
+          </div>
+        </div>
+
+        {/* 抄送未读 */}
+        <div className='A2ll2 A2ll2Full'>
+          <div className='A2tit'>抄送未读</div>
+          <div className='A2ll2RowBox'>
+            {arr3.length ? (
+              arr3.map((v, i) => (
+                <div key={i} className='A2ll2Row'>
+                  {v.name}
+                  <p>{v.num}</p>
+                </div>
+              ))
+            ) : (
+              <div className='A2none'>暂无信息</div>
+            )}
+          </div>
+        </div>
+      </div>
+      {/* 右边我的申请 */}
+      <div className='A2rr'>
+        <h1>我的申请</h1>
+
+        {rrArr.map(item => (
+          <Dropdown key={item.name} menu={{ items: item.key }} placement='bottom' arrow>
+            <div className='A2rrRow'>
+              <div>{item.name}</div>
+              <div>{item.num}</div>
+            </div>
+          </Dropdown>
+        ))}
+      </div>
     </div>
   )
 }

+ 2 - 2
src/pages/B_enterTibet/B3_4page/index.tsx

@@ -36,8 +36,8 @@ export const B3_4inputKeyArr: {
   name: string
   key: D3InputKeyType
 }[] = [
-  { name: '申请编号', key: 'aaaa' },
-  { name: '业务名称', key: 'bbbb' },
+  { name: '业务单号', key: 'aaaa' },
+  { name: '申请名称', key: 'bbbb' },
   { name: '发起部门', key: 'cccc' },
   { name: '发起人', key: 'dddd' }
 ]

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

@@ -591,7 +591,7 @@ function B3GaddNew({ nowSta, closeFu, succFu }: Props) {
             {/* 表格 */}
             <MyTable
               list={table}
-              columnsTemp={Y33tableC('新增')}
+              columnsTemp={Y33tableC}
               lastBtn={tableLastBtn}
               startBtn={startBtn}
               pagingInfo={false}

+ 3 - 2
src/pages/B_enterTibet/B3goodsTable/B3GaddNow/index.tsx

@@ -8,6 +8,7 @@ import { openGoodsInfoFu } from '@/utils/history'
 import { MessageFu } from '@/utils/message'
 import { C1GoodType } from '@/pages/C_goodsManage/C1ledger/type'
 import { API_goodsNowAdd } from '@/store/action/C1ledger'
+import { selectObj } from '@/utils/select'
 
 type Props = {
   closeFu: () => void
@@ -134,8 +135,8 @@ function B3GaddNow({ nowSta, closeFu, isOne = false, dataResFu, oldCheckArr }: P
             </div>
 
             <div>
-              <span>藏品总登记号:</span>
-              <Select />
+              <span>编号类型:</span>
+              <Select options={selectObj['藏品编号类型']} defaultValue='藏品总登记号' />
             </div>
             <div>
               <span>文物级别:</span>

+ 1 - 1
src/pages/C_goodsManage/C1ledger/data.ts

@@ -41,7 +41,7 @@ export const C1InputKeyArr1: {
   key: C1InputKeyType
   type: '输入框' | '下拉框' | '级联'
 }[] = [
-  { name: '藏品总登记号', key: 'aaaa', type: '下拉框' },
+  { name: '编号类型', key: 'aaaa', type: '下拉框' },
   { name: '藏品编号', key: 'bbbb', type: '输入框' },
   { name: '藏品名称', key: 'cccc', type: '输入框' },
   { name: '文物级别', key: 'dddd', type: '级联' },

+ 31 - 10
src/pages/C_goodsManage/C2files/data.ts

@@ -1,27 +1,48 @@
+import { selectObj } from '@/utils/select'
 import { C2InputKeyType, TypeC2Form } from './type'
+import { cascaderArr } from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew/data'
+import { TypeZ1dict } from '@/pages/Z_system/Z1dict/type'
+import store from '@/store'
 
 export const C2baseFormData: TypeC2Form = {
-  aaaa: '',
+  // 待完善 编号类型,藏品编号 effect用途
+  aaaa: '藏品总登记号',
   bbbb: '',
-  cccc: '',
-  dddd: '',
-  eeee: '',
+  goodName: '',
+  fileName: '',
+  effect: '',
+  creatorName: '',
   startTime: '',
   endTime: '',
-  ffff: '',
   pageNum: 1,
   pageSize: 10
 }
 
+// 级联数据平铺
+let dictAll: TypeZ1dict[] = []
+
+export const cascaderFu = (val: string) => {
+  if (dictAll && dictAll.length === 0) {
+    dictAll = store.getState().Z1dict.dictAll
+  }
+
+  let obj: any = {}
+  if (dictAll && dictAll.length) {
+    obj = cascaderArr(dictAll)
+  }
+  return obj[val]
+}
+
 export const C2InputKeyArr: {
   name: string
   key: C2InputKeyType
   type: '输入框' | '下拉框' | '级联'
+  data?: any[]
 }[] = [
-  { name: '藏品总登记号', key: 'aaaa', type: '下拉框' },
+  { name: '编号类型', key: 'aaaa', type: '下拉框', data: selectObj['藏品编号类型'] },
   { name: '藏品编号', key: 'bbbb', type: '输入框' },
-  { name: '藏品名称', key: 'cccc', type: '输入框' },
-  { name: '附件名称', key: 'dddd', type: '输入框' },
-  { name: '用途', key: 'dddd', type: '级联' },
-  { name: '上传人', key: 'dddd', type: '输入框' }
+  { name: '藏品名称', key: 'goodName', type: '输入框' },
+  { name: '附件名称', key: 'fileName', type: '输入框' },
+  { name: '用途', key: 'effect', type: '级联', data: cascaderFu('附件用途') },
+  { name: '上传人', key: 'creatorName', type: '输入框' }
 ]

+ 84 - 41
src/pages/C_goodsManage/C2files/index.tsx

@@ -13,9 +13,17 @@ import { C2tableC } from '@/utils/tableData'
 import { GoodFileType } from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew/type'
 import { selectObj } from '@/utils/select'
 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 { MessageFu } from '@/utils/message'
 const { RangePicker } = DatePicker
 
 function C2files() {
+  const dispatch = useDispatch()
+
   const [formData, setFormData] = useState(C2baseFormData)
   const formDataRef = useRef(C2baseFormData)
 
@@ -23,7 +31,7 @@ function C2files() {
     formDataRef.current = formData
   }, [formData])
 
-  const [btnAc, setBtnAc] = useState('全部')
+  const [btnAc, setBtnAc] = useState('')
 
   // 点击搜索的 时间戳
   const [timeKey, setTimeKey] = useState(0)
@@ -52,8 +60,9 @@ function C2files() {
 
   // 封装发送请求的函数
   const getListFu = useCallback(() => {
-    console.log('发送请求', { ...formDataRef.current, type: btnAc })
-  }, [btnAc])
+    dispatch(C2_APIgetList({ ...formDataRef.current, type: btnAc }))
+    setCheckArr([])
+  }, [btnAc, dispatch])
 
   useEffect(() => {
     getListFu()
@@ -101,22 +110,20 @@ function C2files() {
   )
 
   // 批量和单个设置
-
   const [typeMo, setTypeMo] = useState({} as infoType)
 
+  const tableInfo = useSelector((state: RootState) => state.C2files.tableInfo)
+
   const startBtn = useMemo(() => {
     let arr: any = [
       {
         title: '选择',
         width: 50,
-        render: (item: any) => (
+        render: (item: GoodFileType) => (
           <Checkbox checked={checkArr.includes(item.id)} onChange={() => checkFu(item.id)} />
         )
-      }
-    ]
-
-    if (['全部', '图像', '视频'].includes(btnAc))
-      arr.push({
+      },
+      {
         width: 100,
         title: '缩略图/视频',
         render: (item: GoodFileType) => {
@@ -133,20 +140,42 @@ function C2files() {
             ' - '
           )
         }
-      })
+      },
+      {
+        title: '附件类型',
+        render: (item: GoodFileType) =>
+          selectObj['附件类型'].find(v => v.value === item.type)?.label
+      },
+      {
+        title: '附件用途',
+        render: (item: GoodFileType) => (item.effect ? resJiLianFu(item.effect) : '(空)')
+      }
+    ]
 
     return arr
-  }, [btnAc, checkArr, checkFu])
+  }, [checkArr, checkFu])
+
+  // 点击删除
+  const delFu = useCallback(
+    async (data: number[]) => {
+      const res = await API_C2dels(data)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
 
   const tableLastBtn = useMemo(() => {
     return [
       {
         title: '操作',
-        render: (item: any) => {
+        render: (item: GoodFileType) => {
           return (
             <>
               <Button size='small' type='text'>
-                <a href={item.src} download target='_blank' rel='noreferrer'>
+                <a href={baseURL + item.filePath} download target='_blank' rel='noreferrer'>
                   下载
                 </a>
               </Button>
@@ -165,14 +194,34 @@ function C2files() {
                 >
                   设置
                 </Button>
-                <MyPopconfirm txtK='删除' onConfirm={() => {}} />
+                <MyPopconfirm txtK='删除' onConfirm={() => delFu([item.id])} />
               </>
             </>
           )
         }
       }
     ]
-  }, [])
+  }, [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])
 
   return (
     <div className={styles.C2files}>
@@ -187,13 +236,13 @@ function C2files() {
               onClick={() => setBtnAc(v.value)}
               type={btnAc === v.value ? 'primary' : 'default'}
             >
-              {v.value}
+              {v.label}
             </Button>
           ))}
         </div>
 
         <div className='C2toprr'>
-          <Button type='primary' disabled={checkArr.length === 0}>
+          <Button type='primary' disabled={checkArr.length === 0} onClick={downsFu}>
             批量下载
           </Button>
           &emsp;
@@ -227,7 +276,15 @@ function C2files() {
             <div key={item.name}>
               <span>{item.name}:</span>
 
-              {item.type === '下拉框' ? <Select placeholder='全部' /> : null}
+              {item.type === '下拉框' ? (
+                <Select
+                  allowClear={true}
+                  placeholder='全部'
+                  value={formData[item.key]}
+                  onChange={e => txtChangeFu(e, item.key)}
+                  options={item.data}
+                />
+              ) : null}
               {item.type === '输入框' ? (
                 <Input
                   placeholder='请输入'
@@ -239,11 +296,13 @@ function C2files() {
 
               {item.type === '级联' ? (
                 <Cascader
-                  changeOnSelect
-                  options={[]}
+                  // changeOnSelect
+                  options={item.data}
+                  value={formData.effect ? formData.effect.split(',') : null}
+                  onChange={e => txtChangeFu(e ? e.join(',') : '', item.key)}
                   placeholder='全部'
-                  // fieldNames={{ label: 'name', value: 'id', children: 'children' }}
-                  allowClear={false}
+                  fieldNames={{ label: 'name', value: 'id', children: 'children' }}
+                  allowClear={true}
                 />
               ) : null}
             </div>
@@ -263,29 +322,13 @@ function C2files() {
       {/* 表格 */}
       <MyTable
         yHeight={600}
-        list={[
-          {
-            id: 1,
-            type: '图像',
-            fileName: 'https://houseoss.4dkankan.com/project/DEMO/staticResource/touxiang.jpg'
-          },
-          {
-            id: 2,
-            type: '视频',
-            fileName: 'https://houseoss.4dkankan.com/project/DEMO/staticResource/loop.mp4'
-          },
-          {
-            id: 3,
-            type: '3D',
-            fileName: 'xxxx'
-          }
-        ]}
+        list={tableInfo.list}
         columnsTemp={C2tableC}
         lastBtn={tableLastBtn}
         startBtn={startBtn}
         pageNum={formData.pageNum}
         pageSize={formData.pageSize}
-        total={0}
+        total={tableInfo.total}
         onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
       />
 

+ 4 - 4
src/pages/C_goodsManage/C2files/type.d.ts

@@ -1,12 +1,12 @@
 export type TypeC2Form = {
   aaaa: string
   bbbb: string
-  cccc: string
-  dddd: string
-  eeee: string
+  goodName: string
+  fileName: string
+  effect: any
+  creatorName: string
   startTime: string
   endTime: string
-  ffff: string
   pageNum: number
   pageSize: number
 }

+ 2 - 2
src/pages/Layout/data.ts

@@ -14,7 +14,7 @@ const tabLeftArr: RouterType = [
       },
       {
         id: 120,
-        name: '业务中心333',
+        name: '业务中心',
         path: '/business',
         Com: React.lazy(() => import('../A_workbench/A2business'))
       },
@@ -258,7 +258,7 @@ const tabLeftArr: RouterType = [
 export default tabLeftArr
 
 // 里面的页面,不是左边的tab栏
-export const routerSon: RouterTypeRow = [
+export const routerSon: RouterTypeRow[] = [
   {
     id: 1,
     name: '库房设置-查看',

+ 9 - 3
src/pages/Layout/index.module.scss

@@ -81,12 +81,18 @@
 
           .userNameBox {
             cursor: pointer;
-            background: url('../../assets/img/user.png') no-repeat left center;
-            background-size: 40px 40px;
-            padding-left: 46px;
+            // background: url('../../assets/img/user.png') no-repeat left center;
+            // background-size: 40px 40px;
+            // padding-left: 46px;
             height: 60px;
             display: flex;
             align-items: center;
+            img {
+              border-radius: 50%;
+              width: 40px;
+              height: 40px;
+              margin-right: 20px;
+            }
           }
 
           .userInco {

+ 31 - 14
src/pages/Layout/index.tsx

@@ -10,7 +10,7 @@ import { Button, Form, Input, Modal } from 'antd'
 import { Base64 } from 'js-base64'
 import encodeStr from '@/utils/pass'
 import { API_getRoleArr, passWordEditAPI } from '@/store/action/layout'
-import { getTokenInfo, removeTokenInfo } from '@/utils/storage'
+import { changSetFu, getTokenInfo, removeTokenInfo } from '@/utils/storage'
 import { MessageFu } from '@/utils/message'
 import logoImg from '@/assets/img/logo2.png'
 import NotFound from '@/components/NotFound'
@@ -19,10 +19,21 @@ import { RouterType, RouterTypeRow } from '@/types'
 import tabLeftArr, { routerSon } from './data'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import { TypeZ5Role } from '../Z_system/Z5role/type'
-import { useDispatch } from 'react-redux'
+import { useDispatch, useSelector } from 'react-redux'
 import { Z1_APIgetDict } from '@/store/action/Z1dict'
+import store, { RootState } from '@/store'
+import { baseURL } from '@/utils/http'
+import baseTouXiangImg from '@/assets/img/user.png'
 
 function Layout() {
+  // 用户信息存到仓库
+  useEffect(() => {
+    store.dispatch({ type: 'layout/userInfo', payload: (getTokenInfo() || {}).user })
+  }, [])
+
+  // 获取用户信息
+  const { userInfo, passEditShow } = useSelector((state: RootState) => state.A0Layout)
+
   const dispatch = useDispatch()
 
   // 很多地方会用到的下拉框 或者级联数据
@@ -70,7 +81,7 @@ function Layout() {
         // isOkIdArr.push(9901)
       }
 
-      const tempArr: RouterTypeRow = []
+      const tempArr: RouterTypeRow[] = []
 
       tabLeftArr.forEach(v1 => {
         if (v1.son && v1.son[0]) {
@@ -123,20 +134,18 @@ function Layout() {
   const [list, setList] = useState([] as RouterType)
 
   // 路由信息(过滤之后的)
-  const [RouterCom, setRouterCom] = useState<RouterTypeRow>([])
+  const [RouterCom, setRouterCom] = useState<RouterTypeRow[]>([])
 
   // useEffect(() => {
   //   console.log(123, list);
   // }, [list]);
 
   // 点击跳转
-  const pathCutFu = useCallback((path: string) => {
-    history.push(path)
+  const pathCutFu = useCallback((item: RouterTypeRow) => {
+    history.push(item.path)
+    if (item.name !== '业务中心') changSetFu(item)
   }, [])
 
-  // 修改密码相关
-  const [open, setOpen] = useState(false)
-
   // 拿到新密码的输入框的值
   const oldPasswordValue = useRef('')
 
@@ -209,7 +218,7 @@ function Layout() {
                   key={v2.id}
                   hidden={v2.id >= 9901}
                   className={classNames('layoutLRowBoxRow', pathAcFu(v2.path) ? 'active' : '')}
-                  onClick={() => pathCutFu(v2.path)}
+                  onClick={() => pathCutFu(v2)}
                 >
                   {v2.name}
                 </div>
@@ -227,6 +236,8 @@ function Layout() {
             onMouseLeave={() => setIsUserBtnShow(false)}
           >
             <div className='userNameBox' onClick={() => setIsUserBtnShow(true)}>
+              <img src={userInfo.thumb ? baseURL + userInfo.thumb : baseTouXiangImg} alt='' />
+
               {getTokenInfo().user.realName || getTokenInfo().user.userName || '匿名'}
 
               <div className='userInco userInco2'>
@@ -236,7 +247,11 @@ function Layout() {
 
             <div className='userSet'>
               <div>
-                <span onClick={() => setOpen(true)}>修改密码</span>
+                <span
+                  onClick={() => store.dispatch({ type: 'layout/passEditShow', payload: true })}
+                >
+                  修改密码
+                </span>
                 <MyPopconfirm txtK='退出登录' onConfirm={loginExit} Dom='退出登录' loc='bottom' />
               </div>
             </div>
@@ -268,9 +283,9 @@ function Layout() {
       {/* 点击修改密码打开的对话框 */}
       <Modal
         destroyOnClose
-        open={open}
+        open={passEditShow}
         title='修改密码'
-        onCancel={() => setOpen(false)}
+        onCancel={() => store.dispatch({ type: 'layout/passEditShow', payload: false })}
         footer={
           [] // 设置footer为空,去掉 取消 确定默认按钮
         }
@@ -317,7 +332,9 @@ function Layout() {
           </Form.Item>
 
           <Form.Item wrapperCol={{ offset: 14, span: 16 }}>
-            <Button onClick={() => setOpen(false)}>取消</Button>
+            <Button onClick={() => store.dispatch({ type: 'layout/passEditShow', payload: false })}>
+              取消
+            </Button>
             &emsp;
             <Button type='primary' htmlType='submit'>
               确定

+ 1 - 0
src/pages/Login/index.tsx

@@ -71,6 +71,7 @@ export default function Login() {
 
       // 用户信息存到本地
       setTokenInfo(res.data)
+
       history.push('/')
     } else if (res.code === -1 && res.msg === '验证码有误') {
       LoginGetCodeFu()

+ 6 - 2
src/pages/Y_goodsDetails/Y1cathet/Y33com.tsx

@@ -26,6 +26,7 @@ function Y33com({ isLook, sId }: Props) {
     const res = await API_goodFileList(sId)
     if (res.code === 0) {
       setFileList(res.data || [])
+      setCheckArr([])
     }
   }, [sId])
 
@@ -181,7 +182,10 @@ function Y33com({ isLook, sId }: Props) {
           {[{ label: '全部', value: '' }, ...selectObj['附件类型']].map(v => (
             <Button
               key={v.value}
-              onClick={() => setBtnAc(v.value)}
+              onClick={() => {
+                setBtnAc(v.value)
+                setCheckArr([])
+              }}
               type={btnAc === v.value ? 'primary' : 'default'}
             >
               {v.label}
@@ -217,7 +221,7 @@ function Y33com({ isLook, sId }: Props) {
         classKey='Y33comTable'
         yHeight={isLook ? 640 : 666}
         list={tableObj[btnAc] || []}
-        columnsTemp={Y33tableC('新增')}
+        columnsTemp={Y33tableC}
         lastBtn={tableLastBtn}
         startBtn={startBtn}
         pagingInfo={false}

+ 16 - 17
src/pages/Z_system/Z3flowSet/Z3edit/Z3addPro.tsx

@@ -1,6 +1,6 @@
 import React, { useCallback, useEffect, useState } from 'react'
 import styles from './index.module.scss'
-import { Button, Cascader, Input, InputNumber, Modal, Radio, Select } from 'antd'
+import { Button, Input, InputNumber, Modal, Radio, Select, TreeSelect } from 'antd'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import { Z3_APIgetProInfo } from '@/store/action/Z3flowSet'
 import { UserTableListType } from '@/types'
@@ -9,7 +9,6 @@ import { Z5_APIgetList } from '@/store/action/Z5role'
 import { RootState } from '@/store'
 import { D4_APIgetTree } from '@/store/action/Z4organization'
 import { MessageFu } from '@/utils/message'
-const { SHOW_CHILD } = Cascader
 
 const baseFormData = {
   id: -1,
@@ -66,15 +65,13 @@ function Z3addPro({ sId, closeFu, succFu, userList }: Props) {
 
   const [idsArr1, setIdsArr1] = useState<string[]>([])
   const [idsArr2, setIdsArr2] = useState<string[]>([])
-  const [idsArr3, setIdsArr3] = useState<string[][]>([])
+  const [idsArr3, setIdsArr3] = useState<string[]>([])
 
   // 点击提交
   const btnOk = useCallback(async () => {
     if (!form.name) return MessageFu.warning('请输入节点名称')
     if (!form.sort) return MessageFu.warning('请输入正整数排序值')
 
-    console.log('xxxxxxxx', idsArr3)
-
     const id1 = (idsArr1 || []).join(',')
 
     if (form.type === 'user' && !id1) return MessageFu.warning('请选择指定用户')
@@ -83,21 +80,20 @@ function Z3addPro({ sId, closeFu, succFu, userList }: Props) {
 
     if (form.type === 'role' && !id2) return MessageFu.warning('请选择角色')
 
-    const id3 = (idsArr3 || [[]]).map(arr => arr.slice(-1)[0]).join(',')
+    const id3 = (idsArr3 || []).join(',')
     // .flat().join(',')
     // .map(arr => arr.slice(-1)[0]).join(',');
-    // 待完善 和后端沟通 需要把id的
-    // 还需要多一个字段存json数据回显
 
     if (form.type === 'dept' && !id3) return MessageFu.warning('请选择部门')
 
     const obj = {
       ...form,
-      xxxxx: form.type === 'user' ? id1 : form.type === 'role' ? id2 : id3
+      xxxxx: form.type === 'user' ? id1 : form.type === 'role' ? id2 : id3,
+      id: sId > 0 ? sId : null
     }
 
     console.log(123, obj)
-  }, [form, idsArr1, idsArr2, idsArr3])
+  }, [form, idsArr1, idsArr2, idsArr3, sId])
 
   return (
     <Modal
@@ -172,15 +168,18 @@ function Z3addPro({ sId, closeFu, succFu, userList }: Props) {
         </div>
 
         <div className='Z3aRowrr' hidden={form.type !== 'dept'}>
-          <Cascader
-            placeholder='请选择'
+          <TreeSelect
+            showSearch={false}
+            defaultOpen={form.type === 'dept'}
             style={{ width: '100%' }}
-            options={treeData}
-            value={idsArr3}
-            onChange={e => setIdsArr3(e as string[][])}
+            dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
+            placeholder='请选择'
+            allowClear
             multiple
-            maxTagCount='responsive'
-            showCheckedStrategy={SHOW_CHILD}
+            treeDefaultExpandAll
+            value={idsArr3}
+            onChange={value => setIdsArr3(value)}
+            treeData={treeData}
             fieldNames={{ value: 'id', label: 'name', children: 'children' }}
           />
         </div>

+ 18 - 0
src/store/action/C2files.ts

@@ -1,4 +1,22 @@
 import http from '@/utils/http'
+import { AppDispatch } from '..'
+
+/**
+ * 库房设置 - 获取分页列表
+ */
+export const C2_APIgetList = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/goodsFile/page', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+
+      dispatch({ type: 'C2/getList', payload: obj })
+    }
+  }
+}
 
 /**
  * 删除附件

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

@@ -0,0 +1,28 @@
+import { GoodFileType } from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew/type'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as GoodFileType[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'C2/getList'
+  payload: { list: GoodFileType[]; total: number }
+}
+
+// reducer
+export default function userReducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'C2/getList':
+      return { ...state, tableInfo: 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 FourAll from './FourAll'
+import C2files from './C2files'
 import D2storSet from './D2storSet'
 import D4impStor from './D4impStor'
 import Z1dict from './Z1dict'
@@ -18,6 +19,7 @@ import Z7log from './Z7log'
 const rootReducer = combineReducers({
   A0Layout,
   FourAll,
+  C2files,
   D2storSet,
   D4impStor,
   Z1dict,

+ 41 - 32
src/store/reducer/layout.ts

@@ -1,65 +1,74 @@
-import { LookDomType } from "@/types";
-import { MessageType } from "@/utils/message";
+import { LookDomType, UserTableListType } from '@/types'
+import { MessageType } from '@/utils/message'
 
 // 初始化状态
 const initState = {
   // 所有图片点击预览查看大图
   lookBigImg: {
-    url: "",
-    show: false,
+    url: '',
+    show: false
   },
   // 查看视频、音频、模型
   lookDom: {
-    src: "",
-    type: "",
+    src: '',
+    type: ''
   } as LookDomType,
 
   // antd轻提示(兼容360浏览器)
   message: {
-    txt: "",
-    type: "info",
-    duration: 3,
+    txt: '',
+    type: 'info',
+    duration: 3
   } as MessageType,
   // 上传文件点击取消
   closeUpFile: {
     fu: () => {},
-    state: false,
+    state: false
   },
-};
+  // 用户信息
+  userInfo: {} as UserTableListType,
+  // 修改密码
+  passEditShow: false
+}
 
 // 定义 action 类型
 type LayoutActionType =
-  | { type: "layout/lookBigImg"; payload: { url: string; show: boolean } }
-  | { type: "layout/lookDom"; payload: LookDomType }
-  | { type: "layout/message"; payload: MessageType }
+  | { type: 'layout/lookBigImg'; payload: { url: string; show: boolean } }
+  | { type: 'layout/lookDom'; payload: LookDomType }
+  | { type: 'layout/message'; payload: MessageType }
   | {
-      type: "layout/closeUpFile";
+      type: 'layout/closeUpFile'
       payload: {
-        fu: () => void;
-        state: boolean;
-      };
-    };
+        fu: () => void
+        state: boolean
+      }
+    }
+  | { type: 'layout/userInfo'; payload: UserTableListType }
+  | { type: 'layout/passEditShow'; payload: boolean }
 
 // 频道 reducer
-export default function layoutReducer(
-  state = initState,
-  action: LayoutActionType
-) {
+export default function layoutReducer(state = initState, action: LayoutActionType) {
   switch (action.type) {
     // 所有图片点击预览查看大图
-    case "layout/lookBigImg":
-      return { ...state, lookBigImg: action.payload };
+    case 'layout/lookBigImg':
+      return { ...state, lookBigImg: action.payload }
     // 查看视频
-    case "layout/lookDom":
-      return { ...state, lookDom: action.payload };
+    case 'layout/lookDom':
+      return { ...state, lookDom: action.payload }
 
     // antd轻提示(兼容360浏览器)
-    case "layout/message":
-      return { ...state, message: action.payload };
+    case 'layout/message':
+      return { ...state, message: action.payload }
     // 上传文件点击取消
-    case "layout/closeUpFile":
-      return { ...state, closeUpFile: action.payload };
+    case 'layout/closeUpFile':
+      return { ...state, closeUpFile: action.payload }
+    // 设置用户信息
+    case 'layout/userInfo':
+      return { ...state, userInfo: action.payload }
+    // 修改密码
+    case 'layout/passEditShow':
+      return { ...state, passEditShow: action.payload }
     default:
-      return state;
+      return state
   }
 }

+ 1 - 0
src/types/api/Z6user.d.ts

@@ -23,6 +23,7 @@ export type UserTableListType = {
   userName: string
   deptName: string
   deptNameRes: string
+  deptId: number
 }
 
 export type SaveUserType = {

+ 2 - 2
src/types/api/layot.d.ts

@@ -10,12 +10,12 @@ export type RouterTypeRow = {
   path: string
   pathLast?: string
   Com: React.LazyExoticComponent<React.MemoExoticComponent<() => JSX.Element>>
-}[]
+}
 
 export type RouterType = {
   id: number
   name: string
-  son: RouterTypeRow
+  son: RouterTypeRow[]
 }[]
 
 export type FileImgListType = {

+ 26 - 0
src/utils/storage.ts

@@ -1,5 +1,7 @@
 // ------------------------------------token的本地存储------------------------------------
 
+import { RouterTypeRow } from '@/types'
+
 // 用户 Token 的本地缓存键名,自己定义
 const TOKEN_KEY = 'YWGOODS_HT_USER_INFO'
 
@@ -38,3 +40,27 @@ export const hasToken = (): boolean => {
 export const getTokenFu = (): string => {
   return getTokenInfo().token
 }
+
+// --------------------业务中心-常用功能存储
+const CHANG_KEY = 'YWGOODS_HT_CHANG_ARR'
+
+// 存
+export const changSetFu = (info: RouterTypeRow): void => {
+  const oldArr = changGetFu()
+
+  let newArr: RouterTypeRow[] = []
+
+  // 已经存在了
+  const oldIds = oldArr.map(v => v.id)
+  if (oldIds.includes(info.id)) newArr = oldArr
+  else {
+    if (oldArr.length <= 2) newArr = [...oldArr, info]
+    else newArr = [...oldArr.slice(-2), info]
+  }
+
+  localStorage.setItem(CHANG_KEY, JSON.stringify(newArr))
+}
+// 取
+export const changGetFu = (): RouterTypeRow[] => {
+  return JSON.parse(localStorage.getItem(CHANG_KEY) || '[]')
+}

+ 13 - 22
src/utils/tableData.ts

@@ -89,16 +89,14 @@ export const C1tableC = [
   ['txt', '库存状态', 'xxx']
 ]
 
-// 待完善
 export const C2tableC = [
-  ['txt', '附件类型', 'type'],
-  ['txt', '用途', 'description'],
-  ['txt', '藏品名称', 'description'],
-  ['txt', '总登记号', 'description'],
-  ['txt', '附件名称', 'description'],
-  ['txt', '上传日期', 'description'],
-  ['txt', '上传人', 'description'],
-  ['txt', '文件大小', 'description']
+  ['txt', '藏品名称', 'goodNumName'],
+  ['txt', '编号类型', '待完善'],
+  ['txt', '藏品编号', 'goodNum'],
+  ['txt', '附件名称', 'fileName'],
+  ['txt', '上传日期', 'updateTime'],
+  ['txt', '上传人', 'creatorName'],
+  ['txt', '附件大小', 'fileSize']
 ]
 
 // 待完善
@@ -183,20 +181,13 @@ export const Y22tableC = [
   ['txt', '库存详情', 'description']
 ]
 
-export const Y33tableC = (type: '详情' | '新增') => {
-  let arr1 = [
-    ['txt', '附件类型', 'type'],
-    ['txt', '用途', 'effect']
-  ]
+export const Y33tableC = [
+  ['text', '附件名称', 'fileName', 50],
+  ['txt', '附件大小', 'fileSize'],
+  ['txt', '上传日期', 'updateTime'],
+  ['txt', '上传人', 'creatorName']
+]
 
-  const arr2 = [
-    ['text', '附件名称', 'fileName', 50],
-    ['txt', '附件大小', 'fileSize'],
-    ['txt', '上传日期', 'updateTime'],
-    ['txt', '上传人', 'creatorName']
-  ]
-  return type === '详情' ? [...arr1, ...arr2] : arr2
-}
 // 待完善
 export const Y44tableC = [
   ['txt', '业务类型', 'xxxx'],