Explorar o código

修复新窗口打开页面问题

shaogen1995 hai 8 meses
pai
achega
91192ffe4c

+ 2 - 2
src/pages/B_enterTibet/B34typeIn/B34edit/index.tsx

@@ -17,7 +17,7 @@ import {
   FourAPI_saveDraft
 } from '@/store/action/FourAll'
 import { MessageFu } from '@/utils/message'
-import history, { btnFlagFu2 } from '@/utils/history'
+import history, { btnFlagFu2, openGoodsInfoFu } from '@/utils/history'
 import { EXbtnFu } from '@/utils/EXBtn'
 import { pageTitTxtObj } from '@/pages/D_storeManage/D4impStor/D4edit'
 import X3auditInfo from '@/pages/X_stock/X3auditInfo'
@@ -83,7 +83,7 @@ function B34edit({ type }: Props) {
         render: (item: C1GoodType) => {
           return item.subNum && item.relatedOrderId ? (
             <span
-              onClick={() => window.open(`/#/register_edit/4/${item.relatedOrderId}`, '_blank')}
+              onClick={() => openGoodsInfoFu(item.relatedOrderId, '#/register_edit/4/')}
               className='D1GtNum'
             >
               {item.subNum}

+ 2 - 1
src/pages/Y_goodsDetails/Y1cathet/Y44com.tsx

@@ -9,6 +9,7 @@ import { API_getInfoLogList } from '@/store/action/C1ledger'
 import tabLeftArr from '@/pages/Layout/data'
 import { RouterTypeRow } from '@/types'
 import { MessageFu } from '@/utils/message'
+import { openGoodsInfoFu } from '@/utils/history'
 const { RangePicker } = DatePicker
 
 const baseFormData: TypeY44form = {
@@ -139,7 +140,7 @@ function Y44com({ isLook, sId }: Props) {
   const lookPage = useCallback(
     (name: string, id: number) => {
       const obj = typePageArr.find(v => v.name === name)
-      if (obj) window.open(`/#${obj.path}_edit/4/${id}`, '_blank')
+      if (obj) openGoodsInfoFu(id, `#${obj.path}_edit/4/`)
       else MessageFu.warning('业务类型错误')
     },
     [typePageArr]

+ 7 - 10
src/utils/history.ts

@@ -13,16 +13,17 @@ export default history
 
 // -------------------所有藏品详情 全部新页面打开-------------------
 export const openGoodsInfoFu = (id: number, src?: string) => {
-  window.open(src ? src : `/#/goodsLook/${id}`, '_blank')
+  const urlArr = window.location
+  const urlQian = urlArr.origin + urlArr.pathname
+
+  window.open(src ? urlQian + src + id : `${urlQian}#/goodsLook/${id}`, '_blank')
 }
 
 // -------------------级联回显-------------------
 let dictAll: TypeZ1dict[] = []
 export const resJiLianFu = (idTemp: string, isNull?: string) => {
   if (idTemp) {
-    if (dictAll && dictAll.length === 0) {
-      dictAll = store.getState().Z1dict.dictAll
-    }
+    dictAll = store.getState().Z1dict.dictAll
 
     const idArr = idTemp.split(',')
     const id = idArr[idArr.length - 1]
@@ -88,9 +89,7 @@ export const filterTreeByName = (tree: TypeZ1dict[], searchTemp: string): TypeZ1
 // -------------------处理所属部门数据-------------------
 let buMenTree: TypeZ4Tree[] = []
 export const buMenRes = (list: any[]) => {
-  if (buMenTree && buMenTree.length === 0) {
-    buMenTree = store.getState().Z4organization.treeData
-  }
+  buMenTree = store.getState().Z4organization.treeData
   let arr = list.map((v: any) => ({
     ...v,
     deptNameRes: v.deptId
@@ -339,9 +338,7 @@ export const ruTransformDataFu = (data: any[]): any[] => {
 
 // ---------------所有级联的数据平铺-------------------
 export const cascaderObjFu = (): any => {
-  if (dictAll && dictAll.length === 0) {
-    dictAll = store.getState().Z1dict.dictAll
-  }
+  dictAll = store.getState().Z1dict.dictAll
 
   let obj: any = {}
   if (dictAll && dictAll.length) {

+ 2 - 2
src/utils/http.ts

@@ -7,8 +7,8 @@ import { domShowFu } from './domShow'
 
 const envFlag = process.env.NODE_ENV === 'development'
 
-// const baseUrlTemp = 'https://sit-yiwubwg.4dage.com' // 测试环境
-const baseUrlTemp = 'http://192.168.20.61:8096' // 线下环境
+const baseUrlTemp = 'https://sit-yiwubwg.4dage.com' // 测试环境
+// const baseUrlTemp = 'http://192.168.20.61:8096' // 线下环境
 
 const baseFlag = baseUrlTemp.includes('https://')