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/views/tabledesign/index.jsx |   82 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 68 insertions(+), 14 deletions(-)

diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx
index d4a4218..5e04a17 100644
--- a/src/views/tabledesign/index.jsx
+++ b/src/views/tabledesign/index.jsx
@@ -4,15 +4,15 @@
 import { is, fromJS } from 'immutable'
 import moment from 'moment'
 import HTML5Backend from 'react-dnd-html5-backend'
-import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button, Typography } from 'antd'
+import { notification, Modal, Collapse, Card, Switch, Button, Typography } from 'antd'
 import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons'
 import md5 from 'md5'
 
 import Api from '@/api'
-import Utils, { setGLOBFuncs } from '@/utils/utils.js'
-import antdZhCN from 'antd/es/locale/zh_CN'
+import Utils from '@/utils/utils.js'
+import { langs } from '@/store/options'
 import MKEmitter from '@/utils/events.js'
-import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js'
+import { getTables, getFuncsAndInters, getOutMessage, getLangTrans, getAllSqls } from '@/utils/utils-custom.js'
 import SourceElement from '@/templates/zshare/dragsource'
 import asyncComponent from '@/utils/asyncComponent'
 import Source from './source'
@@ -23,7 +23,6 @@
 const { Panel } = Collapse
 const { confirm } = Modal
 const { Paragraph } = Typography
-const _locale = antdZhCN
 
 const MenuForm = asyncComponent(() => import('./menuform'))
 const PopView = asyncComponent(() => import('./popview'))
@@ -59,6 +58,7 @@
     comloading: false,
     settingshow: sessionStorage.getItem('settingshow') !== 'false',
     view: null,
+    langName: '',
     popConfig: null
   }
 
@@ -88,11 +88,16 @@
     try {
       let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
 
+      if (param.lang) {
+        sessionStorage.setItem('lang', param.lang)
+      }
+      
       this.setState({
         MenuId: param.MenuID,
         ParentId: param.ParentId || '',
         MenuName: param.MenuName || '',
         MenuNo: param.MenuNo || '',
+        langName: sessionStorage.getItem('lang') !== 'zh-CN' && langs[sessionStorage.getItem('lang')] ? `锛�${langs[sessionStorage.getItem('lang')]}锛塦 : ''
       }, () => {
         this.getMenuParam()
       })
@@ -116,7 +121,7 @@
     MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave)
     setTimeout(() => {
       this.getRoleFields()
-      setGLOBFuncs()
+      // setGLOBFuncs()
     }, 1000)
 
     document.onkeydown = (event) => {
@@ -535,6 +540,8 @@
     } else if (this.checklog()) {
       if (sessionStorage.getItem('langList') && !config.trans) {
 
+      } else if (window.backend && config.enabled && !config.allSqls) {
+
       } else {
         notification.success({
           top: 92,
@@ -559,6 +566,51 @@
       } else if (!config.enabled && config.force && _pass) {
         config.enabled = true
         delete config.force
+      }
+
+      let long_data = ''
+      if (window.backend && config.enabled) {
+        let sqls = getAllSqls(config)
+        let _t = moment().format('YYYYMMDDHHmmss')
+        let getguid = () => {
+          let uuid = ''
+          for (let i = 0; i < 18; i++) {
+            uuid += String.fromCharCode(Math.floor(Math.random() * 26) + 65)
+          }
+          return uuid
+        }
+
+        long_data = []
+        let oriIds = {}
+        if (config.allSqls) {
+          config.allSqls.forEach(item => {
+            if (!item.md5) return
+            oriIds[item.uuid + item.md5] = item.v_id
+          })
+        }
+        
+        config.allSqls = sqls.map(item => {
+          let v_id = _t + getguid()
+
+          if (oriIds[item.uuid + item.md5]) {
+            v_id = oriIds[item.uuid + item.md5]
+          }
+          
+          long_data.push(`${md5(window.GLOB.appkey + v_id)},${item.uuid},${v_id},${window.btoa(window.encodeURIComponent(item.LText))}`)
+          
+          return {
+            uuid: item.uuid,
+            v_id: v_id,
+            type: item.type,
+            reps: item.reps,
+            md5: item.md5 || '',
+            luser: item.luser === true
+          }
+        })
+
+        long_data = long_data.join(';')
+      } else {
+        delete config.allSqls
       }
 
       let tbs = []
@@ -588,11 +640,14 @@
         let urlparam = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
         urlparam.type = 'admin'
         urlparam.MenuType = 'BaseTable'
+        urlparam.lang = sessionStorage.getItem('lang')
+
         url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
         config.tbkey = key
       }
 
       let interfaces = getFuncsAndInters(config)
+      let msg = getOutMessage(config)
       let urlFields = config.urlFields ? config.urlFields.join(',') : ''
       let langSql = getLangTrans(config)
 
@@ -606,10 +661,9 @@
         EasyCode: config.easyCode || '',
         Template: 'BaseTable',
         MenuName: config.MenuName || '',
-        PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}),
+        PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, msg, urlFields}),
         open_edition: config.open_edition,
-        // LText: '',
-        // LTexttb: '',
+        long_data: long_data,
         debug_md5: key,
         debug_url: url,
         debug_list: window.btoa(tbs),
@@ -858,11 +912,11 @@
   }
 
   render () {
-    const { view, activeKey, comloading, MenuId, config, settingshow, ParentId, menuloading } = this.state
+    const { view, activeKey, comloading, MenuId, config, settingshow, ParentId, menuloading, langName } = this.state
 
     return (
-      <ConfigProvider locale={_locale}>
-        <Header menuName={config ? config.MenuName : ''}/>
+      <>
+        <Header menuName={config ? config.MenuName + langName : ''}/>
         <DndProvider backend={HTML5Backend}>
         {view !== 'popview' ? <div className="pc-table-view">
             <div className="menu-body">
@@ -927,7 +981,7 @@
                     <PasteBaseTable type="page" insert={this.insert}/>
                     {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                     <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button>
-                    <Button type="default" onClick={this.closeView}>鍏抽棴</Button>
+                    <Button type="default" disabled={menuloading} onClick={this.closeView}>鍏抽棴</Button>
                   </div>
                 } style={{ width: '100%' }}>
                   {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null}
@@ -938,7 +992,7 @@
         </DndProvider>
         <StyleController />
         <ModalController />
-      </ConfigProvider>
+      </>
     )
   }
 }

--
Gitblit v1.8.0