فهرست منبع

卡在关联资源

shaogen1995 2 ماه پیش
والد
کامیت
557cbe0e85

+ 6 - 0
src/components/MyTable/index.tsx

@@ -123,6 +123,12 @@ function MyTable({
           if (obj) txt = obj.label
           return txt
         },
+        sizeNum: (item: any) => {
+          let txt = isNull
+          const size = item[v[2]] || ''
+          if (size) txt = (size / v[3]).toFixed(2)
+          return txt
+        },
         txtChange: (item: any) => Reflect.get(v[3], item[v[2]]) || v[4] || isNull,
         text: (item: any) => {
           let tempCom: any = item[v[2]] || isNull

+ 12 - 4
src/components/Z0sonTable/index.tsx

@@ -12,6 +12,7 @@ type Props = {
   kuList: antdSelectType[]
   formZi: baseFormType[]
   tableList: any[]
+  formDefId: number
   tableBtnFu?: (val: '编辑' | '删除', id: number) => void
   isLook?: boolean
   pageInfo?: { current: number; size: number; total: number }
@@ -20,12 +21,14 @@ type Props = {
   staBtn?: any[]
   filArr?: string[]
   classKey?: string
+  tabBtnArrAll?: any[] //从资源总览看
 }
 
 function Z0sonTable({
   kuList,
   formZi,
   tableList,
+  formDefId,
   tableBtnFu,
   isLook = false,
   pageInfo,
@@ -33,7 +36,8 @@ function Z0sonTable({
   onChange,
   staBtn = [],
   classKey = '',
-  filArr = ['排序值', '入库状态', '发布状态', '推荐状态', '附件', '大封面']
+  filArr = ['排序值', '入库状态', '发布状态', '推荐状态', '附件', '大封面'],
+  tabBtnArrAll
 }: Props) {
   useEffect(() => {
     if (tableList && tableList.length) {
@@ -60,7 +64,11 @@ function Z0sonTable({
         render: (item: any) => {
           return (
             <>
-              <Button size='small' type='text' onClick={() => openLink(`/goodsLook/${item.id}`)}>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => openLink(`/goodsLook/${item.id}/${formDefId}`)}
+              >
                 查看
               </Button>
               {tableBtnFu && !isLook ? (
@@ -76,7 +84,7 @@ function Z0sonTable({
         }
       }
     ]
-  }, [isLook, tableBtnFu])
+  }, [formDefId, isLook, tableBtnFu])
 
   return (
     <>
@@ -90,7 +98,7 @@ function Z0sonTable({
         >
           <Table
             rowKey='id'
-            columns={tableColumns(kuList, staBtn, formZi, tabBtnArr, filArr)}
+            columns={tableColumns(kuList, staBtn, formZi, tabBtnArrAll || tabBtnArr, filArr)}
             dataSource={tableList}
             scroll={{ x: 'max-content', y: yHeight || 'auto' }}
             pagination={

+ 2 - 0
src/pages/Bresource/B1overview/data.ts

@@ -0,0 +1,2 @@
+// 顶部搜索需要过滤的字典
+export const B1searchFile = ['资源名称', '责任者', '资源编码']

+ 34 - 1
src/pages/Bresource/B1overview/index.module.scss

@@ -1,4 +1,37 @@
-.A1overview {
+.B1overview {
+  padding: 15px;
   :global {
+    .B1main {
+      width: 100%;
+      height: 100%;
+      display: flex;
+      .b1top {
+        width: 320px;
+        margin-right: 10px;
+        padding-right: 9px;
+        border-right: 1px solid #ccc;
+        .Z0ku {
+          .Z0ku1 {
+            padding-left: 24px;
+            display: flex;
+            justify-content: space-around;
+            margin-top: 10px;
+          }
+        }
+
+        .B1topMain {
+          width: 100%;
+          height: calc(100% - 120px);
+          overflow: auto;
+          .sgLeftRow {
+            margin-top: 10px;
+            padding-right: 10px;
+          }
+        }
+      }
+      .b1table {
+        width: calc(100% - 330px);
+      }
+    }
   }
 }

+ 320 - 6
src/pages/Bresource/B1overview/index.tsx

@@ -1,13 +1,327 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
-function A1overview() {
+import { antdSelectType, selectObj, tableSelectToTxt } from '@/utils/dataChange'
+import { useDispatch, useSelector } from 'react-redux'
+import { selectTopBase } from '@/pages/Zother/SelectGoods/data'
+import { getKuListByOpenFu } from '@/pages/Zother/data'
+import { ziyuanAcGet, ziyuanAcSet } from '@/utils/storage'
+import { APIdelTable, B1_APIgetList } from '@/store/action/Bresource/B1overview'
+import { RootState } from '@/store'
+import { Button, Cascader, Input, Select } from 'antd'
+import { Z1_APIgetFormZiDuan } from '@/store/action/Zsystem/Z1sysSet'
+import { baseFormType } from '@/pages/Zsystem/Z1sysSet/data'
+import { treeOneIdByResFu } from '@/pages/Zother/Z1formSet/data'
+import { B1searchFile } from './data'
+import { MessageFu } from '@/utils/message'
+import Z0sonTable from '@/components/Z0sonTable'
+import { openLink } from '@/utils/history'
+import MyPopconfirm from '@/components/MyPopconfirm'
+function B1overview() {
+  const [kuList, setKuList] = useState<antdSelectType[]>([])
+
+  const [loding, setLoding] = useState(false)
+
+  const dispatch = useDispatch()
+
+  const [formData, setFormData] = useState({ ...selectTopBase })
+  const formDataRef = useRef({ ...selectTopBase })
+
+  useEffect(() => {
+    formDataRef.current = { ...formData }
+  }, [formData])
+
+  // 获取表单字段
+  const [formZi, setFormZi] = useState<baseFormType[]>([])
+
+  const getFormZiFu = useCallback(async (id: number) => {
+    const res = await Z1_APIgetFormZiDuan(id)
+    if (res.code === 0) {
+      const list: any[] = res.data || {}
+      setFormZi(list.filter(v => !B1searchFile.includes(v.fieldLabel)))
+    }
+  }, [])
+
+  useEffect(() => {
+    getKuListByOpenFu(data => {
+      setLoding(true)
+      if (data && data.length) {
+        setKuList(data)
+        const ziyuanAcTxt = ziyuanAcGet()
+
+        const fId = ziyuanAcTxt || data[0].value
+        const obj = { ...selectTopBase, formDefId: fId }
+        setFormData(obj)
+        getFormZiFu(fId)
+        setTimeout(() => {
+          setTimeKey(Date.now())
+        }, 50)
+      }
+    })
+  }, [dispatch, getFormZiFu])
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(0)
+
+  // 点击搜索
+  const clickSearch = useCallback(() => {
+    setFormData({ ...formData, current: 1 })
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [formData])
+
+  // 点击重置
+  const resetSelectFu = useCallback(
+    (formDefId?: number) => {
+      setFormData({ ...selectTopBase, formDefId: formDefId || formData.formDefId })
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [formData.formDefId]
+  )
+
+  // 封装发送请求的函数
+  const getList = useCallback(async () => {
+    const obj = {
+      ...formDataRef.current
+    }
+
+    // 字典和标签需要 取最后一级 转成数字
+    const sonObj = { ...(obj.dictQuery || {}) }
+
+    for (const k in sonObj) {
+      const temp = sonObj[k]
+      if (typeof temp === 'object') sonObj[k] = Number(temp[temp.length - 1])
+    }
+
+    obj.dictQuery = sonObj
+
+    dispatch(B1_APIgetList(obj))
+  }, [dispatch])
+
+  useEffect(() => {
+    if (timeKey) getList()
+  }, [getList, timeKey])
+
+  // 页码变化
+  const paginationChange = useCallback(
+    (pageNum: number, pageSize: number) => {
+      setFormData({ ...formData, current: pageNum, size: pageSize })
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [formData]
+  )
+
+  // 动态表单的渲染
+  const dongFormChange = useCallback(
+    (key: any, val: any, flag?: boolean) => {
+      const resKey = flag ? 'dictQuery' : 'queryParams'
+
+      const oldFormSon = { ...(formData[resKey] || {}) }
+      oldFormSon[key] = val
+      setFormData({ ...formData, [resKey]: oldFormSon })
+    },
+    [formData]
+  )
+
+  // 关联字典数组
+  const dictArrTemp = useSelector((state: RootState) => state.Z2dict.dictAll)
+  // 关联标签
+  const biaoQianTemp = useSelector((state: RootState) => state.B3resTag.dictAll)
+  // 表格数据
+  const tableInfo = useSelector((state: RootState) => state.B1overview.tableInfo)
+
+  // 点击删除和二维码
+  const tableBtnFu = useCallback(
+    async (val: '删除' | '二维码', id: number) => {
+      if (val === '删除') {
+        const res = await APIdelTable(formData.formDefId, id)
+        if (res.code === 0) {
+          MessageFu.success('删除成功')
+          getList()
+        }
+      } else MessageFu.warning('开发中')
+    },
+    [formData.formDefId, getList]
+  )
+
+  // 表格操作按钮
+  const tabBtnArr = useMemo(() => {
+    return [
+      {
+        title: '入库状态',
+        width: 100,
+        render: (item: any) => tableSelectToTxt(item.status_storage, selectObj['入库状态'])
+      },
+      {
+        title: '发布状态',
+        width: 100,
+        render: (item: any) => tableSelectToTxt(item.status_publish, selectObj['发布状态'])
+      },
+      {
+        title: '推荐状态',
+        width: 100,
+        render: (item: any) => tableSelectToTxt(item.status_hot, selectObj['推荐状态'])
+      },
+      {
+        title: '操作',
+        width: 'auto',
+        fixed: 'right',
+        render: (item: any) => {
+          return (
+            <>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => openLink(`/goodsLook/${item.id}/${formData.formDefId}`)}
+              >
+                查看
+              </Button>
+              {[2, 3].includes(item.status_storage) ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu('二维码', item.id)}>
+                  二维码
+                </Button>
+              ) : (
+                <MyPopconfirm txtK='删除' onConfirm={() => tableBtnFu('删除', item.id)} />
+              )}
+            </>
+          )
+        }
+      }
+    ]
+  }, [formData.formDefId, tableBtnFu])
+
   return (
-    <div className={styles.A1overview}>
-      <h1>A1overview</h1>
+    <div className={styles.B1overview}>
+      <div className='pageTitle'>资源总览</div>
+
+      {formData.formDefId ? (
+        <div className='B1main'>
+          <div className='b1top'>
+            <div className='Z0ku'>
+              资源库:
+              <Select
+                style={{ maxWidth: 200, minWidth: 120 }}
+                value={formData.formDefId}
+                onChange={e => {
+                  setFormData({ ...formData, pageNum: 1, formDefId: e })
+                  ziyuanAcSet(e)
+                  getFormZiFu(e)
+                  resetSelectFu(e)
+                }}
+                options={kuList}
+              />
+              <div className='Z0ku1'>
+                <Button type='primary' onClick={() => MessageFu.warning('开发中')}>
+                  数据导入
+                </Button>
+                <Button type='primary' onClick={() => MessageFu.warning('开发中')}>
+                  数据导出
+                </Button>
+              </div>
+              <div className='Z0ku1'>
+                <Button type='primary' onClick={clickSearch}>
+                  查&emsp;&emsp;询
+                </Button>
+
+                <Button onClick={() => resetSelectFu()}>重&emsp;&emsp;置</Button>
+              </div>
+            </div>
+
+            <div className='B1topMain'>
+              <div className='sgLeftRow'>
+                <Input
+                  style={{ width: 290 }}
+                  value={formData.searchKey}
+                  onChange={e => setFormData({ ...formData, searchKey: e.target.value })}
+                  placeholder='请输入资源编码、资源名称、责任者'
+                  maxLength={30}
+                  showCount
+                />
+              </div>
+              <div className='sgLeftRow'>
+                <Select
+                  allowClear
+                  style={{ width: 120 }}
+                  value={(formData.queryParams || {})['status_storage']}
+                  onChange={e => dongFormChange('status_storage', e)}
+                  options={selectObj['入库状态']}
+                  placeholder='入库状态'
+                />
+              </div>
+              <div className='sgLeftRow'>
+                <Select
+                  allowClear
+                  style={{ width: 120 }}
+                  value={(formData.queryParams || {})['status_publish']}
+                  onChange={e => dongFormChange('status_publish', e)}
+                  options={selectObj['发布状态']}
+                  placeholder='发布状态'
+                />
+              </div>
+
+              {formZi.map(item => (
+                <div key={item.id} className='sgLeftRow'>
+                  {item.tag === '文本' ? (
+                    <Input
+                      value={(formData.queryParams || {})[item.fieldName]}
+                      onChange={e => dongFormChange(item.fieldName, e.target.value.trim())}
+                      placeholder={item.fieldLabel}
+                      maxLength={30}
+                      showCount
+                    />
+                  ) : ['关联标签', '关联字典'].includes(item.tag) ? (
+                    <Cascader
+                      changeOnSelect
+                      value={(formData.dictQuery || {})[item.fieldName]}
+                      onChange={e => dongFormChange(item.fieldName, e, true)}
+                      fieldNames={{ label: 'name', value: 'id', children: 'children' }}
+                      options={treeOneIdByResFu(
+                        item.tag === '关联字典' ? dictArrTemp : biaoQianTemp,
+                        item.dictId + ''
+                      )}
+                      placeholder={item.fieldLabel}
+                    />
+                  ) : item.tag === '下拉' ? (
+                    <Select
+                      allowClear
+                      value={(formData.queryParams || {})[item.fieldName]}
+                      onChange={e => dongFormChange(item.fieldName, e)}
+                      style={{ width: 120 }}
+                      options={item.options.split(',').map(v => ({ value: v, label: v }))}
+                      placeholder={item.fieldLabel}
+                    />
+                  ) : null}
+                </div>
+              ))}
+            </div>
+          </div>
+
+          <div className='b1table'>
+            <Z0sonTable
+              kuList={kuList}
+              formZi={formZi}
+              formDefId={formData.formDefId}
+              tableList={tableInfo.list}
+              pageInfo={{ current: formData.current, size: formData.size, total: tableInfo.total }}
+              yHeight={710}
+              onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
+              tabBtnArrAll={tabBtnArr}
+            />
+          </div>
+        </div>
+      ) : (
+        <div hidden={!loding} className='Z0null'>
+          请先在 系统管理-资源库管理 添加数据 或 开启资源库状态
+        </div>
+      )}
     </div>
   )
 }
 
-const MemoA1overview = React.memo(A1overview)
+const MemoB1overview = React.memo(B1overview)
 
-export default MemoA1overview
+export default MemoB1overview

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

@@ -179,7 +179,7 @@ const tabLeftArr: RouterType = [
       {
         id: 9901,
         name: '资源详情',
-        path: '/goodsLook/:id',
+        path: '/goodsLook/:id/:fId',
         pathLast: '/goodsLook',
         Com: React.lazy(() => import('../Zother/ZgoodsInfo'))
       }

+ 23 - 9
src/pages/Zother/AddGood/index.tsx

@@ -5,7 +5,7 @@ import MyPopconfirm from '@/components/MyPopconfirm'
 import { baseFormType } from '@/pages/Zsystem/Z1sysSet/data'
 import ZupOne from '@/components/ZupOne'
 import { MessageFu } from '@/utils/message'
-import { APIgetGoodsInfo, APIsaveGoods } from '@/store/action/Bresource/B1overview'
+import { APIgetFileList, APIgetGoodsInfo, APIsaveGoods } from '@/store/action/Bresource/B1overview'
 import Z3upFiles from '@/components/Z3upFiles'
 import { treeOneIdByResFu } from '../Z1formSet/data'
 import { useSelector } from 'react-redux'
@@ -16,10 +16,9 @@ type Props = {
   succFu: (val: '新增' | '编辑', obj: any) => void
   formZi: baseFormType[]
   formDefId: number
-  moduleId: number
 }
 
-function AddGood({ formDefId, sId, closeFu, succFu, formZi, moduleId }: Props) {
+function AddGood({ formDefId, sId, closeFu, succFu, formZi }: Props) {
   // 级联选择
   const jiLianKey = useMemo(() => {
     return formZi.filter(v => ['关联标签', '关联字典'].includes(v.tag)).map(c => c.fieldName)
@@ -32,11 +31,13 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi, moduleId }: Props) {
 
   const fileRef = useRef<any>(null)
 
+  const oldInfoRef = useRef<any>({})
+
   const getInfoFu = useCallback(async () => {
     const res = await APIgetGoodsInfo(formDefId, sId)
     if (res.code === 0) {
       const data = res.data
-
+      oldInfoRef.current = { ...data }
       jiLianKey.forEach(v => {
         if (data[v] === '0') data[v] = null
         else if (data[v]) {
@@ -47,8 +48,14 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi, moduleId }: Props) {
       FormBoxRef.current?.setFieldsValue(data)
       imgRef.current?.setFileComFileFu({ fileName: '', filePath: data.thumbPc, thumb: data.thumb })
 
-      // 设置附件 -待完善
-      // fileRef.current?.sonSetListFu(res.data)
+      // 设置附件
+      if (data.file_ids) {
+        const res2 = await APIgetFileList(data.file_ids.split(','))
+
+        if (res2.code === 0) {
+          fileRef.current?.sonSetListFu(res2.data)
+        }
+      }
     }
   }, [formDefId, jiLianKey, sId])
 
@@ -73,7 +80,8 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi, moduleId }: Props) {
       if (!imgObj.filePath) return MessageFu.warning('请上传封面图')
 
       // 获取附件
-      const { list: flieList } = fileRef.current?.sonResListFu()
+      let flieList = []
+      if (fileRef.current) flieList = fileRef.current?.sonResListFu().list
 
       const fileObj = formZi.find(v => v.tag === '附件')
       if (fileObj && fileObj.required === 1 && flieList.length === 0)
@@ -88,7 +96,13 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi, moduleId }: Props) {
         id: sId > 0 ? sId : null,
         thumb: imgObj.thumb || '',
         thumbPc: imgObj.filePath || '',
-        file_ids: flieList.map((v: any) => v.id).join(',')
+        file_ids: flieList.map((v: any) => v.id).join(','),
+
+        // 新增的时候自己添加的字段
+        display: oldInfoRef.current.display || 0,
+        status_storage: oldInfoRef.current.status_storage || 1,
+        status_publish: oldInfoRef.current.status_publish || 0,
+        status_hot: oldInfoRef.current.status_hot || 0
       }
 
       // if (1 + 1 === 2) {
@@ -159,7 +173,7 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi, moduleId }: Props) {
                   ) : item.fieldLabel === '附件' ? (
                     <Z3upFiles
                       fileCheck={item.required === 1 && fileCheck}
-                      moduleId={moduleId}
+                      moduleId={sId > 0 ? sId : 0}
                       formDefId={formDefId}
                       ref={fileRef}
                       dirCode='addGoodsFile'

+ 18 - 4
src/pages/Zother/SelectGoods/data.tsx

@@ -8,6 +8,19 @@ export const selectTopBase: any = {
   size: 10
 }
 
+// 表格文本字符太长 处理
+const tableTxtRes = (val: string) => {
+  let txt: any = val || '(空)'
+  if (val && val.length > 20) {
+    txt = (
+      <span style={{ cursor: 'context-menu' }} title={val}>
+        {val.substring(0, 20) + '...'}
+      </span>
+    )
+  }
+  return txt
+}
+
 // 动态表单展示
 export const tableColumns = (
   kuList: antdSelectType[],
@@ -21,19 +34,19 @@ export const tableColumns = (
       title: '资源编码',
       width: 100,
       fixed: 'left',
-      render: (item: any) => item.num || '(空)'
+      render: (item: any) => tableTxtRes(item.num)
     },
     {
       title: '资源名称',
       width: 100,
       fixed: 'left',
-      render: (item: any) => item.name || '(空)'
+      render: (item: any) => tableTxtRes(item.name)
     },
     {
       title: '责任者',
       width: 100,
       fixed: 'left',
-      render: (item: any) => item.create_by || '(空)'
+      render: (item: any) => tableTxtRes(item.create_by)
     },
     {
       title: '封面',
@@ -69,10 +82,11 @@ export const tableColumns = (
     title: v.fieldLabel,
     render: (item: any) => {
       let txt: any = '(空)'
-      if (['文本', '数字'].includes(v.tag)) txt = item[v.fieldName] || '(空)'
+      if (['文本', '数字'].includes(v.tag)) txt = tableTxtRes(item[v.fieldName])
       else if (['关联字典', '关联标签'].includes(v.tag)) {
         txt = dictIdByName(item[v.fieldName])
       } else if (v.tag === '关联资源') {
+        // 待完善
         if (item.form_ids) {
           const arr: any[] = item.form_ids.split(',')
           const arrTemp = kuList.filter(v => arr.includes(v.value + '')).map(c => c.label)

+ 1 - 0
src/pages/Zother/SelectGoods/index.module.scss

@@ -39,6 +39,7 @@
           display: inline-block;
           white-space: nowrap;
           width: calc(100% - 160px);
+          padding-bottom: 5px;
           .sgLeftRow {
             display: inline-block;
           }

+ 66 - 43
src/pages/Zother/SelectGoods/index.tsx

@@ -11,6 +11,8 @@ import { treeOneIdByResFu } from '../Z1formSet/data'
 import { antdSelectType } from '@/utils/dataChange'
 import Z0sonTable from '@/components/Z0sonTable'
 import { baseFormType } from '@/pages/Zsystem/Z1sysSet/data'
+import { Z1_APIgetFormZiDuan } from '@/store/action/Zsystem/Z1sysSet'
+import { baseFilter } from '@/pages/Zuse/UseFormZi'
 
 type Props = {
   API_getList: any
@@ -19,8 +21,7 @@ type Props = {
   oldCheckArr: GoodsType[]
   formDefId: number
   kuList: antdSelectType[]
-  formBi: baseFormType[]
-  formZi: baseFormType[]
+  formZiTemp: baseFormType[]
   isOne?: boolean // 单选
   canObj?: any //其他额外的参数
   isKu?: boolean
@@ -33,12 +34,27 @@ function SelectGoods({
   formDefId,
   oldCheckArr,
   kuList,
-  formBi,
-  formZi,
+  formZiTemp,
   isOne,
   canObj,
   isKu = false
 }: Props) {
+  // 获取表单字段
+  const [formZi, setFormZi] = useState<baseFormType[]>([])
+
+  const getFormZiFu = useCallback(async (id: number) => {
+    // 获取表单字段
+    const res = await Z1_APIgetFormZiDuan(id)
+    if (res.code === 0) {
+      const list: any[] = res.data || {}
+      setFormZi(list)
+    }
+  }, [])
+
+  useEffect(() => {
+    setFormZi(formZiTemp)
+  }, [formZiTemp])
+
   const [formData, setFormData] = useState({ ...selectTopBase, formDefId })
   const formDataRef = useRef({ ...selectTopBase, formDefId })
 
@@ -81,14 +97,14 @@ function SelectGoods({
     }
 
     // 字典和标签需要 取最后一级 转成数字
-    const sonObj = { ...(obj.queryParams || {}) }
+    const sonObj = { ...(obj.dictQuery || {}) }
 
     for (const k in sonObj) {
       const temp = sonObj[k]
       if (typeof temp === 'object') sonObj[k] = Number(temp[temp.length - 1])
     }
 
-    obj.queryParams = sonObj
+    obj.dictQuery = sonObj
 
     // 第一次进来,获取到所有数据
     if (timeKey === 0) obj.size = 99999
@@ -179,10 +195,12 @@ function SelectGoods({
 
   // 动态表单的渲染
   const dongFormChange = useCallback(
-    (key: any, val: any) => {
-      const oldFormSon = { ...(formData.queryParams || {}) }
+    (key: any, val: any, flag?: boolean) => {
+      const resKey = flag ? 'dictQuery' : 'queryParams'
+
+      const oldFormSon = { ...(formData[resKey] || {}) }
       oldFormSon[key] = val
-      setFormData({ ...formData, queryParams: oldFormSon })
+      setFormData({ ...formData, [resKey]: oldFormSon })
     },
     [formData]
   )
@@ -211,6 +229,7 @@ function SelectGoods({
                 value={formData.formDefId}
                 onChange={e => {
                   setFormData({ ...formData, formDefId: e })
+                  getFormZiFu(e)
                   resetSelectFu(e)
                 }}
               />
@@ -226,6 +245,7 @@ function SelectGoods({
           <div className='sgLeft2'>
             <div className='sgLeftRow'>
               <Input
+                allowClear
                 style={{ width: 300 }}
                 value={formData.searchKey}
                 onChange={e => setFormData({ ...formData, searchKey: e.target.value })}
@@ -234,40 +254,42 @@ function SelectGoods({
                 showCount
               />
             </div>
-            {formBi.map(item => (
-              <div key={item.id} className='sgLeftRow'>
-                {item.tag === '文本' ? (
-                  <Input
-                    value={(formData.queryParams || {})[item.fieldName]}
-                    onChange={e => dongFormChange(item.fieldName, e.target.value.trim())}
-                    placeholder={item.fieldLabel}
-                    maxLength={30}
-                    showCount
-                  />
-                ) : ['关联标签', '关联字典'].includes(item.tag) ? (
-                  <Cascader
-                    changeOnSelect
-                    value={(formData.queryParams || {})[item.fieldName]}
-                    onChange={e => dongFormChange(item.fieldName, e)}
-                    fieldNames={{ label: 'name', value: 'id', children: 'children' }}
-                    options={treeOneIdByResFu(
-                      item.tag === '关联字典' ? dictArrTemp : biaoQianTemp,
-                      item.dictId + ''
-                    )}
-                    placeholder={item.fieldLabel}
-                  />
-                ) : item.tag === '下拉' ? (
-                  <Select
-                    allowClear
-                    value={(formData.queryParams || {})[item.fieldName]}
-                    onChange={e => dongFormChange(item.fieldName, e)}
-                    style={{ width: 120 }}
-                    options={item.options.split(',').map(v => ({ value: v, label: v }))}
-                    placeholder={item.fieldLabel}
-                  />
-                ) : null}
-              </div>
-            ))}
+            {formZi
+              .filter(v => v.queryType && !baseFilter.includes(v.fieldName))
+              .map(item => (
+                <div key={item.id} className='sgLeftRow'>
+                  {item.tag === '文本' ? (
+                    <Input
+                      value={(formData.queryParams || {})[item.fieldName]}
+                      onChange={e => dongFormChange(item.fieldName, e.target.value.trim())}
+                      placeholder={item.fieldLabel}
+                      maxLength={30}
+                      showCount
+                    />
+                  ) : ['关联标签', '关联字典'].includes(item.tag) ? (
+                    <Cascader
+                      changeOnSelect
+                      value={(formData.dictQuery || {})[item.fieldName]}
+                      onChange={e => dongFormChange(item.fieldName, e, true)}
+                      fieldNames={{ label: 'name', value: 'id', children: 'children' }}
+                      options={treeOneIdByResFu(
+                        item.tag === '关联字典' ? dictArrTemp : biaoQianTemp,
+                        item.dictId + ''
+                      )}
+                      placeholder={item.fieldLabel}
+                    />
+                  ) : item.tag === '下拉' ? (
+                    <Select
+                      allowClear
+                      value={(formData.queryParams || {})[item.fieldName]}
+                      onChange={e => dongFormChange(item.fieldName, e)}
+                      style={{ width: 120 }}
+                      options={item.options.split(',').map(v => ({ value: v, label: v }))}
+                      placeholder={item.fieldLabel}
+                    />
+                  ) : null}
+                </div>
+              ))}
           </div>
           <div className='sgLeftBtn'>
             <Button type='primary' onClick={clickSearch}>
@@ -283,6 +305,7 @@ function SelectGoods({
           <Z0sonTable
             kuList={kuList}
             formZi={formZi}
+            formDefId={formDefId}
             tableList={tableList}
             pageInfo={{ current: formData.current, size: formData.size, total: total }}
             yHeight={540}

+ 16 - 12
src/pages/Zother/Z0edit/index.tsx

@@ -139,13 +139,11 @@ function Z0edit({ pageKey, APIobj, topArr, selectTxt, selcctOne = false }: Props
       // 新增、编辑、审批、查看互相跳转
       if (flag) pageSkitFu(pageKey.key, val, info.id, fId, flag)
       else {
-        const goodIdArr: number[] = []
         const snapsArr: any[] = []
         snaps.forEach((v, i) => {
-          goodIdArr.push(v.id)
-
           snapsArr.push({
-            goodId: v.id,
+            formDataId: v.id,
+            formDefId: Number(info.formDefId || fId),
             orderId: info.id,
             snap: JSON.stringify(v)
           })
@@ -153,9 +151,8 @@ function Z0edit({ pageKey, APIobj, topArr, selectTxt, selcctOne = false }: Props
 
         let obj = {
           ...info,
-          goodIds: goodIdArr.join(','),
           snaps: snapsArr,
-          formDefId: info.formDefId || fId
+          formDefId: Number(info.formDefId || fId)
         }
 
         // if (1 + 1 === 2) {
@@ -271,7 +268,7 @@ function Z0edit({ pageKey, APIobj, topArr, selectTxt, selcctOne = false }: Props
   const [openSelect, setOpenSelect] = useState(0)
 
   // 获取表单字段
-  const { formBi, formZi } = UseFormZi(fId)
+  const { formZi } = UseFormZi(fId)
 
   // 点击新增 编辑
   const [editId, setEditId] = useState(0)
@@ -412,9 +409,10 @@ function Z0edit({ pageKey, APIobj, topArr, selectTxt, selcctOne = false }: Props
             )}
           </div>
 
-          {/* 表格 */}
+          {/* ----------------表格----------------- */}
           <Z0sonTable
             classKey='EdTable'
+            formDefId={fId}
             kuList={kuList}
             formZi={formZi}
             tableList={snaps}
@@ -501,8 +499,7 @@ function Z0edit({ pageKey, APIobj, topArr, selectTxt, selcctOne = false }: Props
           oldCheckArr={snaps}
           formDefId={openSelect}
           kuList={kuList}
-          formBi={formBi}
-          formZi={formZi}
+          formZiTemp={formZi}
           isOne={selcctOne}
         />
       ) : null}
@@ -512,10 +509,17 @@ function Z0edit({ pageKey, APIobj, topArr, selectTxt, selcctOne = false }: Props
         <AddGood
           sId={editId}
           closeFu={() => setEditId(0)}
-          succFu={(val, obj) => {}}
+          succFu={(val, obj) => {
+            if (val === '新增') setSnaps([obj, ...snaps])
+            else {
+              const arr = snaps.map(v => {
+                return obj.id === v.id ? obj : v
+              })
+              setSnaps(arr)
+            }
+          }}
           formZi={formZi}
           formDefId={fId}
-          moduleId={info.id}
         />
       ) : null}
     </div>

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

@@ -61,7 +61,7 @@ function Z0table({ topSearchArr, getListAPI, pageKey, yHeight = 660, tableInfo }
     }, 50)
   }, [formData])
 
-  // 封装发送请求的函数(级联字段传数组中最后一个值)
+  // 封装发送请求的函数
   const getListFu = useCallback(() => {
     if (formDataRef.current.formDefId) {
       const params = {

+ 38 - 0
src/pages/Zother/ZgoodsInfo/Zg1txt/index.module.scss

@@ -0,0 +1,38 @@
+.Zg1txt {
+  display: flex;
+  justify-content: space-between;
+  :global {
+    .Zg1txt1 {
+      width: calc(100% - 320px);
+      .GI1Lrow {
+        display: flex;
+        font-size: 16px;
+        width: 100%;
+        border: 1px solid #ccc;
+        // border-right: 0;
+        & > div {
+          text-align: center;
+          font-weight: 700;
+          width: 170px;
+          background-color: #eaeaea;
+          padding: 5px 0;
+        }
+        & > p {
+          padding: 5px 10px;
+          width: calc(100% - 170px);
+          word-wrap: break-word;
+        }
+      }
+    }
+    .Zg1txt2 {
+      width: 320px;
+      display: flex;
+      justify-content: center;
+      padding-top: 100px;
+      & > div {
+        border-radius: 8px;
+        overflow: hidden;
+      }
+    }
+  }
+}

+ 76 - 0
src/pages/Zother/ZgoodsInfo/Zg1txt/index.tsx

@@ -0,0 +1,76 @@
+import React, { useEffect, useState } from 'react'
+import styles from './index.module.scss'
+import { baseFormType } from '@/pages/Zsystem/Z1sysSet/data'
+import ImageLazy from '@/components/ImageLazy'
+import { dictIdByName } from '@/utils'
+
+export type FormTxtType = {
+  key: string
+  value: string
+  type: '文本' | '关联字典' | '关联标签' | '关联资源'
+}
+
+// 在这里需要过滤的字段
+const filArr = [
+  '资源名称',
+  '封面',
+  '大封面',
+  '排序值',
+  '入库状态',
+  '发布状态',
+  '推荐状态',
+  '资源编码',
+  '附件'
+]
+
+type Props = {
+  info: any
+  formZi: baseFormType[]
+}
+
+function Zg1txt({ info, formZi }: Props) {
+  const [list, setList] = useState<FormTxtType[]>([])
+
+  useEffect(() => {
+    const arr: FormTxtType[] = []
+    formZi.forEach(v => {
+      if (!filArr.includes(v.fieldLabel)) {
+        arr.push({
+          key: v.fieldLabel,
+          value: info[v.fieldName],
+          type: v.tag as '文本'
+        })
+      }
+    })
+    setList(arr)
+  }, [formZi, info])
+
+  return (
+    <div className={styles.Zg1txt}>
+      <div className='Zg1txt1'>
+        {list.map((item, index) => (
+          <div key={index} className='GI1Lrow'>
+            <div>{item.key}</div>
+            <p>
+              {['关联字典', '关联标签'].includes(item.type)
+                ? dictIdByName(item.value)
+                : item.value || '(空)'}
+            </p>
+          </div>
+        ))}
+      </div>
+      <div className='Zg1txt2'>
+        <ImageLazy
+          width={240}
+          height={220}
+          src={info.thumb || info.thumbPc}
+          srcBig={info.thumbPc || info.thumb}
+        />
+      </div>
+    </div>
+  )
+}
+
+const MemoZg1txt = React.memo(Zg1txt)
+
+export default MemoZg1txt

+ 4 - 0
src/pages/Zother/ZgoodsInfo/Zg2file/index.module.scss

@@ -0,0 +1,4 @@
+.Zg2file {
+  :global {
+  }
+}

+ 103 - 0
src/pages/Zother/ZgoodsInfo/Zg2file/index.tsx

@@ -0,0 +1,103 @@
+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'
+
+type Props = {
+  list: FileListType[]
+}
+
+function Zg2file({ list }: Props) {
+  const staBtn = useMemo(() => {
+    let arr: any[] = []
+
+    arr.push({
+      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
+  }, [])
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: FileListType) => (
+          <>
+            <Button size='small' type='text' onClick={async () => downloadFileByUrl(item.filePath)}>
+              下载
+            </Button>
+          </>
+        )
+      }
+    ]
+  }, [])
+
+  return (
+    <div className={styles.Zg2file}>
+      {/* 表格 */}
+      <MyTable
+        classKey='Zg2file'
+        yHeight={600}
+        list={list}
+        columnsTemp={[
+          ['select', '附件类型', 'type', selectObj['附件类型']],
+          ['txt', '附件名称', 'fileName'],
+          ['dateRes', '上传日期', 'createTime'],
+          ['txt', '上传人', 'creatorName'],
+          ['sizeNum', '文件大小(mb)', 'fileSize', 1024]
+        ]}
+        lastBtn={tableLastBtn}
+        staBtn={staBtn}
+        pagingInfo={false}
+      />
+    </div>
+  )
+}
+
+const MemoZg2file = React.memo(Zg2file)
+
+export default MemoZg2file

+ 4 - 0
src/pages/Zother/ZgoodsInfo/Zg3log/index.module.scss

@@ -0,0 +1,4 @@
+.Zg3log {
+  :global {
+  }
+}

+ 14 - 0
src/pages/Zother/ZgoodsInfo/Zg3log/index.tsx

@@ -0,0 +1,14 @@
+import React from 'react'
+import styles from './index.module.scss'
+function Zg3log() {
+  return (
+    <div className={styles.Zg3log}>
+      <h1>开发中</h1>
+      {/* 待完善 */}
+    </div>
+  )
+}
+
+const MemoZg3log = React.memo(Zg3log)
+
+export default MemoZg3log

+ 72 - 0
src/pages/Zother/ZgoodsInfo/index.module.scss

@@ -1,4 +1,76 @@
 .ZgoodsInfo {
+  padding: 10px;
   :global {
+    .ZGtop1 {
+      display: flex;
+      font-size: 20px;
+      font-weight: 700;
+      & > p {
+        max-width: calc(100% - 400px);
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+        cursor: context-menu;
+        color: var(--txtColor);
+      }
+      .ant-btn {
+        margin-left: 15px;
+        pointer-events: none;
+      }
+    }
+
+    .ZGtop2 {
+      font-size: 18px;
+      font-weight: 700;
+      margin: 10px 0;
+    }
+
+    .ZGtop3 {
+      display: flex;
+      justify-content: space-between;
+      border-bottom: 1px solid #ccc;
+      padding-bottom: 10px;
+      & > div {
+        display: flex;
+        .GItab1 {
+          cursor: pointer;
+          font-size: 16px;
+          padding: 0 10px;
+          margin: 0 5px;
+          position: relative;
+          font-weight: 700;
+        }
+        .GItab1Ac {
+          color: var(--txtColor);
+          &::before {
+            content: '';
+            position: absolute;
+            bottom: -10px;
+            left: 0;
+            width: 100%;
+            height: 6px;
+            background-color: var(--txtColor);
+          }
+        }
+        .ant-btn {
+          margin-left: 15px;
+        }
+      }
+    }
+
+    .ZGmain {
+      margin-top: 20px;
+      width: 100%;
+      height: calc(100% - 140px);
+      & > div {
+        width: 100%;
+        height: 100%;
+        & > div {
+          width: 100%;
+          height: 100%;
+          overflow-y: auto;
+        }
+      }
+    }
   }
 }

+ 204 - 2
src/pages/Zother/ZgoodsInfo/index.tsx

@@ -1,9 +1,211 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
 import styles from './index.module.scss'
+import { APIgetFileList, APIgetGoodsInfo } from '@/store/action/Bresource/B1overview'
+import { useParams } from 'react-router-dom'
+import { selectObj } from '@/utils/dataChange'
+import { Button, Dropdown } from 'antd'
+import classNames from 'classnames'
+import { MessageFu } from '@/utils/message'
+import { CaretDownOutlined } from '@ant-design/icons'
+import { UseFormZi } from '@/pages/Zuse/UseFormZi'
+import Zg1txt from './Zg1txt'
+import { authorityFu } from '@/utils/authority'
+import AddGood from '../AddGood'
+import { FileListType } from '@/components/Z3upFiles/data'
+import Zg2file from './Zg2file'
+import Zg3log from './Zg3log'
+
 function ZgoodsInfo() {
+  const { id, fId } = useParams<any>()
+  // 获取表单字段
+  const { formZi } = UseFormZi(fId)
+
+  const [info, setInfo] = useState<any>({})
+
+  const [fileList, setFileList] = useState<FileListType[]>([])
+
+  const getInfoFu = useCallback(async () => {
+    const res = await APIgetGoodsInfo(fId, id)
+
+    if (res.code === 0) {
+      const data = res.data
+
+      setInfo(data)
+
+      // 设置附件
+      if (data.file_ids) {
+        const res2 = await APIgetFileList(data.file_ids.split(','))
+
+        if (res2.code === 0) {
+          setFileList(res2.data)
+        }
+      }
+    }
+  }, [fId, id])
+
+  useEffect(() => {
+    getInfoFu()
+  }, [getInfoFu])
+
+  // 发布状态/入库状态
+  const selectTxt = useCallback((type: '发布状态' | '入库状态', val: number) => {
+    let txt = type === '发布状态' ? '未发布' : '未入库'
+    const obj = selectObj[type].find(v => v.value === val)
+    if (obj) txt = obj.label
+    return txt
+  }, [])
+
+  // 切换左侧tab
+  const [btnArr, setBtnArr] = useState([
+    {
+      id: 331,
+      name: '资源信息',
+      show: true,
+      done: true
+    },
+    { id: 332, name: '资源附件', show: false, done: false },
+    { id: 333, name: '资源日志', show: false, done: false }
+  ])
+
+  const cutTabFu = useCallback(
+    (id: number) => {
+      setBtnArr(
+        btnArr.map(v => ({
+          ...v,
+          done: v.id === id && !v.done ? true : v.done,
+          show: v.id === id
+        }))
+      )
+    },
+    [btnArr]
+  )
+
+  // 点击 资源 修改
+  const [editId, setEditId] = useState(0)
+
+  // 点击的时候校验前置状态和页面权限
+  const tabArr2 = useMemo(() => {
+    // 待完善 校验
+    //   let arr: any[] = []
+    // if ([3, 4, 6, 7].includes(info.status)) {
+
+    //   }
+    let arr = [
+      {
+        id: 336,
+        name: '档案管理',
+        son: [
+          {
+            key: '1',
+            label: '修改',
+            onClick: () => {
+              authorityFu(310, '资源入库', () => setEditId(info.id))
+            }
+          },
+          {
+            key: '2',
+            label: '注销',
+            onClick: () => {
+              MessageFu.warning('开发中')
+            }
+          }
+        ]
+      },
+      {
+        id: 337,
+        name: '发布管理',
+        son: [
+          {
+            key: '1',
+            label: '发布',
+            onClick: () => {
+              MessageFu.warning('开发中')
+            }
+          },
+          {
+            key: '2',
+            label: '下架',
+            onClick: () => {
+              MessageFu.warning('开发中')
+            }
+          },
+          {
+            key: '3',
+            label: '推荐',
+            onClick: () => {
+              MessageFu.warning('开发中')
+            }
+          }
+        ]
+      }
+    ]
+
+    return arr
+  }, [info.id])
   return (
     <div className={styles.ZgoodsInfo}>
-      <h1>ZgoodsInfo</h1>
+      <div className='pageTitle'>资源详情</div>
+      {info.id ? (
+        <>
+          <div className='ZGtop1'>
+            <p title={info.name}>{info.name}</p>
+            <Button>{selectTxt('发布状态', info.status_publish)}</Button>
+            <Button>{selectTxt('入库状态', info.status_storage)}</Button>
+          </div>
+
+          <div className='ZGtop2'>资源编码:{info.num}</div>
+
+          <div className='ZGtop3'>
+            <div>
+              {btnArr.map(item => (
+                <div
+                  className={classNames('GItab1', item.show ? 'GItab1Ac' : '')}
+                  key={item.id}
+                  onClick={() => cutTabFu(item.id)}
+                >
+                  {item.name}
+                </div>
+              ))}
+            </div>
+
+            <div>
+              {info.status_storage
+                ? tabArr2.map(item => (
+                    <Dropdown key={item.id} menu={{ items: item.son }} trigger={['click']}>
+                      <Button type='primary'>
+                        {item.name}
+                        <CaretDownOutlined />
+                      </Button>
+                    </Dropdown>
+                  ))
+                : null}
+            </div>
+          </div>
+
+          <div className='ZGmain'>
+            <div hidden={!btnArr[0].show}>
+              {btnArr[0].done ? <Zg1txt info={info} formZi={formZi} /> : null}
+            </div>
+
+            <div hidden={!btnArr[1].show}>
+              {btnArr[1].done ? <Zg2file list={fileList} /> : null}
+            </div>
+
+            <div hidden={!btnArr[2].show}>{btnArr[2].done ? <Zg3log /> : null}</div>
+          </div>
+        </>
+      ) : null}
+
+      {/* 新增/编辑 资源 */}
+      {editId ? (
+        <AddGood
+          sId={editId}
+          closeFu={() => setEditId(0)}
+          succFu={(val, obj) => getInfoFu()}
+          formZi={formZi}
+          formDefId={fId}
+        />
+      ) : null}
     </div>
   )
 }

+ 1 - 1
src/pages/Zuse/UseFormZi.tsx

@@ -4,7 +4,7 @@ import { baseFormType } from '../Zsystem/Z1sysSet/data'
 import { Z1_APIgetFormZiDuan } from '@/store/action/Zsystem/Z1sysSet'
 
 // 需要过滤的字段
-const baseFilter = [
+export const baseFilter = [
   'name',
   'create_by',
   'thumb',

+ 30 - 0
src/store/action/Bresource/B1overview.ts

@@ -1,3 +1,4 @@
+import { AppDispatch } from '@/store'
 import http from '@/utils/http'
 
 // 获取资源详情
@@ -9,3 +10,32 @@ export const APIgetGoodsInfo = (formDefId: number, id: number) => {
 export const APIsaveGoods = (formDefId: number, param: any) => {
   return http.post(`cms/form/data/save`, { formDefId: Number(formDefId), param })
 }
+
+// 根据id查看附件
+export const APIgetFileList = (ids: string[]) => {
+  return http.post(`cms/file/getList`, ids)
+}
+
+/**
+ * 资源总览 -获取分页列表
+ */
+export const B1_APIgetList = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/form/data/pageList', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+
+      dispatch({ type: 'B1/getList', payload: obj })
+    }
+  }
+}
+
+/**
+ * 资源总览 -删除表格数据
+ */
+export const APIdelTable = (formDefId: number, id: number) => {
+  return http.get(`cms/form/data/remove/${formDefId}/${id}`)
+}

+ 28 - 0
src/store/reducer/Bresource/B1overview.ts

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

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

@@ -3,6 +3,7 @@ import { combineReducers } from 'redux'
 
 // 导入 登录 模块的 reducer
 import A0Layout from './layout'
+import B1overview from './Bresource/B1overview'
 import B3resTag from './Bresource/B3resTag'
 import C1resIn from './CinStorage/C1resIn'
 import Z1sysSet from './Zsystem/Z1sysSet'
@@ -17,6 +18,7 @@ import Z8sysLog from './Zsystem/Z8sysLog'
 // 合并 reducer
 const rootReducer = combineReducers({
   A0Layout,
+  B1overview,
   B3resTag,
   C1resIn,
   Z1sysSet,

+ 10 - 0
src/utils/authority.ts

@@ -1,4 +1,14 @@
+import store from '@/store'
 import { getTokenInfo } from './storage'
+import { MessageFu } from './message'
+
+// 看下有没有权限
+export const authorityFu = (id: number, txt: string, fu: () => void, txt2?: string) => {
+  const authorityIds = store.getState().A0Layout.authorityIds
+
+  if (authorityIds.includes(id)) fu()
+  else MessageFu.warning(txt2 ? txt2 : `您没有 ${txt} 页面权限`)
+}
 
 // 列表页面的审批按钮是否显示,true为显示
 export const tableListAuditBtnFu = (item: any) => {

+ 32 - 0
src/utils/dataChange.ts

@@ -25,7 +25,39 @@ export const selectObj = {
     { value: '关联字典', label: '关联字典' },
     { value: '关联标签', label: '关联标签' },
     { value: '关联资源', label: '关联资源' }
+  ],
+  发布状态: [
+    { value: 0, label: '未发布' },
+    { value: 2, label: '发布中' },
+    { value: 3, label: '已发布' }
+  ],
+  推荐状态: [
+    { value: 0, label: '未推荐' },
+    { value: 2, label: '推荐中' },
+    { value: 3, label: '已推荐' }
+  ],
+  入库状态: [
+    // { value: 0, label: '(空)' },
+    { value: 1, label: '待入库' },
+    { value: 2, label: '入库中' },
+    { value: 3, label: '已入库' }
+  ],
+  附件类型: [
+    { value: 'img', label: '图像' },
+    { value: 'model', label: '3D' },
+    { value: 'audio', label: '音频' },
+    { value: 'video', label: '视频' },
+    { value: 'doc', label: '文档' },
+    { value: 'other', label: '其他' }
   ]
 }
 
 export type antdSelectType = { value: number; label: string }
+
+// 表格下拉
+export const tableSelectToTxt = (val: number, arr: any[]) => {
+  let txt = '(空)'
+  const obj = arr.find(v => v.value === (val || 0))
+  if (obj) txt = obj.label
+  return txt
+}