king
2025-04-21 f3d4db769ba9b51b799d981511a710fd443d0e08
src/views/systemproc/proc/index.jsx
@@ -6,6 +6,7 @@
import Utils from '@/utils/utils.js'
import Api from '@/api'
import CodeMirror from '@/templates/zshare/codemirror'
import Transfer from '../transfer'
import './index.scss'
const { confirm } = Modal
@@ -13,7 +14,7 @@
class ProcControl extends Component {
  state = {
    procName: '',
    procName: this.props.func || '',
    content: '',
    loading: false,
    visible: false,
@@ -24,9 +25,12 @@
  }
  componentDidMount () {
    sessionStorage.setItem('User_Name', sessionStorage.getItem('CloudUserName'))
    sessionStorage.setItem('Full_Name', sessionStorage.getItem('CloudFullName'))
    if (sessionStorage.getItem('permFuncField')) {
      this.setState({permFuncs: JSON.parse(sessionStorage.getItem('permFuncField'))})
    } else {
    } else if (sessionStorage.getItem('UserID')) {
      Api.getCloudConfig({func: 'sPC_Get_Roles_sModular'}).then(res => {
        if (res.status) {
          let _permFuncs = []
@@ -53,6 +57,12 @@
          })
        }
      })
    }
    if (this.props.func && sessionStorage.getItem('UserID')) {
      setTimeout(() => {
        this.search(this.props.func)
      }, 500)
    }
  }
@@ -108,7 +118,8 @@
        {key: 'alter', reg: /(^|\s)alter\s/ig},
        {key: 'object', reg: /(^|\s)object(\s|\()/ig},
        {key: 'kill', reg: /(^|\s)kill\s/ig},
        {key: '--', reg: /--/ig}
        {key: '--', reg: /--/ig},
        {key: ',,', reg: /,,/ig}
      ]
      let error = ''
@@ -151,23 +162,24 @@
    let dropParam = {
      func: 'sPC_TableData_InUpDe',
      LText: Utils.formatOptions(dropfunc),
      LText: Utils.formatOptions(dropfunc, window.GLOB.execType || 'y'),
      exec_type: window.GLOB.execType || 'y',
      TypeCharOne: 'proc' // 删除存储过程
    }
    dropParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    dropParam.secretkey = Utils.encrypt(dropParam.LText, dropParam.timestamp)
    dropParam.secretkey = Utils.encrypt('', dropParam.timestamp)
    dropParam.open_key = Utils.encryptOpenKey(dropParam.secretkey, dropParam.timestamp)
    let createParam = {
      func: 'sPC_TableData_InUpDe',
      LText: Utils.formatOptions(createfunc),
      LText: Utils.formatOptions(createfunc, window.GLOB.execType || 'y'),
      exec_type: window.GLOB.execType || 'y',
      TypeCharOne: 'proc' // 创建存储过程
    }
    createParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    createParam.secretkey = Utils.encrypt(createParam.LText, createParam.timestamp)
    createParam.secretkey = Utils.encrypt('', createParam.timestamp)
    createParam.open_key = Utils.encryptOpenKey(createParam.secretkey, createParam.timestamp)
    let saveParam = {
@@ -370,13 +382,14 @@
              {!inputing ? <Search placeholder="请输入存储过程名称" defaultValue={procName} disabled={loading} enterButton="确定" onSearch={this.search}/> : null}
            </div>
            <div className="action-wrap">
              {!procName || loading || !content ? null : <Transfer procName={procName} content={content} />}
              <Button key="save" className="mk-btn mk-green" disabled={loading} onClick={() => this.save()}>保存</Button>
              <Button key="prev" className="mk-btn mk-primary" disabled={!procName || loading} onClick={this.prev}>上一版本</Button>
              <Button key="next" className="mk-btn mk-primary" disabled={!procName || loading} onClick={this.next}>下一版本</Button>
            </div>
          </div>
          <div className="edit-wrap">
            <CodeMirror value={content} onChange={(val) => this.setState({content: val})}/>
            <CodeMirror value={content} func={true} onChange={(val) => this.setState({content: val})}/>
          </div>
        </div>
        <Modal