From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 09 十二月 2022 15:53:32 +0800
Subject: [PATCH] 2022-12-09

---
 src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx
index a54097c..2f679b7 100644
--- a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx
+++ b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx
@@ -17,7 +17,6 @@
 
 class CustomForm extends Component {
   static propTpyes = {
-    dict: PropTypes.object,         // 瀛楀吀椤�
     setting: PropTypes.object,      // 璁剧疆
     scripts: PropTypes.array,       // 鑷畾涔夎剼鏈垪琛�
     searches: PropTypes.array,      // 鎼滅储鏉′欢
@@ -28,6 +27,7 @@
   }
 
   state = {
+    wrapId: Utils.getuuid(),
     editItem: null,
     loading: false,
     usefulFields: '',
@@ -70,13 +70,13 @@
         render: (text, record) => record.status === 'false' ?
           (
             <div style={{color: '#ff4d4f'}}>
-              {this.props.dict['model.status.forbidden']}
+              绂佺敤
               <StopOutlined style={{marginLeft: '5px'}} />
             </div>
           ) :
           (
             <div style={{color: '#26C281'}}>
-              {this.props.dict['model.status.open']}
+              鍚敤
               <CheckCircleOutlined style={{marginLeft: '5px'}}/>
             </div>
           )
@@ -88,11 +88,11 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
-            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span>
-            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><SwapOutlined /></span>
+            <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span>
+            <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><SwapOutlined /></span>
             <Popconfirm
               overlayClassName="popover-confirm"
-              title={this.props.dict['model.query.delete']}
+              title="纭畾鍒犻櫎鍚�?"
               onConfirm={() => this.handleDelete(record)
             }>
               <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
@@ -151,6 +151,13 @@
   }
 
   getsysScript = () => {
+    if (sessionStorage.getItem('mk_sys_scripts')) {
+      this.setState({
+        systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts'))
+      })
+      return
+    }
+    
     let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort`
 
     _scriptSql = Utils.formatOptions(_scriptSql)
@@ -169,12 +176,13 @@
     Api.getSystemConfig(_sParam).then(res => {
       if (res.status) {
         let _scripts = res.data.map(item => {
-          let _item = {
+          return {
             name: item.funcname,
             value: window.decodeURIComponent(window.atob(item.longparam))
           }
-          return _item
         })
+
+        sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts))
 
         this.setState({
           systemScripts: _scripts
@@ -289,12 +297,16 @@
       exec_type: 'y',
       LText: SettingUtils.getCustomDebugSql(_scripts, this.props.regoptions)
     }
-    param.LText = Utils.formatOptions(param.LText)
+
     param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+    param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
+    param.LText = param.LText.replace(/\n/g, ' ')
+    
+    param.LText = Utils.formatOptions(param.LText)
     param.secretkey = Utils.encrypt('', param.timestamp)
     
     this.setState({loading: true})
-    Api.getLocalConfig(param).then(result => {
+    Api.genericInterface(param).then(result => {
       if (result.status) {
         this.setState({
           loading: false,
@@ -356,7 +368,7 @@
   }
 
   scrolltop = () => {
-    let node = document.getElementById('model-setting-form-body').parentNode
+    let node = document.getElementById(this.state.wrapId).parentNode
 
     if (node && node.scrollTop) {
       let inter = Math.ceil(node.scrollTop / 10)
@@ -404,7 +416,7 @@
   render() {
     const { setting, scripts } = this.props
     const { getFieldDecorator } = this.props.form
-    const { usefulFields, scriptsColumns, systemScripts, urlFields } = this.state
+    const { usefulFields, scriptsColumns, systemScripts, urlFields, wrapId } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -417,7 +429,7 @@
     }
 
     return (
-      <div className="modal-menu-setting-script">
+      <div className="modal-menu-setting-script" id={wrapId}>
         <Form {...formItemLayout}>
           <Row gutter={24}>
             <Col span={4}>

--
Gitblit v1.8.0