Ver código fonte

配置项信息修改

shaogen1995 2 meses atrás
pai
commit
f098430f60

+ 3 - 3
README.md

@@ -1,10 +1,10 @@
 1.使用 yarn。 npm 有问题
 node 版本:22.18.0
 
-2.测试后端文档地址:xxxxx
+2.测试后端文档地址:https://sit-chaoxuept.4dage.com/api/doc.html#/home
 
-3.测试堡垒机位置:xxxxx
+3.测试堡垒机位置:/Default/腾讯云/项目节点/腾讯云-四维时代-项目测试服务器-111.230.233.212/data/data/museum_guangdong_chaozhou_yanjiuyuan_form_data
 
-4:测试网址:xxxx
+4:测试网址:https://sit-chaoxuept.4dage.com/backstage
 
 5:蓝湖地址:https://lanhuapp.com/web/#/item/project/product?tid=de3e5e3e-a489-4b19-862a-7c87ce113467&pid=4fd044ba-f0a7-4506-aafb-7fac2723030f&image_id=bce72843-1e2e-4ca1-aa01-c7d70072ae27&docId=bce72843-1e2e-4ca1-aa01-c7d70072ae27&docType=axure&versionId=80b6541c-1f0b-429c-9496-ed0f2f21b531&pageId=55b65a8e4d3c4934a9d928e686c347b8&parentId=a9b62ea95f7245ba991d41df8b3f2b06

+ 6 - 5
src/pages/Zother/AddGood/index.tsx

@@ -70,12 +70,13 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi, kuList }: Props) {
       // 关联资源
       if (data.form_ids) {
         const obj = JSON.parse(data.form_ids || '{}')
+        if (typeof obj === 'object') {
+          const res3 = await APIgetZiYuanInfo(obj)
 
-        const res3 = await APIgetZiYuanInfo(obj)
-
-        if (res3.code === 0) {
-          const list = res3.data
-          setZiYuanObj(ziYuanChangeFu(list))
+          if (res3.code === 0) {
+            const list = res3.data
+            setZiYuanObj(ziYuanChangeFu(list))
+          }
         }
       }
     }

+ 19 - 0
src/pages/Zother/Z0edit/index.tsx

@@ -25,6 +25,7 @@ import SelectGoods from '../SelectGoods'
 import Z0sonTable from '@/components/Z0sonTable'
 import { UseFormZi } from '@/pages/Zuse/UseFormZi'
 import AddGood from '../AddGood'
+import { APIgetGoodsInfo } from '@/store/action/Bresource/B1overview'
 
 const verifyArr = [{ key: 'num', txt: '请输入申请编号' }]
 
@@ -40,6 +41,24 @@ function Z0edit({ pageKey, APIobj, topArr, selectInfo, selcctOne = false }: Prop
   const { key, id, fId } = useParams<any>()
   // key:1 新增 2编辑 3审批 4查看
 
+  // 从藏品详情进来的-获取藏品详情
+  const getGoodsInfoFu = useCallback(
+    async (id: number) => {
+      const res = await APIgetGoodsInfo(fId, id)
+      if (res.code === 0) {
+        setSnaps([res.data])
+      }
+    },
+    [fId]
+  )
+  useEffect(() => {
+    const urlAll = window.location.href
+    if (urlAll.includes('?gId=')) {
+      const gId = urlAll.split('?gId=')[1]
+      getGoodsInfoFu(Number(gId))
+    }
+  }, [getGoodsInfoFu])
+
   const isLook = useMemo(() => {
     return ['3', '4'].includes(key)
   }, [key])

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

@@ -127,7 +127,7 @@ function Z1formSet({ sId, closeFu }: Props) {
                 ) : item.tag === '附件' ? (
                   <div className='formRightFile'>
                     <Button type='primary'>上传附件</Button>&emsp;
-                    <p>最大支持500M。</p>
+                    <p>支持上传多个附件,单个附件最大支持500M。</p>
                   </div>
                 ) : item.tag === '关联资源' ? (
                   <Button type='primary'>关联资源</Button>

+ 7 - 4
src/pages/Zother/ZgoodsInfo/Zg1txt/index.tsx

@@ -55,11 +55,14 @@ function Zg1txt({ info, formZi, kuList }: Props) {
   const getZiYuanInfoFu = useCallback(async (val: string) => {
     if (val) {
       const obj = JSON.parse(val || '{}')
-      const res3 = await APIgetZiYuanInfo(obj)
 
-      if (res3.code === 0) {
-        const list = res3.data
-        setZiYuanObj(ziYuanChangeFu(list))
+      if (typeof obj === 'object') {
+        const res3 = await APIgetZiYuanInfo(obj)
+
+        if (res3.code === 0) {
+          const list = res3.data
+          setZiYuanObj(ziYuanChangeFu(list))
+        }
       }
     }
   }, [])

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

@@ -4,7 +4,6 @@ function Zg3log() {
   return (
     <div className={styles.Zg3log}>
       <h1>开发中</h1>
-      {/* 待完善 */}
     </div>
   )
 }

+ 1 - 1
src/pages/Zother/ZgoodsInfo/index.module.scss

@@ -6,7 +6,7 @@
       font-size: 20px;
       font-weight: 700;
       & > p {
-        max-width: calc(100% - 400px);
+        max-width: calc(100% - 270px);
         overflow: hidden;
         text-overflow: ellipsis;
         white-space: nowrap;

+ 44 - 18
src/pages/Zother/ZgoodsInfo/index.tsx

@@ -15,6 +15,7 @@ import { FileListType } from '@/components/Z3upFiles/data'
 import Zg2file from './Zg2file'
 import Zg3log from './Zg3log'
 import { getKuListByOpenFu } from '../data'
+import history from '@/utils/history'
 
 function ZgoodsInfo() {
   const { id, fId } = useParams<any>()
@@ -22,14 +23,17 @@ function ZgoodsInfo() {
   const [kuTxt, setkuTxt] = useState('')
   const [kuList, setKuList] = useState<antdSelectType[]>([])
 
+  const [errFlag, setErrFlag] = useState(false)
+
   useEffect(() => {
     getKuListByOpenFu(data => {
       if (data && data.length) {
         setKuList(data)
         const obj = data.find(v => v.value === Number(fId))
         if (obj) setkuTxt(obj.label)
+        else setErrFlag(true)
       }
-    }, true)
+    })
   }, [fId])
 
   // 获取表单字段
@@ -63,8 +67,8 @@ function ZgoodsInfo() {
   }, [getInfoFu])
 
   // 发布状态/入库状态
-  const selectTxt = useCallback((type: '发布状态' | '入库状态', val: number) => {
-    let txt = type === '发布状态' ? '未发布' : '未入库'
+  const selectTxt = useCallback((type: '发布状态' | '入库状态' | '推荐状态', val: number) => {
+    let txt = type === '发布状态' ? '未发布' : type === '入库状态' ? '未入库' : '未推荐'
     const obj = selectObj[type].find(v => v.value === val)
     if (obj) txt = obj.label
     return txt
@@ -100,11 +104,6 @@ function ZgoodsInfo() {
 
   // 点击的时候校验前置状态和页面权限
   const tabArr2 = useMemo(() => {
-    // 待完善 校验
-    //   let arr: any[] = []
-    // if ([3, 4, 6, 7].includes(info.status)) {
-
-    //   }
     let arr = [
       {
         id: 336,
@@ -121,7 +120,12 @@ function ZgoodsInfo() {
             key: '2',
             label: '注销',
             onClick: () => {
-              MessageFu.warning('开发中')
+              // 发布状态 未发布
+              if ([2, 3].includes(info.status_publish)) {
+                MessageFu.warning(`发布状态为(未发布)时,才可进行注销`)
+              } else {
+                MessageFu.warning('开发中')
+              }
             }
           }
         ]
@@ -134,21 +138,39 @@ function ZgoodsInfo() {
             key: '1',
             label: '发布',
             onClick: () => {
-              MessageFu.warning('开发中')
+              // 发布状态 未发布
+              if ([2, 3].includes(info.status_publish)) {
+                MessageFu.warning(`发布状态为(未发布)时,才可进行发布`)
+              } else {
+                authorityFu(410, '资源发布', () =>
+                  history.push(`/resIssue_edit/1/null/${fId}?gId=${info.id}`)
+                )
+              }
             }
           },
           {
             key: '2',
             label: '下架',
             onClick: () => {
-              MessageFu.warning('开发中')
+              // 发布状态 已发布
+              if (info.status_publish === 3) {
+                MessageFu.warning('开发中')
+              } else MessageFu.warning(`发布状态为(已发布)时,才可进行下架`)
             }
           },
           {
             key: '3',
             label: '推荐',
             onClick: () => {
-              MessageFu.warning('开发中')
+              // 发布状态 已发布
+              if (info.status_publish === 3) {
+                // 推荐状态 未推荐
+                if ([2, 3].includes(info.status_hot)) {
+                  MessageFu.warning(`推荐状态为(未推荐)时,才可进行推荐`)
+                } else {
+                  MessageFu.warning('开发中')
+                }
+              } else MessageFu.warning(`发布状态为(已发布)时,才可进行推荐`)
             }
           }
         ]
@@ -156,16 +178,20 @@ function ZgoodsInfo() {
     ]
 
     return arr
-  }, [info.id])
+  }, [fId, info])
   return (
     <div className={styles.ZgoodsInfo}>
-      <div className='pageTitle'>资源详情&emsp;资源库:{kuTxt}</div>
-      {info.id ? (
+      <div className='pageTitle'>
+        资源详情&emsp;{errFlag ? null : '资源库:'}
+        {kuTxt}
+      </div>
+      {info.id && kuTxt ? (
         <>
           <div className='ZGtop1'>
             <p title={info.name}>{info.name}</p>
-            <Button>{selectTxt('发布状态', info.status_publish)}</Button>
             <Button>{selectTxt('入库状态', info.status_storage)}</Button>
+            <Button>{selectTxt('发布状态', info.status_publish)}</Button>
+            <Button>{selectTxt('推荐状态', info.status_hot)}</Button>
           </div>
 
           <div className='ZGtop2'>资源编码:{info.num}</div>
@@ -184,7 +210,7 @@ function ZgoodsInfo() {
             </div>
 
             <div>
-              {info.status_storage
+              {info.status_storage === 3
                 ? tabArr2.map(item => (
                     <Dropdown key={item.id} menu={{ items: item.son }} trigger={['click']}>
                       <Button type='primary'>
@@ -210,7 +236,7 @@ function ZgoodsInfo() {
           </div>
         </>
       ) : null}
-
+      {errFlag ? <div className='Z0null'>资源库数据异常 或 资源库状态被停用</div> : null}
       {/* 新增/编辑 资源 */}
       {editId ? (
         <AddGood

+ 2 - 2
src/pages/Zother/data.tsx

@@ -34,11 +34,11 @@ export type Typetable = {
 export type GoodsType = any
 
 // 异步获取资源库列表--已开启状态
-export const getKuListByOpenFu = async (back: (data: any[]) => void, all?: boolean) => {
+export const getKuListByOpenFu = async (back: (data: any[]) => void) => {
   const res = await Z1_APIgetAll({ pageNum: 1, pageSize: 99999 }, true)
   if (res.code === 0) {
     let list: any[] = res.data.records || []
-    list = list.filter(v => v.isEnabled === 1 || all).map(v => ({ value: v.id, label: v.formName }))
+    list = list.filter(v => v.isEnabled === 1).map(v => ({ value: v.id, label: v.formName }))
     back(list)
   }
 }

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

@@ -80,7 +80,7 @@ function Z2dict() {
       const data = dataTemp || []
 
       return data.map(item => {
-        const strTitle = ((item.num ? item.num + ' ' : '') + item.name) as string
+        const strTitle = item.name as string
         const strTitleD = strTitle.toUpperCase()
 
         const valueD = value.toUpperCase()

+ 15 - 7
src/store/action/Zsystem/Z2dict.ts

@@ -2,6 +2,17 @@ import { Z2dataType } from '@/pages/Zsystem/Z2dict/data'
 import { AppDispatch } from '@/store'
 import http from '@/utils/http'
 /**
+ * 递归给所有层级的节点添加 nameRes 字段
+ */
+const addNameResField = (list: Z2dataType[]): Z2dataType[] => {
+  return list.map(item => ({
+    ...item,
+    name: (item.num ? item.num + ' ' : '') + (item.name || ''),
+    children: item.children ? addNameResField(item.children) : undefined
+  }))
+}
+
+/**
  * 获取对应表格列表(传id就是列表,从第三级开始)
  */
 export const Z2_APIgetDict = (backFu?: (data: Z2dataType[]) => void, urlTemp?: string): any => {
@@ -9,17 +20,14 @@ export const Z2_APIgetDict = (backFu?: (data: Z2dataType[]) => void, urlTemp?: s
     let url = urlTemp || 'cms/dict/getTree'
     const res = await http.get(url)
     if (res.code === 0) {
-      dispatch({ type: 'Z2/getDictAll', payload: res.data || [] })
-      backFu && backFu(res.data || [])
+      const list: Z2dataType[] = res.data || []
+      const processedList = addNameResField(list)
+      dispatch({ type: 'Z2/getDictAll', payload: processedList })
+      backFu && backFu(processedList)
     }
   }
 }
 
-// 根据指定id返回树结构
-export const Z2_APIgetDictZhi = (id: string) => {
-  return http.get(`cms/dict/getTree?parentId=${id}`)
-}
-
 /**
  * 获取详情
  */

+ 1 - 1
src/utils/http.ts

@@ -10,7 +10,7 @@ export const defaultPassWord = 'Aa147852'
 
 export const envFlag = process.env.NODE_ENV === 'development'
 
-// const baseUrlTemp = 'xxxxxxxxxxxxxx' // 测试环境
+// const baseUrlTemp = 'https://sit-chaoxuept.4dage.com' // 测试环境
 const baseUrlTemp = 'http://192.168.20.61:8118' // 线下环境
 
 const baseFlag = baseUrlTemp.includes('https://')