From c39acd25c3e8747be16773a003f519e4ef801640 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 17 一月 2023 16:44:16 +0800
Subject: [PATCH] 2023-01-17

---
 src/tabviews/zshare/actionList/exceloutbutton/index.jsx |   85 ++++++++++++++++++++++++++++++++----------
 1 files changed, 65 insertions(+), 20 deletions(-)

diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index 0450dce..3d93b36 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -3,7 +3,7 @@
 import moment from 'moment'
 import { is, fromJS } from 'immutable'
 import { Button, Modal, notification, message } from 'antd'
-import * as XLSX from 'xlsx'
+import * as XLSX from 'sheetjs-style'
 
 import Utils from '@/utils/utils.js'
 import options from '@/store/options.js'
@@ -18,7 +18,6 @@
   static propTpyes = {
     BID: PropTypes.string,            // 涓昏〃ID
     BData: PropTypes.any,             // 涓昏〃鏁版嵁
-    Tab: PropTypes.any,               // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭�
     btn: PropTypes.object,            // 鎸夐挳
     setting: PropTypes.any,           // 椤甸潰閫氱敤璁剧疆
     updateStatus: PropTypes.func,     // 鎸夐挳鐘舵�佹洿鏂�
@@ -113,13 +112,13 @@
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
   actionTrigger = (triggerId, record, type) => {
-    const { setting, Tab, BID, btn } = this.props
+    const { setting, BID, btn } = this.props
     const { loading, disabled } = this.state
 
     if (loading || disabled) return
     if (triggerId && btn.uuid !== triggerId) return
 
-    if (((Tab && Tab.supMenu) || setting.supModule) && !BID) {
+    if (setting.supModule && !BID) {
       notification.warning({
         top: 92,
         message: '闇�瑕佷笂绾т富閿�硷紒',
@@ -196,7 +195,7 @@
         })
         viewParam.arr_field = viewParam.arr_field.join(',')
 
-        viewParam.orderBy = btn.verify.order || viewParam.orderBy
+        viewParam.orderBy = btn.verify.order || ''
       }
     }
     if (btn.intertype === 'system' && btn.verify.enable === 'true') {
@@ -252,9 +251,17 @@
             }
           }
         } else {
-          if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) {
-            param.rduri = window.GLOB.mainSystemApi
-          } else if (btn.sysInterface !== 'true') {
+          if (btn.sysInterface === 'true') {
+            if (window.GLOB.mainSystemApi) {
+              param.rduri = window.GLOB.mainSystemApi
+            }
+          } else if (btn.sysInterface === 'external') {
+            if (window.GLOB.systemType === 'production') {
+              param.$token = btn.exProInterface || ''
+            } else {
+              param.$token = btn.exInterface || ''
+            }
+          } else {
             if (window.GLOB.systemType === 'production' && btn.proInterface) {
               param.rduri = btn.proInterface
             } else {
@@ -304,9 +311,17 @@
                 }
               }
             } else {
-              if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) {
-                res.rduri = window.GLOB.mainSystemApi
-              } else if (btn.sysInterface !== 'true') {
+              if (btn.sysInterface === 'true') {
+                if (window.GLOB.mainSystemApi) {
+                  res.rduri = window.GLOB.mainSystemApi
+                }
+              } else if (btn.sysInterface === 'external') {
+                if (window.GLOB.systemType === 'production') {
+                  res.$token = btn.exProInterface || ''
+                } else {
+                  res.$token = btn.exInterface || ''
+                }
+              } else {
                 if (window.GLOB.systemType === 'production' && btn.proInterface) {
                   res.rduri = btn.proInterface
                 } else {
@@ -379,9 +394,17 @@
             }
           }
         } else {
-          if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) {
-            res.rduri = window.GLOB.mainSystemApi
-          } else if (btn.sysInterface !== 'true') {
+          if (btn.sysInterface === 'true') {
+            if (window.GLOB.mainSystemApi) {
+              res.rduri = window.GLOB.mainSystemApi
+            }
+          } else if (btn.sysInterface === 'external') {
+            if (window.GLOB.systemType === 'production') {
+              res.$token = btn.exProInterface || ''
+            } else {
+              res.$token = btn.exInterface || ''
+            }
+          } else {
             if (window.GLOB.systemType === 'production' && btn.proInterface) {
               res.rduri = btn.proInterface
             } else {
@@ -457,9 +480,17 @@
           }
         }
       } else {
-        if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) {
-          param.rduri = window.GLOB.mainSystemApi
-        } else if (btn.sysInterface !== 'true') {
+        if (btn.sysInterface === 'true') {
+          if (window.GLOB.mainSystemApi) {
+            param.rduri = window.GLOB.mainSystemApi
+          }
+        } else if (btn.sysInterface === 'external') {
+          if (window.GLOB.systemType === 'production') {
+            param.$token = btn.exProInterface || ''
+          } else {
+            param.$token = btn.exInterface || ''
+          }
+        } else {
           if (window.GLOB.systemType === 'production' && btn.proInterface) {
             param.rduri = btn.proInterface
           } else {
@@ -571,11 +602,15 @@
         let _header = []
         let _topRow = {}
         let colwidth = []
-  
-        columns.forEach(col => {
+        let requires = []
+
+        columns.forEach((col, i) => {
           _header.push(col.Column)
           _topRow[col.Column] = col.Text
           colwidth.push({width: col.Width || 20})
+          if (col.required === 'true') {
+            requires.push(i)
+          }
         })
   
         let table = []
@@ -607,8 +642,18 @@
         })
   
         const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true})
-  
+
         ws['!cols'] = colwidth
+
+        if (requires.length) {
+          let cols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+          requires.forEach(col => {
+            if (cols[col]) {
+              ws[cols[col] + '1'].s = {font: { color: { rgb: 'F5222D' } }}
+            }
+          })
+        }
+        // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA"  }}, font: { color: { rgb: "1890FF" } }}
   
         const wb = XLSX.utils.book_new()
         XLSX.utils.book_append_sheet(wb, ws, 'Sheet1')

--
Gitblit v1.8.0