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/actioncomponent/verifyexcelin/index.jsx |  100 ++++++++++++++++++++++---------------------------
 1 files changed, 45 insertions(+), 55 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
index 86c254e..555ed77 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
@@ -23,7 +23,6 @@
 class VerifyCard extends Component {
   static propTpyes = {
     columns: PropTypes.array,  // 鏄剧ず鍒�
-    dict: PropTypes.object,    // 瀛楀吀椤�
     card: PropTypes.object,
   }
 
@@ -33,7 +32,7 @@
     activeKey: 'basemsg',
     excelColumns: [
       {
-        title: this.props.dict['model.form.field'],
+        title: '瀛楁',
         dataIndex: 'Column',
         width: '14%',
         inputType: 'input',
@@ -41,14 +40,14 @@
         editable: true
       },
       {
-        title: this.props.dict['model.name'],
+        title: '鍚嶇О',
         dataIndex: 'Text',
         width: '14%',
         inputType: 'input',
         editable: true
       },
       {
-        title: this.props.dict['model.form.type'],
+        title: '绫诲瀷',
         dataIndex: 'type',
         width: '15%',
         editable: true,
@@ -72,20 +71,20 @@
         ]
       },
       {
-        title: this.props.dict['model.required'],
+        title: '蹇呭~',
         dataIndex: 'required',
         width: '10%',
         editable: true,
         inputType: 'switch',
-        render: (text, record) => record.required === 'true' ? this.props.dict['model.true'] : this.props.dict['model.false']
+        render: (text, record) => record.required === 'true' ? '鏄�' : '鍚�'
       },
       {
-        title: this.props.dict['model.import'],
+        title: '瀵煎叆',
         dataIndex: 'import',
         width: '10%',
         editable: true,
         inputType: 'switch',
-        render: (text, record) => record.import !== 'false' ? this.props.dict['model.true'] : this.props.dict['model.false']
+        render: (text, record) => record.import !== 'false' ? '鏄�' : '鍚�'
       },
       {
         title: '鏈�灏忓��',
@@ -155,13 +154,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>
           )
@@ -206,13 +205,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>
           )
@@ -224,11 +223,11 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
-            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
-            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
+            <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
+            <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
             <Popconfirm
               overlayClassName="popover-confirm"
-              title={this.props.dict['model.query.delete']}
+              title="纭畾鍒犻櫎鍚�?"
               onConfirm={() => this.handleDelete(record, 'scripts')
             }>
               <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
@@ -277,6 +276,17 @@
   }
 
   componentDidMount () {
+    this.getsysScript()
+  }
+
+  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)
@@ -290,18 +300,21 @@
     
     _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
     _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp)
-
     _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉
     
     Api.getSystemConfig(_sParam).then(res => {
       if (res.status) {
+        let _scripts = res.data.map(item => {
+          return {
+            name: item.funcname,
+            value: window.decodeURIComponent(window.atob(item.longparam))
+          }
+        })
+
+        sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts))
+
         this.setState({
-          systemScripts: res.data.map(item => {
-            return {
-              name: item.funcname,
-              value: window.decodeURIComponent(window.atob(item.longparam))
-            }
-          })
+          systemScripts: _scripts
         })
       } else {
         notification.warning({
@@ -429,22 +442,6 @@
   changeColumns = (columns) => {
     const { verify } = this.state
 
-    if (columns[0] && (columns[0].type === 'image' || columns[0].type === 'text')) {
-      columns = columns.map(col => {
-        let _cell = {
-          uuid: Utils.getuuid(),
-          Column: col.Column,
-          Text: col.Text,
-          type: 'Nvarchar(50)',
-          limit: '50',
-          import: 'true',
-          required: 'true'
-        }
-
-        return _cell
-      })
-    }
-
     columns = columns.map(col => {
       if (/^Nvarchar/ig.test(col.type)) {
         col.limit = col.type.match(/\d+/) ? col.type.match(/\d+/)[0] : '20000'
@@ -541,11 +538,12 @@
   }
 
   handleEdit = (record, type) => {
+    let node = null
+
     if (type === 'scripts') {
       this.scriptsForm.edit(record)
+      node = document.getElementById('mk-exin-script')
     }
-
-    let node = document.getElementById('verify-excel-box-tab').parentNode
 
     if (node && node.scrollTop) {
       let inter = Math.ceil(node.scrollTop / 10)
@@ -736,19 +734,20 @@
     }
 
     return (
-      <div id="verify-excel-box-tab">
+      <div>
+        {card.label ? <div className="mk-com-name">{card.label} - 楠岃瘉淇℃伅</div> : null}
         <Tabs activeKey={activeKey} className="excelin-verify-card-box" onChange={this.tabchange}>
           <TabPane tab="鍩虹楠岃瘉" key="basemsg">
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col span={8}>
-                  <Form.Item label={this.props.dict['model.form.tablename']}>
+                  <Form.Item label="琛ㄥ悕">
                     {getFieldDecorator('sheet', {
                       initialValue: verify.sheet || '',
                       rules: [
                         {
                           required: true,
-                          message: this.props.dict['form.required.input'] + this.props.dict['model.form.tablename'] + '!'
+                          message: '璇疯緭鍏ヨ〃鍚�!'
                         }
                       ]
                     })(<Input placeholder="" autoComplete="off" />)}
@@ -783,7 +782,7 @@
               {verify.columns.length ? <span className="count-tip">{verify.columns.length}</span> : null}
             </span>
           } key="excelcolumn">
-            <ColumnForm dict={this.props.dict} columnChange={this.columnChange}/>
+            <ColumnForm columnChange={this.columnChange}/>
             <Button className="excel-col-add mk-green" title="娣诲姞鏄剧ず鍒楀瓧娈�" onClick={this.columnFieldInput}>
               鍚屾鏄剧ず鍒�
             </Button>
@@ -799,7 +798,7 @@
               {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null}
             </span>
           } key="unique">
-            <UniqueForm fields={verify.columns} dict={this.props.dict} uniqueChange={this.uniqueChange}/>
+            <UniqueForm fields={verify.columns} uniqueChange={this.uniqueChange}/>
             <EditTable actions={['edit', 'move', 'del', 'status']} data={verify.uniques} columns={uniqueColumns} onChange={this.changeUniques}/>
           </TabPane> : null}
           {card.intertype === 'system' ? <TabPane tab={
@@ -807,9 +806,8 @@
               鑷畾涔夎剼鏈�
               {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null}
             </span>
-          } key="scripts">
+          } key="scripts" id="mk-exin-script">
             <CustomScript
-              dict={this.props.dict}
               btn={this.props.card}
               usefulfields={verify.columns}
               scripts={verify.scripts}
@@ -818,14 +816,6 @@
               wrappedComponentRef={(inst) => this.scriptsForm = inst}
             />
             <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/>
-            {/* <Table
-              bordered
-              rowKey="uuid"
-              className="custom-table"
-              dataSource={verify.scripts}
-              columns={scriptsColumns}
-              pagination={false}
-            /> */}
           </TabPane> : null}
           <TabPane tab="淇℃伅鎻愮ず" key="tip">
             <Form {...formItemLayout}>

--
Gitblit v1.8.0