From da64ab0923bf8817fc8599a6e37b953ce38f64c8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 27 八月 2023 18:37:36 +0800
Subject: [PATCH] 2023-08-27

---
 src/tabviews/zshare/actionList/newpagebutton/index.jsx |   59 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx
index 94b50d8..756c068 100644
--- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx
+++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx
@@ -3,8 +3,6 @@
 import { is, fromJS } from 'immutable'
 import { Button, notification, Modal } from 'antd'
 
-import zhCN from '@/locales/zh-CN/main.js'
-import enUS from '@/locales/en-US/main.js'
 import MKEmitter from '@/utils/events.js'
 import MkIcon from '@/components/mk-icon'
 import './index.scss'
@@ -13,6 +11,7 @@
 
 class NewPageButton extends Component {
   static propTpyes = {
+    BID: PropTypes.any,               // BID
     BData: PropTypes.any,             // 涓昏〃鏁版嵁
     btn: PropTypes.object,            // 鎸夐挳
     selectedData: PropTypes.any,      // 瀛愯〃涓�夋嫨鏁版嵁
@@ -20,7 +19,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     disabled: false,
     hidden: false,
     visible: false
@@ -102,7 +100,7 @@
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
   actionTrigger = (triggerId, record, type) => {
-    const { btn, selectedData } = this.props
+    const { btn, selectedData, BID } = this.props
     const { disabled } = this.state
 
     if (disabled) return
@@ -114,11 +112,11 @@
 
     let data = record || selectedData || []
 
-    if (btn.Ot && btn.Ot !== 'notRequired' && data.length === 0) {
+    if (btn.Ot !== 'notRequired' && data.length === 0) {
       // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹�
       notification.warning({
         top: 92,
-        message: this.state.dict['main.action.confirm.selectline'],
+        message: '璇烽�夋嫨琛岋紒',
         duration: 5
       })
       return
@@ -126,7 +124,7 @@
       // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁
       notification.warning({
         top: 92,
-        message: this.state.dict['main.action.confirm.selectSingleLine'],
+        message: '璇烽�夋嫨鍗曡鏁版嵁锛�',
         duration: 5
       })
       return
@@ -154,14 +152,18 @@
 
     if (btn.pageTemplate === 'billprint') {
       _name = '鍗曟嵁鎵撳嵃'
-      if (btn.Ot === 'required' && data && data.length > 0) {
-        data.forEach((item, i) => {
+      if (btn.Ot === 'required') {
+        data.forEach(item => {
           let _id = item.$$uuid || ''
-          let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: _id, tempId: btn.printTemp, dataM: sessionStorage.getItem('dataM') })))
+          let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: _id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))
           window.open(url)
         })
+      } else if (btn.Ot === 'requiredOnce') {
+        Id = data.map(item => item.$$uuid).filter(Boolean).join(',')
+
+        window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') }))))
       } else {
-        window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, dataM: sessionStorage.getItem('dataM') }))))
+        window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') }))))
       }
     } else if (btn.pageTemplate === 'billprintTemp') {
       let src = '#/menudesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'billPrint', MenuId: Id, MenuNo: MenuNo, MenuName: name || '鎵撳嵃', Remark: Remark })))
@@ -193,18 +195,43 @@
       window.open(url)
     } else if (btn.pageTemplate === 'custom') {
       let url = btn.url
+      if (window.GLOB.systemType === 'production' && btn.proUrl) {
+        url = btn.proUrl
+      }
+
+      if (btn.Ot === 'notRequired' && BID) {
+        Id = BID
+      }
+      
+      if (/#\/iframe\//.test(url)) {
+        url = url.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID'))
+
+        if (btn.joint === 'true' && Id) {
+          url = url + '/' + Id
+        }
+
+        let menu = {
+          MenuID: btn.uuid,
+          MenuName: btn.label,
+          type: 'iframe',
+          OpenType: 'newtab',
+          src: url
+        }
+        MKEmitter.emit('modifyTabs', menu)
+
+        return
+      }
+      
       let con = '?'
 
       if (/\?/ig.test(url)) {
         con = '&'
       }
-      
-      if (btn.Ot === 'requiredSgl' && btn.joint !== 'false') {
+
+      if (btn.joint === 'true') {
         url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
-      } else if (btn.Ot === 'requiredSgl' && btn.joint === 'false') {
+      } else if (Id) {
         url = url + `${con}id=${Id}`
-      } else if (btn.joint !== 'false') {
-        url = url + `${con}appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}`
       }
 
       window.open(url)

--
Gitblit v1.8.0