From a45ebcabfb93f05d8c0550edb9659b50c227c5cc Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 15 四月 2020 09:44:31 +0800
Subject: [PATCH] 2020-04-15

---
 src/tabviews/managetable/secretKeyTable/index.jsx            |   40 ++++++++++++--------
 public/options.text                                          |    2 
 src/tabviews/managetable/secretKeyTable/actionList/index.jsx |   63 ++++++++++++++++---------------
 src/templates/formtabconfig/source.jsx                       |    8 ----
 src/components/header/index.jsx                              |    1 
 public/options.js                                            |    2 
 6 files changed, 59 insertions(+), 57 deletions(-)

diff --git a/public/options.js b/public/options.js
index eb6dd43..ef760b8 100644
--- a/public/options.js
+++ b/public/options.js
@@ -3,7 +3,7 @@
   appId: '201912040924165801464FF1788654BC5AC73',
   appkey: '20191106103859640976D6E924E464D029CF0',
   mainSystemApi: 'http://cloud.mk9h.cn/webapi/dostars',
-  systemType: 'test',
+  systemType: '',
   platTitle: '',
   platName: '',
   favicon: '',
diff --git a/public/options.text b/public/options.text
index 9bbc4c2..21a57dc 100644
--- a/public/options.text
+++ b/public/options.text
@@ -2,7 +2,7 @@
 appId         -- 浜戠鐢熸垚鐨勫簲鐢↖D
 appkey        -- 浜戠鐢熸垚鐨勫簲鐢ㄥ瘑閽�
 mainSystemApi -- sso绯荤粺鐨勬帴鍙h矾寰勶紝娉細涓氬姟绯荤粺闇�瑕佸~鍐欙紝涓斿�间负閫氱敤鎺ュ彛鐨勫畬鏁磋矾寰�
-systemType    -- 涓氬姟绯荤粺浣跨敤姝ゅ弬鏁帮紝鍒ゆ柇绯荤粺涓烘祴璇曟垨姝e紡锛坱est銆乷fficial锛夛紝姝e紡绯荤粺寮�鍙戞潈闄愬彧鏈夌郴缁熷崌绾�
+systemType    -- 涓氬姟绯荤粺浣跨敤姝ゅ弬鏁帮紝鍒ゆ柇绯荤粺涓烘祴璇曟垨姝e紡锛坥fficial锛夛紝姝e紡绯荤粺寮�鍙戞潈闄愬彧鏈夌郴缁熷崌绾�
 platTitle     -- 绯荤粺鏍囬鏍忔爣棰�
 platName      -- 绯荤粺鍚嶇О
 favicon       -- 绯荤粺鏍囬鏍忓浘鏍�
diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 0ddce70..ed21820 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -146,7 +146,6 @@
       return
     }
     if (value.PageParam.OpenType === 'menu') {
-      console.log(value)
       this.props.modifyMainMenu(value)
     } else {
       window.open('#/' + value.PageParam.linkUrl + '/')
diff --git a/src/tabviews/managetable/secretKeyTable/actionList/index.jsx b/src/tabviews/managetable/secretKeyTable/actionList/index.jsx
index 7b14a7a..d50430e 100644
--- a/src/tabviews/managetable/secretKeyTable/actionList/index.jsx
+++ b/src/tabviews/managetable/secretKeyTable/actionList/index.jsx
@@ -1,12 +1,11 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-// import moment from 'moment'
+import moment from 'moment'
 import { Button, Modal, notification, message } from 'antd'
 import MutilForm from '@/tabviews/zshare/mutilform'
 import Utils from '@/utils/utils.js'
 import { refCodes } from '../config'
-// import options from '@/store/options.js'
-// import Api from '@/api'
+import Api from '@/api'
 import './index.scss'
 
 const { confirm } = Modal
@@ -45,7 +44,7 @@
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
   actionTrigger = (item) => {
-    const { setting, BID } = this.props
+    const { setting, BID, datalist } = this.props
 
     if (!BID) {
       notification.warning({
@@ -95,6 +94,15 @@
         })
         return
       }
+    }
+    
+    if ((!datalist || datalist.length === 0) && item.sqlType !== 'revert') {
+      notification.warning({
+        top: 92,
+        message: '鏁版嵁涓㈠け鎴栭敊璇紝璇锋仮澶嶉粯璁よ缃紒',
+        duration: 10
+      })
+      return
     }
 
     if (item.OpenType === 'prompt') {
@@ -161,35 +169,30 @@
         {uuid: 'other_system2', public: 'd', private: 'damson', keyType: 'other'}
       ]
     }
-    console.log(datalist)
+
     let _number =  Math.floor(Math.random() * 10)
-    console.log(_number)
     let keyString = window.btoa(window.encodeURIComponent(JSON.stringify(datalist)))
-    console.log(keyString)
     let regular = refCodes[_number]
-    console.log(regular)
-    keyString = keyString.replace(new RegExp(regular.char,'g'), regular.md5str)
-    console.log(keyString)
-    // window.btoa(window.encodeURIComponent(JSON.stringify(val)))
-    
-    // for (let i = 0; i < a.length; i++) {
-    //   if (a[i] !== b[i]) {
-    //     console.log(i)
-    //     console.log(src.substring(i- 10, i+ 10))
-    //   }
-    // }
-    // let param = { refCodes
-    //   func: 'sPC_TableData_InUpDe',
-    //   BID: this.props.BID
-    // }
-    // Api.genericInterface(param).then((res) => {
-    //   if (res.status) {
-    //     this.execSuccess(btn, res)
-    //   } else {
-    //     this.execError(res, btn)
-    //   }
-    //   _resolve()
-    // })
+    keyString = keyString.replace(new RegExp(regular.char, 'g'), regular.md5str)
+    keyString = window.btoa(keyString)
+    keyString = _number + keyString
+
+    let param = {
+      func: 's_app_secret_param_adduptdel',
+      BID: this.props.BID,
+      LText: keyString,
+      timestamp: moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+    }
+
+    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+    Api.getLocalConfig(param).then((res) => {
+      if (res.status) {
+        this.execSuccess(btn, res)
+      } else {
+        this.execError(res, btn)
+      }
+      _resolve()
+    })
   }
 
 
diff --git a/src/tabviews/managetable/secretKeyTable/index.jsx b/src/tabviews/managetable/secretKeyTable/index.jsx
index 7141cc7..2e5b17e 100644
--- a/src/tabviews/managetable/secretKeyTable/index.jsx
+++ b/src/tabviews/managetable/secretKeyTable/index.jsx
@@ -7,7 +7,7 @@
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
 import options from '@/store/options.js'
-import { buttonConfig, tabConfig } from './config'
+import { buttonConfig, tabConfig, refCodes } from './config'
 
 import SubTable from '@/tabviews/zshare/normalTable'
 import SubAction from './actionList'
@@ -150,32 +150,40 @@
     let result = await Api.getLocalConfig(param)
 
     if (result.status) {
-      // let _data = result.secret_param
+      let str = result.secret_param
 
-      let _data = [
-        {uuid: 'sso_system', public: 'a', private: 'apple', keyType: 'sso'},
-        {uuid: 'local_system', public: 'b', private: 'banana', keyType: 'local'},
-        {uuid: 'other_system1', public: 'c', private: 'cherry', keyType: 'other'},
-        {uuid: 'other_system2', public: 'd', private: 'damson', keyType: 'other'}
-      ]
-      _data = _data.map((item, index) => {
-        item.key = index
-        return item
-      })
-      // Math.floor(Math.random()*10)
       try {
-
+        if (str) {
+          str = str.substring(1)
+          str = window.atob(str)
+          refCodes.forEach(item => {
+            str = str.replace(new RegExp(item.md5str, 'g'), item.char)
+          })
+          str = JSON.parse(window.decodeURIComponent(window.atob(str)))
+        }
       } catch {
+        str = ''
+      }
+
+      if (!str) {
         this.setState({
-          loading: false
+          loading: false,
+          pickup: false,
+          data: []
         })
         notification.error({
           top: 92,
-          message: '瀵嗛挜缁勬暟鎹牸寮忛敊璇紝璇锋仮澶嶉粯璁よ缃悗锛岄噸鏂版坊鍔狅紒',
+          message: '瀵嗛挜缁勬暟鎹涪澶辨垨鏍煎紡閿欒锛岃鎭㈠榛樿璁剧疆锛岄噸鏂版坊鍔狅紒',
           duration: 15
         })
         return
       }
+
+      let _data = str.map((item, index) => {
+        item.key = index
+        return item
+      })
+
       this.setState({
         data: _data,
         pickup: false,
diff --git a/src/templates/formtabconfig/source.jsx b/src/templates/formtabconfig/source.jsx
index f02c01c..7b7e8b4 100644
--- a/src/templates/formtabconfig/source.jsx
+++ b/src/templates/formtabconfig/source.jsx
@@ -9,15 +9,7 @@
     type: 'FormTab',
     enabled: false,
     setting: {
-      // tableName: '',
-      // primaryKey: '',
-      // dataresource: '',
       datatype: 'query',
-      // interType: 'inner',
-      // sysInterface: 'false',
-      // innerFunc: '',
-      // interface: '',
-      // outerFunc: '',
       cols: '2',
       width: 100
     },

--
Gitblit v1.8.0