king
2024-02-20 c0e017668d780c40f85230f227ea0160b5d22d4d
src/templates/zshare/customscript/index.jsx
@@ -7,7 +7,7 @@
import Utils from '@/utils/utils.js'
import Api from '@/api'
import { checkSQL } from '@/utils/utils-custom.js'
import { checkSQL, getSearchFields } from '@/utils/utils-custom.js'
import CodeMirror from '@/templates/zshare/codemirror'
import asyncComponent from '@/utils/asyncComponent'
import MKEmitter from '@/utils/events.js'
@@ -93,31 +93,9 @@
  UNSAFE_componentWillMount() {
    const { searches, scripts, urlFields } = this.props
    let _usefulFields = []
    searches.forEach(item => {
      if (['dateweek', 'datemonth'].includes(item.type)) {
        _usefulFields.push(item.key)
        _usefulFields.push(item.key + '1')
      } else if (item.type === 'daterange') {
        let _skey = item.key
        let _ekey = item.key + '1'
        if (/,/.test(item.key)) {
          _skey = item.key.split(',')[0]
          _ekey = item.key.split(',')[1]
        }
        _usefulFields.push(_skey)
        _usefulFields.push(_ekey)
      } else if (item.type === 'date' && _usefulFields.includes(item.key)) {
        _usefulFields.push(item.key + '1')
      } else {
        _usefulFields.push(item.key.replace(/,/ig, ', '))
      }
    })
    this.setState({
      urlFields: urlFields ? urlFields.join(', ') : '',
      usefulFields: _usefulFields.join(', '),
      usefulFields: getSearchFields(searches),
      scripts: fromJS(scripts).toJS()
    })
  }
@@ -135,17 +113,18 @@
    }
    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)
    _scriptSql = Utils.formatOptions(_scriptSql, 'x')
    let _sParam = {
      func: 'sPC_Get_SelectedList',
      LText: _scriptSql,
      obj_name: 'data',
      arr_field: 'funcname,longparam'
      arr_field: 'funcname,longparam',
      exec_type: 'x'
    }
    
    _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp)
    _sParam.secretkey = Utils.encrypt('', _sParam.timestamp)
    _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 云端数据验证
    
    Api.getCloudConfig(_sParam).then(res => {