From 04c038af25f79ac7fc80e93054856a614f22b63b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 12 六月 2024 16:43:39 +0800
Subject: [PATCH] 2024-06-12

---
 src/index.js                                                   |    1 
 src/utils/utils-datamanage.js                                  |    6 
 src/menu/components/share/actioncomponent/formconfig.jsx       |   28 ++++
 src/menu/datasource/verifycard/settingform/index.jsx           |   19 ++
 src/utils/utils-custom.js                                      |  302 +++++++++++++++++++++++++++++++++++++++++++
 src/tabviews/zshare/actionList/excelInbutton/index.jsx         |    6 
 src/tabviews/zshare/actionList/exceloutbutton/index.jsx        |   11 +
 src/views/tabledesign/index.jsx                                |    6 
 src/menu/components/share/actioncomponent/actionform/index.jsx |    8 
 src/tabviews/zshare/actionList/normalbutton/index.jsx          |    8 +
 src/views/systemfunc/sidemenu/config.jsx                       |    8 +
 src/views/menudesign/index.jsx                                 |    6 
 src/views/login/index.jsx                                      |    2 
 13 files changed, 404 insertions(+), 7 deletions(-)

diff --git a/src/index.js b/src/index.js
index 2fbab2f..7d65f61 100644
--- a/src/index.js
+++ b/src/index.js
@@ -61,6 +61,7 @@
     GLOB.upStatus = false
     GLOB.navBar = 'shutter' // 榛樿涓虹櫨鍙剁獥
     GLOB.style = 'bg_black_style_blue'
+    GLOB.defLang = config.defaultLang
 
     GLOB.sysType = options.sysType
     if (GLOB.sysType !== 'cloud') {
diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 3f88b64..104c448 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -221,7 +221,7 @@
         }
         reRequired.innerFunc = true
       } else {
-        shows.push('sql', 'sqlType', 'output')
+        shows.push('sql', 'sqlType', 'output', 'database')
       }
 
       if (Ot === 'required') {
@@ -299,7 +299,7 @@
         shows.push('innerFunc', 'extraParam')
         reRequired.innerFunc = true
       } else {
-        shows.push('sql', 'sqlType')
+        shows.push('sql', 'sqlType', 'database')
       }
 
       if (this.record.execSuccess === 'goback') {
@@ -349,6 +349,8 @@
       } else if (this.record.intertype === 'inner') {
         shows.push('innerFunc', 'extraParam')
         reRequired.innerFunc = true
+      } else {
+        shows.push('database')
       }
       if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') {
         shows.push('resetPageIndex')
@@ -384,6 +386,8 @@
       } else if (this.record.intertype === 'inner') {
         shows.push('innerFunc', 'extraParam')
         reRequired.innerFunc = true
+      } else {
+        shows.push('database')
       }
       if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') {
         shows.push('resetPageIndex')
diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx
index 2660856..8a2e8ce 100644
--- a/src/menu/components/share/actioncomponent/formconfig.jsx
+++ b/src/menu/components/share/actioncomponent/formconfig.jsx
@@ -1371,6 +1371,20 @@
     },
     {
       type: 'radio',
+      key: 'database',
+      label: '鏁版嵁搴�',
+      initVal: card.database || 'local',
+      tooltip: '娴嬭瘯绯荤粺鏁版嵁搴撳潎鎸囧悜鏈湴锛屾寮忕郴缁熷彲浣跨敤鍗曠偣鏁版嵁搴撱��',
+      options: [{
+        value: 'local',
+        text: '鏈湴'
+      }, {
+        value: 'sso',
+        text: '鍗曠偣'
+      }]
+    },
+    {
+      type: 'radio',
       key: 'permission',
       label: '鏉冮檺楠岃瘉',
       initVal: card.permission || 'true',
@@ -2562,6 +2576,20 @@
     },
     {
       type: 'radio',
+      key: 'database',
+      label: '鏁版嵁搴�',
+      initVal: card.database || 'local',
+      tooltip: '娴嬭瘯绯荤粺鏁版嵁搴撳潎鎸囧悜鏈湴锛屾寮忕郴缁熷彲浣跨敤鍗曠偣鏁版嵁搴撱��',
+      options: [{
+        value: 'local',
+        text: '鏈湴'
+      }, {
+        value: 'sso',
+        text: '鍗曠偣'
+      }]
+    },
+    {
+      type: 'radio',
       key: 'permission',
       label: '鏉冮檺楠岃瘉',
       initVal: card.permission || 'true',
diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx
index 97cedeb..8a8c97c 100644
--- a/src/menu/datasource/verifycard/settingform/index.jsx
+++ b/src/menu/datasource/verifycard/settingform/index.jsx
@@ -105,6 +105,9 @@
           if (values.interType === 'system' && values.onload === 'false') {
             values.sync = 'false'
           }
+          if (values.interType === 'system' && values.database === 'sso') {
+            values.sync = 'false'
+          }
 
           // 鏁版嵁婧愬墠绔獙璇�
           if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) {
@@ -515,6 +518,22 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col> : null}
+            {setting.interType === 'system' ? <Col span={8}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="娴嬭瘯绯荤粺鏁版嵁搴撳潎鎸囧悜鏈湴锛屾寮忕郴缁熷彲浣跨敤鍗曠偣鏁版嵁搴撱��">
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  鏁版嵁搴�
+                </Tooltip>
+              }>
+                {getFieldDecorator('database', {
+                  initialValue: setting.database || 'local'
+                })(
+                <Radio.Group>
+                  <Radio value="local">鏈湴</Radio>
+                  <Radio value="sso">鍗曠偣</Radio>
+                </Radio.Group>)}
+              </Form.Item>
+            </Col> : null}
             {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 */}
             {!['navbar', 'interface', 'calendar'].includes(config.type) && !['editable', 'basetable', 'dualdatacard', 'invoice', 'invTable'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') && setting.interType === 'system' && setting.onload !== 'false' ? <Col span={8}>
               <Form.Item label={
diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index 033c274..9686f45 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -354,6 +354,12 @@
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
       }
 
+      if (btn.database === 'sso') {
+        if ((window.GLOB.mkHS || window.GLOB.systemType === 'production') && window.GLOB.mainSystemApi) {
+          param.rduri = window.GLOB.mainSystemApi
+        }
+      }
+
       param.menuname = btn.logLabel
       
       if (window.GLOB.probation) {
diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index 9de32fc..f3ce2a3 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -159,7 +159,11 @@
     if (btn.pagination !== 'true') {
       if (btn.intertype === 'system') { // 浣跨敤绯荤粺鍑芥暟
         let param = this.getExcelDefaultParam(viewParam.orderBy, viewParam.search)
-
+        if (btn.database === 'sso') {
+          if ((window.GLOB.mkHS || window.GLOB.systemType === 'production') && window.GLOB.mainSystemApi) {
+            param.rduri = window.GLOB.mainSystemApi
+          }
+        }
         Api.genericInterface(param).then(result => {
           if (result.status) {
             this.exportExcel(result.data, result.ErrCode, result.message, viewParam.search)
@@ -376,6 +380,11 @@
     let param = null
     if (btn.intertype === 'system') { // 浣跨敤绯荤粺鍑芥暟
       param = this.getExcelDefaultParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize)
+      if (btn.database === 'sso') {
+        if ((window.GLOB.mkHS || window.GLOB.systemType === 'production') && window.GLOB.mainSystemApi) {
+          param.rduri = window.GLOB.mainSystemApi
+        }
+      }
     } else if (btn.intertype === 'inner') { // 浣跨敤鍐呴儴鍑芥暟
       param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize)
       param.func = btn.innerFunc
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 9733c33..c9547e1 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1137,6 +1137,14 @@
             return item
           })
         }
+        if (btn.database === 'sso') {
+          if ((window.GLOB.mkHS || window.GLOB.systemType === 'production') && window.GLOB.mainSystemApi) {
+            params = params.map(item => {
+              item.rduri = window.GLOB.mainSystemApi
+              return item
+            })
+          }
+        }
       } else {
         params = this.getInnerParam(data, formdata)
       }
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 6d66833..16fba25 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -558,6 +558,9 @@
           })
         }
       } else if (item.type === 'form') {
+        if (item.wrap.datatype === 'public' && item.wrap.publicId) {
+          item.wrap.publicId = md5(commonId + item.wrap.publicId)
+        }
         item.subcards = item.subcards.map(cell => {
           cell.uuid = this.getuuid()
   
@@ -2071,4 +2074,303 @@
   }
 
   return true
+}
+
+/**
+ * @description 鑾峰彇璇█杞崲淇℃伅
+ */
+export function getLangTrans (config) {
+  let defLang = window.GLOB.defLang || ''
+  let langList = sessionStorage.getItem('langList')
+  
+  if (langList) {
+    try {
+      langList = JSON.parse(langList)
+      if (langList.length === 1) {
+        defLang = ''
+      } else if (!defLang || langList.findIndex(item => item.Lang === defLang) === -1) {
+        if (langList.findIndex(item => item.Lang === 'zh-CN') === -1) {
+          defLang = langList[0].Lang
+        } else {
+          defLang = 'zh-CN'
+        }
+      }
+    } catch (e) {
+      defLang = ''
+    }
+  } else {
+    defLang = ''
+  }
+
+  if (!defLang) return ''
+
+  let sql = []
+  let btn = []
+  let ops = []
+  let text = []
+
+  let filterElement = (card) => {
+    if (card.datatype === 'static' && card.eleType === 'text') {
+      sql.push(card.value)
+    }
+    if (card.prefix) {
+      sql.push(card.prefix)
+    }
+    if (card.postfix) {
+      sql.push(card.postfix)
+    }
+  }
+
+  let filterSql = (sl) => {
+    if (!sl) return
+
+    let cutreg = /[\u4E00-\u9FA5銆傦紒锛屻�乚+/ig
+    let tbs = sl.match(cutreg)
+
+    if (!tbs) return
+    
+    text.push(...tbs)
+  }
+
+  let filterBtn = (btn) => {
+    if (!btn.verify) return
+
+    btn.verify.customverifys && btn.verify.customverifys.forEach(script => {
+      filterSql(script.sql)
+    })
+    btn.verify.scripts && btn.verify.scripts.forEach(script => {
+      filterSql(script.sql)
+    })
+    btn.verify.cbScripts && btn.verify.cbScripts.forEach(script => {
+      filterSql(script.sql)
+    })
+
+    if (btn.OpenType === 'funcbutton') {
+      if (btn.intertype === 'system' && btn.verify.dataType === 'custom' && btn.verify.setting) {
+        filterSql(btn.verify.setting.dataresource)
+      }
+    } else if (btn.OpenType === 'excelOut') {
+      filterSql(btn.verify.dataresource)
+    }
+  }
+
+  let traversal = (components) => {
+    if (!components) return
+
+    components.forEach(item => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          sql.push(tab.label)
+          traversal(tab.components)
+        })
+      } else if (item.type === 'group') {
+        traversal(item.components)
+      } else {
+        if (item.setting && (!item.wrap || !item.wrap.datatype || item.wrap.datatype === 'dynamic')) {
+          if (item.setting.interType === 'system') {
+            filterSql(item.setting.dataresource)
+            item.scripts && item.scripts.forEach(script => {
+              filterSql(script.sql)
+            })
+          }
+        }
+
+        if (item.columns) {
+          item.columns.forEach(cell => {
+            sql.push(cell.label)
+          })
+        }
+        if (item.search) {
+          item.search.forEach(cell => {
+            sql.push(cell.label)
+            if (cell.options) {
+              cell.options.forEach(o => {
+                ops.push(o.Text)
+              })
+            }
+            if (cell.resourceType === '1') {
+              filterSql(cell.dataSource)
+            }
+          })
+        }
+        if (item.action) {
+          item.action.forEach(cell => {
+            btn.push(cell.label)
+            filterBtn(cell)
+            if (cell.OpenType === 'popview' && cell.config) {
+              traversal(cell.config.components)
+            } else if (cell.OpenType === 'pop') {
+              if (cell.modal && cell.modal.fields.length) {
+                cell.modal.fields.forEach(n => {
+                  sql.push(n.label)
+                  if (n.resourceType === '1') {
+                    filterSql(n.dataSource)
+                  }
+                })
+              }
+            }
+          })
+        }
+
+        if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
+          item.subcards.forEach(card => {
+            card.elements && card.elements.forEach(cell => {
+              if (cell.eleType === 'button') {
+                btn.push(cell.label)
+                filterBtn(cell)
+                if (cell.OpenType === 'popview' && cell.config) {
+                  traversal(cell.config.components)
+                } else if (cell.OpenType === 'pop') {
+                  if (cell.modal && cell.modal.fields.length) {
+                    cell.modal.fields.forEach(n => {
+                      sql.push(n.label)
+                      if (n.resourceType === '1') {
+                        filterSql(n.dataSource)
+                      }
+                    })
+                  }
+                }
+              } else {
+                filterElement(cell)
+              }
+            })
+            card.backElements && card.backElements.forEach(cell => {
+              if (cell.eleType === 'button') {
+                btn.push(cell.label)
+                filterBtn(cell)
+                if (cell.OpenType === 'popview' && cell.config) {
+                  traversal(cell.config.components)
+                } else if (cell.OpenType === 'pop') {
+                  if (cell.modal && cell.modal.fields.length) {
+                    cell.modal.fields.forEach(n => {
+                      sql.push(n.label)
+                      if (n.resourceType === '1') {
+                        filterSql(n.dataSource)
+                      }
+                    })
+                  }
+                }
+              } else {
+                filterElement(cell)
+              }
+            })
+          })
+        } else if (item.type === 'balcony') {
+          item.elements && item.elements.forEach(cell => {
+            if (cell.eleType === 'button') {
+              btn.push(cell.label)
+              filterBtn(cell)
+              if (cell.OpenType === 'popview' && cell.config) {
+                traversal(cell.config.components)
+              } else if (cell.OpenType === 'pop') {
+                if (cell.modal && cell.modal.fields.length) {
+                  cell.modal.fields.forEach(n => {
+                    sql.push(n.label)
+                    if (n.resourceType === '1') {
+                      filterSql(n.dataSource)
+                    }
+                  })
+                }
+              }
+            } else {
+              filterElement(cell)
+            }
+          })
+        } else if (item.type === 'table') {
+          let loopCol = (cols) => {
+            cols.forEach(col => {
+              sql.push(col.label)
+              if (col.prefix) {
+                sql.push(col.prefix)
+              }
+              if (col.postfix) {
+                sql.push(col.postfix)
+              }
+              if (col.type === 'colspan') {
+                loopCol(col.subcols)
+              } else if (col.type === 'custom') {
+                col.elements.forEach(cell => {
+                  if (cell.eleType === 'button') {
+                    btn.push(cell.label)
+                    filterBtn(cell)
+                    if (cell.OpenType === 'popview' && cell.config) {
+                      traversal(cell.config.components)
+                    } else if (cell.OpenType === 'pop') {
+                      if (cell.modal && cell.modal.fields.length) {
+                        cell.modal.fields.forEach(n => {
+                          sql.push(n.label)
+                          if (n.resourceType === '1') {
+                            filterSql(n.dataSource)
+                          }
+                        })
+                      }
+                    }
+                  } else {
+                    filterElement(cell)
+                  }
+                })
+              }
+            })
+          }
+          loopCol(item.cols)
+        } else if (item.type === 'form') {
+          item.subcards.forEach(cell => {
+            filterBtn(cell.subButton)
+            cell.fields.forEach(n => {
+              sql.push(n.label)
+              if (n.resourceType === '1') {
+                filterSql(n.dataSource)
+              }
+            })
+          })
+        }
+      }
+    })
+  }
+
+  if (config.interfaces) {
+    config.interfaces.forEach(item => {
+      if (item.setting.interType === 'system') {
+        filterSql(item.setting.dataresource)
+        item.scripts && item.scripts.forEach(script => {
+          filterSql(script.sql)
+        })
+      }
+    })
+  }
+
+  traversal(config.components)
+
+  sql = sql.filter(Boolean)
+  btn = btn.filter(Boolean)
+  ops = ops.filter(Boolean)
+  text = text.filter(Boolean)
+
+  sql = Array.from(new Set(sql))
+  btn = Array.from(new Set(btn))
+  ops = Array.from(new Set(ops))
+  text = Array.from(new Set(text))
+
+  sql = sql.map(l => `'${l}','title'`)
+  btn = btn.map(l => `'${l}','button'`)
+  ops = ops.map(l => `'${l}','list'`)
+  text = text.map(l => `'${l}','text'`)
+
+  let list = [...btn, ...sql, ...ops, ...text]
+
+  if (config.MenuName) {
+    list.unshift(`'${config.MenuName}','menu'`)
+  }
+
+  let result = []
+
+  langList.forEach(lan => {
+    if (lan.Lang === defLang) return
+
+    list.forEach(n => {
+      result.push(`'${lan.Lang}',${n}`)
+    })
+  })
+  
+  return result.join(';')
 }
\ No newline at end of file
diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js
index 218a0b1..b3e17b5 100644
--- a/src/utils/utils-datamanage.js
+++ b/src/utils/utils-datamanage.js
@@ -323,6 +323,12 @@
       param.s_version_up = 'true'
     }
 
+    if (setting.database === 'sso') {
+      if ((window.GLOB.mkHS || window.GLOB.systemType === 'production') && window.GLOB.mainSystemApi) {
+        param.rduri = window.GLOB.mainSystemApi
+      }
+    }
+
     return param
   }
 
diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx
index d8a5ada..2ce42a1 100644
--- a/src/views/login/index.jsx
+++ b/src/views/login/index.jsx
@@ -699,6 +699,8 @@
             } catch (e) {
               localStorage.removeItem(_loginurl)
             }
+
+            sessionStorage.setItem('langList', JSON.stringify(res.lang_data || []))
             
             this.setState({
               loginWays: login_ways,
diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index 70ec720..7d92941 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -13,7 +13,7 @@
 import Utils, { setGLOBFuncs } from '@/utils/utils.js'
 import antdZhCN from 'antd/es/locale/zh_CN'
 import MKEmitter from '@/utils/events.js'
-import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js'
+import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js'
 import asyncComponent from '@/utils/asyncComponent'
 
 import '@/assets/css/design.scss'
@@ -842,6 +842,7 @@
 
       let interfaces = getFuncsAndInters(config)
       let urlFields = config.urlFields ? config.urlFields.join(',') : ''
+      let langSql = getLangTrans(config)
 
       let param = {
         func: 'sPC_TrdMenu_AddUpt',
@@ -860,7 +861,8 @@
         debug_md5: key,
         debug_url: url,
         debug_list: window.btoa(tbs),
-        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config)))
+        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))),
+        lang_translation: window.btoa(window.encodeURIComponent(langSql))
       }
 
       param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
diff --git a/src/views/systemfunc/sidemenu/config.jsx b/src/views/systemfunc/sidemenu/config.jsx
index ce7475b..058481e 100644
--- a/src/views/systemfunc/sidemenu/config.jsx
+++ b/src/views/systemfunc/sidemenu/config.jsx
@@ -84,6 +84,14 @@
     MenuID: '15827879285193g85m3i2uprektpgmpf',
     MenuNo: 'bd_mes_techM',
     MenuName: '宸ヨ壓涓绘暟鎹�',
+  }, {
+    src: '',
+    systems: ['local'],
+    PageParam: {OpenType: 'newtab', Template: 'CustomPage'},
+    type: 'CustomPage',
+    MenuID: '17180925258436em38rhpqncckvohv0s',
+    MenuNo: 's_app_lang_translation_M',
+    MenuName: '璇█鍖�',
   }]
 }, {
   MenuID: 'systemManageViewInterface',
diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx
index 391683c..1fa22f4 100644
--- a/src/views/tabledesign/index.jsx
+++ b/src/views/tabledesign/index.jsx
@@ -12,7 +12,7 @@
 import Utils, { setGLOBFuncs } from '@/utils/utils.js'
 import antdZhCN from 'antd/es/locale/zh_CN'
 import MKEmitter from '@/utils/events.js'
-import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js'
+import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js'
 import SourceElement from '@/templates/zshare/dragsource'
 import asyncComponent from '@/utils/asyncComponent'
 import Source from './source'
@@ -590,6 +590,7 @@
 
       let interfaces = getFuncsAndInters(config)
       let urlFields = config.urlFields ? config.urlFields.join(',') : ''
+      let langSql = getLangTrans(config)
 
       let param = {
         func: 'sPC_TrdMenu_AddUpt',
@@ -608,7 +609,8 @@
         debug_md5: key,
         debug_url: url,
         debug_list: window.btoa(tbs),
-        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config)))
+        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))),
+        lang_translation: window.btoa(window.encodeURIComponent(langSql))
       }
 
       param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')

--
Gitblit v1.8.0