king
2020-04-15 a45ebcabfb93f05d8c0550edb9659b50c227c5cc
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()
    })
  }