Merge branch 'master' into positec
| | |
| | | data: qs.stringify(data) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description sql检验 |
| | | */ |
| | | sDebug (sql, rduri = null) { |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | userid: sessionStorage.getItem('UserID') || '', |
| | | lang: sessionStorage.getItem('lang') || '', |
| | | SessionUid: localStorage.getItem('SessionUid') || '', |
| | | LoginUID: sessionStorage.getItem('LoginUID') || '', |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | console.info(`/* sql 验证 */\n${sql.replace(/\n\s{6,20}/ig, '\n')}`) |
| | | |
| | | sql = sql.replace(/\n/ig, ' ') |
| | | |
| | | param.LText = Utils.formatOptions(sql) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | param = this.encryptParam(param) |
| | | |
| | | let url = '/webapi/dostars' |
| | | |
| | | if (rduri) { |
| | | url = rduri |
| | | } |
| | | |
| | | let timer = setTimeout(() => { |
| | | let _param = { |
| | | func: 's_debug_sql_cancel', |
| | | userid: sessionStorage.getItem('UserID') || '', |
| | | lang: sessionStorage.getItem('lang') || '', |
| | | SessionUid: localStorage.getItem('SessionUid') || '', |
| | | LoginUID: sessionStorage.getItem('LoginUID') || '', |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | _param = this.encryptParam(_param) |
| | | axios({ |
| | | url: `${url}/s_debug_sql_cancel`, |
| | | method: 'post', |
| | | data: JSON.stringify(_param) |
| | | }) |
| | | }, 20000) |
| | | |
| | | return new Promise(resolve => { |
| | | axios({ |
| | | url: `${url}/s_debug_sql`, |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | clearTimeout(timer) |
| | | if (/Shared Memory Provider|会话处于终止状态|当前命令发生了严重错误/.test(res.message)) { |
| | | res.message = '验证失败,请检查SQL中是否存在死循环。' |
| | | } |
| | | resolve(res) |
| | | }, () => { |
| | | clearTimeout(timer) |
| | | resolve({status: false, ErrCode: 'E', message: '验证失败:1请检查SQL中是否存在死循环;2请检查网络连接是否正常。'}) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | export default new Api() |
| | |
| | | if (_menu) { |
| | | this.openTab(_menu, 0) |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | this.getwork() |
| | | }, 100) |
| | | }) |
| | | |
| | | // 获取角色权限, edition_type 接口版本控制 ''、'Y'、'A' |
| | |
| | | _permAction[menu.MenuID] = true |
| | | }) |
| | | } |
| | | } else { |
| | | } else if (!/PRIMARY KEY/ig.test(result.message)) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | |
| | | }, 50) |
| | | } |
| | | |
| | | getwork = () => { |
| | | if (sessionStorage.getItem('work_grade')) return |
| | | |
| | | Api.genericInterface({func: 's_get_local_my_worker_v1'}).then(result => { |
| | | sessionStorage.setItem('work_grade', result.work_grade || 0) |
| | | sessionStorage.setItem('work_group', result.work_group || '') |
| | | |
| | | if (!result.status && sessionStorage.getItem('debug') === 'true') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: /s_get_local_my_worker_v1/.test(result.message) ? '职员信息获取失败,请联系管理员。' : result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | openTab = (menu, times) => { |
| | | if (times > 50) return |
| | | times++ |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Modal, Button, Switch, notification, message } from 'antd' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | } |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').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) |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | editform: null, |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Modal, Button, Switch, notification, message } from 'antd' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | } |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | editform: null, |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Modal, Button, Switch, notification, message } from 'antd' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').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) |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | editform: null, |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, notification, Popover, Switch, message } from 'antd' |
| | | import { PlusOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: res.dataSource |
| | | } |
| | | let sql = res.dataSource |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').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) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | visible: false |
| | |
| | | type: 'select', |
| | | key: 'popClose', |
| | | label: '关闭后', |
| | | initVal: card.popClose || 'never', |
| | | initVal: card.popClose || 'grid', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | |
| | | type: 'select', |
| | | key: 'popClose', |
| | | label: '关闭后', |
| | | initVal: card.popClose || 'never', |
| | | initVal: card.popClose || 'grid', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | |
| | | const { visible } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}}> |
| | | <> |
| | | {type === 'page' ? <Button icon="snippets" style={{color: '#1890ff', borderColor: '#1890ff'}} onClick={() => {this.setState({visible: true})}} >粘贴</Button> : <SnippetsOutlined style={{color: 'purple'}} onClick={() => {this.setState({visible: true})}} />} |
| | | <Modal |
| | | title="粘贴" |
| | |
| | | > |
| | | <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, notification } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getSearchForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import SearchForm from '@/templates/sharecomponent/searchcomponent/searchform' |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: res.dataSource |
| | | } |
| | | let sql = res.dataSource |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').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) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | searchlist: _searchlist, |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Modal, notification, Popover } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${values.dataSource}` |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').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) |
| | | |
| | | |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${values.dataSource}` |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && values.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({visible: false, loading: false, formlist: null}) |
| | | this.props.submitCol(values) |
| | | this.record = null |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | |
| | | } |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | |
| | | }) |
| | | } else { |
| | | this.setState({loading: true}) |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | Api.sDebug(sql).then(res => { |
| | | if (res.status || res.ErrCode === '-2') { |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | |
| | | mainSearch: [], |
| | | visible: false, |
| | | loading: false, |
| | | setting: null, |
| | | record: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | |
| | | this.setState({setting: fromJS(config.setting).toJS()}) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | |
| | | this.setState({loading: false, visible: false}) |
| | | |
| | | if (res.cols) { |
| | | res.cols = [...config.cols, ...res.cols] |
| | | } else { |
| | | delete res.cols |
| | | } |
| | | |
| | | this.props.updateConfig({...config, ...res}) |
| | | }, () => { |
| | | this.setState({loading: false}) |
| | |
| | | searches: PropTypes.array, // 搜索条件 |
| | | systemScripts: PropTypes.array, // 系统脚本 |
| | | scriptSubmit: PropTypes.func, // 脚本验证后提交 |
| | | scriptsChange: PropTypes.func // 脚本验证 |
| | | scriptsChange: PropTypes.func, |
| | | addProcess: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | _usefulFields.push(item.field) |
| | | _usefulFields.push(item.datefield) |
| | | _usefulFields.push(item.datefield + '1') |
| | | } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { |
| | | } else if (['dateweek', 'datemonth'].includes(item.type)) { |
| | | _usefulFields.push(item.field) |
| | | _usefulFields.push(item.field + '1') |
| | | } else if (item.type === 'daterange') { |
| | | let _skey = item.field |
| | | let _ekey = item.field + '1' |
| | | |
| | | if (/,/.test(item.field)) { |
| | | _skey = item.field.split(',')[0] |
| | | _ekey = item.field.split(',')[1] |
| | | } |
| | | _usefulFields.push(_skey) |
| | | _usefulFields.push(_ekey) |
| | | } else if (item.type === 'date' && _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)) { |
| | | } else if (['dateweek', 'datemonth'].includes(item.type)) { |
| | | _usefulFields.push(item.field) |
| | | _usefulFields.push(item.field + '1') |
| | | } else if (item.type === 'daterange') { |
| | | let _skey = item.field |
| | | let _ekey = item.field + '1' |
| | | |
| | | if (/,/.test(item.field)) { |
| | | _skey = item.field.split(',')[0] |
| | | _ekey = item.field.split(',')[1] |
| | | } |
| | | _usefulFields.push(_skey) |
| | | _usefulFields.push(_ekey) |
| | | } else if (item.type === 'date' && _usefulFields.includes(item.field)) { |
| | | _usefulFields.push(item.field + '1') |
| | | } else { |
| | |
| | | |
| | | if (value === 'defaultsql') { |
| | | value = this.props.defaultsql |
| | | } else if (value === 'flowsql') { |
| | | value = `/* select a.*,w.remark as remark_w,w.statusname as statusname_w,w.status as status_w,w.works_flow_param from (数据源) a inner join (select * from s_my_works_flow where works_flow_code=@works_flow_code@ and status=0 and deleted=0) w on a.id=w.works_flow_id */` |
| | | this.props.addProcess() |
| | | } |
| | | |
| | | _sql = _sql.replace(/\s{6}$/, '') |
| | |
| | | onSelect={this.selectScript} |
| | | > |
| | | <Select.Option style={{whiteSpace: 'normal'}} key="default" value="defaultsql">默认sql</Select.Option> |
| | | {window.GLOB.process ? <Select.Option style={{whiteSpace: 'normal'}} key="default" value="flowsql">默认sql(工作流)</Select.Option> : null} |
| | | <Select.Option key="debugger" value={`z_debug: select @ErrorCode='E',@retmsg='测试断点' goto aaa`}> |
| | | 测试断点 |
| | | </Select.Option> |
| | |
| | | const { TabPane } = Tabs |
| | | const { Paragraph } = Typography |
| | | const { Search } = Input |
| | | const { confirm } = Modal |
| | | |
| | | const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | |
| | | reload: false, |
| | | script: null, |
| | | scriptValue: '', |
| | | cols: null, |
| | | colColumns: [ |
| | | { |
| | | title: '名称', |
| | |
| | | } |
| | | |
| | | return new Promise((resolve, reject) => { |
| | | this.sqlverify(resolve, reject, false, scripts) |
| | | this.sqlverify(resolve, reject, 'script', scripts) |
| | | }) |
| | | } |
| | | |
| | |
| | | loading: false |
| | | }) |
| | | this.getdefaultSql() |
| | | }, true) |
| | | }, 'change') |
| | | }) |
| | | }, () => { |
| | | this.setState({loading: false}) |
| | |
| | | |
| | | submitDataSource = () => { |
| | | const { config, mainSearch } = this.props |
| | | const { activeKey, setting, columns, subColumns, scripts } = this.state |
| | | const { activeKey, setting, columns, subColumns, scripts, cols } = this.state |
| | | |
| | | if (config.subtype === 'dualdatacard') { |
| | | let arr = columns.map(col => col.field.toLowerCase()) |
| | |
| | | defaultSearch: _search, |
| | | setting: res |
| | | }, () => { |
| | | this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts }) }, reject, false) |
| | | this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | }) |
| | | }, () => { |
| | | reject() |
| | |
| | | reject() |
| | | return |
| | | } |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts }) }, reject, false) |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | } else if (activeKey === 'subcolumns') { |
| | | if (this.subdatasource && this.subdatasource.state.editingKey) { |
| | | notification.warning({ |
| | |
| | | reject() |
| | | return |
| | | } |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts }) }, reject, false) |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | } else if (activeKey === 'scripts') { |
| | | let _loading = false |
| | | if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | |
| | | return |
| | | } |
| | | |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts }) }, reject, false) |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | } |
| | | }) |
| | | } |
| | | |
| | | sqlverify = (resolve, reject, change = false, testScripts) => { |
| | | sqlverify = (resolve, reject, type, testScripts) => { |
| | | const { config } = this.props |
| | | const { columns, setting, scripts, searches, defaultSearch, debugId } = this.state |
| | | |
| | |
| | | if (testScripts) { |
| | | _scripts = testScripts.filter(item => item.status !== 'false') |
| | | } |
| | | if (!change && setting.interType === 'system' && setting.execute === 'false' && _scripts.length === 0) { |
| | | if (type !== 'change' && setting.interType === 'system' && setting.execute === 'false' && _scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,请添加自定义脚本!', |
| | |
| | | return |
| | | } |
| | | |
| | | if (change && columns.length === 0) { |
| | | if (type === 'change' && columns.length === 0) { |
| | | reject() |
| | | return |
| | | } |
| | | |
| | | if ((setting.interType === 'system' && setting.execute !== 'false') || _scripts.length > 0) { |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let r = SettingUtils.getDebugSql(setting, _scripts, columns, searches, defaultSearch, config.type, '2023-04-20 15:29:37') |
| | | let r = SettingUtils.getDebugSql(setting, _scripts, columns, searches, defaultSearch, config.type) |
| | | |
| | | let _debugId = md5(r.sql) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: r.sql |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | |
| | | let sumParam = null |
| | | if (r.sumSql) { |
| | | sumParam = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: r.sumSql |
| | | } |
| | | sumParam.LText = Utils.formatOptions(sumParam.LText) |
| | | sumParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | sumParam.secretkey = Utils.encrypt('', sumParam.timestamp) |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | if (sumParam) { |
| | | Api.genericInterface(sumParam).then(res => { |
| | | if (res.status) { |
| | | this.setState({debugId: _debugId}, () => { |
| | | resolve() |
| | | }) |
| | | } else { |
| | | Api.sDebug(r.sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({debugId: _debugId}, () => { |
| | | resolve() |
| | | }) |
| | | } else { |
| | | if (type === 'submit') { |
| | | Modal.confirm({ |
| | | title: result.message, |
| | | okText: '知道了', |
| | | cancelText: '强制保存', |
| | | onOk: () => { |
| | | reject() |
| | | Modal.error({ |
| | | title: res.message |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | resolve() |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({debugId: _debugId}, () => { |
| | | resolve() |
| | | reject() |
| | | Modal.error({ |
| | | title: result.message, |
| | | okText: '知道了' |
| | | }) |
| | | } |
| | | } else { |
| | | reject() |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | |
| | | this.setState({loading: true}) |
| | | |
| | | this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, false, _scripts) |
| | | this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, 'script', _scripts) |
| | | } |
| | | |
| | | updatefields = (columns) => { |
| | |
| | | message.success('复制成功。') |
| | | } |
| | | |
| | | addProcess = () => { |
| | | const { config } = this.props |
| | | const { columns } = this.state |
| | | |
| | | if (config.subtype === 'dualdatacard') return |
| | | |
| | | let fields = [] |
| | | let cols = [] |
| | | let _cols = columns.map(item => item.field.toLowerCase()) |
| | | |
| | | if (!_cols.includes('remark_w')) { |
| | | fields.push({ uuid: Utils.getuuid(), label: '备注', field: 'remark_w', datatype: 'Nvarchar(50)', fieldlength: 50, type: 'text' }) |
| | | cols.push({ uuid: Utils.getuuid(), Width: 120, label: '备注', field: 'remark_w', type: 'text', Hide: 'false', IsSort: 'false', fieldlength: 50 }) |
| | | } |
| | | if (!_cols.includes('statusname_w')) { |
| | | fields.push({ uuid: Utils.getuuid(), label: '状态', field: 'statusname_w', datatype: 'Nvarchar(50)', fieldlength: 50, type: 'text' }) |
| | | cols.push({ uuid: Utils.getuuid(), Width: 120, label: '状态', field: 'statusname_w', type: 'text', Hide: 'false', IsSort: 'false', fieldlength: 50 }) |
| | | } |
| | | if (!_cols.includes('works_flow_param')) { |
| | | fields.push({ uuid: Utils.getuuid(), label: '流程参数', field: 'works_flow_param', datatype: 'Nvarchar(512)', fieldlength: 512, type: 'text' }) |
| | | cols.push({ uuid: Utils.getuuid(), Width: 120, label: '流程参数', field: 'works_flow_param', type: 'text', Hide: 'true', IsSort: 'false', fieldlength: 512 }) |
| | | } |
| | | |
| | | if (fields.length === 0) return |
| | | |
| | | const that = this |
| | | |
| | | if (config.subtype !== 'basetable') { |
| | | cols = null |
| | | } |
| | | |
| | | confirm({ |
| | | content: cols ? '显示列中是否添加工作流字段?' : '字段集中是否添加工作流字段?', |
| | | onOk() { |
| | | that.setState({ |
| | | cols: cols, |
| | | columns: [...fields, ...columns] |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | setting={setting} |
| | | scripts={scripts} |
| | | updateStatus={this.updateStatus} |
| | | addProcess={this.addProcess} |
| | | wrappedComponentRef={(inst) => this.settingForm = inst} |
| | | /> : null} |
| | | </TabPane> |
| | |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.scriptsChange} |
| | | scriptSubmit={this.scriptSubmit} |
| | | addProcess={this.addProcess} |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |
| | | /> |
| | | <EditTable actions={['move']} data={scripts} columns={scriptsColumns} onChange={this.changeScripts}/> |
| | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | | updateStatus: PropTypes.func, |
| | | addProcess: PropTypes.func, |
| | | config: PropTypes.object, // 组件配置 |
| | | setting: PropTypes.object, // 数据源配置 |
| | | columns: PropTypes.array, // 列设置 |
| | |
| | | addProcess = () => { |
| | | let _sql = this.props.form.getFieldValue('dataresource') |
| | | |
| | | _sql = _sql + `\n/* select a.*, w.remark as remark_w, w.statusname as statusname_w,w.status as status_w from 数据源 a inner join (select * from s_my_works_flow where works_flow_code=@works_flow_code@ and status=0 and deleted=0) w on a.id=w.works_flow_id */` |
| | | _sql = _sql + `\n/* select a.*,w.remark as remark_w,w.statusname as statusname_w,w.status as status_w,w.works_flow_param from (数据源) a inner join (select * from s_my_works_flow where works_flow_code=@works_flow_code@ and status=0 and deleted=0) w on a.id=w.works_flow_id */` |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | dataresource: _sql |
| | | }) |
| | | |
| | | this.props.addProcess() |
| | | } |
| | | |
| | | render() { |
| | |
| | | * @return {Object} setting 页面设置 |
| | | * @return {Array} columns 显示字段 |
| | | */ |
| | | static getDebugSql (setting, scripts, columns, searches = [], defSearch, type, timestamp) { |
| | | static getDebugSql (setting, scripts, columns, searches = [], defSearch, type) { |
| | | let sql = '' |
| | | let error = '' |
| | | let _dataresource = '' |
| | |
| | | }) |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) |
| | | _customScript = _customScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) |
| | | _tailScript = _tailScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) |
| | | _dataresource = _dataresource.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _tailScript = _tailScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '') |
| | | |
| | | if (window.GLOB.process) { |
| | | _dataresource = _dataresource.replace(/@works_flow_code@/ig, `'${timestamp}'`) |
| | | _customScript = _customScript.replace(/@works_flow_code@/ig, `'${timestamp}'`) |
| | | _tailScript = _tailScript.replace(/@works_flow_code@/ig, `'${timestamp}'`) |
| | | _dataresource = _dataresource.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) |
| | | _tailScript = _tailScript.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | |
| | | if (!item.field) return |
| | | if (item.datefield) { |
| | | _regoptions.push({ |
| | | var: new RegExp('@' + item.datefield, 'ig'), |
| | | reg: new RegExp('@' + item.datefield + '@', 'ig') |
| | | }) |
| | | _regoptions.push({ |
| | | var: new RegExp('@' + item.datefield + '1', 'ig'), |
| | | reg: new RegExp('@' + item.datefield + '1@', 'ig') |
| | | }) |
| | | } |
| | | if (['dateweek', 'datemonth', 'daterange', 'range'].includes(item.type)) { |
| | | if (['dateweek', 'datemonth', 'range'].includes(item.type)) { |
| | | _regoptions.push({ |
| | | var: new RegExp('@' + item.field, 'ig'), |
| | | reg: new RegExp('@' + item.field + '@', 'ig') |
| | | }) |
| | | _regoptions.push({ |
| | | var: new RegExp('@' + item.field + '1', 'ig'), |
| | | reg: new RegExp('@' + item.field + '1@', 'ig') |
| | | }) |
| | | } else if (item.type === 'daterange') { |
| | | let _skey = item.field |
| | | let _ekey = item.field + '1' |
| | | |
| | | if (/,/.test(item.field)) { |
| | | _skey = item.field.split(',')[0] |
| | | _ekey = item.field.split(',')[1] |
| | | } |
| | | |
| | | _regoptions.push({ |
| | | reg: new RegExp('@' + _skey + '@', 'ig') |
| | | }) |
| | | _regoptions.push({ |
| | | reg: new RegExp('@' + _ekey + '@', 'ig') |
| | | }) |
| | | } else if (item.type === 'date') { |
| | | if (_fields.includes(item.field)) { |
| | | _regoptions.push({ |
| | | var: new RegExp('@' + item.field + '1', 'ig'), |
| | | reg: new RegExp('@' + item.field + '1@', 'ig') |
| | | }) |
| | | } else { |
| | | _fields.push(item.field) |
| | | _regoptions.push({ |
| | | var: new RegExp('@' + item.field, 'ig'), |
| | | reg: new RegExp('@' + item.field + '@', 'ig') |
| | | }) |
| | | } |
| | | } else if (item.type === 'text' || item.type === 'select') { |
| | | item.field.split(',').forEach(field => { |
| | | _regoptions.push({ |
| | | var: new RegExp('@' + field, 'ig'), |
| | | reg: new RegExp('@' + field + '@', 'ig') |
| | | }) |
| | | }) |
| | | } else { |
| | | _regoptions.push({ |
| | | var: new RegExp('@' + item.field, 'ig'), |
| | | reg: new RegExp('@' + item.field + '@', 'ig') |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | sql = `${_customScript} |
| | | ${_dataresource} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } else if (_tailScript) { |
| | | sql = `/* sql 验证 */ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | ${_dataresource} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } else { |
| | | sql = `/* sql 验证 */ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | ${_dataresource}` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | |
| | | console.info(sql) |
| | | |
| | | let errors = [] |
| | | |
| | |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | sql = sql.replace(/\n/g, ' ') |
| | | |
| | | return { error, sql, errors: errors.join(';') } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { fromJS } from 'immutable' |
| | | import { Modal, Button } from 'antd' |
| | | // import moment from 'moment' |
| | | |
| | | // import Api from '@/api' |
| | | // import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | class DebugSql extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object |
| | | } |
| | | |
| | | state = { |
| | | visible: false, |
| | | confirming: false, |
| | | } |
| | | |
| | | trigger = () => { |
| | | // const { config } = this.props |
| | | |
| | | // let list = [] |
| | | // let mainSearch = [] |
| | | } |
| | | |
| | | // formatSearch (config) { |
| | | // if (!config.search) return [] |
| | | |
| | | // let values = [] |
| | | |
| | | // config.search.forEach(item => { |
| | | // item.hidden = item.Hide === 'true' |
| | | // item.required = !item.hidden && item.required === 'true' |
| | | // item.advanced = item.advanced === 'true' |
| | | // item.$forbid = item.query === 'false' |
| | | // item.precision = item.precision || 'day' |
| | | |
| | | // if (item.type === 'date') { // 时间搜索 |
| | | // let format = 'YYYY-MM-DD' |
| | | // if (item.precision === 'day') { |
| | | |
| | | // } else if (item.precision === 'hour') { |
| | | // format = 'YYYY-MM-DD HH' |
| | | // } else if (item.precision === 'minute') { |
| | | // format = 'YYYY-MM-DD HH:mm' |
| | | // } else if (item.precision === 'second') { |
| | | // format = 'YYYY-MM-DD HH:mm:ss' |
| | | // } |
| | | |
| | | // item.initval = item.initval ? moment().subtract(item.initval, 'days').format(format) : '' |
| | | // } else if (item.type === 'datemonth') { |
| | | // item.initval = item.initval ? moment().subtract(item.initval, 'month').format('YYYY-MM') : '' |
| | | // } else if (item.type === 'dateweek') { |
| | | // item.initval = item.initval ? moment().subtract(item.initval * 7, 'days').format('YYYY-MM-DD') : '' |
| | | // } else if (item.type === 'daterange') { |
| | | // let format = 'YYYY-MM-DD' |
| | | // if (item.precision === 'day') { |
| | | |
| | | // } else if (item.precision === 'hour') { |
| | | // format = 'YYYY-MM-DD HH' |
| | | // } else if (item.precision === 'minute') { |
| | | // format = 'YYYY-MM-DD HH:mm' |
| | | // } else if (item.precision === 'second') { |
| | | // format = 'YYYY-MM-DD HH:mm:ss' |
| | | // } |
| | | // if (item.initval === 'week') { |
| | | // item.initval = [moment().startOf('week').format(format), moment().endOf('week').format(format)].join(',') |
| | | // } else if (item.initval === 'month') { |
| | | // item.initval = [moment().startOf('month').format(format), moment().endOf('month').format(format)].join(',') |
| | | // } else if (item.initval === 'lastMonth') { |
| | | // item.initval = [moment().subtract(1, 'months').startOf('month').format(format), moment().subtract(1, 'months').endOf('month').format(format)].join(',') |
| | | // } else if (item.initval) { |
| | | // try { |
| | | // let _initval = JSON.parse(item.initval) |
| | | // let _vals = [moment().subtract(_initval[0], 'days').format(format), moment().subtract(_initval[1], 'days').format(format)] |
| | | // item.initval = _vals.join(',') |
| | | // } catch (e) { |
| | | // item.initval = '' |
| | | // } |
| | | // } |
| | | // } else if (item.type === 'group') { |
| | | // if (item.initval && item.initval[0]) { |
| | | // let _type = item.initval[0] |
| | | // let _val = item.initval[1] |
| | | // let _dateRange = '' |
| | | |
| | | // if (_type === 'day') { |
| | | // _dateRange = [moment().subtract(_val, 'days').format('YYYY-MM-DD'), |
| | | // moment().subtract(_val, 'days').format('YYYY-MM-DD')] |
| | | // } else if (_type === 'week') { |
| | | // _dateRange = [moment().subtract(_val * 7, 'days').startOf('week').format('YYYY-MM-DD'), |
| | | // moment().subtract(_val * 7, 'days').endOf('week').format('YYYY-MM-DD')] |
| | | // } else if (_type === 'month') { |
| | | // _dateRange = [moment().subtract(_val, 'month').startOf('month').format('YYYY-MM-DD'), |
| | | // moment().subtract(_val, 'month').endOf('month').format('YYYY-MM-DD')] |
| | | // } else if (_type === 'quarter') { |
| | | // let _differ = parseInt(moment().format('MM')) % 3 |
| | | // let _pdiffer = 0 |
| | | // let _ndiffer = 0 |
| | | |
| | | // // 差值计算 |
| | | // switch(_differ) { |
| | | // case 0: |
| | | // _pdiffer = 2 |
| | | // _ndiffer = 0 |
| | | // break |
| | | // case 1: |
| | | // _pdiffer = 0 |
| | | // _ndiffer = -2 |
| | | // break |
| | | // case 2: |
| | | // _pdiffer = 1 |
| | | // _ndiffer = -1 |
| | | // break |
| | | // default: |
| | | // } |
| | | // _dateRange = [moment().subtract(_pdiffer + _val * 3, 'month').startOf('month').format('YYYY-MM-DD'), |
| | | // moment().subtract(_ndiffer + _val * 3, 'month').endOf('month').format('YYYY-MM-DD')] |
| | | // } else if (_type === 'year') { |
| | | // let _year = parseInt(moment().format('YYYY')) - _val |
| | | // _dateRange = [_year + '-01-01', _year + '-12-31'] |
| | | // } else if (_type === 'customized') { |
| | | // try { |
| | | // _val = JSON.parse(_val) |
| | | // } catch (e) { |
| | | // _val = [0, 0] |
| | | // } |
| | | // _dateRange = [moment().subtract(_val[0], 'days').format('YYYY-MM-DD'), |
| | | // moment().subtract(_val[1], 'days').format('YYYY-MM-DD')] |
| | | // } |
| | | |
| | | // item.initval = _dateRange.join(',') |
| | | // item.initType = _type |
| | | // } else { |
| | | // item.initval = '' |
| | | // item.initType = '' |
| | | // } |
| | | // } |
| | | |
| | | // item.oriInitval = item.initval |
| | | |
| | | // if (values) { |
| | | // item.initval = values[item.field] || '' |
| | | // } |
| | | |
| | | // if (item.blacklist && item.blacklist.length > 0 && !item.hidden) { |
| | | // if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { |
| | | // item.hidden = true |
| | | // item.required = false |
| | | // } |
| | | // } |
| | | |
| | | // if (item.required) { |
| | | // required = true |
| | | // } |
| | | |
| | | // if (item.type === 'text' || item.type === 'select') { |
| | | // if (/,/.test(item.field)) { |
| | | // item.field.split(',').forEach(field => { |
| | | // keys.push(field.toLowerCase()) |
| | | // }) |
| | | // } else { |
| | | // keys.push(item.field.toLowerCase()) |
| | | // } |
| | | // } else if (item.type === 'group') { |
| | | // keys.push(item.field.toLowerCase()) |
| | | // keys.push(item.datefield.toLowerCase()) |
| | | // } |
| | | |
| | | // return item |
| | | // }) |
| | | |
| | | // config.$s_keys = keys |
| | | // config.$s_req = required |
| | | // } |
| | | |
| | | |
| | | render() { |
| | | const { visible, confirming } = this.state |
| | | |
| | | return ( |
| | | <> |
| | | <Button className="mk-border-yellow" icon="bug" onClick={this.trigger}>调试</Button> |
| | | <Modal |
| | | title="SQL验证" |
| | | wrapClassName="debug-modal" |
| | | visible={visible} |
| | | width={600} |
| | | maskClosable={false} |
| | | onOk={this.submit} |
| | | onCancel={() => { this.setState({ visible: false })}} |
| | | confirmLoading={confirming} |
| | | destroyOnClose |
| | | > |
| | | </Modal> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default DebugSql |
New file |
| | |
| | | .replace-field-modal { |
| | | .ant-modal { |
| | | top: 70px; |
| | | } |
| | | .ant-modal-body { |
| | | min-height: 150px; |
| | | padding-top: 40px; |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import { is, fromJS } from 'immutable' |
| | | |
| | | import avatar from '@/assets/img/avatar.jpg' |
| | | import MainLogo from '@/assets/img/main-logo.png' |
| | |
| | | userName: sessionStorage.getItem('CloudUserName') |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | render () { |
| | | const { menuName } = this.props |
| | | |
| | | return ( |
| | | <header className="menu-header-container"> |
| | | <div className="header-logo"><img src={MainLogo} alt=""/></div> |
| | | <div className="header-setting"> |
| | | <img src={this.state.avatar} alt=""/> |
| | | <span> |
| | | <span className="username">{this.state.userName}</span> |
| | | </span> |
| | | </div> |
| | | <div className="menu-name">{menuName}</div> |
| | | <div className="header-setting"> |
| | | <img src={this.state.avatar} alt=""/> |
| | | <span> |
| | | <span className="username">{this.state.userName}</span> |
| | | </span> |
| | | </div> |
| | | </header> |
| | | ) |
| | | } |
| | |
| | | border-bottom: 1px solid #000; |
| | | |
| | | .header-logo { |
| | | float: left; |
| | | position: absolute; |
| | | width: 180px; |
| | | line-height: 48px; |
| | | text-align: center; |
| | |
| | | max-height: 40px; |
| | | } |
| | | } |
| | | .menu-name { |
| | | text-align: center; |
| | | color: #ffffff; |
| | | line-height: 45px; |
| | | font-size: 16px; |
| | | margin-left: 40px; |
| | | } |
| | | .header-setting { |
| | | float: right; |
| | | position: absolute; |
| | | right: 0px; |
| | | top: 0px; |
| | | line-height: 48px; |
| | | margin-right: 10px; |
| | | img { |
| | |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | } |
| | | } |
| | | |
| | | >.ant-menu { |
| | | float: left; |
| | | width: unset; |
| | | .ant-menu-item { |
| | | margin-bottom: 0; |
| | | float: left; |
| | | width: unset; |
| | | cursor: default; |
| | | .anticon-arrow-left { |
| | | height: 24px; |
| | | cursor: pointer; |
| | | } |
| | | .ant-btn { |
| | | color: #fff; |
| | | width: unset; |
| | | cursor: pointer; |
| | | height: 37px; |
| | | background: transparent; |
| | | border: 0; |
| | | .anticon-save { |
| | | margin-right: 0; |
| | | } |
| | | } |
| | | .ant-btn[ant-click-animating-without-extra-node="true"]::after { |
| | | display: none!important; |
| | | } |
| | | .ant-btn::before { |
| | | display: none!important; |
| | | } |
| | | } |
| | | .ant-menu-item.ant-menu-item-selected { |
| | | background-color: transparent; |
| | | } |
| | | .ant-menu-item:not(:last-child) { |
| | | border-right: 1px solid #353535; |
| | | } |
| | | } |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import moment from 'moment' |
| | | import { Button, Card, Modal, Collapse, notification, Switch, message } from 'antd' |
| | | import { SettingOutlined, CopyOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getModalForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import SourceElement from '@/templates/modalconfig/dragelement/source' |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | } |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: _config, |
| | |
| | | const { visible } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-view-paste" style={{display: 'inline-block'}}> |
| | | <> |
| | | <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={() => {this.setState({visible: true})}}><SnippetsOutlined />粘贴</Button> |
| | | <Modal |
| | | title="粘贴" |
| | |
| | | > |
| | | <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | |
| | | const { visible, editvisible, card, filpictures, filvideos, piclist, vidlist, imageKey, videoKey, pageSize, picIndex, vidIndex, colorlist, iconlist } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}}> |
| | | <> |
| | | <Button className="mk-border-purple" onClick={this.trigger}><PictureOutlined /> 资源管理</Button> |
| | | <Modal |
| | | wrapClassName="mk-pop-modal picture-control-model" |
| | |
| | | > |
| | | <EditForm card={card} wrappedComponentRef={(inst) => this.editFormRef = inst} inputSubmit={this.save}/> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | |
| | | const { visible, loadingTable, tables, confirming } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-replace-field" style={{display: 'inline-block'}}> |
| | | <> |
| | | <Button className="mk-border-yellow" icon="swap" loading={loadingTable} onClick={this.trigger}>字段替换</Button> |
| | | <Modal |
| | | title="字段替换" |
| | |
| | | > |
| | | <SettingForm tables={tables} wrappedComponentRef={(inst) => this.settingRef = inst}/> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | |
| | | const { visible, columns, interfaces } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-sys-interface" style={{display: 'inline-block'}}> |
| | | <> |
| | | <Button className="mk-border-danger" onClick={this.trigger}><DatabaseOutlined /> 公共数据源</Button> |
| | | <Modal |
| | | title="公共数据源" |
| | |
| | | <PlusOutlined key="add-interface" onClick={this.addInterface}/> |
| | | <EditTable key="manage-interface" actions={['copy']} type="interface" data={interfaces} columns={columns} onChange={this.changeScripts}/> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | |
| | | const { visible, loading, empty } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}}> |
| | | <> |
| | | <Button style={{borderColor: '#8E44AD', color: '#8E44AD'}} onClick={this.trigger}><ForkOutlined /> 表关系图</Button> |
| | | <Modal |
| | | title="" |
| | |
| | | <span className="tip">注:点击表名(右侧)可展开/收起菜单,左侧橙色标注为接口或函数名。</span> |
| | | </div> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | |
| | | const { visible, preconfirming, nextconfirming } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}}> |
| | | <> |
| | | <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={this.trigger}><CalendarOutlined /> 版本管理</Button> |
| | | <Modal |
| | | title="" |
| | |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false })}}>取消</Button> |
| | | </div> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import moment from 'moment' |
| | | import { Button, Modal, Collapse, notification, Switch, message } from 'antd' |
| | | import { LeftOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getModalForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import SourceElement from '@/templates/modalconfig/dragelement/source' |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | } |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: _config, |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import moment from 'moment' |
| | | import { Button, Modal, Collapse, notification, Switch } from 'antd' |
| | | import { SettingOutlined, LeftOutlined, SearchOutlined, PlusOutlined } from '@ant-design/icons' |
| | | |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: res.dataSource |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | let sql = res.dataSource |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | group: _group, |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.flow_code) { |
| | | regs.push({ reg: /@works_flow_code@/ig, value: config.flow_code }) |
| | | } |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName, config.process === 'true') |
| | | |
| | | let autoMatic = null |
| | |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props.data), fromJS(nextProps.data)) |
| | | return !is(fromJS(this.props), fromJS(nextProps)) |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.flow_code) { |
| | | regs.push({ reg: /@works_flow_code@/ig, value: config.flow_code }) |
| | | } |
| | | |
| | | config.$cache = config.cacheLocal === 'true' |
| | | config.$time = config.localCacheTime || 0 |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (Tab.$process && window.GLOB.UserCacheMap.has(Tab.$flowId)) { |
| | | let flow = window.GLOB.UserCacheMap.get(Tab.$flowId) |
| | | regs.push({ reg: /@works_flow_code@/ig, value: flow.flow_code || '' }) |
| | | } |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, Tab.uuid, Tab.uuid) |
| | | |
| | | // 获取主搜索条件 |
| | |
| | | } |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | |
| | | param.key_back_type = 'Y' |
| | | } |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | |
| | | param.key_back_type = 'Y' |
| | | } |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | param.key_back_type = 'Y' |
| | | } |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | |
| | | } |
| | | |
| | | if (retmsg) { |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns, primaryId, this.props.BID) |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns, this.props.BID) |
| | | } |
| | | |
| | | _params.push(param) |
| | |
| | | } |
| | | |
| | | if (retmsg) { |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns, primaryId, this.props.BID) |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns, this.props.BID) |
| | | } |
| | | |
| | | return param |
| | |
| | | /** |
| | | * @description 获取回调脚本的字段定义 |
| | | */ |
| | | getSysDeclareSql = (btn, formdata, data, columns, primaryId, BID = '') => { |
| | | getSysDeclareSql = (btn, formdata, data, columns, BID = '') => { |
| | | let datavars = {} // 声明的变量,表单及显示列 |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] |
| | |
| | | /* 显示列变量赋值 */ |
| | | select ${_initColfields.join(',')} |
| | | ` |
| | | } |
| | | |
| | | _sql = _sql.replace(/@ID@/ig, `'${primaryId || ''}'`) |
| | | _sql = _sql.replace(/@BID@/ig, `'${BID}'`) |
| | | _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _sql = _sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | _sql = _sql.replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | _sql = _sql.replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | return _sql |
| | |
| | | * @description 自定义请求循环执行 |
| | | */ |
| | | customLoopRequest = (params, _resolve) => { |
| | | const { setting, btn } = this.props |
| | | |
| | | let param = params.shift() |
| | | |
| | | this.setState({ |
| | |
| | | ID: param.ID || '', |
| | | callbacksql: param.$callbacksql || '', |
| | | mk_api_key: '' |
| | | } |
| | | |
| | | if (!record.ID && btn.Ot !== 'notRequired' && param[setting.primaryKey]) { |
| | | record.ID = param[setting.primaryKey] |
| | | } |
| | | |
| | | delete param.$callbacksql |
| | |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | |
| | | if (record.BID) { |
| | | param.BID = this.props.BID |
| | | param.BID = record.BID |
| | | } |
| | | if (record.ID) { |
| | | param.ID = record.ID |
| | |
| | | if (btn.output) { |
| | | _backCustomScript += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | |
| | | param.key_back_type = 'Y' |
| | | } else { |
| | | _backCustomScript += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | |
| | | sql = sql + _backCustomScript |
| | | |
| | | sql = sql.replace(/@ID@/ig, `'${record.ID || ''}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${this.props.BID || ''}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${record.BID || ''}'`) |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | |
| | | * @description 外部请求循环执行 |
| | | */ |
| | | outerLoopRequest = (params, _resolve) => { |
| | | if (!params && params.length === 0) return |
| | | const { setting, btn } = this.props |
| | | |
| | | let param = params.shift() |
| | | |
| | |
| | | callbacksql: param.$callbacksql || '' |
| | | } |
| | | |
| | | if (!record.ID && btn.Ot !== 'notRequired' && param[setting.primaryKey]) { |
| | | record.ID = param[setting.primaryKey] |
| | | } |
| | | |
| | | delete param.$callbacksql |
| | | |
| | | if (!param.func) { |
| | |
| | | sign = '' |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | const { config, BID } = this.props |
| | | |
| | | let _searchlist = [] |
| | | let fieldMap = new Map() |
| | |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | |
| | | _option.sql = _option.sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | |
| | | if (window.GLOB.debugger === true) { |
| | | console.info(_option.sql) |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import moment from 'moment' |
| | | import { Button, Card, Modal, Collapse, notification, Switch } from 'antd' |
| | | import { SettingOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getModalForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import SourceElement from './dragelement/source' |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | } |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: _config, |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | |
| | | } |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | |
| | | }) |
| | | } else { |
| | | this.setState({loading: true}) |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | Api.sDebug(sql).then(res => { |
| | | if (res.status || res.ErrCode === '-2') { |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | |
| | | _usefulFields.push(item.field) |
| | | _usefulFields.push(item.datefield) |
| | | _usefulFields.push(item.datefield + '1') |
| | | } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { |
| | | } else if (['dateweek', 'datemonth'].includes(item.type)) { |
| | | _usefulFields.push(item.field) |
| | | _usefulFields.push(item.field + '1') |
| | | } else if (item.type === 'daterange') { |
| | | let _skey = item.field |
| | | let _ekey = item.field + '1' |
| | | |
| | | if (/,/.test(item.field)) { |
| | | _skey = item.field.split(',')[0] |
| | | _ekey = item.field.split(',')[1] |
| | | } |
| | | _usefulFields.push(_skey) |
| | | _usefulFields.push(_ekey) |
| | | } else if (item.type === 'date' && _usefulFields.includes(item.field)) { |
| | | _usefulFields.push(item.field + '1') |
| | | } else { |
| | |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Spin, Typography, Popconfirm } from 'antd' |
| | | import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | |
| | | return |
| | | } |
| | | |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils, '2023-04-20 15:29:37') |
| | | let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils) |
| | | |
| | | let _debugId = md5(sql) |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: sql |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({debugId: _debugId}) |
| | | _resolve() |
| | | } else { |
| | |
| | | /** |
| | | * @description 生成页面查询语句 |
| | | */ |
| | | static getDebugSql (verify, scripts, searches, Utils, timestamp) { |
| | | static getDebugSql (verify, scripts, searches, Utils) { |
| | | let sql = '' |
| | | let _dataresource = verify.dataresource || '' |
| | | let regoptions = this.getRegOptions(searches) |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) |
| | | _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '') |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `/* sql 验证 */ |
| | | ${declare} |
| | | sql = `${declare} |
| | | ${_customScript} |
| | | ${_dataresource} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } else if (_tailScript) { |
| | | sql = `${declare} |
| | |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } else { |
| | | sql = `/* sql 验证 */ |
| | | ${declare} |
| | | sql = `${declare} |
| | | ${_dataresource}` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | sql = sql.replace(/\n/g, ' ') |
| | | |
| | | return sql |
| | | } |
| | |
| | | value: '0' |
| | | }) |
| | | options.push(item) |
| | | } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) { |
| | | } else if (['datemonth', 'dateweek'].includes(search.type)) { |
| | | options.push(item) |
| | | options.push({ |
| | | key: item.key + '1', |
| | | value: '0' |
| | | }) |
| | | } else if (search.type === 'daterange') { |
| | | let _skey = search.field |
| | | let _ekey = search.field + '1' |
| | | |
| | | if (/,/.test(search.field)) { |
| | | _skey = search.field.split(',')[0] |
| | | _ekey = search.field.split(',')[1] |
| | | } |
| | | |
| | | options.push({ |
| | | key: _skey, |
| | | value: '0' |
| | | }) |
| | | options.push({ |
| | | key: _ekey, |
| | | value: '0' |
| | | }) |
| | | } else if (search.type === 'text' || search.type === 'select') { |
| | | item.key.split(',').forEach(field => { |
| | | let cell = JSON.parse(JSON.stringify(item)) |
| | |
| | | sqlverify = (_resolve, _reject, scripts) => { |
| | | const { verify, declareSql, debugId } = this.state |
| | | |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let sql = SettingUtils.getDebugSql(verify.setting || {}, verify.columns, scripts, declareSql, '2023-04-20 15:29:37') |
| | | let sql = SettingUtils.getDebugSql(verify.setting || {}, verify.columns, scripts, declareSql) |
| | | |
| | | let _debugId = md5(sql) |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: sql |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({debugId: _debugId}) |
| | | _resolve() |
| | | } else { |
| | |
| | | |
| | | export default class SettingUtils { |
| | | static getDebugSql (setting, columns, scripts, declareSql, timestamp) { |
| | | static getDebugSql (setting, columns, scripts, declareSql) { |
| | | let sql = '' |
| | | let _dataresource = setting.dataresource || '' |
| | | |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) |
| | | _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '') |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | sql = `${_customScript} |
| | | ${_dataresource} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } else if (_tailScript) { |
| | | sql = `/* sql 验证 */ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | ${declareSql} |
| | | ${_dataresource} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } else { |
| | | sql = `/* sql 验证 */ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | ${declareSql} |
| | | ${_dataresource}` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | sql = sql.replace(/\n/g, ' ') |
| | | |
| | | return sql |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, notification, Switch } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getSearchForm } from '@/templates/zshare/formconfig' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: res.dataSource |
| | | } |
| | | let sql = res.dataSource |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').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) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | searchlist: _searchlist, |
| | |
| | | |
| | | if (type === 'text' || type === 'select') { |
| | | reTooltip.field = '字段名可以使用逗号分隔,进行综合搜索。' |
| | | } else if (type === 'daterange') { |
| | | reTooltip.field = '字段名可以使用逗号分隔,例如startTime,endTime。' |
| | | } else if (type === 'group') { |
| | | reTooltip.field = '查询数据时(自定义脚本或统计数据源),类型字段将用作替换脚本中的 @字段@ ,类型字段对应值为:日 -> day;周 -> week;月 -> month;季 -> quarter;年 -> year;自定义 -> customized' |
| | | reLabel.field = '类型字段' |
| | |
| | | ] |
| | | if (item.key === 'field' || item.key === 'datefield') { |
| | | rules.push({ |
| | | pattern: (type === 'text' || type === 'select') ? formRule.field.multipattern : formRule.field.pattern, |
| | | pattern: (type === 'text' || type === 'select' || type === 'daterange') ? formRule.field.multipattern : formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.props.card.uuid |
| | | |
| | | if (/,/.test(values.field)) { |
| | | values.field = values.field.split(',').filter(Boolean) |
| | | if (values.type === 'daterange' && values.field.length > 2) { |
| | | values.field.length = 2 |
| | | } |
| | | values.field = values.field.join(',') |
| | | } |
| | | |
| | | // 下拉菜单或联动菜单 |
| | | if (['multiselect', 'select', 'link', 'radio'].includes(values.type)) { |
| | | if (values.resourceType === '0') { |
| | |
| | | value: '0' |
| | | }) |
| | | options.push(item) |
| | | } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) { |
| | | } else if (['datemonth', 'dateweek'].includes(search.type)) { |
| | | options.push(item) |
| | | options.push({ |
| | | key: item.key + '1', |
| | | value: '0' |
| | | }) |
| | | } else if (search.type === 'daterange') { |
| | | let _skey = search.field |
| | | let _ekey = search.field + '1' |
| | | |
| | | if (/,/.test(search.field)) { |
| | | _skey = search.field.split(',')[0] |
| | | _ekey = search.field.split(',')[1] |
| | | } |
| | | |
| | | options.push({ |
| | | key: _skey, |
| | | value: '0' |
| | | }) |
| | | options.push({ |
| | | key: _ekey, |
| | | value: '0' |
| | | }) |
| | | } else if (search.type === 'text' || search.type === 'select') { |
| | |
| | | } else if (type === 'scripts' && _scripts.length === 0) { |
| | | _resolve() |
| | | } else { // type 为 submit 、 verify ,以及其他需要验证的场景 |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let r = SettingUtils.getDebugSql(setting, _scripts, arr_field, regoptions, search, timestamp) |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: r.sql |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | let r = SettingUtils.getDebugSql(setting, _scripts, arr_field, regoptions, search) |
| | | |
| | | if (r.errors) { |
| | | notification.warning({ |
| | |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | let sumParam = null |
| | | if (r.sumSql) { |
| | | sumParam = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: r.sumSql |
| | | } |
| | | sumParam.LText = Utils.formatOptions(sumParam.LText) |
| | | sumParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | sumParam.secretkey = Utils.encrypt('', sumParam.timestamp) |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | if (sumParam) { |
| | | Api.genericInterface(sumParam).then(res => { |
| | | if (res.status) { |
| | | _resolve() |
| | | } else { |
| | | _reject() |
| | | Modal.error({ |
| | | title: res.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | _resolve() |
| | | } |
| | | Api.sDebug(r.sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | _resolve() |
| | | } else { |
| | | _reject() |
| | | Modal.error({ |
| | |
| | | _scripts.push(values) |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: SettingUtils.getCustomDebugSql(_scripts, this.props.regoptions) |
| | | } |
| | | |
| | | 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) |
| | | let sql = SettingUtils.getCustomDebugSql(_scripts, this.props.regoptions) |
| | | sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({ |
| | | loading: false, |
| | | scripts: _scripts, |
| | |
| | | * @return {Object} setting 页面设置 |
| | | * @return {Array} regoptions 搜索条件正则替换 |
| | | */ |
| | | static getDebugSql (setting, scripts, arr_field, regoptions, search, timestamp) { |
| | | static getDebugSql (setting, scripts, arr_field, regoptions, search) { |
| | | let sql = '' |
| | | let _dataresource = setting.dataresource || '' |
| | | let _customScript = '' |
| | |
| | | }) |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`) |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'1949-10-01 15:00:00'`) |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | |
| | | }) |
| | | } |
| | | |
| | | let sumSql = '' |
| | | |
| | | if (arr_field && _dataresource && /\/\*\$sum@/ig.test(_dataresource)) { |
| | | let _sql = _dataresource.replace(/\/\*\$sum@|@sum\$\*\//ig, '') |
| | | _sql = `/*system_query*/${_sql} ${_search}` |
| | | if (_customScript) { |
| | | sumSql = `/* sql sum验证 */ |
| | | ${_customScript} |
| | | ${_sql} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' |
| | | ` |
| | | } else { |
| | | sumSql = `/* sql sum验证 */ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | ${_sql}` |
| | | } |
| | | } |
| | | |
| | | // 数据源处理, 存在显示列时 |
| | | if (arr_field && _dataresource) { |
| | | if (/\s/.test(_dataresource)) { |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | sql = `${_customScript} |
| | | ${_dataresource} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } else { |
| | | sql = `/* sql 验证 */ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | ${_dataresource}` |
| | | } |
| | | |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | |
| | | let errors = [] |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (sumSql) { |
| | | sumSql = sumSql.replace(/\n\s{10}/ig, '\n') |
| | | console.info(sumSql) |
| | | sumSql = sumSql.replace(/\n/g, ' ') |
| | | } |
| | | sql = sql.replace(/\n/g, ' ') |
| | | |
| | | return { sql, sumSql, errors: errors.join(';') } |
| | | return { sql, errors: errors.join(';') } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@userName@|@fullName@/ig, `''`) |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | // 正则替换 |
| | | if (regoptions) { |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | sql = `${_customScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | |
| | | return sql |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, notification, Modal, Spin, Tabs } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import SettingUtils from './utils.jsx' |
| | | import DataSource from './datasource' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | } else if (type === 'scripts' && _scripts.length === 0) { |
| | | _resolve() |
| | | } else { // type 为 submit 、 verify ,以及其他需要验证的场景 |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: SettingUtils.getDebugSql(setting, _scripts, timestamp) |
| | | } |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | let sql = SettingUtils.getDebugSql(setting, _scripts) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | Api.sDebug(sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | _resolve() |
| | | } else { |
| | | _reject() |
| | |
| | | * @return {String} scripts 自定义脚本 |
| | | * @return {Object} setting 页面设置 |
| | | */ |
| | | static getDebugSql (setting, scripts, timestamp) { |
| | | static getDebugSql (setting, scripts) { |
| | | let arr_field = `${setting.valueField},${setting.labelField},${setting.parentField}` |
| | | let sql = '' |
| | | let _dataresource = setting.dataresource || '' |
| | |
| | | }) |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`) |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | // 正则替换 |
| | | let _regoptions = [ |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | sql = `${_customScript} |
| | | ${_dataresource} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' |
| | | ` |
| | | } else { |
| | | sql = `/* sql 验证 */ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' |
| | | ${_dataresource}` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | |
| | | return sql |
| | | } |
| | |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'popClose', |
| | | label: '关闭后', |
| | | initVal: card.popClose || 'never', |
| | | initVal: card.popClose || 'grid', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | |
| | | checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'place', 'width', 'multiple', 'splitline', 'marginTop', 'marginBottom'], |
| | | multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'dropdown'], |
| | | link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkField', 'linkSubField', 'span', 'place', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'], |
| | | fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom', 'maxSize'], |
| | | fileupload: ['readonly', 'required', 'hidden', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom', 'maxSize'], |
| | | switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'linkSubField', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'], |
| | | check: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'checkTip'], |
| | | date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], |
| | |
| | | const { visible, actions, autoMatic } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}}> |
| | | <> |
| | | <Button className="mk-border-purple" onClick={this.trigger}><UserOutlined/> 无人值守</Button> |
| | | <Modal |
| | | title="无人值守" |
| | |
| | | > |
| | | <SettingForm actions={actions} autoMatic={autoMatic} wrappedComponentRef={(inst) => this.settingRef = inst}/> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | |
| | | } |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: this.props.initsql + _prevCustomScript + _backCustomScript + tail |
| | | } |
| | | let sql = this.props.initsql + _prevCustomScript + _backCustomScript + tail |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | param.LText = param.LText.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | |
| | | // 数据权限 |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | |
| | | // check |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'${param.timestamp}'`) |
| | | |
| | | console.info(`/* sql 验证 */\n${param.LText.replace(/\n\s{6,20}/ig, '\n')}`) |
| | | |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') |
| | | sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | |
| | | }) |
| | | } else { |
| | | this.setState({loading: true}) |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | Api.sDebug(sql).then(res => { |
| | | if (res.status || res.ErrCode === '-2') { |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Button, notification, Modal, Tooltip } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | } |
| | | |
| | | param.LText = `${this.props.initsql} |
| | | let sql = `${this.props.initsql} |
| | | /* 自定义验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select top 1 @tbid='X' from (${values.sql}) a |
| | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | param.LText = param.LText.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | |
| | | // 数据权限 |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | 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}'`) |
| | | |
| | | console.info(`/* sql 验证 */\n${param.LText.replace(/\n\s{10}/ig, '\n')}`) |
| | | |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | Api.sDebug(sql).then(res => { |
| | | if (res.status || res.ErrCode === '-2') { |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | |
| | | } |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: this.props.initsql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | } |
| | | let sql = this.props.initsql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | | let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') |
| | | param.LText = param.LText.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | } |
| | | |
| | | // 数据权限 |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | // check |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${param.timestamp}'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') |
| | | sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | if (window.GLOB.process && workFlow === 'true') { |
| | | param.LText = param.LText.replace(/@works_flow_code@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/@works_flow_name@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/@works_flow_param@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/@works_flow_detail_id@/ig, `'${param.timestamp}'`) |
| | | sql = sql.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@works_flow_name@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@works_flow_param@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@works_flow_detail_id@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@status@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@statusname@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@work_group@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@work_grade@/ig, `'1949-10-01 15:00:00'`) |
| | | } |
| | | |
| | | console.info(`/* sql 验证 */\n${param.LText.replace(/\n\s{6,20}/ig, '\n')}`) |
| | | |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | |
| | | }) |
| | | } else { |
| | | this.setState({loading: true}) |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | Api.sDebug(sql).then(res => { |
| | | if (res.status || res.ErrCode === '-2') { |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | |
| | | |
| | | if (value === 'flowSql') { |
| | | if (flowType === 'start') { |
| | | value = `insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) |
| | | select @ID@,@works_flow_code@,@works_flow_param@,'职员分组',@works_flow_detail_id@,'职员等级',@bid@,@UserID@,@UserName,@FullName |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,status,statuscharone,statuschartwo,StatusCharThree,StatusCharFour,StatusCharFive,statusname,remark,CreateUserID,CreateUser,CreateStaff,works_flow_detail_id,sort,upid,work_group,work_grade,typecharone,deleted,statusname_suc,statusname_back )` |
| | | value = `insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) |
| | | select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade) |
| | | select @works_flow_id@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@` |
| | | } else { |
| | | value = `insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) |
| | | select @ID@,@works_flow_code@,@works_flow_param@,'职员分组',@works_flow_detail_id@,'职员等级',@bid@,@UserID@,@UserName,@FullName` |
| | | value = `insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) |
| | | select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade) |
| | | select @works_flow_id@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@` |
| | | } |
| | | |
| | | value = value.replace(/\n\s{8}/g, '\n') |
| | |
| | | } |
| | | } |
| | | |
| | | newsearches[item.key] = _startval |
| | | newsearches[item.key + '1'] = _endval |
| | | let _skey = item.key |
| | | let _ekey = item.key + '1' |
| | | |
| | | if (/,/.test(item.key)) { |
| | | _skey = item.key.split(',')[0] |
| | | _ekey = item.key.split(',')[1] |
| | | } |
| | | |
| | | newsearches[_skey] = _startval |
| | | newsearches[_ekey] = _endval |
| | | } else if (item.type === 'text' || item.type === 'select') { |
| | | item.key.split(',').forEach(field => { // 综合搜索,所字段拼接 |
| | | newsearches[field] = item.value |
| | |
| | | _endval = val[1] + '.000' |
| | | } |
| | | |
| | | searchText.push('(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')') |
| | | let _skey = item.key |
| | | let _ekey = item.key |
| | | |
| | | if (/,/.test(item.key)) { |
| | | _skey = item.key.split(',')[0] |
| | | _ekey = item.key.split(',')[1] |
| | | } |
| | | |
| | | searchText.push('(' + _skey + ' >= \'' + _startval + '\' AND ' + _ekey + ' < \'' + _endval + '\')') |
| | | } else if (item.type === 'range') { |
| | | let val = item.value.split(',') |
| | | |
| | |
| | | sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | |
| | | return { |
| | |
| | | } |
| | | |
| | | columns.forEach(col => { |
| | | if (col.field === 'works_flow_param') return |
| | | |
| | | if (col.type === 'colspan' || col.type === 'old_colspan') { |
| | | col.subcols.forEach(cell => { |
| | | setField(cell) |
| | |
| | | ` |
| | | } |
| | | |
| | | if (btn.$process && verify.workFlow === 'true' && window.GLOB.UserCacheMap.has(btn.$flowId)) { |
| | | let flow = window.GLOB.UserCacheMap.get(btn.$flowId) |
| | | let node = null |
| | | let line = null |
| | | let target = null |
| | | let status = 0 |
| | | let statusName = '' |
| | | let detailId = '' |
| | | |
| | | if (verify.flowSql === 'true') { |
| | | if (verify.flowType === 'start') { |
| | | target = flow.cells.filter(cell => cell.mknode === 'start')[0] |
| | | |
| | | if (target) { |
| | | detailId = target.id |
| | | status = target.mkdata.status |
| | | statusName = target.mkdata.statusName |
| | | } |
| | | } else if (_data.works_flow_param) { |
| | | node = JSON.parse(window.decodeURIComponent(window.atob(_data.works_flow_param))) |
| | | |
| | | if (node) { |
| | | line = flow.cells.filter(cell => cell.shape === 'edge' && cell.source.cell === node.id)[0] |
| | | } |
| | | |
| | | if (line) { |
| | | target = flow.cells.filter(cell => cell.id === line.target.cell)[0] |
| | | } |
| | | } |
| | | |
| | | if (target) { |
| | | _sql += ` |
| | | /* 工作流默认sql */ |
| | | insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) |
| | | select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade) |
| | | select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@ |
| | | ` |
| | | } |
| | | } |
| | | |
| | | _sql = _sql.replace(/@works_flow_code@/ig, `'${flow.flow_code}'`) |
| | | _sql = _sql.replace(/@works_flow_name@/ig, `'${flow.flow_name}'`) |
| | | if (target) { |
| | | let msg = {...target.mkdata, id: target.id} |
| | | _sql = _sql.replace(/@works_flow_param@/ig, `'${window.btoa(window.encodeURIComponent(JSON.stringify(msg)))}'`) |
| | | } else { |
| | | _sql = _sql.replace(/@works_flow_param@/ig, `''`) |
| | | } |
| | | _sql = _sql.replace(/@works_flow_detail_id@/ig, `'${detailId}'`) |
| | | _sql = _sql.replace(/@status@/ig, `'${status}'`) |
| | | _sql = _sql.replace(/@statusname@/ig, `'${statusName}'`) |
| | | _sql = _sql.replace(/@work_group@/ig, `'${sessionStorage.getItem('work_group') || ''}'`) |
| | | _sql = _sql.replace(/@work_grade@/ig, `'${sessionStorage.getItem('work_grade') || 0}'`) |
| | | } |
| | | |
| | | if (_backCustomScript) { |
| | | _sql += _backCustomScript |
| | | } |
| | |
| | | _sql = _sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | _sql = _sql.replace(/@datam@/ig, '\'Y\'') |
| | | _sql = _sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, `'Y'`) |
| | | } else { |
| | | _sql = _sql.replace(/@datam@/ig, '\'\'') |
| | | _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) |
| | | } |
| | | |
| | | if (window.GLOB.debugger === true) { |
| | |
| | | } |
| | | |
| | | if (retmsg) { |
| | | _callbacksql = _callbacksql.replace(/@ID@/ig, `'${primaryId || ''}'`) |
| | | _callbacksql = _callbacksql.replace(/@BID@/ig, `'${BID}'`) |
| | | _callbacksql = _callbacksql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | _callbacksql = _callbacksql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | _callbacksql = _callbacksql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _callbacksql = _callbacksql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _callbacksql = _callbacksql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | _callbacksql = _callbacksql.replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | _callbacksql = _callbacksql.replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | return { |
| | | sql: _sql, |
| | | callbacksql: _callbacksql |
| | |
| | | const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) |
| | | const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) |
| | | const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | // const Debug = asyncComponent(() => import('@/menu/debug')) |
| | | const NormalCss = asyncComponent(() => import('@/menu/normalCss')) |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const TableNodes = asyncComponent(() => import('@/menu/tablenodes')) |
| | |
| | | |
| | | return ( |
| | | <ConfigProvider locale={_locale}> |
| | | <Header /> |
| | | <Header menuName={config ? config.MenuName : ''}/> |
| | | <DndProvider backend={HTML5Backend}> |
| | | {view !== 'popview' ? <div className={'pc-menu-view ' + (MenuType || '')}> |
| | | <div className="menu-body"> |
| | |
| | | </Collapse> |
| | | </div> |
| | | <div className={'menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}> |
| | | <Card title={config ? config.MenuName : ''} bordered={false} extra={ |
| | | <Card bordered={false} extra={ |
| | | <div className="mk-opeartion-list"> |
| | | {/* <Debug config={config}/> */} |
| | | <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 组件名</Button> |
| | | <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> |
| | | <TableNodes config={config} /> |
| | |
| | | button { |
| | | margin-left: 10px; |
| | | } |
| | | >div >div >button, .style-control-button { |
| | | padding: 0px 7px; |
| | | .mk-opeartion-list button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) { |
| | | padding: 0px 10px; |
| | | } |
| | | .ant-switch.big { |
| | | min-width: 60px; |
| | |
| | | } |
| | | } |
| | | .menu-control { |
| | | .back-view, .mk-view-paste, .quote-wrap, .mk-sys-interface, .set-home, .set-login, .mk-replace-field { |
| | | .quote-wrap, .set-home, .set-login { |
| | | display: none!important; |
| | | } |
| | | } |
| | |
| | | const BgController = asyncComponent(() => import('@/pc/bgcontroller')) |
| | | const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) |
| | | const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | // const Debug = asyncComponent(() => import('@/menu/debug')) |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const Transfer = asyncComponent(() => import('@/menu/transfer')) |
| | | const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) |
| | |
| | | |
| | | return ( |
| | | <ConfigProvider locale={_locale}> |
| | | <Header /> |
| | | <Header menuName={config ? config.MenuName : ''}/> |
| | | <DndProvider backend={HTML5Backend}> |
| | | {view !== 'popview' ? <div className="pc-table-view"> |
| | | <div className="menu-body"> |
| | |
| | | </Collapse> |
| | | </div> |
| | | <div className={'menu-view' + (menuloading ? ' saving' : '')}> |
| | | <Card title={ |
| | | <div style={{paddingLeft: '15px'}}> {config && config.MenuName} </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <Card bordered={false} extra={ |
| | | <div className="mk-opeartion-list"> |
| | | {/* {config ? <Debug config={config}/> : null} */} |
| | | {config ? <Transfer config={config}/> : null} |
| | | {config ? <Unattended config={config} updateConfig={this.updateConfig}/> : null} |
| | | <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> |
| | |
| | | button { |
| | | margin-left: 15px; |
| | | } |
| | | >div >div >button, .style-control-button { |
| | | padding: 0px 7px; |
| | | .mk-opeartion-list button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) { |
| | | padding: 0px 10px; |
| | | } |
| | | .ant-switch.big { |
| | | min-width: 60px; |