| | |
| | | let _item = { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | // value: Utils.UnformatOptions(item.longparam) |
| | | } |
| | | |
| | | _scripts.push(_item) |
| | |
| | | let _item = { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | // value: Utils.UnformatOptions(item.longparam) |
| | | } |
| | | |
| | | _scripts.push(_item) |
| | |
| | | if (result.status) { |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | // item.LongParam = Utils.UnformatOptions(item.LongParam) |
| | | // item.LongParam = this.UnformatOptions(item.LongParam) |
| | | item.key = index |
| | | return item |
| | | }), |
| | |
| | | } |
| | | } |
| | | |
| | | // UnformatOptions = (value) => { |
| | | // if (!value) return '' |
| | | // let salt = 'minKe' // 盐值 |
| | | // let _value = '' |
| | | // const formatKeys = [ |
| | | // { key: 'select', value: ' msltk ' }, |
| | | // { key: 'from', value: ' mfrmk ' }, |
| | | // { key: 'where', value: ' mwhrk ' }, |
| | | // { key: 'order by', value: ' modbk ' }, |
| | | // { key: 'asc', value: ' modack ' }, |
| | | // { key: 'desc', value: ' moddesk ' }, |
| | | // { key: 'top', value: ' mtpk ' }, |
| | | // { key: 'like', value: ' mlkk ' }, |
| | | // { key: 'not like', value: ' mnlkk ' }, |
| | | // { key: 'between', value: ' mbtnk ' }, |
| | | // { key: 'and', value: ' madk ' }, |
| | | // { key: 'insert', value: ' mistk ' }, |
| | | // { key: 'into', value: ' mitk ' }, |
| | | // { key: 'update', value: ' muptk ' }, |
| | | // { key: 'delete', value: ' mdelk ' }, |
| | | // { key: 'begin', value: ' mbgink ' }, |
| | | // { key: 'end', value: ' medk ' }, |
| | | // { key: 'if', value: ' mefk ' }, |
| | | // { key: 'while', value: ' mwilk ' }, |
| | | // { key: 'create', value: ' mcrtk ' }, |
| | | // { key: 'alter', value: ' matek ' }, |
| | | // { key: 'len', value: ' mlnk ' }, |
| | | // { key: 'left', value: ' mlftk ' }, |
| | | // { key: 'right', value: ' mritk ' }, |
| | | // { key: 'union', value: ' munok ' }, |
| | | // { key: 'varchar', value: ' mvcrk ' }, |
| | | // { key: 'getdate', value: ' mgtdtk ' }, |
| | | // { key: 'TRY', value: ' mtryonek ' }, |
| | | // { key: 'TRAN', value: ' mtrnk ' }, |
| | | // { key: 'goto', value: ' mgtk ' }, |
| | | // { key: 'set', value: ' mstk ' }, |
| | | // { key: 'ROLLBACK', value: ' mrlbkk ' } |
| | | // ] |
| | | |
| | | // try { |
| | | // try { |
| | | // _value = JSON.parse(window.decodeURIComponent(window.atob(value))) |
| | | // } catch { |
| | | // _value = '' |
| | | // } |
| | | |
| | | // if (!_value) { |
| | | // _value = window.atob(value) |
| | | // _value = _value.replace(salt, '') |
| | | // _value = window.decodeURIComponent(window.atob(_value)) |
| | | |
| | | // _value = _value.replace(/\smpercent\s/g, '%') |
| | | |
| | | // formatKeys.forEach(item => { |
| | | // let reg = new RegExp(item.value, 'g') |
| | | // _value = _value.replace(reg, ' ' + item.key + ' ') |
| | | // }) |
| | | |
| | | // _value = _value.replace(/\s\n\s/ig, '\n') |
| | | // _value = _value.replace(/(^\s+|\s+$)/ig, '') |
| | | // } |
| | | // } catch { |
| | | // console.warn('UnFormat Failure') |
| | | // _value = '' |
| | | // } |
| | | |
| | | // return _value |
| | | // } |
| | | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | // value: Utils.UnformatOptions(item.longparam) |
| | | } |
| | | }) |
| | | }) |
| | |
| | | padding-bottom: 5px; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 190px); |
| | | min-height: 250px; |
| | | overflow-y: auto; |
| | | padding-top: 10px; |
| | | } |
| | |
| | | setting: PropTypes.object, // 数据源配置 |
| | | columns: PropTypes.array, // 列设置 |
| | | scripts: PropTypes.array, // 自定义脚本 |
| | | updateStatus: PropTypes.func, // 状态更新 |
| | | } |
| | | |
| | | state = { |
| | | interType: 'system', |
| | | procMode: 'system', |
| | | procMode: 'script', |
| | | requestMode: 'system', |
| | | funcTooltip: '', |
| | | funcRules: [] |
| | |
| | | |
| | | this.setState({ |
| | | interType: setting.interType || 'system', |
| | | procMode: setting.procMode || 'system', |
| | | procMode: setting.procMode || 'script', |
| | | requestMode: setting.requestMode || 'system', |
| | | funcTooltip: tooltip, |
| | | funcRules: rules |
| | |
| | | interface: window.GLOB.mainSystemApi || '' |
| | | }) |
| | | } |
| | | this.props.updateStatus({[key]: value}) |
| | | } |
| | | |
| | | primaryKeyChange = (val) => { |
| | |
| | | ] |
| | | })( |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.onRadioChange(e, 'procMode')}}> |
| | | <Radio value="system">前置脚本</Radio> |
| | | <Radio value="script">前置脚本</Radio> |
| | | <Radio value="inner">前置函数</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | |
| | | {interType === 'custom' ? <Col span={12}> |
| | | <Form.Item label="回调方式"> |
| | | {getFieldDecorator('callbackType', { |
| | | initialValue: setting.callbackType || 'default' |
| | | initialValue: setting.callbackType || 'script' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio.Group onChange={(e) => {this.onRadioChange(e, 'callbackType')}}> |
| | | <Radio value="default">默认脚本</Radio> |
| | | <Radio value="script">自定义脚本</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={12}> |
| | | <Form.Item label="回调表名"> |
| | | {getFieldDecorator('cbTable', { |
| | | initialValue: setting.cbTable || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '回调表名!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'同步执行:外部接口调用成功后再请求数据;异步执行:外部接口调用与请求数据同时进行。'}> |
| | | <Icon type="question-circle" /> |
| | |
| | | arr_field: '', |
| | | regoptions: [], |
| | | setting: null, |
| | | defaultSql: '' |
| | | defaultSql: '', |
| | | status: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | _search = _search.replace(/@\$@/ig, '') |
| | | _search = _search ? 'where ' + _search : '' |
| | | |
| | | let status = fromJS(_setting).toJS() |
| | | status.requestMode = status.requestMode || 'system' |
| | | status.procMode = status.procMode || 'script' |
| | | status.callbackType = status.callbackType || 'script' |
| | | |
| | | this.setState({ |
| | | setting: _setting, |
| | | search: _search, |
| | |
| | | columns: columns, |
| | | scripts: _scripts, |
| | | preScripts: _preScripts, |
| | | cbScripts: _cbScripts |
| | | cbScripts: _cbScripts, |
| | | status |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | handleConfirm = (trigger) => { |
| | | const { activeKey, setting, scripts } = this.state |
| | | const { activeKey, setting, scripts, preScripts, cbScripts } = this.state |
| | | |
| | | let _loading = false |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { |
| | |
| | | this.setState({loading: false}) |
| | | reject() |
| | | return |
| | | } else if (res.interType === 'system' && res.default === 'false' && _scripts.length === 0) { |
| | | } else if ((res.interType === 'system' || res.requestMode === 'system') && res.default === 'false' && _scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,请添加自定义脚本!', |
| | |
| | | }, () => { |
| | | this.sqlverify(() => { |
| | | this.setState({loading: false}) |
| | | resolve({...res, scripts}) |
| | | resolve({...res, scripts, preScripts, cbScripts}) |
| | | }, () => { |
| | | this.setState({loading: false}) |
| | | reject() |
| | |
| | | reject() |
| | | }) |
| | | }) |
| | | } else { |
| | | } else if (activeKey === 'scripts') { |
| | | return new Promise((resolve, reject) => { |
| | | if (trigger === 'func' && setting.interType !== 'inner') { |
| | | notification.warning({ |
| | |
| | | }) |
| | | this.setState({loading: false}) |
| | | reject() |
| | | } else if (setting.interType === 'system' && setting.default === 'false' && _scripts.length === 0) { |
| | | } else if ((setting.interType === 'system' || setting.requestMode === 'system') && setting.default === 'false' && _scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,请添加自定义脚本!', |
| | |
| | | } else { |
| | | this.sqlverify(() => { |
| | | this.setState({loading: false}) |
| | | resolve({...setting, scripts}) |
| | | resolve({...setting, scripts, preScripts, cbScripts}) |
| | | }, () => { |
| | | this.setState({loading: false}) |
| | | reject() |
| | | }, 'submit') |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({loading: false}) |
| | | return new Promise((resolve) => { |
| | | resolve({...setting, scripts, preScripts, cbScripts}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | sqlverify = (_resolve, _reject, type, uscripts) => { |
| | | const { setting, scripts, arr_field, regoptions, search } = this.state |
| | | |
| | | if (setting.interType !== 'system') { // 不使用系统接口时,不需要sql验证 |
| | | if (setting.interType !== 'system' && setting.requestMode !== 'system') { // 不使用系统接口时,不需要sql验证 |
| | | _resolve() |
| | | return |
| | | } |
| | |
| | | |
| | | // 标签切换 |
| | | changeTab = (val) => { |
| | | const { activeKey, search, arr_field } = this.state |
| | | const { activeKey, search, arr_field, setting } = this.state |
| | | |
| | | let _loading = false |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { |
| | |
| | | return |
| | | } |
| | | |
| | | if (activeKey !== 'setting') { |
| | | if (setting.interType !== 'system' && setting.requestMode !== 'system' && val === 'scripts') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用系统接口时,才可以设置自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (setting.interType !== 'custom' && (val === 'prescripts' || val === 'cbscripts')) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用自定义接口时,才可以设置前置或回调脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (activeKey === 'setting') { |
| | | let _defaultSql = '' |
| | | this.settingForm.handleConfirm().then(res => { |
| | | if (res.interType !== 'system') { |
| | | if (res.interType !== 'system' && res.requestMode !== 'system' && val === 'scripts') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用系统接口时,才可以设置自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (res.interType !== 'custom' && (val === 'prescripts' || val === 'cbscripts')) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用自定义接口时,才可以设置前置或回调脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | loading: false |
| | | }) |
| | | }, activeKey) |
| | | } else { |
| | | this.setState({ |
| | | activeKey: val |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({cbScripts}) |
| | | } |
| | | |
| | | updateStatus = (status) => { |
| | | this.setState({status: {...this.state.status, ...status}}) |
| | | } |
| | | |
| | | render() { |
| | | const { config, menu, dict } = this.props |
| | | const { loading, activeKey, setting, defaultSql, columns, scripts, preScripts, cbScripts } = this.state |
| | | const { loading, activeKey, setting, defaultSql, columns, scripts, preScripts, cbScripts, status, regoptions } = this.state |
| | | |
| | | return ( |
| | | <div className="model-table-setting-form-box" id="model-setting-form-body"> |
| | |
| | | columns={columns} |
| | | setting={setting} |
| | | scripts={scripts} |
| | | updateStatus={this.updateStatus} |
| | | wrappedComponentRef={(inst) => this.settingForm = inst} |
| | | /> |
| | | </TabPane> |
| | |
| | | 自定义脚本 |
| | | {scripts.length ? <span className="count-tip">{scripts.length}</span> : null} |
| | | </span> |
| | | } key="scripts"> |
| | | } disabled={!(status.interType === 'system' || (status.interType === 'custom' && status.requestMode === 'system'))} key="scripts"> |
| | | <CustomScript |
| | | dict={dict} |
| | | setting={setting} |
| | | scripts={scripts} |
| | | defaultSql={defaultSql} |
| | | searches={this.props.search} |
| | | scriptsChange={this.scriptsChange} |
| | | scriptsUpdate={this.scriptsUpdate} |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |
| | | /> |
| | |
| | | 前置脚本 |
| | | {preScripts.length ? <span className="count-tip">{preScripts.length}</span> : null} |
| | | </span> |
| | | } key="prescripts"> |
| | | } disabled={status.interType !== 'custom' || status.procMode !== 'script'} key="prescripts"> |
| | | <SimpleScript |
| | | dict={dict} |
| | | setting={setting} |
| | | scripts={preScripts} |
| | | defaultSql={defaultSql} |
| | | regoptions={regoptions} |
| | | searches={this.props.search} |
| | | scriptsChange={this.scriptsChange} |
| | | scriptsUpdate={this.preScriptsUpdate} |
| | | wrappedComponentRef={(inst) => this.preScriptsForm = inst} |
| | | /> |
| | |
| | | 回调脚本 |
| | | {cbScripts.length ? <span className="count-tip">{cbScripts.length}</span> : null} |
| | | </span> |
| | | } key="cbscripts"> |
| | | } disabled={status.interType !== 'custom' || status.callbackType !== 'script'} key="cbscripts"> |
| | | <SimpleScript |
| | | dict={dict} |
| | | setting={setting} |
| | | scripts={cbScripts} |
| | | searches={this.props.search} |
| | | scriptsChange={this.scriptsChange} |
| | | scriptsUpdate={this.scriptsUpdate} |
| | | scriptsUpdate={this.cbScriptsUpdate} |
| | | wrappedComponentRef={(inst) => this.cbScriptsForm = inst} |
| | | /> |
| | | </TabPane> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Icon, Button, notification, Select, Popconfirm, Typography } from 'antd' |
| | | import { Form, Row, Col, Icon, Button, notification, Select, Popconfirm, Typography, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | | import SettingUtils from '../utils' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | |
| | | setting: PropTypes.object, // 设置 |
| | | scripts: PropTypes.array, // 自定义脚本列表 |
| | | searches: PropTypes.array, // 搜索条件 |
| | | defaultSql: PropTypes.string, // 默认sql |
| | | regoptions: PropTypes.any, // 正则替换 |
| | | scriptsChange: PropTypes.func, // 自定义脚本切换时验证 |
| | | scriptsUpdate: PropTypes.func // 表单 |
| | | } |
| | |
| | | const { searches, scripts } = this.props |
| | | |
| | | let _usefulFields = [] |
| | | searches.forEach(item => { |
| | | if (!item.field) return |
| | | if (item.type === 'group') { |
| | | if (item.transfer === 'true') { |
| | | |
| | | if (searches) { |
| | | searches.forEach(item => { |
| | | if (!item.field) return |
| | | if (item.type === 'group') { |
| | | if (item.transfer === 'true') { |
| | | _usefulFields.push(item.field) |
| | | } |
| | | _usefulFields.push(item.datefield) |
| | | _usefulFields.push(item.datefield + '1') |
| | | } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { |
| | | _usefulFields.push(item.field) |
| | | _usefulFields.push(item.field + '1') |
| | | } else if (_usefulFields.includes(item.field)) { |
| | | _usefulFields.push(item.field + '1') |
| | | } else { |
| | | _usefulFields.push(item.field) |
| | | } |
| | | _usefulFields.push(item.datefield) |
| | | _usefulFields.push(item.datefield + '1') |
| | | } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { |
| | | _usefulFields.push(item.field) |
| | | _usefulFields.push(item.field + '1') |
| | | } else if (_usefulFields.includes(item.field)) { |
| | | _usefulFields.push(item.field + '1') |
| | | } else { |
| | | _usefulFields.push(item.field) |
| | | } |
| | | }) |
| | | }) |
| | | _usefulFields = _usefulFields.join(', ') |
| | | } else { |
| | | _usefulFields = null |
| | | } |
| | | |
| | | this.setState({ |
| | | usefulFields: _usefulFields.join(', '), |
| | | usefulFields: _usefulFields, |
| | | scripts: fromJS(scripts).toJS() |
| | | }) |
| | | } |
| | |
| | | let _item = { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | // value: Utils.UnformatOptions(item.longparam) |
| | | } |
| | | return _item |
| | | }) |
| | |
| | | _scripts.push(values) |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | 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.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({loading: true}) |
| | | this.props.scriptsChange(_scripts).then(res => { |
| | | this.setState({ |
| | | loading: false, |
| | | scripts: _scripts, |
| | | editItem: null |
| | | }) |
| | | |
| | | this.props.scriptsUpdate(_scripts) |
| | | this.props.form.setFieldsValue({ |
| | | sql: '' |
| | | }) |
| | | }, () => { |
| | | this.setState({loading: false}) |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | loading: false, |
| | | scripts: _scripts, |
| | | editItem: null |
| | | }) |
| | | |
| | | this.props.scriptsUpdate(_scripts) |
| | | this.props.form.setFieldsValue({ |
| | | sql: '' |
| | | }) |
| | | } else { |
| | | this.setState({loading: false}) |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | selectScript = (value, option) => { |
| | | if (!value || !option) return |
| | | let _sql = this.props.form.getFieldValue('sql') |
| | | if (_sql) { |
| | | _sql = _sql + ` |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { setting, defaultSql, scripts } = this.props |
| | | const { setting, scripts } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { usefulFields, scriptsColumns, systemScripts } = this.state |
| | | const formItemLayout = { |
| | |
| | | <div className="modal-menu-setting-script"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | {setting.tableName ? <Col span={8}> |
| | | <Form.Item label={'表名'} style={{whiteSpace: 'nowrap', margin: 0}}> |
| | | {setting.tableName} |
| | | <Col span={8}> |
| | | <Form.Item label={'回调表名'} style={{whiteSpace: 'nowrap', margin: 0}}> |
| | | {setting.cbTable} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Col> |
| | | <Col span={16}> |
| | | <Form.Item label={'报错字段'} style={{margin: 0}}> |
| | | ErrorCode, retmsg |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24} className="sqlfield"> |
| | | {usefulFields ? <Col span={24} className="sqlfield"> |
| | | <Form.Item label={'可用字段'}> |
| | | id, bid, loginuid, sessionuid, userid, username, fullname, appkey, time_id, orderBy{setting.laypage === 'true' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''} |
| | | id, bid, loginuid, sessionuid, userid, username, fullname, appkey, time_id{usefulFields ? ', ' + usefulFields : ''} |
| | | </Form.Item> |
| | | </Col> |
| | | </Col> : null} |
| | | <Col span={10} className="quick-add"> |
| | | <Form.Item label={'快捷添加'} style={{marginBottom: 0}}> |
| | | <Select |
| | | allowClear |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={this.selectScript} |
| | | > |
| | | <Select.Option key="default" value={defaultSql}>默认sql</Select.Option> |
| | | {!usefulFields ? <Select.Option key="default" value={`declare @${setting.cbTable} table (mk_api_key nvarchar(100))`}>默认sql</Select.Option> : null} |
| | | {systemScripts.map((option, i) => |
| | | <Select.Option style={{whiteSpace: 'normal'}} key={i} value={option.value}>{option.name}</Select.Option> |
| | | )} |
| | |
| | | |
| | | return sql |
| | | } |
| | | |
| | | /** |
| | | * @description 生成前置或后置语句 |
| | | * @return {String} scripts 脚本 |
| | | * @return {Array} regoptions 搜索条件正则替换 |
| | | */ |
| | | static getCustomDebugSql (scripts, regoptions) { |
| | | let sql = '' |
| | | let _customScript = '' |
| | | |
| | | scripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | }) |
| | | |
| | | if (_customScript) { |
| | | _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50) select @ErrorCode='',@retmsg ='' |
| | | ${_customScript} |
| | | ` |
| | | } |
| | | |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | // 正则替换 |
| | | if (regoptions) { |
| | | let _regoptions = regoptions.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'0'` |
| | | } |
| | | }) |
| | | _regoptions.forEach(item => { |
| | | _customScript = _customScript.replace(item.reg, item.value) |
| | | }) |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | |
| | | return sql |
| | | } |
| | | } |
| | |
| | | let _item = { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | // value: Utils.UnformatOptions(item.longparam) |
| | | } |
| | | return _item |
| | | }) |
| | |
| | | } |
| | | |
| | | selectScript = (value, option) => { |
| | | if (!value || !option) return |
| | | let _sql = this.props.form.getFieldValue('sql') |
| | | if (_sql) { |
| | | _sql = _sql + ` |
| | |
| | | <Col span={10} className="quick-add"> |
| | | <Form.Item label={'快捷添加'} style={{marginBottom: 0}}> |
| | | <Select |
| | | allowClear |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={this.selectScript} |
| | |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | // value: Utils.UnformatOptions(item.longparam) |
| | | } |
| | | }) |
| | | }) |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 解密 |
| | | * @return {String} value |
| | | */ |
| | | static UnformatOptions (value) { |
| | | if (!value) return '' |
| | | let salt = 'minKe' // 盐值 |
| | | let _value = '' |
| | | |
| | | try { |
| | | try { |
| | | _value = JSON.parse(window.decodeURIComponent(window.atob(value))) |
| | | } catch { |
| | | _value = '' |
| | | } |
| | | |
| | | if (!_value) { |
| | | _value = window.atob(value) |
| | | _value = _value.replace(salt, '') |
| | | _value = window.decodeURIComponent(window.atob(_value)) |
| | | |
| | | _value = _value.replace(/\smpercent\s/g, '%') |
| | | |
| | | formatKeys.forEach(item => { |
| | | let reg = new RegExp(item.value, 'g') |
| | | _value = _value.replace(reg, ' ' + item.key + ' ') |
| | | }) |
| | | |
| | | _value = _value.replace(/\s\n\s/ig, '\n') |
| | | _value = _value.replace(/(^\s+|\s+$)/ig, '') |
| | | } |
| | | } catch { |
| | | console.warn('UnFormat Failure') |
| | | _value = '' |
| | | } |
| | | |
| | | return _value |
| | | } |
| | | |
| | | /** |
| | | * @description sPC_TableData_InUpDe sql加密 |
| | | * @return {String} value |
| | | */ |