king
2022-12-09 cb9ade2afd2a367ad767bc605ab7086c695dd010
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}>