From 4d6b9f8a2d7b316633e43b489eae9ada949c07b5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 10 九月 2024 10:18:08 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/zshare/actionList/newpagebutton/index.jsx |  133 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 123 insertions(+), 10 deletions(-)

diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx
index 943d8a9..2a61fb0 100644
--- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx
+++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx
@@ -3,6 +3,7 @@
 import { is, fromJS } from 'immutable'
 import { Button, notification, Modal, message } from 'antd'
 import moment from 'moment'
+import md5 from 'md5'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -158,10 +159,10 @@
       lang = data[0].lang_s || ''
     }
 
-    let _name = '鏂伴〉闈�'
+    // let _name = '鏂伴〉闈�'
 
     if (btn.pageTemplate === 'billprint') {
-      _name = '鍗曟嵁鎵撳嵃'
+      // _name = '鍗曟嵁鎵撳嵃'
       if (btn.preHandle === 'true' && btn.pre_func) {
         MKEmitter.emit('queryModuleParam', btn.$menuId, (res) => {
           let searches = {}
@@ -220,16 +221,49 @@
       } else {
         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, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))
+            let _param = { id: item.$$uuid || '', tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM')}
+
+            Object.keys(item).forEach(key => {
+              if (/^\$/.test(key)) return
+              if (typeof(item[key]) !== 'string' && typeof(item[key]) !== 'number') return
+              if (typeof(item[key]) === 'string' && item[key].length > 50) return
+              if (['id', 'tempid', 'pageid', 'datam'].includes(key.toLowerCase())) return
+
+              _param[key.toLowerCase()] = item[key]
+            })
+
+            let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify(_param)))
             window.open(url)
           })
         } else if (btn.Ot === 'requiredOnce') {
           Id = data.map(item => item.$$uuid).filter(Boolean).join(',')
+          let _param = { id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM')}
+          let item = data[0]
+
+          Object.keys(item).forEach(key => {
+            if (/^\$/.test(key)) return
+            if (typeof(item[key]) !== 'string' && typeof(item[key]) !== 'number') return
+            if (typeof(item[key]) === 'string' && item[key].length > 50) return
+            if (['id', 'tempid', 'pageid', 'datam'].includes(key.toLowerCase())) return
+
+            _param[key.toLowerCase()] = item[key]
+          })
   
-          window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') }))))
+          window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify(_param))))
         } else {
-          window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') }))))
+          let _param = { id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM')}
+          let item = data[0]
+
+          Object.keys(item).forEach(key => {
+            if (/^\$/.test(key)) return
+            if (typeof(item[key]) !== 'string' && typeof(item[key]) !== 'number') return
+            if (typeof(item[key]) === 'string' && item[key].length > 50) return
+            if (['id', 'tempid', 'pageid', 'datam'].includes(key.toLowerCase())) return
+
+            _param[key.toLowerCase()] = item[key]
+          })
+
+          window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify(_param))))
         }
       }
     } else if (btn.pageTemplate === 'billprintTemp') {
@@ -239,7 +273,7 @@
       let src = '#/print/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: Id, lang })))
       window.open(src)
     } else if (btn.pageTemplate === 'pay') {
-      _name = '鏀粯'
+      // _name = '鏀粯'
 
       let appId = ''
       let merchId = ''
@@ -338,9 +372,9 @@
       window.open(url)
     }
 
-    if (window.GLOB.systemType === 'production') {
-      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _name})
-    }
+    // if (window.GLOB.systemType === 'production') {
+    //   MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _name})
+    // }
   }
 
   prequest = (ID, data, appId, merchId) => {
@@ -356,6 +390,8 @@
         dataM: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
         ID: ID
       }
+    } else if (window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) {
+      param = this.getbackParam(ID, data)
     } else {
       let sql = this.getSysDeclareSql(ID, data)
 
@@ -415,6 +451,83 @@
     })
   }
 
+  getbackParam = (ID, data) => {
+    const { columns, btn, BID } = this.props
+
+    let ex = window.GLOB.CacheData.get('sql_' + btn.uuid)
+    let exps = []
+    let values = {
+      time_id: Utils.getguid(),
+      roleid: sessionStorage.getItem('role_id') || '',
+      mk_departmentcode: sessionStorage.getItem('departmentcode') || '',
+      mk_organization: sessionStorage.getItem('organization') || '',
+      mk_user_type: sessionStorage.getItem('mk_user_type') || '',
+      mk_nation: sessionStorage.getItem('nation') || '',
+      mk_province: sessionStorage.getItem('province') || '',
+      mk_city: sessionStorage.getItem('city') || '',
+      mk_district: sessionStorage.getItem('district') || '',
+      mk_address: sessionStorage.getItem('address') || '',
+      id: ID || '',
+      bid: BID || '',
+      typename: 'admin',
+      datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
+      datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
+      datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
+    }
+  
+    if (window.GLOB.externalDatabase !== null) {
+      values.db = window.GLOB.externalDatabase
+    }
+
+    ex.reps.forEach(n => {
+      let key = n.toLowerCase()
+      if (values.hasOwnProperty(key)) {
+        exps.push({
+          key: n,
+          value: values[key]
+        })
+      }
+    })
+
+    let _data = {}
+    Object.keys(data).forEach(key => {
+      _data[key.toLowerCase()] = data[key]
+    })
+  
+    columns.forEach(col => {
+      if (!ex.reps.includes(col.field)) return
+      if (!col.datatype) return
+
+      let _key = col.field.toLowerCase()
+      let _val = _data.hasOwnProperty(_key) ? _data[_key] : ''
+
+      if (/^date/ig.test(col.datatype) && !_val) {
+        _val = '1949-10-01'
+      }
+
+      exps.push({
+        key: 'mk_' + col.field + '_mk',
+        value: _val
+      })
+    })
+
+    let md5_id = ''
+    if (window.GLOB.probation) {
+      md5_id = md5(ex.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000))
+      md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18)
+    }
+
+    return {
+      $backend: true,
+      data: [{
+        id: ex.id,
+        exps: exps,
+        menuname: btn.logLabel || '',
+        md5_id: md5_id
+      }]
+    }
+  }
+
   getSysDeclareSql = (ID, data) => {
     const { columns, btn, BID } = this.props
 

--
Gitblit v1.8.0