shaogen1995 5 روز پیش
والد
کامیت
22670ba7ee

+ 4 - 6
src/pages/Abench/A1statistics/index.tsx

@@ -2,9 +2,8 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { Button, Select, TreeSelect } from 'antd'
 import { iconUrl } from '@/utils/http'
-import { useDispatch, useSelector } from 'react-redux'
+import { useSelector } from 'react-redux'
 import { RootState } from '@/store'
-import { E1_APIgetTree } from '@/store/action/Eculture/E1tag'
 import type { TypeI5Tree } from '@/pages/Isystem/I5organization/data'
 import * as xlsx from 'xlsx'
 import * as echarts from 'echarts'
@@ -46,7 +45,6 @@ function A1statistics() {
   const [categoryTagId, setCategoryTagId] = useState<string | null>(null)
   const [categoryData, setCategoryData] = useState<{ name: string; value: number }[]>([])
 
-  const dispatch = useDispatch()
   const categoryTreeData = useSelector((state: RootState) => state.E1tag.treeData)
 
   // 一级/二级分类
@@ -154,9 +152,9 @@ function A1statistics() {
     : null
 
   // 获取品类树(cms/tag/getTree)
-  useEffect(() => {
-    dispatch(E1_APIgetTree())
-  }, [dispatch])
+  // useEffect(() => {
+  //   dispatch(E1_APIgetTree(undefined, 'cms/common/tagGetTree'))
+  // }, [dispatch])
 
   // 品类树加载后默认选中第一个
   useEffect(() => {

+ 2 - 2
src/pages/Cledger/C1ledger/C1ImportRes/index.tsx

@@ -6,8 +6,8 @@ import MyTable from '@/components/MyTable'
 import { Input, Select, Button } from 'antd'
 import {
   API_addImportExcel,
-  API_addImportExcelRecord,
-  API_saveFileLog
+  API_addImportExcelRecord
+  // API_saveFileLog
 } from '@/store/action/Cledger/C1ledger'
 import { MessageFu } from '@/utils/message'
 

+ 1 - 1
src/pages/Isystem/I4processSet/index.tsx

@@ -28,7 +28,7 @@ function I4processSet() {
       I2_APIgetDict(data => {
         const dataRes = data || []
         setTreeData(dataRes.filter(v => dictFilterArr.includes(v.id)))
-      })
+      }, 'cms/common/dictGetTree')
     )
   }, [dispatch])
 

+ 3 - 3
src/pages/Layout/index.tsx

@@ -33,10 +33,10 @@ function Layout() {
     dispatch(
       I2_APIgetDict(() => {
         setLoding(true)
-      })
+      }, 'cms/common/dictGetTree')
     )
-    dispatch(E1_APIgetTree())
-    dispatch(E3_APIgetTree())
+    dispatch(E1_APIgetTree(undefined, 'cms/common/tagGetTree'))
+    dispatch(E3_APIgetTree(undefined, 'cms/common/artGetTree'))
   }, [dispatch])
 
   useEffect(() => {

+ 2 - 2
src/store/action/Eculture/E1tag.ts

@@ -5,9 +5,9 @@ import http from '@/utils/http'
 /**
  * 标签 - 获取树列表
  */
-export const E1_APIgetTree = (callFu?: (data: TypeI5Tree[]) => void): any => {
+export const E1_APIgetTree = (callFu?: (data: TypeI5Tree[]) => void, urlTemp?: string): any => {
   return async (dispatch: AppDispatch) => {
-    const res = await http.get('cms/tag/getTree')
+    const res = await http.get(urlTemp || 'cms/tag/getTree')
     if (res.code === 0) {
       callFu && callFu(res.data || [])
       dispatch({ type: 'E1/getTree', payload: res.data || [] })

+ 2 - 2
src/store/action/Eculture/E3label.ts

@@ -5,9 +5,9 @@ import http from '@/utils/http'
 /**
  * 标签 - 获取树列表
  */
-export const E3_APIgetTree = (callFu?: (data: TypeI5Tree[]) => void): any => {
+export const E3_APIgetTree = (callFu?: (data: TypeI5Tree[]) => void, urlTemp?: string): any => {
   return async (dispatch: AppDispatch) => {
-    const res = await http.get('cms/art/getTree')
+    const res = await http.get(urlTemp || 'cms/art/getTree')
     if (res.code === 0) {
       callFu && callFu(res.data || [])
       dispatch({ type: 'E3/getTree', payload: res.data || [] })

+ 2 - 2
src/store/action/Isystem/I2dict.ts

@@ -4,9 +4,9 @@ import http from '@/utils/http'
 /**
  * 获取对应表格列表(传id就是列表,从第三级开始)
  */
-export const I2_APIgetDict = (backFu?: (data: TypeI5Tree[]) => void): any => {
+export const I2_APIgetDict = (backFu?: (data: TypeI5Tree[]) => void, urlTemp?: string): any => {
   return async (dispatch: AppDispatch) => {
-    let url = 'cms/dict/getTree'
+    let url = urlTemp || 'cms/dict/getTree'
     const res = await http.get(url)
     if (res.code === 0) {
       dispatch({ type: 'I2/getDictAll', payload: res.data || [] })

+ 5 - 5
src/utils/http.ts

@@ -10,8 +10,8 @@ export const defaultPassWord = 'Aa147852'
 
 export const envFlag = process.env.NODE_ENV === 'development'
 
-const baseUrlTemp = 'https://sit-qingdaobeer.4dage.com' // 测试环境
-// const baseUrlTemp = 'http://192.168.20.61:8112' // 线下环境
+// const baseUrlTemp = 'https://sit-qingdaobeer.4dage.com' // 测试环境
+const baseUrlTemp = 'http://192.168.20.61:8112' // 线下环境
 
 const baseFlag = baseUrlTemp.includes('https://')
 
@@ -68,12 +68,12 @@ http.interceptors.response.use(
     if (axajInd === 0) {
       domShowFu('#AsyncSpinLoding', false)
     }
-    if (response.data.code === 401) {
+    if ([401, 403].includes(response.data.code)) {
       removeTokenInfo()
       loginOutFu()
       clearTimeout(timeId)
       timeId = window.setTimeout(() => {
-        MessageFu.warning('登录超时,请重新登录')
+        MessageFu.warning(response.data.code === 401 ? '登录超时,请重新登录' : response.data.msg)
       }, 200)
     } else if (response.data.code === 0) {
       // MessageFu.success(response.data.msg);
@@ -99,7 +99,7 @@ http.interceptors.response.use(
         ) {
           MessageFu.error(err.response.data.msg)
           // 没有权限
-          if (err.response.data.code === 401) {
+          if ([401, 403].includes(err.response.data.code)) {
             removeTokenInfo()
             loginOutFu()
           }

+ 4 - 0
tsconfig.json

@@ -20,6 +20,10 @@
     "isolatedModules": true,
     "noEmit": true,
     "jsx": "react-jsx",
+    "types": [
+      "node"
+    ],
+    "ignoreDeprecations": "6.0"
   },
   "include": [
     "src"