| | |
| | | param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || '' |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | | if (param.$backend) { |
| | | delete param.$backend |
| | | |
| | | let id = '' |
| | | if (cache) { |
| | | id = param.data[0].id |
| | | |
| | | if (window.GLOB.CacheMap.has(id)) { |
| | | return Promise.resolve(window.GLOB.CacheMap.get(id)) |
| | | } |
| | | } |
| | | |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | param.s_debug = window.GLOB.debugger ? 'Y' : '' |
| | | param.data_md5 = param.data_md5 || '' |
| | | param.time_limit = param.time_limit || 0 |
| | | |
| | | let url = '/webapi/exstars' |
| | | if (param.rduri) { |
| | | param.rduri = param.rduri.replace(/dostars/ig, 'exstars') |
| | | if (!window.GLOB.transfer) { |
| | | url = param.rduri |
| | | delete param.rduri |
| | | } |
| | | } |
| | | |
| | | param = this.encryptParam(param) |
| | | |
| | | return new Promise((resolve) => { |
| | | axios({ |
| | | url: url, |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | if (res.mksqls) { |
| | | res.mksqls.forEach(n => { |
| | | n = n.replace(/(UNION ALL\s+)?SELECT obj_name='[\S\s]+sub_field=''\s+/ig, '') |
| | | window.mkInfo(n) |
| | | }) |
| | | } |
| | | if (res.ErrCode === 'version_error') { |
| | | res.ErrCode = '-2' |
| | | MKEmitter.emit('reloadTabs') |
| | | } |
| | | if (res.status) { |
| | | window.GLOB.CacheMap.set(id, res) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | let url = '/webapi/dostars' |
| | | if (param.rduri && !window.GLOB.transfer) { |
| | | url = param.rduri |
| | |
| | | } |
| | | }) |
| | | }) |
| | | } else if (param.$backend) { |
| | | delete param.$backend |
| | | |
| | | let url = '/webapi/exstars' |
| | | if (param.rduri) { |
| | | param.rduri = param.rduri.replace(/dostars/ig, 'exstars') |
| | | if (!window.GLOB.transfer) { |
| | | url = param.rduri |
| | | delete param.rduri |
| | | } |
| | | } |
| | | |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | param.s_debug = window.GLOB.debugger ? 'Y' : '' |
| | | param.data_md5 = param.data_md5 || '' |
| | | param.time_limit = param.time_limit || 0 |
| | | |
| | | param = this.encryptParam(param) |
| | | |
| | | return new Promise((resolve) => { |
| | | axios({ |
| | | url: url, |
| | | method: 'post', |
| | | data: JSON.stringify(param), |
| | | requestId |
| | | }).then(res => { |
| | | if (res.mksqls) { |
| | | res.mksqls.forEach(n => { |
| | | n = n.replace(/(UNION ALL\s+)?SELECT obj_name='[\S\s]+sub_field=''\s+/ig, '') |
| | | window.mkInfo(n) |
| | | }) |
| | | } |
| | | if (res.ErrCode === 'version_error') { |
| | | res.ErrCode = '-2' |
| | | MKEmitter.emit('reloadTabs') |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | } else { |
| | | let url = '/webapi/dostars' |
| | | if (param.rduri && (!window.GLOB.transfer || /https:\/\/sso.mk9h.cn/.test(param.rduri)) && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') { |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('modifyTabs', this.modifyTabs) |
| | | if (window.GLOB.forcedUpdate) { |
| | | MKEmitter.addListener('reloadTabs', this.reloadTabs) |
| | | } |
| | | MKEmitter.addListener('reloadTabs', this.reloadTabs) |
| | | } |
| | | |
| | | /** |
| | |
| | | reloadTabs = () => { |
| | | if (this.reloading) return |
| | | |
| | | this.reloading = true |
| | | let time = new Date().getTime() |
| | | |
| | | let oldTime = sessionStorage.getItem('mk_reloadTabs') |
| | | |
| | | if (oldTime && time - oldTime < 180000) return |
| | | |
| | | sessionStorage.setItem('mk_reloadTabs', time) |
| | | |
| | | this.reloading = true |
| | | this.setState({visible: true}) |
| | | |
| | | Api.getAppVersion(true).then((list) => { |
| | |
| | | MKEmitter.emit('modifyTabs', menu) |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: menu.MenuID, name: '菜单'}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: menu.MenuID, name: '菜单'}) |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } catch (e) { |
| | | // 通过sql语句添加字段集 |
| | | if (/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int)/ig.test(config)) { |
| | | if (/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int|datetime|date)/ig.test(config)) { |
| | | _config = { |
| | | key: 'datasourcefield', |
| | | type: 'array', |
| | | data: [] |
| | | } |
| | | |
| | | let list = config.match(/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int)/ig) |
| | | let list = config.match(/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int|datetime|date)/ig) |
| | | |
| | | list.forEach(item => { |
| | | _config.data.unshift({ |
| | |
| | | MKEmitter.emit('modifyTabs', menu) |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: menu.MenuID, name: '菜单'}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: menu.MenuID, name: '菜单'}) |
| | | // } |
| | | } |
| | | |
| | | onOpenChange = openKeys => { |
| | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('modifyTabs', this.modifyTabs) |
| | | MKEmitter.addListener('closeTabView', this.closeTabView) |
| | | |
| | | if (window.GLOB.forcedUpdate) { |
| | | MKEmitter.addListener('reloadTabs', this.reloadTabs) |
| | | } |
| | | MKEmitter.addListener('reloadTabs', this.reloadTabs) |
| | | } |
| | | |
| | | /** |
| | |
| | | reloadTabs = () => { |
| | | if (this.reloading) return |
| | | |
| | | this.reloading = true |
| | | let time = new Date().getTime() |
| | | |
| | | let oldTime = sessionStorage.getItem('mk_reloadTabs') |
| | | |
| | | if (oldTime && time - oldTime < 180000) return |
| | | |
| | | sessionStorage.setItem('mk_reloadTabs', time) |
| | | |
| | | this.reloading = true |
| | | |
| | | this.setState({visible: true}) |
| | | |
| | | Api.getAppVersion(true).then((list) => { |
| | |
| | | } |
| | | |
| | | if (/#\/hs$/.test(window.location.href)) { // hs下不打印脚本 |
| | | config.systemRun = '' // hs 不使用后端替换 |
| | | GLOB.debugger = false |
| | | |
| | | if (GLOB.mainSystemApi) { |
| | |
| | | } |
| | | |
| | | if (config.systemRun === 'backend') { |
| | | GLOB.debugger = false |
| | | Object.defineProperty(window, 'backend', { |
| | | writable: false, |
| | | value: true |
| | |
| | | let _card = { |
| | | uuid: card.uuid, |
| | | type: card.type, |
| | | format: 'object', // 组件属性 - 数据格式 |
| | | format: 'array', // 组件属性 - 数据格式 |
| | | pageable: false, // 组件属性 - 是否可分页 |
| | | switchable: false, // 组件属性 - 数据是否可切换 |
| | | width: card.width || 24, |
| | |
| | | } else { |
| | | let _card = fromJS(card).toJS() |
| | | |
| | | _card.format = 'array' |
| | | if (_card.wrap.firstTr === 'light') { |
| | | _card.wrap.tbStyle = 'th-light' |
| | | delete _card.wrap.firstTr |
| | |
| | | </Col> : null} |
| | | {!type ? <Col span={8}> |
| | | <Form.Item label="报错字段" style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | errorcode(增加后缀NT表示数据不回滚,如ENT、NNT、FNT、NMNT、CNT、-2NT), retmsg |
| | | errorcode, retmsg |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!type ? <Col span={24} className="sqlfield"> |
| | |
| | | <Row gutter={24}> |
| | | {!type ? <Col span={8}> |
| | | <Form.Item label={'报错字段'} style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | errorcode(增加后缀NT表示数据不回滚,如ENT、NNT、FNT、NMNT、CNT、-2NT), retmsg |
| | | errorcode, retmsg |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!type ? <Col span={24} className="sqlfield"> |
| | |
| | | </Col> : null} |
| | | {!type ? <Col span={10}> |
| | | <Form.Item label="报错字段" style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | errorcode(增加后缀NT表示数据不回滚,如ENT、NNT、FNT、NMNT), retmsg |
| | | errorcode, retmsg |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!type ? <Col span={24} className="sqlfield"> |
| | |
| | | {/* 1、不分页且不存在上级模块 */} |
| | | {!['navbar', 'interface', 'calendar'].includes(config.type) && !['editable', 'basetable', 'dualdatacard', 'invoice', 'invTable'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') && setting.interType === 'system' && setting.onload !== 'false' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'初始化加载时,是否与其他组件一同加载数据,注:如菜单未使用后端缓存,则查询语句大于8000字符时无效。'}> |
| | | <Tooltip placement="topLeft" title={'初始化加载时,是否与其他组件一同加载数据。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 同步查询 |
| | | </Tooltip> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {window.backend && setting.interType === 'system' ? <Col span={8}> |
| | | <Form.Item label="事务"> |
| | | {getFieldDecorator('transact', { |
| | | initialValue: setting.transact || 'false' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'transact')}}> |
| | | <Radio value="true">启用</Radio> |
| | | <Radio value="false">禁用</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.type === 'interface' && ((setting.supModule && setting.supModule[0] === 'empty') || MenuType === 'billPrint') ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="初始化加载将在页面加载前执行。"> |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Spin, Row, Col } from 'antd' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | |
| | | window.GLOB.CacheData.set(MenuID, urlparam) |
| | | |
| | | // if (window.backend && config.allSqls) { |
| | | // let keys = Object.keys(urlparam) |
| | | // config.allSqls.forEach(item => { |
| | | // if (item.type === 'datasource') { |
| | | // item.urlkeys = keys |
| | | // item.urlparam = urlparam |
| | | // if (config.flow_code) { |
| | | // item.works_flow_code = config.flow_code |
| | | // } |
| | | // } |
| | | // window.GLOB.CacheData.set('sql_' + item.uuid, item) |
| | | // }) |
| | | // } |
| | | if (window.backend && config.allSqls) { |
| | | let keys = Object.keys(urlparam) |
| | | config.allSqls.forEach(item => { |
| | | item.id = md5(window.GLOB.appkey + item.v_id) |
| | | if (item.type === 'datasource' || item.type === 'excelOut') { |
| | | item.urlkeys = keys |
| | | item.urlparam = urlparam |
| | | if (config.flow_code) { |
| | | item.works_flow_code = config.flow_code |
| | | } |
| | | } |
| | | window.GLOB.CacheData.set('sql_' + item.uuid, item) |
| | | }) |
| | | } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | |
| | | BID: '', // 上级ID |
| | | config: null, // 图表配置信息 |
| | | loading: false, // 数据加载状态 |
| | | data: {} // 数据 |
| | | data: [] // 数据 |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | |
| | | let _config = fromJS(config).toJS() |
| | | let _data = { $$empty: true } |
| | | let _data = [] |
| | | |
| | | let BID = '' |
| | | let BData = '' |
| | |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | _data = _data[0] || {$$empty: true} |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.has(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | if (_data.$$empty) { |
| | | _data = [] |
| | | } else { |
| | | _data = [_data] |
| | | } |
| | | } |
| | | |
| | | if (_config.wrap.minHeight) { |
| | |
| | | if (config.$syncId !== syncId) return |
| | | |
| | | let _data = window.GLOB.SyncData.get(config.dataName) || [] |
| | | _data = _data[0] || {$$empty: true} |
| | | |
| | | this.setState({data: _data}) |
| | | |
| | |
| | | |
| | | if (config.wrap.datatype === 'public' && config.wrap.publicId === publicId) { |
| | | let _data = fromJS(data).toJS() |
| | | if (_data.$$empty) { |
| | | _data = [] |
| | | } else { |
| | | _data = [_data] |
| | | } |
| | | |
| | | this.setState({data: _data}) |
| | | } |
| | |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | data: {$$empty: true}, |
| | | data: [], |
| | | loading: false |
| | | }) |
| | | return |
| | | } else if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: {$$empty: true}, |
| | | data: [], |
| | | loading: false |
| | | }) |
| | | return |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let _data = result.data || [] |
| | | _data = _data[0] || {$$empty: true} |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | | data: result.data || [], |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | render() { |
| | | const { config, loading, data } = this.state |
| | | |
| | | if (config.wrap.empty === 'hidden' && (!data || data.$$empty)) return null |
| | | if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null |
| | | |
| | | return ( |
| | | <div className={'custom-braft-editor-box ' + (config.wrap.tbStyle || '')} id={'anchor' + config.uuid} style={config.style}> |
| | |
| | | </div> : null |
| | | } |
| | | <NormalHeader config={config}/> |
| | | <BraftContent |
| | | value={config.wrap.datatype !== 'static' ? (data[config.wrap.field] || '') : config.html} |
| | | encryption={config.wrap.datatype !== 'static' ? config.wrap.encryption : 'false'} |
| | | /> |
| | | {config.wrap.datatype === 'static' ? <BraftContent |
| | | value={config.html} |
| | | encryption={'false'} |
| | | /> : data.map((item, index) => <BraftContent |
| | | key={index} |
| | | value={item[config.wrap.field] || ''} |
| | | encryption={config.wrap.encryption} |
| | | />)} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | if (Array.isArray(val)) { |
| | | val.forEach(item => { |
| | | if (typeof(item) !== 'object' || Array.isArray(item)) return |
| | | if (Object.keys(item).length > 0) { |
| | | item.$$key = tb + '_' + key |
| | | subObjs.push(item) |
| | | } |
| | | if (Object.keys(item).length === 0) return |
| | | |
| | | Object.keys(item).forEach(k => { |
| | | if (item[k] === null) { |
| | | item[k] = '' |
| | | } |
| | | }) |
| | | item.$$key = tb + '_' + key |
| | | subObjs.push(item) |
| | | }) |
| | | } else if (Object.keys(val).length > 0) { |
| | | val.$$key = tb + '_' + key |
| | |
| | | UNSAFE_componentWillMount () { |
| | | let _config = fromJS(this.props.config).toJS() |
| | | |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(_config.$pageId) |
| | | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let params = [] |
| | | if (_config.type !== 'group') { |
| | | _config.components = this.formatSetting(_config.components, params) |
| | | _config.components = this.formatSetting(_config.components, params, BID) |
| | | } else { |
| | | let delay = 110 |
| | | _config.components.forEach(item => { |
| | |
| | | config: _config |
| | | }, () => { |
| | | if (params.length > 0) { |
| | | this.loadmaindata(params) |
| | | this.loadmaindata(params, BID) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | formatSetting = (components, params) => { |
| | | formatSetting = (components, params, BID) => { |
| | | let delay = 110 |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') return item |
| | | if (item.type === 'group') { |
| | | item.components = this.formatSetting(item.components, params) |
| | | item.components = this.formatSetting(item.components, params, BID) |
| | | return item |
| | | } |
| | | |
| | |
| | | item.setting.sync = 'false' |
| | | item.setting.onload = 'false' |
| | | } else { |
| | | params.push(getStructDefaultParam(item, searchlist, params.length === 0)) |
| | | let backend = false |
| | | if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + item.uuid)) { |
| | | backend = true |
| | | } else if (window.backend && params[0] && params[0].exps) { |
| | | backend = true |
| | | } |
| | | |
| | | if (backend && !window.GLOB.CacheData.has('sql_' + item.uuid)) { |
| | | item.setting.sync = 'false' |
| | | } else { |
| | | params.push(getStructDefaultParam(item, searchlist, params.length === 0, BID)) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | loadmaindata = (params, BID) => { |
| | | const { config } = this.state |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(config.$pageId) |
| | | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let param = getStructuredParams(params, config, BID) |
| | | |
| | | if (config.$cache && config.$time) { |
| | | Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => { |
| | | Api.getLCacheConfig(params[0].uuid || params[0].id, config.$time, BID).then(res => { |
| | | if (!res.valid) { |
| | | this.getMainData(param, params, config.uuid) |
| | | } |
| | |
| | | } |
| | | |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | let _data = result[item.dataName] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | window.GLOB.SyncData.set(item.name, _data) |
| | | window.GLOB.SyncData.set(item.dataName, _data) |
| | | }) |
| | | |
| | | MKEmitter.emit('transferSyncData', tabId) |
| | |
| | | deForms: hasBid ? deForms : null |
| | | }, () => { |
| | | if (deForms.length > 0 && (!hasBid || BID)) { |
| | | this.improveActionForm(deForms, BID) |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + deForms[0].uuid)) { |
| | | this.improveBackActionForm(deForms, BID) |
| | | } else { |
| | | this.improveActionForm(deForms, BID) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | |
| | | const { deForms } = this.state |
| | | |
| | | if (deForms && nextProps.BID !== BID) { |
| | | this.improveActionForm(deForms, nextProps.BID) |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + deForms[0].uuid)) { |
| | | this.improveBackActionForm(deForms, nextProps.BID) |
| | | } else { |
| | | this.improveActionForm(deForms, nextProps.BID) |
| | | } |
| | | } |
| | | if (parCtrl && !is(fromJS(this.props.columns), fromJS(nextProps.columns))) { |
| | | let getColumns = (cols, sk) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | improveBackActionForm = (deForms, BID) => { |
| | | let sysvals = { |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | bid: BID || '', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | sysvals.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let deffers = [] |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | |
| | | deForms.forEach(item => { |
| | | let ex = window.GLOB.CacheData.get('sql_' + item.uuid) |
| | | |
| | | if (!ex) return |
| | | |
| | | let exps = [] |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (sysvals.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: sysvals[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let cell = { |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: item.label + '(表单)', |
| | | md5_id: '' |
| | | } |
| | | |
| | | if (item.database === 'sso' && window.GLOB.mainSystemApi) { |
| | | mainItems.push(cell) |
| | | } else { |
| | | localItems.push(cell) |
| | | } |
| | | }) |
| | | |
| | | if (localItems.length) { |
| | | deffers.push({ |
| | | $backend: true, |
| | | data: localItems |
| | | }) |
| | | } |
| | | |
| | | if (mainItems.length) { |
| | | deffers.push({ |
| | | $backend: true, |
| | | data: mainItems, |
| | | rduri: window.GLOB.mainSystemApi |
| | | }) |
| | | } |
| | | |
| | | if (!deffers.length) return |
| | | |
| | | deffers = deffers.map(item => { |
| | | return new Promise(resolve => { |
| | | Api.getSystemCacheConfig(item, false).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {...response[0], ...(response[1] || {})} |
| | | |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | this.resetFormList(result) |
| | | }) |
| | | } |
| | | |
| | | resetFormList = (result) => { |
| | | const { columns, edData } = this.state |
| | | |
| | |
| | | |
| | | if (!data) return |
| | | |
| | | let result = getEditTableSql(submit, data, forms) |
| | | |
| | | let param = { |
| | | excel_in: result.lines, |
| | | BID: BID || '' |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | if (submit.intertype === 'system') { // 系统存储过程 |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | |
| | | delete param.excel_in |
| | | if (submit.intertype === 'system' && window.backend && window.GLOB.CacheData.has('sql_' + submit.$menuId)) { |
| | | let ex = window.GLOB.CacheData.get('sql_' + submit.$menuId) |
| | | let param = this.getExps(ex, submit, data, forms) |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res, record) |
| | | } else { |
| | | this.execError(res, record) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | |
| | | this.execError({}) |
| | | }) |
| | | } else if (submit.intertype === 'system') { // 系统存储过程 |
| | | let result = getEditTableSql(submit, data, forms) |
| | | let param = {} |
| | | |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | param.BID = BID || '' |
| | | |
| | | param.exec_type = window.GLOB.execType || 'y' |
| | | param.LText = Utils.formatOptions(result.sql, param.exec_type) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | this.execError({}) |
| | | }) |
| | | } else if (submit.intertype === 'inner' && submit.innerFunc) { // 自定义存储过程 |
| | | let result = getEditTableSql(submit, data, forms) |
| | | let param = {} |
| | | |
| | | param.func = submit.innerFunc |
| | | param.BID = BID || '' |
| | | param.excel_in = result.lines |
| | | |
| | | if (submit.recordUser === 'true') { |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | |
| | | } |
| | | } |
| | | |
| | | getExps = (ex, btn, data, forms) => { |
| | | const { BID } = this.props |
| | | |
| | | let exps = [] |
| | | let values = { |
| | | time_id: Utils.getguid(), |
| | | roleid: sessionStorage.getItem('role_id') || '', |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | mk_nation: sessionStorage.getItem('nation') || '', |
| | | mk_province: sessionStorage.getItem('province') || '', |
| | | mk_city: sessionStorage.getItem('city') || '', |
| | | mk_district: sessionStorage.getItem('district') || '', |
| | | mk_address: sessionStorage.getItem('address') || '', |
| | | bid: BID || '', |
| | | typename: 'admin', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | } |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | values.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let lines = data.map(item => { |
| | | let vals = [] |
| | | forms.forEach(col => { |
| | | vals.push(item[col.field]) |
| | | }) |
| | | |
| | | vals.push(item.$$uuid) |
| | | vals.push(item.$type || 'upt') |
| | | vals.push(BID) |
| | | |
| | | return vals |
| | | }) |
| | | |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (values.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | exps.push({ |
| | | key: 'mk_excel_data', |
| | | value: lines |
| | | }) |
| | | |
| | | let md5_id = '' |
| | | if (window.GLOB.probation) { |
| | | md5_id = md5(ex.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000)) |
| | | md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18) |
| | | } |
| | | |
| | | return { |
| | | $backend: true, |
| | | data: [{ |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: btn.logLabel || '', |
| | | md5_id: md5_id |
| | | }] |
| | | } |
| | | } |
| | | |
| | | execSuccess = (res, record) => { |
| | | const { submit } = this.props |
| | | const { edData, dict } = this.state |
| | |
| | | loading: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | exec_type: window.GLOB.execType || 'y', |
| | | arr_field: config.arr_field, |
| | | default_sql: 'true', |
| | | custom_script: '', |
| | | menuname: config.label |
| | | } |
| | | let param = null |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + config.uuid)) { |
| | | let ex = window.GLOB.CacheData.get('sql_' + config.uuid) |
| | | let sysvals = { |
| | | time_id: Utils.getguid(), |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | id: ID || '', |
| | | bid: BID || '', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | orderby: orderBy || config.order || '', |
| | | pagesize: config.laypage === 'true' ? pageSize : '9999', |
| | | pageindex: pageIndex |
| | | } |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | sysvals.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let sql = '' |
| | | let DateCount = '' |
| | | let _search = '' |
| | | let _orderBy = orderBy || config.order || '' |
| | | let _datasource = config.dataSource |
| | | let exps = [] |
| | | |
| | | if (config.searchKey && searchKey) { |
| | | let fields = config.searchKey.split(',').map(field => field + ` like '%${searchKey}%'`) |
| | | _search = 'where ' + fields.join(' OR ') |
| | | } |
| | | if (config.searchKey) { |
| | | if (!searchKey) { |
| | | exps.push({ |
| | | key: 'mk_search', |
| | | value: [] |
| | | }) |
| | | } else { |
| | | exps.push({ |
| | | key: 'mk_search', |
| | | value: [{ |
| | | key: config.searchKey, |
| | | match: '01', |
| | | type: /,/.test(config.searchKey) ? 'text_or' : 'text', |
| | | value: searchKey |
| | | }] |
| | | }) |
| | | } |
| | | config.searchKey.split(',').forEach(key => { |
| | | sysvals[key.toLowerCase()] = searchKey || '' |
| | | }) |
| | | } |
| | | |
| | | _datasource = _datasource.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _datasource = _datasource.replace(/@ID@/ig, `'${ID || ''}'`) |
| | | |
| | | if (config.laypage === 'true') { |
| | | sql = `/*system_query*/select top ${pageSize} ${config.arr_field} from (select ${config.arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` |
| | | DateCount = `/*system_query*/select count(1) as total from ${_datasource} ${_search}` |
| | | } else if (_orderBy) { |
| | | sql = `/*system_query*/select ${config.arr_field} from (select ${config.arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else { |
| | | sql = `/*system_query*/select ${config.arr_field} from ${_datasource} ${_search} ` |
| | | } |
| | | |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (sysvals.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: sysvals[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | Select @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}' |
| | | ${sql}` |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true) { |
| | | window.mkInfo(`/*${config.label} 数据源*/\n` + sql.replace(/\n\s{6}/ig, '\n')) |
| | | DateCount && window.mkInfo(`/*${config.label} 总数查询*/\n` + DateCount.replace(/\n\s{6}/ig, '\n')) |
| | | param = { |
| | | $backend: true, |
| | | data: [{ |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: '', |
| | | md5_id: '' |
| | | }] |
| | | } |
| | | } else { |
| | | param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | exec_type: window.GLOB.execType || 'y', |
| | | arr_field: config.arr_field, |
| | | default_sql: 'true', |
| | | custom_script: '', |
| | | menuname: config.label |
| | | } |
| | | |
| | | let sql = '' |
| | | let DateCount = '' |
| | | let _search = '' |
| | | let _orderBy = orderBy || config.order || '' |
| | | let _datasource = config.dataSource |
| | | |
| | | if (config.searchKey && searchKey) { |
| | | let fields = config.searchKey.split(',').map(field => field + ` like '%${searchKey}%'`) |
| | | _search = 'where ' + fields.join(' OR ') |
| | | } |
| | | |
| | | _datasource = _datasource.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _datasource = _datasource.replace(/@ID@/ig, `'${ID || ''}'`) |
| | | |
| | | if (config.laypage === 'true') { |
| | | sql = `/*system_query*/select top ${pageSize} ${config.arr_field} from (select ${config.arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` |
| | | DateCount = `/*system_query*/select count(1) as total from ${_datasource} ${_search}` |
| | | } else if (_orderBy) { |
| | | sql = `/*system_query*/select ${config.arr_field} from (select ${config.arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else { |
| | | sql = `/*system_query*/select ${config.arr_field} from ${_datasource} ${_search} ` |
| | | } |
| | | |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | |
| | | sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | Select @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}' |
| | | ${sql}` |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true) { |
| | | window.mkInfo(`/*${config.label} 数据源*/\n` + sql.replace(/\n\s{6}/ig, '\n')) |
| | | DateCount && window.mkInfo(`/*${config.label} 总数查询*/\n` + DateCount.replace(/\n\s{6}/ig, '\n')) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(sql, param.exec_type) |
| | | param.DateCount = Utils.formatOptions(DateCount, param.exec_type) |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(sql, param.exec_type) |
| | | param.DateCount = Utils.formatOptions(DateCount, param.exec_type) |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | |
| | | Api.getSystemCacheConfig(param, config.cache === 'true').then(result => { |
| | | if (result.status) { |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Spin, Row, Col, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | |
| | | window.GLOB.CacheData.set(MenuID, urlparam) |
| | | |
| | | if (window.backend && config.allSqls) { |
| | | let keys = Object.keys(urlparam) |
| | | config.allSqls.forEach(item => { |
| | | item.id = md5(window.GLOB.appkey + item.v_id) |
| | | if (item.type === 'datasource' || item.type === 'excelOut') { |
| | | item.urlkeys = keys |
| | | item.urlparam = urlparam |
| | | if (config.flow_code) { |
| | | item.works_flow_code = config.flow_code |
| | | } |
| | | } |
| | | window.GLOB.CacheData.set('sql_' + item.uuid, item) |
| | | }) |
| | | } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | |
| | |
| | | } |
| | | }) |
| | | |
| | | config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap) |
| | | config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap, BID) |
| | | |
| | | if (initInters.length > 0) { |
| | | this.stepInter = { |
| | |
| | | |
| | | if (item.hasExtend) { |
| | | item.setting.hasExtend = true |
| | | item.setting.sync = 'false' |
| | | item.setting.tableMode = 'compatible' |
| | | item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | item.colsCtrls = null |
| | |
| | | } |
| | | } |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | if (item.wrap.datatype === 'public') { |
| | | balMap.set(item.wrap.publicId + 'public', true) |
| | | } |
| | | item.subcards && item.subcards.forEach(card => { |
| | | if (card.style.boxShadow) { |
| | | delete card.style.hShadow |
| | |
| | | |
| | | if (item.setting.sync === 'true') { |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | | if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true') { |
| | | if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true' && !_tailScript) { |
| | | |
| | | } else { |
| | | item.setting.sync = 'false' |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatSetting = (components, params, inherit, interfaces, balMap, tbMap) => { |
| | | formatSetting = (components, params, inherit, interfaces, balMap, tbMap, BID) => { |
| | | let delay = 20 |
| | | return components.map(component => { |
| | | if (component.type === 'tabs') { |
| | | component.subtabs = component.subtabs.map(tab => { |
| | | tab.components = this.formatSetting(tab.components, null, inherit, interfaces, balMap, tbMap) |
| | | tab.components = this.formatSetting(tab.components, null, inherit, interfaces, balMap, tbMap, BID) |
| | | tab = {...tab, ...inherit} |
| | | return tab |
| | | }) |
| | | return component |
| | | } else if (component.type === 'group') { |
| | | component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap) |
| | | component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap, BID) |
| | | return component |
| | | } |
| | | |
| | |
| | | |
| | | if (component.setting.interType !== 'system') return component |
| | | |
| | | component.setting.uuid = component.uuid |
| | | |
| | | // dataName 系统生成的数据源名称 |
| | | if (component.setting.sync === 'true') { |
| | | component.dataName = 'mk' + component.uuid.slice(-18) |
| | |
| | | component.setting.sync = 'false' |
| | | component.setting.onload = 'false' |
| | | } else { |
| | | params.push(getStructDefaultParam(component, searchlist, params.length === 0)) |
| | | let backend = false |
| | | if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + component.uuid)) { |
| | | backend = true |
| | | } else if (window.backend && params[0] && params[0].exps) { |
| | | backend = true |
| | | } |
| | | if (backend && !window.GLOB.CacheData.has('sql_' + component.uuid)) { |
| | | component.setting.sync = 'false' |
| | | } else { |
| | | params.push(getStructDefaultParam(component, searchlist, params.length === 0, BID)) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | inter.setting.arr_field = inter.columns.map(col => col.field).join(',') |
| | | |
| | | if (inter.setting.interType !== 'system') return inter |
| | | |
| | | inter.setting.uuid = inter.uuid |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | |
| | | this.setState({loading: true, loadingview: false}) |
| | | |
| | | if (config.$cache && config.$time) { |
| | | Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => { |
| | | Api.getLCacheConfig(params[0].uuid || params[0].id, config.$time, BID).then(res => { |
| | | if (!res.valid) { |
| | | this.getMainData(param, params, config.MenuID) |
| | | } else { |
| | |
| | | } |
| | | |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | let _data = result[item.dataName] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | window.GLOB.SyncData.set(item.name, _data) |
| | | window.GLOB.SyncData.set(item.dataName, _data) |
| | | }) |
| | | |
| | | MKEmitter.emit('transferSyncData', MenuID) |
| | |
| | | let params = [] |
| | | let BID = urlparam.$BID || '' |
| | | |
| | | config.components = this.formatSetting(config.components, params, balMap, tbMap) |
| | | config.components = this.formatSetting(config.components, params, balMap, tbMap, BID) |
| | | |
| | | this.setState({ |
| | | BID: BID, |
| | |
| | | |
| | | if (item.hasExtend) { |
| | | item.setting.hasExtend = true |
| | | item.setting.sync = 'false' |
| | | item.setting.tableMode = 'compatible' |
| | | item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | item.colsCtrls = null |
| | |
| | | } |
| | | } |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | if (item.wrap.datatype === 'public') { |
| | | balMap.set(item.wrap.publicId + 'public', true) |
| | | } |
| | | item.subcards && item.subcards.forEach(card => { |
| | | if (card.style.boxShadow) { |
| | | delete card.style.hShadow |
| | |
| | | |
| | | if (item.setting.sync === 'true') { |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | | if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true') { |
| | | if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true' && !_tailScript) { |
| | | |
| | | } else { |
| | | item.setting.sync = 'false' |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatSetting = (components, params, balMap, tbMap) => { |
| | | formatSetting = (components, params, balMap, tbMap, BID) => { |
| | | let delay = 20 |
| | | return components.map(component => { |
| | | if (component.type === 'tabs') { |
| | | component.subtabs = component.subtabs.map(tab => { |
| | | tab.components = this.formatSetting(tab.components, null, balMap, tbMap) |
| | | tab.components = this.formatSetting(tab.components, null, balMap, tbMap, BID) |
| | | return tab |
| | | }) |
| | | return component |
| | | } else if (component.type === 'group') { |
| | | component.components = this.formatSetting(component.components, params, balMap, tbMap) |
| | | component.components = this.formatSetting(component.components, params, balMap, tbMap, BID) |
| | | return component |
| | | } |
| | | |
| | |
| | | component.setting.sync = 'false' |
| | | component.setting.onload = 'false' |
| | | } else { |
| | | params.push(getStructDefaultParam(component, searchlist, params.length === 0)) |
| | | let backend = false |
| | | if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + component.uuid)) { |
| | | backend = true |
| | | } else if (window.backend && params[0] && params[0].exps) { |
| | | backend = true |
| | | } |
| | | |
| | | if (backend && !window.GLOB.CacheData.has('sql_' + component.uuid)) { |
| | | component.setting.sync = 'false' |
| | | } else { |
| | | params.push(getStructDefaultParam(component, searchlist, params.length === 0, BID)) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | let _data = result[item.dataName] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | window.GLOB.SyncData.set(item.name, _data) |
| | | window.GLOB.SyncData.set(item.dataName, _data) |
| | | }) |
| | | |
| | | MKEmitter.emit('transferSyncData', Tab.uuid) |
| | |
| | | import moment from 'moment' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import md5 from 'md5' |
| | | |
| | | import ExcelIn from './excelin' |
| | | import Utils, { getExcelInSql } from '@/utils/utils.js' |
| | |
| | | this.refs.excelIn.exceltrigger() |
| | | }) |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '导入Excel'}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '导入Excel'}) |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | let result = getExcelInSql(btn, data, (BID || ''), this.state.primaryId) |
| | | if (btn.intertype === 'system' && window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) { |
| | | let ex = window.GLOB.CacheData.get('sql_' + btn.uuid) |
| | | let param = this.getExps(ex, data) |
| | | |
| | | if (result.errors) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.errors, |
| | | duration: 5 |
| | | }) |
| | | this.setState({ loading: false }) |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | ID: this.state.primaryId, |
| | | excel_in: result.lines |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | if (btn.intertype === 'system') { // 系统存储过程 |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | |
| | | delete param.excel_in |
| | | |
| | | // param.excel_in_type = 'true' |
| | | param.exec_type = window.GLOB.execType || 'y' |
| | | param.LText = result.sql |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | if (param.errors) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: param.errors, |
| | | duration: 5 |
| | | }) |
| | | this.setState({ loading: false }) |
| | | return |
| | | } |
| | | |
| | | let unCheckParam = null |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText)) { |
| | | if (ex.reps.includes('mk_check_begin')) { |
| | | unCheckParam = fromJS(param).toJS() |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText, param.exec_type) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | if (window.GLOB.mkHS) { // 云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (btn.database === 'sso' && window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | param.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | param.data[0].exps.push({ |
| | | key: 'mk_check_begin', |
| | | value: '' |
| | | }, { |
| | | key: 'mk_check_end', |
| | | value: '' |
| | | }) |
| | | unCheckParam.data[0].exps.push({ |
| | | key: 'mk_check_begin', |
| | | value: 'Y' |
| | | }, { |
| | | key: 'mk_check_end', |
| | | value: 'Y' |
| | | }) |
| | | } |
| | | |
| | | if (unCheckParam) { |
| | | unCheckParam.LText = unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/') |
| | | unCheckParam.LText = Utils.formatOptions(unCheckParam.LText, unCheckParam.exec_type) |
| | | unCheckParam.secretkey = Utils.encrypt('', unCheckParam.timestamp) |
| | | unCheckParam.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | unCheckParam.s_debug_type = 'Y' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | |
| | | this.execError({}) |
| | | }) |
| | | } |
| | | } else if (btn.intertype === 'inner' && btn.innerFunc) { // 自定义存储过程 |
| | | param.func = btn.innerFunc |
| | | |
| | | if (btn.recordUser === 'true') { |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | } else { |
| | | let result = getExcelInSql(btn, data, (BID || ''), this.state.primaryId) |
| | | |
| | | if (result.errors) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.errors, |
| | | duration: 5 |
| | | }) |
| | | this.setState({ loading: false }) |
| | | return |
| | | } |
| | | if (btn.dataM === 'true') { |
| | | param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | |
| | | let param = { |
| | | ID: this.state.primaryId, |
| | | excel_in: result.lines |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | if (btn.intertype === 'system') { // 系统存储过程 |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | |
| | | delete param.excel_in |
| | | |
| | | // param.excel_in_type = 'true' |
| | | param.exec_type = window.GLOB.execType || 'y' |
| | | param.LText = result.sql |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | |
| | | let unCheckParam = null |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText)) { |
| | | unCheckParam = fromJS(param).toJS() |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else if (btn.intertype === 'outer') { // 外部接口 |
| | | let _outParam = null |
| | | let ver_token = false |
| | | |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | // 存在内部函数时,数据预处理 |
| | | |
| | | param.LText = Utils.formatOptions(param.LText, param.exec_type) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | if (window.GLOB.mkHS) { // 云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (btn.database === 'sso' && window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | param.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | |
| | | if (unCheckParam) { |
| | | unCheckParam.LText = unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/') |
| | | unCheckParam.LText = Utils.formatOptions(unCheckParam.LText, unCheckParam.exec_type) |
| | | unCheckParam.secretkey = Utils.encrypt('', unCheckParam.timestamp) |
| | | unCheckParam.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | unCheckParam.s_debug_type = 'Y' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | delete res.ErrCode |
| | | delete res.ErrMesg |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | // 使用处理后的数据调用外部接口 |
| | | let keys = Object.keys(res) // 提交外部接口前,添加BID |
| | | if (this.props.BID && keys.filter(key => key.toLowerCase() === 'bid').length === 0) { |
| | | res.BID = this.props.BID |
| | | } |
| | | resolve(res) |
| | | this.execSuccess(res) |
| | | } else if (res.ErrCode === 'C') { |
| | | const that = this |
| | | confirm({ |
| | | title: window.GLOB.dict['exec_sure'] || '请确认', |
| | | content: res.message, |
| | | okText: window.GLOB.dict['ok'] || '确定', |
| | | cancelText: window.GLOB.dict['cancel'] || '取消', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(unCheckParam).then(result => { |
| | | if (result.status) { |
| | | that.execSuccess(result) |
| | | } else { |
| | | that.execError(result) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | that.execError(res) |
| | | } |
| | | }) |
| | | } else { |
| | | this.execError(res) |
| | | resolve(false) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else { |
| | | resolve(param) |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = fromJS(res).toJS() |
| | | |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | param.$token = btn.exProInterface || '' |
| | | } else if (btn.intertype === 'inner' && btn.innerFunc) { // 自定义存储过程 |
| | | param.func = btn.innerFunc |
| | | |
| | | if (btn.recordUser === 'true') { |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | if (btn.dataM === 'true') { |
| | | param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else { |
| | | param.$token = btn.exInterface || '' |
| | | this.execError(res) |
| | | } |
| | | ver_token = true |
| | | } else { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else if (btn.intertype === 'outer') { // 外部接口 |
| | | let _outParam = null |
| | | let ver_token = false |
| | | |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | // 存在内部函数时,数据预处理 |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | delete res.ErrCode |
| | | delete res.ErrMesg |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | // 使用处理后的数据调用外部接口 |
| | | let keys = Object.keys(res) // 提交外部接口前,添加BID |
| | | if (this.props.BID && keys.filter(key => key.toLowerCase() === 'bid').length === 0) { |
| | | res.BID = this.props.BID |
| | | } |
| | | resolve(res) |
| | | } else { |
| | | this.execError(res) |
| | | resolve(false) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.execError({}) |
| | | }) |
| | | } else { |
| | | param.rduri = btn.interface |
| | | resolve(param) |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { |
| | | param.$login = true |
| | | } |
| | | } |
| | | |
| | | if (btn.outerFunc) { |
| | | res.func = btn.outerFunc |
| | | } |
| | | |
| | | if (window.GLOB.mkHS && res.func === 's_sDataDictb_excelIn') { // s_sDataDictb_excelIn 云端验证 |
| | | let sql = `Declare @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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)` |
| | | param.LText = Utils.formatOptions(sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response || response.ErrCode === 'LoginError') return |
| | | // 回调请求 |
| | | if (ver_token && response.ErrCode === 'token_error') { |
| | | response.ErrCode = 'E' |
| | | this.execError(response) |
| | | } else if (btn.callbackFunc ) { |
| | | // 存在回调函数时,调用 |
| | | delete response.message |
| | | delete response.status |
| | | |
| | | response.func = btn.callbackFunc |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | this.execSuccess(response) |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = fromJS(res).toJS() |
| | | |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | param.$token = btn.exProInterface || '' |
| | | } else { |
| | | param.$token = btn.exInterface || '' |
| | | } |
| | | ver_token = true |
| | | } else { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { |
| | | param.$login = true |
| | | } |
| | | } |
| | | |
| | | if (btn.outerFunc) { |
| | | res.func = btn.outerFunc |
| | | } |
| | | |
| | | if (window.GLOB.mkHS && res.func === 's_sDataDictb_excelIn') { // s_sDataDictb_excelIn 云端验证 |
| | | let sql = `Declare @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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)` |
| | | param.LText = Utils.formatOptions(sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response || response.ErrCode === 'LoginError') return |
| | | // 回调请求 |
| | | if (ver_token && response.ErrCode === 'token_error') { |
| | | response.ErrCode = 'E' |
| | | this.execError(response) |
| | | } else if (btn.callbackFunc ) { |
| | | // 存在回调函数时,调用 |
| | | delete response.message |
| | | delete response.status |
| | | |
| | | response.func = btn.callbackFunc |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | this.execSuccess(response) |
| | | } else { |
| | | this.execError(response) |
| | | } |
| | | } |
| | | }).then(res => { |
| | | if (!res || res.ErrCode === 'LoginError') return |
| | | |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | getExps = (ex, data) => { |
| | | const { BID, btn } = this.props |
| | | const { primaryId } = this.state |
| | | |
| | | let exps = [] |
| | | let values = { |
| | | time_id: Utils.getguid(), |
| | | roleid: sessionStorage.getItem('role_id') || '', |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | mk_nation: sessionStorage.getItem('nation') || '', |
| | | mk_province: sessionStorage.getItem('province') || '', |
| | | mk_city: sessionStorage.getItem('city') || '', |
| | | mk_district: sessionStorage.getItem('district') || '', |
| | | mk_address: sessionStorage.getItem('address') || '', |
| | | id: primaryId || '', |
| | | bid: BID || '', |
| | | typename: 'admin', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | // mk_check_begin: '', |
| | | // mk_check_end: '' |
| | | } |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | values.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let keys = ['delete', 'drop', 'insert', 'truncate', 'update'] |
| | | let errors = [] |
| | | let _topline = btn.verify.range || 0 |
| | | let cols = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] |
| | | for (let i = 0; i < 26; i++) { |
| | | cols.push('A' + cols[i]) |
| | | } |
| | | |
| | | let lines = data.map((item, lindex) => { |
| | | let vals = [] |
| | | btn.verify.columns.forEach((col, cindex) => { |
| | | if (col.import === 'false') return |
| | | |
| | | let val = item[col.Column] !== undefined ? item[col.Column] : '' |
| | | let _colindex = cols[cindex] || (cindex + 1) |
| | | let _position = (_topline + lindex + 1) + '行 ' + _colindex + '列 ' |
| | | |
| | | if (col.import === 'init') { |
| | | if (/^Nvarchar/ig.test(col.type)) { |
| | | val = '' |
| | | } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) { |
| | | val = 0 |
| | | } else if (col.type === 'date') { |
| | | val = '1949-10-01' |
| | | } else if (col.type === 'datetime') { |
| | | val = '1949-10-01 00:00:00' |
| | | } |
| | | } else if (/^Nvarchar/ig.test(col.type)) { |
| | | val = val + '' |
| | | |
| | | if (/'/.test(val)) { |
| | | val = val.replace(/'/ig, '"') |
| | | } |
| | | |
| | | val = val.replace(/(^\s+$)|\t+|\v+/ig, '') |
| | | |
| | | if (!val && col.required === 'true') { // 必填校验 |
| | | errors.push(_position + '内容不可为空') |
| | | } else if (col.limit && val.length > col.limit) { // 长度校验 |
| | | errors.push(_position + '内容超长') |
| | | } else { // 关键字校验 |
| | | keys.forEach(key => { |
| | | let _patten = new RegExp('(^' + key + '\\s+)|(\\s+' + key + '\\s+)', 'ig') |
| | | if (_patten.test(val)) { |
| | | errors.push(_position + '含有关键字' + key) |
| | | } |
| | | }) |
| | | } |
| | | } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) { |
| | | if (col.required === 'false') { |
| | | if (!val || isNaN(val)) { |
| | | val = 0 |
| | | } |
| | | } else if (!val && val !== 0) { |
| | | errors.push(_position + '内容不可为空') |
| | | } else if (isNaN(val)) { // 检验是否为数值 |
| | | errors.push(_position + '内容应为数值') |
| | | } else if ((col.min || col.min === 0) && val < col.min) { // 最小值检验 |
| | | errors.push(_position + '小于最小值') |
| | | } else if ((col.max || col.max === 0) && val > col.max) { // 最大值检验 |
| | | errors.push(_position + '大于最大值') |
| | | } |
| | | } else if (col.type === 'date' || col.type === 'datetime') { |
| | | if (typeof(val) === 'number') { |
| | | if (val > 2958465 || val <= 0) { // 时间过大或小于等于0 |
| | | errors.push(_position + '时间为负值或太大') |
| | | } else { // 时间格式化 |
| | | if (val < 60) { // 1900-2-29,excel中存在,实际不存在 |
| | | val++ |
| | | } |
| | | if (col.type === 'datetime') { |
| | | val = val - 2 |
| | | let day = Math.floor(val) |
| | | let seconds = Math.round((val - day) * 24 * 60 * 60) |
| | | val = moment('19000101', 'YYYYMMDD').add(day, 'days').add(seconds, 'seconds').format('YYYY-MM-DD HH:mm:ss') |
| | | } else { |
| | | val = moment('19000101', 'YYYYMMDD').add(Math.floor(val - 2), 'days').format('YYYY-MM-DD') |
| | | } |
| | | } |
| | | } else if (typeof(val) === 'string') { |
| | | val = val.replace(/(^\s+$)|\t+|\v+/ig, '') |
| | | if (!val) { |
| | | if (col.required === 'true') { // 时间必填校验 |
| | | errors.push(_position + '内容不可为空') |
| | | } else if (col.type === 'date') { |
| | | val = '1949-10-01' |
| | | } else if (col.type === 'datetime') { |
| | | val = '1949-10-01 00:00:00' |
| | | } |
| | | } else if (!/^[1-9][0-9]{3}/.test(val)) { // 时间正则校验 |
| | | errors.push(_position + '时间格式错误') |
| | | } |
| | | } else { // 时间格式错误 |
| | | errors.push(_position + '时间格式错误') |
| | | } |
| | | } |
| | | }).then(res => { |
| | | if (!res || res.ErrCode === 'LoginError') return |
| | | |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | vals.push(val) |
| | | }) |
| | | |
| | | let _lineIndex = '0000' + (lindex + 1) + '0' |
| | | _lineIndex = _lineIndex.substring(_lineIndex.length - 6) |
| | | |
| | | vals.push(Utils.getguid() + _lineIndex) |
| | | vals.push(BID) |
| | | |
| | | return vals |
| | | }) |
| | | |
| | | if (errors.length) return {errors: errors.join('; ')} |
| | | |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (values.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | exps.push({ |
| | | key: 'mk_excel_data', |
| | | value: lines |
| | | }) |
| | | |
| | | if (btn.$process && btn.verify.workFlow === 'true') { |
| | | let flow = window.GLOB.UserCacheMap.get(btn.$flowId) |
| | | let target = flow ? flow.cells.filter(cell => cell.mknode === 'start')[0] : '' |
| | | |
| | | let error = '' |
| | | let msg = '' |
| | | let status = 0 |
| | | let statusName = '' |
| | | let detailId = '' |
| | | |
| | | if (target) { |
| | | detailId = target.id |
| | | status = target.mkdata.status |
| | | statusName = target.mkdata.statusName |
| | | |
| | | let label = target.attrs && target.attrs.text && target.attrs.text.text ? target.attrs.text.text : '' |
| | | msg = {...target.mkdata, label: label, id: target.id, checkIds: [], checkUsers: []} |
| | | msg = window.btoa(window.encodeURIComponent(JSON.stringify(msg))) |
| | | } else { |
| | | status = 0 |
| | | statusName = '异常' |
| | | error = '工作流无开始节点' |
| | | } |
| | | |
| | | exps.push( |
| | | { key: 'works_flow_error', value: error }, |
| | | { key: 'works_flow_code', value: flow ? flow.flow_code : '' }, |
| | | { key: 'works_flow_name', value: flow ? flow.flow_name : '' }, |
| | | { key: 'works_flow_param', value: msg }, |
| | | { key: 'works_flow_detail_id', value: detailId }, |
| | | { key: 'status', value: status }, |
| | | { key: 'statusname', value: statusName }, |
| | | { key: 'work_group', value: sessionStorage.getItem('work_group') || '' }, |
| | | { key: 'work_grade', value: sessionStorage.getItem('work_grade') || 0 }, |
| | | // { key: 'start_type', value: '开始' }, |
| | | ) |
| | | } |
| | | |
| | | let md5_id = '' |
| | | if (window.GLOB.probation) { |
| | | md5_id = md5(ex.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000)) |
| | | md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18) |
| | | } |
| | | |
| | | return { |
| | | $backend: true, |
| | | data: [{ |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: btn.logLabel || '', |
| | | md5_id: md5_id |
| | | }] |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('queryModuleParam', btn.$menuId, this.triggerExcelout) |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '导出Excel'}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '导出Excel'}) |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | if (btn.dataM === 'true') { |
| | | param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | |
| | | } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 使用外部函数 |
| | | param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | |
| | |
| | | |
| | | let _setting = {} |
| | | let _orderBy = orderBy || '' |
| | | |
| | | if (btn.verify.dataType === 'custom') { |
| | | _setting.uuid = btn.uuid |
| | | _setting.interType = 'system' |
| | | _setting.arr_field = [] |
| | | |
| | | btn.verify.columns.forEach(col => { |
| | |
| | | primaryId = primaryId ? 'excel:' + primaryId : '' |
| | | } |
| | | |
| | | let param = UtilsDM.getDefaultQueryParam(_setting, search, _orderBy, pageIndex, pageSize, primaryId, BID) |
| | | let param = UtilsDM.getQueryDataParams(_setting, search, _orderBy, pageIndex, pageSize, BID, primaryId) |
| | | |
| | | param.DateCount = '' |
| | | |
| | | // 数据管理权限 |
| | | if (sessionStorage.getItem('dataM') === 'true') { |
| | | param.dataM = 'Y' |
| | | } |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | delete param.DateCount |
| | | |
| | | return param |
| | | } |
| | |
| | | dataM: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | ID: orderId |
| | | } |
| | | } else if (window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) { |
| | | param = this.getbackParam(orderId, data) |
| | | } else if (btn.payMode === 'system') { |
| | | let sql = this.getSysDeclareSql(orderId, data) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | getbackParam = (ID, data) => { |
| | | const { columns, btn, BID } = this.props |
| | | |
| | | let ex = window.GLOB.CacheData.get('sql_' + btn.uuid) |
| | | let exps = [] |
| | | let values = { |
| | | time_id: Utils.getguid(), |
| | | roleid: sessionStorage.getItem('role_id') || '', |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | mk_nation: sessionStorage.getItem('nation') || '', |
| | | mk_province: sessionStorage.getItem('province') || '', |
| | | mk_city: sessionStorage.getItem('city') || '', |
| | | mk_district: sessionStorage.getItem('district') || '', |
| | | mk_address: sessionStorage.getItem('address') || '', |
| | | id: ID || '', |
| | | bid: BID || '', |
| | | typename: 'admin', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | } |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | values.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (values.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let _data = {} |
| | | Object.keys(data).forEach(key => { |
| | | _data[key.toLowerCase()] = data[key] |
| | | }) |
| | | |
| | | columns.forEach(col => { |
| | | if (!ex.reps.includes(col.field)) return |
| | | if (!col.datatype) return |
| | | |
| | | let _key = col.field.toLowerCase() |
| | | let _val = _data.hasOwnProperty(_key) ? _data[_key] : '' |
| | | |
| | | if (/^date/ig.test(col.datatype) && !_val) { |
| | | _val = '1949-10-01' |
| | | } |
| | | |
| | | exps.push({ |
| | | key: 'mk_' + col.field + '_mk', |
| | | value: _val |
| | | }) |
| | | }) |
| | | |
| | | let md5_id = '' |
| | | if (window.GLOB.probation) { |
| | | md5_id = md5(ex.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000)) |
| | | md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18) |
| | | } |
| | | |
| | | return { |
| | | $backend: true, |
| | | data: [{ |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: btn.logLabel || '', |
| | | md5_id: md5_id |
| | | }] |
| | | } |
| | | } |
| | | |
| | | getSysDeclareSql = (ID, data) => { |
| | | const { columns, btn, BID } = this.props |
| | | |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, notification, Modal, message } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | lang = data[0].lang_s || '' |
| | | } |
| | | |
| | | let _name = '新页面' |
| | | // let _name = '新页面' |
| | | |
| | | if (btn.pageTemplate === 'billprint') { |
| | | _name = '单据打印' |
| | | // _name = '单据打印' |
| | | if (btn.preHandle === 'true' && btn.pre_func) { |
| | | MKEmitter.emit('queryModuleParam', btn.$menuId, (res) => { |
| | | let searches = {} |
| | |
| | | } else { |
| | | if (btn.Ot === 'required') { |
| | | data.forEach(item => { |
| | | let _id = item.$$uuid || '' |
| | | let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: _id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') }))) |
| | | let _param = { id: item.$$uuid || '', tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM')} |
| | | |
| | | Object.keys(item).forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | | if (typeof(item[key]) !== 'string' && typeof(item[key]) !== 'number') return |
| | | if (typeof(item[key]) === 'string' && item[key].length > 50) return |
| | | if (['id', 'tempid', 'pageid', 'datam'].includes(key.toLowerCase())) return |
| | | |
| | | _param[key.toLowerCase()] = item[key] |
| | | }) |
| | | |
| | | let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) |
| | | window.open(url) |
| | | }) |
| | | } else if (btn.Ot === 'requiredOnce') { |
| | | Id = data.map(item => item.$$uuid).filter(Boolean).join(',') |
| | | let _param = { id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM')} |
| | | let item = data[0] |
| | | |
| | | Object.keys(item).forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | | if (typeof(item[key]) !== 'string' && typeof(item[key]) !== 'number') return |
| | | if (typeof(item[key]) === 'string' && item[key].length > 50) return |
| | | if (['id', 'tempid', 'pageid', 'datam'].includes(key.toLowerCase())) return |
| | | |
| | | _param[key.toLowerCase()] = item[key] |
| | | }) |
| | | |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify(_param)))) |
| | | } else { |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) |
| | | let _param = { id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM')} |
| | | let item = data[0] |
| | | |
| | | Object.keys(item).forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | | if (typeof(item[key]) !== 'string' && typeof(item[key]) !== 'number') return |
| | | if (typeof(item[key]) === 'string' && item[key].length > 50) return |
| | | if (['id', 'tempid', 'pageid', 'datam'].includes(key.toLowerCase())) return |
| | | |
| | | _param[key.toLowerCase()] = item[key] |
| | | }) |
| | | |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify(_param)))) |
| | | } |
| | | } |
| | | } else if (btn.pageTemplate === 'billprintTemp') { |
| | |
| | | let src = '#/print/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: Id, lang }))) |
| | | window.open(src) |
| | | } else if (btn.pageTemplate === 'pay') { |
| | | _name = '支付' |
| | | // _name = '支付' |
| | | |
| | | let appId = '' |
| | | let merchId = '' |
| | |
| | | window.open(url) |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _name}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _name}) |
| | | // } |
| | | } |
| | | |
| | | prequest = (ID, data, appId, merchId) => { |
| | |
| | | dataM: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | ID: ID |
| | | } |
| | | } else if (window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) { |
| | | param = this.getbackParam(ID, data) |
| | | } else { |
| | | let sql = this.getSysDeclareSql(ID, data) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | getbackParam = (ID, data) => { |
| | | const { columns, btn, BID } = this.props |
| | | |
| | | let ex = window.GLOB.CacheData.get('sql_' + btn.uuid) |
| | | let exps = [] |
| | | let values = { |
| | | time_id: Utils.getguid(), |
| | | roleid: sessionStorage.getItem('role_id') || '', |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | mk_nation: sessionStorage.getItem('nation') || '', |
| | | mk_province: sessionStorage.getItem('province') || '', |
| | | mk_city: sessionStorage.getItem('city') || '', |
| | | mk_district: sessionStorage.getItem('district') || '', |
| | | mk_address: sessionStorage.getItem('address') || '', |
| | | id: ID || '', |
| | | bid: BID || '', |
| | | typename: 'admin', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | } |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | values.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (values.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let _data = {} |
| | | Object.keys(data).forEach(key => { |
| | | _data[key.toLowerCase()] = data[key] |
| | | }) |
| | | |
| | | columns.forEach(col => { |
| | | if (!ex.reps.includes(col.field)) return |
| | | if (!col.datatype) return |
| | | |
| | | let _key = col.field.toLowerCase() |
| | | let _val = _data.hasOwnProperty(_key) ? _data[_key] : '' |
| | | |
| | | if (/^date/ig.test(col.datatype) && !_val) { |
| | | _val = '1949-10-01' |
| | | } |
| | | |
| | | exps.push({ |
| | | key: 'mk_' + col.field + '_mk', |
| | | value: _val |
| | | }) |
| | | }) |
| | | |
| | | let md5_id = '' |
| | | if (window.GLOB.probation) { |
| | | md5_id = md5(ex.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000)) |
| | | md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18) |
| | | } |
| | | |
| | | return { |
| | | $backend: true, |
| | | data: [{ |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: btn.logLabel || '', |
| | | md5_id: md5_id |
| | | }] |
| | | } |
| | | } |
| | | |
| | | getSysDeclareSql = (ID, data) => { |
| | | const { columns, btn, BID } = this.props |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | let _change = { |
| | | prompt: '提示框', |
| | | exec: '直接执行', |
| | | pop: '弹窗(表单)', |
| | | formSubmit: '表单', |
| | | form: '表单', |
| | | } |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _change[btn.OpenType]}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // let _change = { |
| | | // prompt: '提示框', |
| | | // exec: '直接执行', |
| | | // pop: '弹窗(表单)', |
| | | // formSubmit: '表单', |
| | | // form: '表单', |
| | | // } |
| | | // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _change[btn.OpenType]}) |
| | | // } |
| | | } |
| | | |
| | | preTrigger = (callback) => { |
| | |
| | | |
| | | let primaryId = '' |
| | | |
| | | if ((btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') && setting.primaryKey) { |
| | | let ids = data.map(d => { return d[setting.primaryKey] || ''}) |
| | | if (btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { |
| | | let ids = data.map(d => d.$$uuid) |
| | | ids = ids.filter(Boolean) |
| | | primaryId = ids.join(',') |
| | | } |
| | |
| | | param.LText = Utils.formatOptions(param.LText, param.exec_type) |
| | | } else if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit' || btn.OpenType === 'form') { // 表单 |
| | | if (btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | primaryId = '' |
| | | |
| | | if (formdata && setting.primaryKey) { // 表单中存在主键字段,主键值以表单中的值为准 |
| | | let _form = formdata.filter(_form => _form.key === setting.primaryKey)[0] |
| | | if (_form) { |
| | | primaryId = _form.value |
| | | } |
| | | } |
| | | |
| | | param.ID = primaryId || Utils.getguid() |
| | | param.ID = Utils.getguid() |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg) // 数据源 |
| | |
| | | return _params |
| | | } |
| | | |
| | | getBackSystemParam = (data, formdata) => { |
| | | const { btn } = this.props |
| | | |
| | | let ex = window.GLOB.CacheData.get('sql_' + btn.uuid) |
| | | let _params = [] |
| | | |
| | | if (btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { |
| | | let primaryId = '' |
| | | let cell = null |
| | | |
| | | if (btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { |
| | | primaryId = data.map(d => d.$$uuid).filter(Boolean).join(',') |
| | | cell = data[0] |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit' || btn.OpenType === 'form') { // 表单 |
| | | if (btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | primaryId = Utils.getguid() |
| | | } |
| | | } |
| | | |
| | | let exp = this.getExps(ex, formdata, cell, primaryId, btn.$process) |
| | | |
| | | if (ex.reps.includes('mk_check_begin')) { |
| | | exp.$unCheckParam = fromJS(exp).toJS() |
| | | |
| | | exp.data[0].exps.push({ |
| | | key: 'mk_check_begin', |
| | | value: '' |
| | | }, { |
| | | key: 'mk_check_end', |
| | | value: '' |
| | | }) |
| | | exp.$unCheckParam.data[0].exps.push({ |
| | | key: 'mk_check_begin', |
| | | value: 'Y' |
| | | }, { |
| | | key: 'mk_check_end', |
| | | value: 'Y' |
| | | }) |
| | | } else if (btn.procMode === 'system' && btn.callbackType === 'script') { |
| | | let _backex = window.GLOB.CacheData.get('sql_back_' + btn.uuid) |
| | | exp.$backParam = this.getExps(_backex, formdata, cell, primaryId) |
| | | } |
| | | |
| | | _params.push(exp) |
| | | } else if (btn.Ot === 'required') { |
| | | _params = data.map((cell, index) => { |
| | | let primaryId = cell.$$uuid || '' |
| | | |
| | | if (btn.OpenType === 'pop') { // 表单 |
| | | if (index !== 0) { |
| | | let _cell = {} |
| | | Object.keys(cell).forEach(key => { |
| | | _cell[key.toLowerCase()] = cell[key] |
| | | }) |
| | | formdata = formdata.map(_data => { |
| | | if (_data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) { |
| | | _data.value = _cell[_data.key.toLowerCase()] |
| | | } |
| | | return _data |
| | | }) |
| | | } |
| | | |
| | | if (btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | primaryId = Utils.getguid() |
| | | } |
| | | } |
| | | let exp = this.getExps(ex, formdata, cell, primaryId, btn.$process) |
| | | if (ex.reps.includes('mk_check_begin')) { |
| | | exp.$unCheckParam = fromJS(exp).toJS() |
| | | |
| | | exp.data[0].exps.push({ |
| | | key: 'mk_check_begin', |
| | | value: '' |
| | | }, { |
| | | key: 'mk_check_end', |
| | | value: '' |
| | | }) |
| | | exp.$unCheckParam.data[0].exps.push({ |
| | | key: 'mk_check_begin', |
| | | value: 'Y' |
| | | }, { |
| | | key: 'mk_check_end', |
| | | value: 'Y' |
| | | }) |
| | | } else if (btn.procMode === 'system' && btn.callbackType === 'script') { |
| | | let _backex = window.GLOB.CacheData.get('sql_back_' + btn.uuid) |
| | | exp.$backParam = this.getExps(_backex, formdata, cell, primaryId) |
| | | } |
| | | |
| | | return exp |
| | | }) |
| | | } |
| | | |
| | | return _params |
| | | } |
| | | |
| | | getExps = (ex, formdata, cell, id, process) => { |
| | | const { columns, BID, btn } = this.props |
| | | let exps = [] |
| | | let values = { |
| | | time_id: Utils.getguid(), |
| | | roleid: sessionStorage.getItem('role_id') || '', |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | mk_nation: sessionStorage.getItem('nation') || '', |
| | | mk_province: sessionStorage.getItem('province') || '', |
| | | mk_city: sessionStorage.getItem('city') || '', |
| | | mk_district: sessionStorage.getItem('district') || '', |
| | | mk_address: sessionStorage.getItem('address') || '', |
| | | id: id || '', |
| | | bid: BID || '', |
| | | typename: 'admin', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | // mk_check_begin: '', |
| | | // mk_check_end: '' |
| | | } |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | values.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let formkeys = [] |
| | | formdata && formdata.forEach(form => { |
| | | if (!ex.reps.includes(form.key)) return |
| | | |
| | | formkeys.push(form.key) |
| | | |
| | | let val = form.value |
| | | if (form.type === 'number' || form.type === 'rate') { |
| | | if (isNaN(val)) { |
| | | val = 0 |
| | | } |
| | | } else if (['date', 'datemonth'].includes(form.type)) { |
| | | val = val || '1949-10-01' |
| | | } |
| | | |
| | | exps.push({ |
| | | key: 'mk_' + form.key + '_mk', |
| | | value: val |
| | | }) |
| | | }) |
| | | |
| | | if (cell && columns && columns.length > 0) { |
| | | let datavars = {} |
| | | |
| | | Object.keys(cell).forEach(key => { |
| | | datavars[key.toLowerCase()] = cell[key] |
| | | }) |
| | | |
| | | columns.forEach(col => { |
| | | if (!ex.reps.includes(col.field) || formkeys.includes(col.field)) return |
| | | if (!col.datatype) return |
| | | |
| | | let _key = col.field.toLowerCase() |
| | | let _val = datavars.hasOwnProperty(_key) ? datavars[_key] : '' |
| | | |
| | | if (/^date/ig.test(col.datatype) && !_val) { |
| | | _val = '1949-10-01' |
| | | } |
| | | |
| | | exps.push({ |
| | | key: 'mk_' + col.field + '_mk', |
| | | value: _val |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (values.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (process && btn.verify.workFlow === 'true') { |
| | | let flow = window.GLOB.UserCacheMap.get(btn.$flowId) |
| | | let node = null |
| | | let line = null |
| | | let target = null |
| | | let status = 0 |
| | | let statusName = '' |
| | | let detailId = '' |
| | | let sign = '' |
| | | let error = '' |
| | | let userid = sessionStorage.getItem('UserID') || '' |
| | | let checkIds = [] |
| | | let checkUsers = [] |
| | | let noticeIds = [] |
| | | let work_grade = sessionStorage.getItem('work_grade') || 0 |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let _data = cell || {} |
| | | let msg = '' |
| | | |
| | | if (btn.verify.flowType === 'start') { |
| | | target = flow ? flow.cells.filter(cell => cell.mknode === 'start')[0] : '' |
| | | |
| | | if (target) { |
| | | detailId = target.id |
| | | status = target.mkdata.status |
| | | statusName = target.mkdata.statusName |
| | | } else { |
| | | error = '工作流无开始节点' |
| | | } |
| | | } else if (_data.works_flow_param) { |
| | | try { |
| | | node = JSON.parse(window.decodeURIComponent(window.atob(_data.works_flow_param))) |
| | | } catch (e) { |
| | | node = null |
| | | } |
| | | |
| | | if (node) { |
| | | let lines = flow ? flow.cells.filter(cell => cell.shape === 'edge' && cell.source.cell === node.id) : [] |
| | | if (btn.verify.flowType === 'reject') { |
| | | line = lines.filter(cell => cell.mkdata.flowType === 'reject' || cell.mknode === 'startEdge')[0] |
| | | } else { |
| | | lines = lines.filter(cell => cell.mkdata.flowType !== 'reject' && cell.mknode !== 'startEdge') |
| | | |
| | | if (lines.length === 0) { |
| | | error = '无可执行的流程分支' |
| | | } else { |
| | | let branchKey = btn.verify.flowBranch ? btn.verify.flowBranch.toLowerCase() : '' |
| | | |
| | | formdata && formdata.forEach(form => { |
| | | let _key = form.key.toLowerCase() |
| | | _data[_key] = form.value |
| | | }) |
| | | |
| | | if (!branchKey) { |
| | | lines.forEach(line => { |
| | | if (line.mkdata.execCondition === 'open') { |
| | | error = '按钮未设置流程控制字段。' |
| | | } |
| | | }) |
| | | if (!error) { |
| | | lines = lines.filter(cell => { |
| | | if (cell.mkdata.seniorCondition === 'open' && !line) { |
| | | cell.mkdata.seniorbers && cell.mkdata.seniorbers.forEach(per => { |
| | | if (per.worker_id === userid) { |
| | | line = cell |
| | | } |
| | | }) |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | |
| | | if (!line) { |
| | | line = lines[0] |
| | | } |
| | | } |
| | | } else if (!_data.hasOwnProperty(branchKey)) { |
| | | error = '信息中无流程控制字段。' |
| | | } else { |
| | | let _def_lines = [] |
| | | let _equ_lines = [] |
| | | let _unequ_lines = [] |
| | | let _or_lines = [] |
| | | let branchVal = _data[branchKey] |
| | | |
| | | if (branchVal && typeof(branchVal) === 'string' && !isNaN(branchVal)) { |
| | | branchVal = +branchVal |
| | | } |
| | | |
| | | lines.forEach(item => { |
| | | if (item.mkdata.execCondition !== 'open') { |
| | | _def_lines.push(item) |
| | | } else { |
| | | if (item.mkdata.match === '=') { |
| | | if (item.mkdata.matchVal === branchVal + '') { |
| | | _equ_lines.push(item) |
| | | } |
| | | } else if (item.mkdata.match === '!=') { |
| | | if (item.mkdata.matchVal !== branchVal + '') { |
| | | _unequ_lines.push(item) |
| | | } |
| | | } else { |
| | | if (item.mkdata.match === '<') { |
| | | if (item.mkdata.matchVal < branchVal) { |
| | | _or_lines.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) |
| | | } |
| | | } else if (item.mkdata.match === '>') { |
| | | if (item.mkdata.matchVal > branchVal) { |
| | | _or_lines.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) |
| | | } |
| | | } else if (item.mkdata.match === '<=') { |
| | | if (item.mkdata.matchVal <= branchVal) { |
| | | _or_lines.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) |
| | | } |
| | | } else if (item.mkdata.match === '>=') { |
| | | if (item.mkdata.matchVal >= branchVal) { |
| | | _or_lines.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | |
| | | _or_lines.sort((a, b) => a.dist - b.dist) |
| | | |
| | | let _lines = [..._equ_lines, ..._or_lines, ..._unequ_lines, ..._def_lines] |
| | | |
| | | _lines = _lines.filter(cell => { |
| | | if (cell.mkdata.seniorCondition === 'open' && !line) { |
| | | cell.mkdata.seniorbers && cell.mkdata.seniorbers.forEach(per => { |
| | | if (per.worker_id === userid) { |
| | | line = cell |
| | | } |
| | | }) |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | |
| | | if (!line) { |
| | | line = _lines[0] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | error = '行信息中工作流参数无法解析' |
| | | } |
| | | |
| | | if (line) { |
| | | detailId = line.id |
| | | status = line.mkdata.status |
| | | statusName = line.mkdata.statusName |
| | | sign = line.mkdata.seniorSign || '' |
| | | target = flow.cells.filter(cell => cell.id === line.target.cell)[0] |
| | | |
| | | line.mkdata.members && line.mkdata.members.forEach(item => { |
| | | if (line.mkdata.approver === 'departmentManager') { |
| | | if (item.job_type === 'manage' && departmentcode === item.parentIds[1]) { |
| | | checkIds.push(item.worker_id) |
| | | checkUsers.push(item) |
| | | } |
| | | } else if (line.mkdata.approver === 'directManager') { |
| | | if (departmentcode === item.parentIds[1] && item.work_grade > work_grade) { |
| | | checkIds.push(item.worker_id) |
| | | checkUsers.push(item) |
| | | } |
| | | } else { |
| | | checkIds.push(item.worker_id) |
| | | checkUsers.push(item) |
| | | } |
| | | }) |
| | | line.mkdata.copys && line.mkdata.copys.forEach(item => { |
| | | noticeIds.push(item.worker_id) |
| | | }) |
| | | |
| | | if (!target) { |
| | | error = '未查询到工作流目标节点' |
| | | } else if (checkIds.length === 0 && !['startEdge', 'endEdge', 'throughEdge'].includes(line.mknode)) { |
| | | error = '未获取到下一步审批人' |
| | | } else if (line.approvalMethod === 'countersign' && (!node.checkIds || !node.checkIds.includes(userid))) { |
| | | error = '当前用户不在审批人列表中' |
| | | } |
| | | } else if (!error) { |
| | | error = '工作流中无对应流程' |
| | | } |
| | | } else { |
| | | error = '行信息中无工作流参数' |
| | | } |
| | | |
| | | if (error) { |
| | | status = 0 |
| | | statusName = '异常' |
| | | } else if (target) { |
| | | let label = target.attrs && target.attrs.text && target.attrs.text.text ? target.attrs.text.text : '' |
| | | msg = {...target.mkdata, label: label, id: target.id, checkIds: [], checkUsers: []} |
| | | msg = window.btoa(window.encodeURIComponent(JSON.stringify(msg))) |
| | | } |
| | | |
| | | if (btn.verify.flowType === 'start') { |
| | | exps.push( |
| | | { key: 'works_flow_error', value: error }, |
| | | { key: 'works_flow_code', value: flow ? flow.flow_code : '' }, |
| | | { key: 'works_flow_name', value: flow ? flow.flow_name : '' }, |
| | | { key: 'works_flow_param', value: msg }, |
| | | { key: 'works_flow_detail_id', value: detailId }, |
| | | { key: 'status', value: status }, |
| | | { key: 'statusname', value: statusName }, |
| | | { key: 'work_group', value: sessionStorage.getItem('work_group') || '' }, |
| | | { key: 'work_grade', value: sessionStorage.getItem('work_grade') || 0 }, |
| | | // { key: 'start_type', value: '开始' }, |
| | | ) |
| | | } else { |
| | | let works_flow_countersign = '' |
| | | let works_flow_sign_values = '' |
| | | let works_flow_sign_field = '' |
| | | let works_flow_sign_label = '' |
| | | let works_begin_branch = '' |
| | | if (line.approvalMethod === 'countersign' && node.checkIds.length > 1) { |
| | | works_flow_countersign = 'Y' |
| | | let mark = line.mark || '已审核' |
| | | let fields = ['statuscharone', 'statuschartwo', 'statuscharthree', 'statuscharfour', 'statuscharfive'] |
| | | node.checkUsers.forEach((user, index) => { |
| | | if (user.worker_id === userid) { |
| | | works_flow_sign_field = fields[index] |
| | | works_flow_sign_label = `${user.parentNames[2] || ''}${user.workername || ''}${mark}` |
| | | } else { |
| | | works_flow_sign_values += `${user.parentNames[2] || ''}${user.workername || ''}${mark}` |
| | | } |
| | | }) |
| | | } else { |
| | | works_begin_branch = line.mknode === 'startEdge' ? 'Y' : '' |
| | | } |
| | | |
| | | exps.push( |
| | | { key: 'works_flow_error', value: error }, |
| | | { key: 'works_flow_countersign', value: works_flow_countersign }, |
| | | { key: 'works_flow_sign_values', value: works_flow_sign_values }, |
| | | { key: 'works_begin_branch', value: works_begin_branch }, |
| | | { key: 'works_flow_sign_field', value: works_flow_sign_field }, |
| | | { key: 'works_flow_sign_label', value: works_flow_sign_label }, |
| | | { key: 'works_flow_code', value: flow ? flow.flow_code : '' }, |
| | | { key: 'works_flow_name', value: flow ? flow.flow_name : '' }, |
| | | { key: 'works_flow_param', value: msg }, |
| | | { key: 'works_flow_detail_id', value: detailId }, |
| | | { key: 'status', value: status }, |
| | | { key: 'statusname', value: statusName }, |
| | | { key: 'work_group', value: sessionStorage.getItem('work_group') || '' }, |
| | | { key: 'work_grade', value: sessionStorage.getItem('work_grade') || 0 }, |
| | | // { key: 'check_type', value: btn.verify.flowType === 'reject' ? '驳回' : '审核' }, |
| | | // { key: 'notice_type', value: '抄送' }, |
| | | { key: 'check_userids', value: checkIds.join(',') }, |
| | | { key: 'notice_userids', value: noticeIds.join(',') }, |
| | | { key: 'works_flow_sign', value: sign }, |
| | | ) |
| | | } |
| | | } |
| | | |
| | | let md5_id = '' |
| | | if (window.GLOB.probation) { |
| | | md5_id = md5(ex.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000)) |
| | | md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18) |
| | | } |
| | | |
| | | return { |
| | | $backend: true, |
| | | data: [{ |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: btn.logLabel || '', |
| | | md5_id: md5_id |
| | | }] |
| | | } |
| | | } |
| | | |
| | | getInnerParam = (data, formdata, retmsg) => { |
| | | const { setting, btn, columns } = this.props |
| | | let _params = [] |
| | |
| | | let primaryId = '' |
| | | |
| | | if ((btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') && setting.primaryKey) { |
| | | let ids = data.map(d => { return d[setting.primaryKey] || ''}) |
| | | let ids = data.map(d => d.$$uuid) |
| | | ids = ids.filter(Boolean) |
| | | primaryId = ids.join(',') |
| | | |
| | |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (retmsg) { |
| | | if (btn.callbackType === 'script' && window.backend && window.GLOB.CacheData.has('sql_back_' + btn.uuid)) { |
| | | let _backex = window.GLOB.CacheData.get('sql_back_' + btn.uuid) |
| | | param.$backParam = this.getExps(_backex, formdata, data[0], primaryId) |
| | | } else if (retmsg) { |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns, this.props.BID) |
| | | } |
| | | |
| | |
| | | param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | |
| | | let primaryId = setting.primaryKey ? cell[setting.primaryKey] || '' : '' |
| | | let primaryId = cell.$$uuid || '' |
| | | |
| | | if (btn.OpenType === 'pop') { // 表单 |
| | | if (index !== 0) { |
| | |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (retmsg) { |
| | | if (btn.callbackType === 'script' && window.backend && window.GLOB.CacheData.has('sql_back_' + btn.uuid)) { |
| | | let _backex = window.GLOB.CacheData.get('sql_back_' + btn.uuid) |
| | | param.$backParam = this.getExps(_backex, formdata, cell, primaryId) |
| | | } else if (retmsg) { |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns, this.props.BID) |
| | | } |
| | | |
| | |
| | | if (btn.intertype === 'system' || btn.intertype === 'inner') { // 系统接口 |
| | | let params = [] |
| | | |
| | | if (btn.intertype === 'system') { |
| | | if (btn.intertype === 'system' && window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) { |
| | | params = this.getBackSystemParam(data, formdata) |
| | | } else if (btn.intertype === 'system') { |
| | | params = this.getSystemParam(data, formdata) |
| | | if (btn.returnValue === 'true') { |
| | | params = params.map(item => { |
| | |
| | | /** *********************调用外部接口************************* */ |
| | | let _params = [] // 请求参数数组 |
| | | |
| | | if (btn.procMode === 'system') { |
| | | if (btn.procMode === 'system' && window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) { |
| | | _params = this.getBackSystemParam(data, formdata) |
| | | } else if (btn.procMode === 'system') { |
| | | _params = this.getSystemParam(data, formdata, true) |
| | | _params = _params.map(item => { |
| | | item.script_type = 'Y' |
| | |
| | | } else if (btn.intertype === 'custom') { // 系统接口 |
| | | let params = [] |
| | | |
| | | if (btn.procMode === 'system') { |
| | | if (btn.procMode === 'system' && window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) { |
| | | params = this.getBackSystemParam(data, formdata) |
| | | } else if (btn.procMode === 'system') { |
| | | params = this.getSystemParam(data, formdata, true) |
| | | params = params.map(item => { |
| | | item.script_type = 'Y' |
| | |
| | | BID: param.BID || '', |
| | | ID: param.ID || '', |
| | | callbacksql: param.$callbacksql || '', |
| | | mk_api_key: '' |
| | | mk_api_key: '', |
| | | backParam: param.$backParam || '' |
| | | } |
| | | |
| | | if (!record.ID && btn.Ot !== 'notRequired' && param[setting.primaryKey]) { |
| | | record.ID = param[setting.primaryKey] |
| | | } |
| | | |
| | | delete param.$backParam |
| | | delete param.$callbacksql |
| | | |
| | | if (param.$pice) { |
| | |
| | | |
| | | this.customOuterRequest(params, param, record, _resolve) |
| | | return |
| | | } else if (!param.func) { |
| | | } else if (!param.func && !param.$backend) { |
| | | this.customOuterRequest(params, param, record, _resolve) |
| | | return |
| | | } |
| | |
| | | _resolve() |
| | | } |
| | | return |
| | | } else if (btn.callbackType === 'script' && record.backParam) { |
| | | param = this.getCallBackendParam(result, record) |
| | | } else if (btn.callbackType === 'script' || btn.callbackType === 'default') { |
| | | param = this.getCallBackSql(result, record) |
| | | } else if (btn.callbackType === 'func') { |
| | |
| | | }) |
| | | } |
| | | |
| | | getCallBackendParam = (result, record) => { |
| | | const { btn } = this.props |
| | | let lines = [] |
| | | let tables = [] |
| | | let param = fromJS(record.backParam).toJS() |
| | | |
| | | btn.verify.cbScripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | if (/\s#[a-z0-9_]+(\s|\()/ig.test(script.sql)) { |
| | | tables.push(...script.sql.match(/\s#[a-z0-9_]+(\s|\()/ig)) |
| | | } |
| | | }) |
| | | |
| | | tables = tables.map(tb => tb.replace(/\s|\(/g, '')) |
| | | |
| | | if (result.$ErrCode) { |
| | | delete result.$ErrCode |
| | | delete result.$ErrMesg |
| | | } |
| | | |
| | | let getDefaultSql = (obj, tb, bid, level) => { |
| | | let vals = {} |
| | | let subObjs = [] |
| | | let id = Utils.getuuid() |
| | | |
| | | delete obj.$$key |
| | | |
| | | Object.keys(obj).forEach(key => { |
| | | let val = obj[key] |
| | | if (val === null || val === undefined) return |
| | | if (typeof(val) === 'object') { |
| | | if (Array.isArray(val)) { |
| | | val.forEach(item => { |
| | | if (typeof(item) !== 'object' || Array.isArray(item)) return |
| | | if (Object.keys(item).length === 0) return |
| | | |
| | | Object.keys(item).forEach(k => { |
| | | if (item[k] === null) { |
| | | item[k] = '' |
| | | } |
| | | }) |
| | | item.$$key = tb + '_' + key |
| | | subObjs.push(item) |
| | | }) |
| | | } else if (Object.keys(val).length > 0) { |
| | | val.$$key = tb + '_' + key |
| | | subObjs.push(val) |
| | | } |
| | | } else { |
| | | if (typeof(val) === 'string') { |
| | | val = val.replace(/'/ig, '"') |
| | | } else { |
| | | val = val + '' |
| | | } |
| | | vals[key] = val |
| | | } |
| | | }) |
| | | |
| | | vals.mk_level = level |
| | | vals.mk_id = id |
| | | vals.mk_bid = bid |
| | | |
| | | let isnew = true |
| | | lines.forEach(line => { |
| | | if (line.tb === tb) { |
| | | line.values.push(vals) |
| | | isnew = false |
| | | } |
| | | }) |
| | | if (isnew) { |
| | | lines.push({ |
| | | tb: tb, |
| | | type: tables.includes('#' + tb) ? '01' : '02', |
| | | values: [vals] |
| | | }) |
| | | } |
| | | |
| | | subObjs.forEach(item => { |
| | | getDefaultSql(item, item.$$key, id, level + 1) |
| | | }) |
| | | } |
| | | |
| | | getDefaultSql(result, btn.cbTable, '', 1) |
| | | |
| | | param.data[0].exps.push({ |
| | | key: 'mk_outer_params', // 回调脚本的数据替换 |
| | | value: lines |
| | | }) |
| | | |
| | | let md5_id = '' |
| | | if (window.GLOB.probation) { |
| | | md5_id = md5('back_' + btn.uuid + JSON.stringify(param.data[0].exps) + Math.floor(new Date().getTime() / 600000)) |
| | | md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18) |
| | | } |
| | | |
| | | param.data[0].md5_id = md5_id |
| | | param.data[0].menuname = btn.logLabel + '(回调)' |
| | | |
| | | return param |
| | | } |
| | | |
| | | getCallBackSql = (result, record) => { |
| | | const { btn } = this.props |
| | | let lines = [] |
| | |
| | | if (Array.isArray(val)) { |
| | | val.forEach(item => { |
| | | if (typeof(item) !== 'object' || Array.isArray(item)) return |
| | | if (Object.keys(item).length > 0) { |
| | | item.$$key = tb + '_' + key |
| | | subObjs.push(item) |
| | | } |
| | | if (Object.keys(item).length === 0) return |
| | | |
| | | Object.keys(item).forEach(k => { |
| | | if (item[k] === null) { |
| | | item[k] = '' |
| | | } |
| | | }) |
| | | item.$$key = tb + '_' + key |
| | | subObjs.push(item) |
| | | }) |
| | | } else if (Object.keys(val).length > 0) { |
| | | val.$$key = tb + '_' + key |
| | |
| | | let record = { |
| | | BID: param.BID || '', |
| | | ID: param.ID || '', |
| | | callbacksql: param.$callbacksql || '' |
| | | callbacksql: param.$callbacksql || '', |
| | | backParam: param.$backParam || '' |
| | | } |
| | | |
| | | if (!record.ID && btn.Ot !== 'notRequired' && param[setting.primaryKey]) { |
| | | record.ID = param[setting.primaryKey] |
| | | } |
| | | |
| | | delete param.$backParam |
| | | delete param.$callbacksql |
| | | |
| | | if (!param.func) { |
| | | if (!param.func && !param.$backend) { |
| | | this.outerOuterRequest(params, param, record, _resolve) |
| | | return |
| | | } |
| | |
| | | _resolve() |
| | | } |
| | | return |
| | | } else if (btn.callbackType === 'script' && record.backParam) { |
| | | param = this.getCallBackendParam(result, record) |
| | | } else if (btn.callbackType === 'script' || btn.callbackType === 'default') { |
| | | param = this.getCallBackSql(result, record) |
| | | } else if (btn.callbackType === 'func' || btn.callbackFunc) { |
| | |
| | | visible: true |
| | | }) |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '弹窗(标签)'}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '弹窗(标签)'}) |
| | | // } |
| | | } |
| | | |
| | | syspopclose = () => { |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | // import './index.scss' |
| | |
| | | this.triggerPrint(data) |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '标签打印'}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '标签打印'}) |
| | | // } |
| | | } |
| | | |
| | | triggerPrint = (data, formlist = []) => { |
| | |
| | | getDefaultSql = (formlist, data, ID) => { |
| | | const { BID, btn, columns } = this.props |
| | | |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) { |
| | | let setting = {...btn.verify.setting} |
| | | setting.interType = 'system' |
| | | setting.uuid = btn.uuid |
| | | |
| | | let _param = UtilsDM.getQueryDataParams(setting, [], setting.order, 1, 9999, BID, ID) |
| | | let item = window.GLOB.CacheData.get('sql_' + btn.uuid) |
| | | |
| | | _param.data[0].exps = _param.data[0].exps.filter(n => n.key !== 'mk_search') |
| | | let formkeys = [] |
| | | |
| | | formlist.forEach(form => { |
| | | if (!item.reps.includes(form.key)) return |
| | | |
| | | formkeys.push(form.key) |
| | | |
| | | let val = form.value |
| | | if (form.type === 'number' || form.type === 'rate') { |
| | | if (isNaN(val)) { |
| | | val = 0 |
| | | } |
| | | } else if (['date', 'datemonth'].includes(form.type)) { |
| | | val = val || '1949-10-01' |
| | | } |
| | | |
| | | _param.data[0].exps.push({ |
| | | key: 'mk_' + form.key + '_mk', |
| | | value: val |
| | | }) |
| | | }) |
| | | |
| | | if (data && columns && columns.length > 0) { |
| | | let datavars = {} |
| | | |
| | | Object.keys(data).forEach(key => { |
| | | datavars[key.toLowerCase()] = data[key] |
| | | }) |
| | | |
| | | columns.forEach(col => { |
| | | if (!item.reps.includes(col.field) || formkeys.includes(col.field)) return |
| | | if (!col.datatype) return |
| | | |
| | | let _key = col.field.toLowerCase() |
| | | let _val = datavars.hasOwnProperty(_key) ? datavars[_key] : '' |
| | | |
| | | if (/^date/ig.test(col.datatype) && !_val) { |
| | | _val = '1949-10-01' |
| | | } |
| | | |
| | | _param.data[0].exps.push({ |
| | | key: 'mk_' + col.field + '_mk', |
| | | value: _val |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | return _param |
| | | } |
| | | |
| | | let arrFields = btn.verify.columns.map(col => col.field).join(',') |
| | | |
| | | let param = { |
| | |
| | | // 获取字段键值对 |
| | | formlist.forEach(form => { |
| | | let _key = form.key.toLowerCase() |
| | | |
| | | if (_vars.includes(_key)) return |
| | | |
| | | _vars.push(_key) |
| | | |
| | |
| | | MKEmitter.emit('openNewTab') |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '标签页'}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '标签页'}) |
| | | // } |
| | | } |
| | | |
| | | triggerMenu = (tab) => { |
| | |
| | | MKEmitter.emit('openNewTab') |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '标签页'}) |
| | | } |
| | | // if (window.GLOB.systemType === 'production') { |
| | | // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '标签页'}) |
| | | // } |
| | | } |
| | | |
| | | render() { |
| | |
| | | } |
| | | |
| | | getFormData = (deForms) => { |
| | | if (deForms.length === 1) { |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + deForms[0].uuid)) { |
| | | this.improveBackActionForm(deForms) |
| | | } else if (deForms.length === 1) { |
| | | this.improveSimpleActionForm(deForms) |
| | | } else if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { |
| | | this.improveSimpleActionForm(deForms) |
| | |
| | | /** |
| | | * @description 获取下拉表单选项信息 |
| | | */ |
| | | improveBackActionForm = (deForms) => { |
| | | const { BID, action } = this.props |
| | | |
| | | let sysvals = { |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | id: this.state.ID || '', |
| | | bid: BID || '', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | sysvals.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let deffers = [] |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | let cache = action.setting.cache !== 'false' && !action.$cache |
| | | let skip = false |
| | | |
| | | deForms.forEach(item => { |
| | | let ex = window.GLOB.CacheData.get('sql_' + item.uuid) |
| | | |
| | | if (!ex) return |
| | | |
| | | let exps = [] |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (sysvals.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: sysvals[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let cell = { |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: item.label + '(表单)', |
| | | md5_id: '' |
| | | } |
| | | |
| | | if (item.database === 'sso' && window.GLOB.mainSystemApi) { |
| | | mainItems.push(cell) |
| | | } else { |
| | | localItems.push(cell) |
| | | } |
| | | }) |
| | | |
| | | if (localItems.length) { |
| | | deffers.push({ |
| | | $backend: true, |
| | | data: localItems |
| | | }) |
| | | } |
| | | |
| | | if (mainItems.length) { |
| | | deffers.push({ |
| | | $backend: true, |
| | | data: mainItems, |
| | | rduri: window.GLOB.mainSystemApi |
| | | }) |
| | | } |
| | | |
| | | if (!deffers.length) return |
| | | |
| | | deffers = deffers.map(item => { |
| | | return new Promise(resolve => { |
| | | Api.getSystemCacheConfig(item, cache).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | skip = true |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {...response[0], ...(response[1] || {})} |
| | | |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | this.resetFormList(result, skip) |
| | | }) |
| | | } |
| | | /** |
| | | * @description 获取下拉表单选项信息 |
| | | */ |
| | | improveActionForm = (deForms) => { |
| | | const { BID, action } = this.props |
| | | |
| | |
| | | loading: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | exec_type: window.GLOB.execType || 'y', |
| | | arr_field: arr_field, |
| | | default_sql: 'true', |
| | | custom_script: '', |
| | | menuname: config.label |
| | | } |
| | | let param = null |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + config.uuid)) { |
| | | let ex = window.GLOB.CacheData.get('sql_' + config.uuid) |
| | | let sysvals = { |
| | | time_id: Utils.getguid(), |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | id: ID || '', |
| | | bid: BID || '', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | orderby: orderBy || config.order || '', |
| | | pagesize: config.laypage === 'true' ? pageSize : '9999', |
| | | pageindex: pageIndex |
| | | } |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | sysvals.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let sql = '' |
| | | let DateCount = '' |
| | | let _search = '' |
| | | let _orderBy = orderBy || config.order || '' |
| | | let _datasource = config.dataSource |
| | | let exps = [] |
| | | |
| | | if (config.searchKey && searchKey) { |
| | | let fields = config.searchKey.split(',').map(field => field + ` like '%${searchKey}%'`) |
| | | _search = 'where ' + fields.join(' OR ') |
| | | } |
| | | if (config.searchKey) { |
| | | if (!searchKey) { |
| | | exps.push({ |
| | | key: 'mk_search', |
| | | value: [] |
| | | }) |
| | | } else { |
| | | exps.push({ |
| | | key: 'mk_search', |
| | | value: [{ |
| | | key: config.searchKey, |
| | | match: '01', |
| | | type: /,/.test(config.searchKey) ? 'text_or' : 'text', |
| | | value: searchKey |
| | | }] |
| | | }) |
| | | } |
| | | config.searchKey.split(',').forEach(key => { |
| | | sysvals[key.toLowerCase()] = searchKey || '' |
| | | }) |
| | | } |
| | | |
| | | _datasource = _datasource.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _datasource = _datasource.replace(/@ID@/ig, `'${ID || ''}'`) |
| | | |
| | | if (config.laypage === 'true') { |
| | | sql = `/*system_query*/select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` |
| | | DateCount = `/*system_query*/select count(1) as total from ${_datasource} ${_search}` |
| | | } else if (_orderBy) { |
| | | sql = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else { |
| | | sql = `/*system_query*/select ${arr_field} from ${_datasource} ${_search} ` |
| | | } |
| | | |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (sysvals.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: sysvals[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | Select @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}' |
| | | ${sql}` |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true) { |
| | | window.mkInfo(`/*${config.label} 数据源*/\n` + sql.replace(/\n\s{6}/ig, '\n')) |
| | | DateCount && window.mkInfo(`/*${config.label} 总数查询*/\n` + DateCount.replace(/\n\s{6}/ig, '\n')) |
| | | param = { |
| | | $backend: true, |
| | | data: [{ |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: '', |
| | | md5_id: '' |
| | | }] |
| | | } |
| | | } else { |
| | | param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | exec_type: window.GLOB.execType || 'y', |
| | | arr_field: arr_field, |
| | | default_sql: 'true', |
| | | custom_script: '', |
| | | menuname: config.label |
| | | } |
| | | |
| | | let sql = '' |
| | | let DateCount = '' |
| | | let _search = '' |
| | | let _orderBy = orderBy || config.order || '' |
| | | let _datasource = config.dataSource |
| | | |
| | | if (config.searchKey && searchKey) { |
| | | let fields = config.searchKey.split(',').map(field => field + ` like '%${searchKey}%'`) |
| | | _search = 'where ' + fields.join(' OR ') |
| | | } |
| | | |
| | | _datasource = _datasource.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _datasource = _datasource.replace(/@ID@/ig, `'${ID || ''}'`) |
| | | |
| | | if (config.laypage === 'true') { |
| | | sql = `/*system_query*/select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` |
| | | DateCount = `/*system_query*/select count(1) as total from ${_datasource} ${_search}` |
| | | } else if (_orderBy) { |
| | | sql = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else { |
| | | sql = `/*system_query*/select ${arr_field} from ${_datasource} ${_search} ` |
| | | } |
| | | |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | |
| | | sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | Select @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}' |
| | | ${sql}` |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true) { |
| | | window.mkInfo(`/*${config.label} 数据源*/\n` + sql.replace(/\n\s{6}/ig, '\n')) |
| | | DateCount && window.mkInfo(`/*${config.label} 总数查询*/\n` + DateCount.replace(/\n\s{6}/ig, '\n')) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(sql, param.exec_type) |
| | | param.DateCount = Utils.formatOptions(DateCount, param.exec_type) |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(sql, param.exec_type) |
| | | param.DateCount = Utils.formatOptions(DateCount, param.exec_type) |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | |
| | | let fieldMap = new Map() |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | let backMItems = [] // 云端或单点数据 |
| | | let backLItems = [] // 本地数据 |
| | | let deForms = [] // 测试系统,单个请求 |
| | | let advanceValues = [] |
| | | let linkFields = {} |
| | |
| | | let forbid = false // header中不设置高级搜索 |
| | | let _setting = {showAdv: false, show: false, style: null} |
| | | let BID = this.props.BID |
| | | let sysvals = {} |
| | | |
| | | if (window.backend) { |
| | | sysvals = { |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | bid: BID || '', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | } |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | sysvals.db = window.GLOB.externalDatabase |
| | | } |
| | | } |
| | | |
| | | if (config.wrap) { |
| | | _setting.show = config.wrap.show !== 'false' |
| | |
| | | |
| | | // 数据源查询语句 |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | let _declare = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + item.uuid)) { |
| | | let ex = window.GLOB.CacheData.get('sql_' + item.uuid) |
| | | let exps = [] |
| | | |
| | | let exec = true |
| | | if (item.checkBid) { |
| | | item.sql = _declare + _option.sql |
| | | item.arr_field = _option.field |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (sysvals.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: sysvals[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | exec = !!BID |
| | | } |
| | | let cell = { |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: item.label + '(搜索)', |
| | | md5_id: '' |
| | | } |
| | | if (item.checkBid) { |
| | | item.sqlId = ex.id |
| | | item.exps = exps |
| | | } |
| | | |
| | | if (exec) { |
| | | let _sql = _option.sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | if (item.checkBid && !BID) { |
| | | |
| | | } else if (item.database === 'sso' && window.GLOB.mainSystemApi) { |
| | | backMItems.push(cell) |
| | | } else { |
| | | backLItems.push(cell) |
| | | } |
| | | } else { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | let _declare = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` |
| | | |
| | | if (window.GLOB.debugger === true) { |
| | | window.mkInfo(_declare + _sql) |
| | | let exec = true |
| | | if (item.checkBid) { |
| | | item.sql = _declare + _option.sql |
| | | item.arr_field = _option.field |
| | | |
| | | exec = !!BID |
| | | } |
| | | |
| | | // 测试系统单个请求 |
| | | if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && !window.GLOB.systemType) { |
| | | deForms.push({ |
| | | ...item, |
| | | arr_field: _option.field, |
| | | data_sql: Utils.formatOptions(_declare + _sql, window.GLOB.execType) |
| | | }) |
| | | } else { // 合并请求,区分本地及系统 |
| | | _sql = _sql.replace(/%/ig, ' mpercent ') |
| | | if (item.database === 'sso') { |
| | | if (mainItems.length === 0) { |
| | | _sql = _declare + _sql |
| | | if (exec) { |
| | | let _sql = _option.sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | |
| | | if (window.GLOB.debugger === true) { |
| | | window.mkInfo(_declare + _sql) |
| | | } |
| | | |
| | | // 测试系统单个请求 |
| | | if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && !window.GLOB.systemType) { |
| | | deForms.push({ |
| | | ...item, |
| | | arr_field: _option.field, |
| | | data_sql: Utils.formatOptions(_declare + _sql, window.GLOB.execType) |
| | | }) |
| | | } else { // 合并请求,区分本地及系统 |
| | | _sql = _sql.replace(/%/ig, ' mpercent ') |
| | | if (item.database === 'sso') { |
| | | if (mainItems.length === 0) { |
| | | _sql = _declare + _sql |
| | | } |
| | | mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_sql))}' as LText`) |
| | | } else { |
| | | if (localItems.length === 0) { |
| | | _sql = _declare + _sql |
| | | } |
| | | localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_sql))}' as LText`) |
| | | } |
| | | mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_sql))}' as LText`) |
| | | } else { |
| | | if (localItems.length === 0) { |
| | | _sql = _declare + _sql |
| | | } |
| | | localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_sql))}' as LText`) |
| | | } |
| | | } |
| | | } |
| | |
| | | advanceValues, |
| | | searchlist: _list |
| | | }, () => { |
| | | if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { |
| | | if (window.backend && (backMItems.length > 0 || backLItems.length > 0)) { |
| | | this.improveBackSearch(backMItems, backLItems, false) |
| | | } else if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { |
| | | this.improveSimpleSearch(deForms, false, null, BID) |
| | | } else if (mainItems.length > 0 || localItems.length > 0) { |
| | | this.improveSearch(mainItems, localItems, BID) |
| | |
| | | |
| | | resetOptions = (BID) => { |
| | | let deForms = [] |
| | | let backMItems = [] // 云端或单点数据 |
| | | let backLItems = [] // 本地数据 |
| | | let searchlist = fromJS(this.state.searchlist).toJS().map(item => { |
| | | if (item.checkBid) { |
| | | let sql = item.sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | |
| | | if (window.GLOB.debugger === true) { |
| | | window.mkInfo(sql) |
| | | } |
| | | if (window.backend && item.sqlId) { |
| | | let cell = { |
| | | id: item.sqlId, |
| | | menuname: item.label + '(搜索)', |
| | | md5_id: '', |
| | | exps: item.exps.map(n => { |
| | | if (n.key === 'BID') { |
| | | n.value = BID |
| | | } |
| | | return n |
| | | }) |
| | | } |
| | | |
| | | deForms.push({ |
| | | ...item, |
| | | arr_field: item.arr_field, |
| | | data_sql: Utils.formatOptions(sql, window.GLOB.execType) |
| | | }) |
| | | if (item.database === 'sso' && window.GLOB.mainSystemApi) { |
| | | backMItems.push(cell) |
| | | } else { |
| | | backLItems.push(cell) |
| | | } |
| | | } else { |
| | | let sql = item.sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | |
| | | if (window.GLOB.debugger === true) { |
| | | window.mkInfo(sql) |
| | | } |
| | | |
| | | deForms.push({ |
| | | ...item, |
| | | arr_field: item.arr_field, |
| | | data_sql: Utils.formatOptions(sql, window.GLOB.execType) |
| | | }) |
| | | } |
| | | } else if (item.checkShift) { |
| | | let d = '' |
| | | if (window.GLOB.CacheData.has(item.$supId)) { |
| | |
| | | return item |
| | | }) |
| | | |
| | | if (deForms.length > 0) { |
| | | if (window.backend && (backMItems.length > 0 || backLItems.length > 0)) { |
| | | this.improveBackSearch(backMItems, backLItems, true, searchlist) |
| | | } else if (deForms.length > 0) { |
| | | this.improveSimpleSearch(deForms, true, searchlist, BID) |
| | | } else { |
| | | this.setState({ |
| | |
| | | delete result.status |
| | | |
| | | this.resetSearch(result, false) |
| | | }) |
| | | } |
| | | |
| | | // 查询下拉菜单 |
| | | improveBackSearch = (mainItems, localItems, trigger, searchlist) => { |
| | | let deffers = [] |
| | | |
| | | if (localItems.length) { |
| | | deffers.push({ |
| | | $backend: true, |
| | | data: localItems |
| | | }) |
| | | } |
| | | |
| | | if (mainItems.length) { |
| | | deffers.push({ |
| | | $backend: true, |
| | | data: mainItems, |
| | | rduri: window.GLOB.mainSystemApi |
| | | }) |
| | | } |
| | | |
| | | deffers = deffers.map(item => { |
| | | return new Promise(resolve => { |
| | | Api.getSystemCacheConfig(item).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {...response[0], ...(response[1] || {})} |
| | | |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | this.resetSearch(result, trigger, searchlist) |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if (typeof(val) === 'string') { |
| | | val = val.replace(/(^\s*|\s*$)/ig, '') |
| | | val = val.replace(/(^\s+|\s+$)/ig, '').replace(/\t+|\v+/g, '') |
| | | } |
| | | |
| | | search.push({ |
| | |
| | | </Col> |
| | | <Col span={10}> |
| | | <Form.Item label="报错字段" style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | errorcode(增加后缀NT表示数据不回滚,如ENT、NNT、FNT、NMNT、CNT、-2NT), retmsg |
| | | errorcode, retmsg |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24} className="sqlfield"> |
| | |
| | | <Row gutter={24}> |
| | | {!type ? <Col span={8}> |
| | | <Form.Item label="报错字段" style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | errorcode(增加后缀NT表示数据不回滚,如ENT、NNT、FNT、NMNT、CNT、-2NT), retmsg |
| | | errorcode, retmsg |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!type ? <Col span={24} className="sqlfield"> |
| | |
| | | } else if (type === 'dateweek' || type === 'daterange' || type === 'range') { |
| | | reOptions.match = matchReg.class5 |
| | | } else if (type === 'checkcard') { |
| | | if (this.record.multiple === 'false') { |
| | | if (this.record.multiple === 'false' || this.record.multiple === 'dropdown') { |
| | | reOptions.match = matchReg.class1 |
| | | } else if (this.record.multiple === 'true') { |
| | | reOptions.match = matchReg.class3 |
| | |
| | | } |
| | | } catch (e) { |
| | | // 通过sql语句添加字段集 |
| | | if (/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int)/ig.test(values.config)) { |
| | | if (/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int|datetime|date)/ig.test(values.config)) { |
| | | _config = { |
| | | key: 'datasourcefield', |
| | | type: 'array', |
| | | data: [] |
| | | } |
| | | |
| | | let list = values.config.match(/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int)/ig) |
| | | let list = values.config.match(/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int|datetime|date)/ig) |
| | | |
| | | list.forEach(item => { |
| | | _config.data.unshift({ |
| | |
| | | let temps = [] |
| | | if (res.template_list) { |
| | | temps = res.template_list.filter(item => { |
| | | if (!item.primary_industry || sysTempsIds.includes(item.template_id)) return false |
| | | if (!item.content || item.content.length < 25 || sysTempsIds.includes(item.template_id)) return false |
| | | if (item.content) { |
| | | item.content = item.content.replace('{{first.DATA}}\n', '').replace('\n{{remark.DATA}}', '') |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取发送外部消息 |
| | | */ |
| | | export function getOutMessage (config) { |
| | | let message = 'false' |
| | | |
| | | let filterBtn = (cell) => { |
| | | if (['pop', 'exec', 'form', 'prompt', 'formSubmit'].includes(cell.OpenType) && cell.verify) { |
| | | if (cell.verify.noteEnable === 'true' || cell.verify.wxNote === 'true' || cell.verify.emailEnable === 'true') { |
| | | message = 'true' |
| | | } |
| | | } |
| | | } |
| | | |
| | | let traversal = (components) => { |
| | | if (!components || message === 'true') return |
| | | |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | traversal(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | traversal(item.components) |
| | | } else { |
| | | if (item.action) { |
| | | item.action.forEach(cell => { |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(group => { |
| | | filterBtn(group.subButton) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | traversal(config.components) |
| | | |
| | | return message |
| | | } |
| | | |
| | | /** |
| | | * @description 检测组件内容 |
| | | */ |
| | | export function checkComponent (card) { |
| | |
| | | let _quot = sql.match(/'{1}/g) |
| | | let _lparen = sql.match(/\({1}/g) |
| | | let _rparen = sql.match(/\){1}/g) |
| | | let _ch_b = sql.match(/\$check@/ig) |
| | | let _ch_d = sql.match(/@check\$/ig) |
| | | let _m_b = sql.match(/\$@/ig) |
| | | let _m_d = sql.match(/@\$/ig) |
| | | |
| | | _quot = _quot ? _quot.length : 0 |
| | | _lparen = _lparen ? _lparen.length : 0 |
| | | _rparen = _rparen ? _rparen.length : 0 |
| | | _ch_b = _ch_b ? _ch_b.length : 0 |
| | | _ch_d = _ch_d ? _ch_d.length : 0 |
| | | _m_b = _m_b ? _m_b.length : 0 |
| | | _m_d = _m_d ? _m_d.length : 0 |
| | | |
| | | if (_quot % 2 !== 0) { |
| | | notification.warning({ |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'sql中()必须成对出现', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (_ch_b !== _ch_d) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'sql中 $check@ 与 @check$ 必须成对出现', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (_m_b !== _m_d) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'sql中 $@ 与 @$ 必须成对出现', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | |
| | | let urlFields = config.urlFields |
| | | let appType = sessionStorage.getItem('appType') |
| | | let process = config.process === 'true' |
| | | let sysVars = ['loginuid', 'sessionuid', 'userid', 'appkey', 'lang', 'username', 'fullname', 'menuname'] |
| | | |
| | | if (urlFields) { |
| | | urlFields = urlFields.map(n => n.toLowerCase()) |
| | | } |
| | | |
| | | let filterComponent = (components, mainSearch) => { |
| | | let callback = ` |
| | | COMMIT TRAN |
| | | set NOCOUNT ON |
| | | RETURN |
| | | END TRY |
| | | BEGIN CATCH |
| | | ROLLBACK TRAN |
| | | DECLARE @ErrorMessage NVARCHAR(4000); |
| | | DECLARE @ErrorSeverity INT; |
| | | DECLARE @ErrorState INT; |
| | | |
| | | set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) |
| | | set @retmsg=ERROR_MESSAGE(); |
| | | select @ErrorMessage=ERROR_MESSAGE(), @ErrorSeverity=ERROR_SEVERITY(), @ErrorState=ERROR_STATE(); |
| | | |
| | | RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState); |
| | | END CATCH |
| | | |
| | | aaa: |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | GOTO_RETURN: |
| | | ROLLBACK TRAN` |
| | | |
| | | let filterComponent = (components, mainSearch, label = '') => { |
| | | components.forEach(item => { |
| | | item.$menuname = (config.MenuName || '') + label + '-' + (item.name || '') |
| | | |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | let _mainSearch = mainSearch || [] |
| | |
| | | _mainSearch = com.search || [] |
| | | }) |
| | | } |
| | | filterComponent(tab.components, _mainSearch) |
| | | filterComponent(tab.components, _mainSearch, label) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | filterComponent(item.components, mainSearch) |
| | | filterComponent(item.components, mainSearch, label) |
| | | } else { |
| | | if (item.wrap && item.setting) { |
| | | if (item.wrap.datatype === 'public' || item.wrap.datatype === 'static') { |
| | |
| | | if (appType !== 'mob' && item.search && item.search.length > 0) { |
| | | item.search.forEach(cell => { |
| | | if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { |
| | | let msg = getFormSql(cell) |
| | | let msg = getFormSql(cell, '搜索') |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'sForm', ...msg}) |
| | | } |
| | |
| | | item.setting.laypage = 'false' |
| | | item.setting.$top = true |
| | | } |
| | | item.setting.$name = item.$menuname || '' |
| | | |
| | | let msg = getDataSource(item, mainSearch) |
| | | |
| | |
| | | }) |
| | | } else if (item.subtype === 'editable' && col.editable === 'true') { |
| | | if (col.editType === 'select' && col.resourceType === '1') { |
| | | let msg = getFormSql(col) |
| | | let msg = getFormSql(col, '表单') |
| | | |
| | | sqls.push({uuid: col.uuid, type: 'tbForm', ...msg}) |
| | | } else if (col.editType === 'popSelect') { |
| | |
| | | getCols(item.cols) |
| | | |
| | | if (item.subtype === 'editable' && item.submit.intertype === 'system') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | let msg = getEditTableSql(item.submit, item.cols, item.columns) |
| | | |
| | | sqls.push({uuid: 'submit_' + item.uuid, type: 'editable', ...msg}) |
| | |
| | | } |
| | | |
| | | let resetButton = (item, cell, isback) => { |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | |
| | | if (['exec', 'prompt', 'pop', 'form', 'formSubmit'].includes(cell.OpenType)) { |
| | | if (cell.intertype === 'system' || cell.procMode === 'system') { // 系统接口 |
| | | if (cell.verify && cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) { |
| | | cell.returnValue = 'true' |
| | | } |
| | | if (item.subtype === 'dualdatacard' && isback) { |
| | | let _item = fromJS(item).toJS() |
| | | _item.columns = _item.subColumns || [] |
| | |
| | | cell.modal.fields.forEach(form => { |
| | | // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单 |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(form.type) && form.resourceType === '1') { |
| | | let msg = getFormSql(form) |
| | | let msg = getFormSql(form, '表单') |
| | | |
| | | sqls.push({uuid: form.uuid, type: 'form', ...msg}) |
| | | } else if (form.type === 'popSelect') { |
| | |
| | | } else if (cell.OpenType === 'funcbutton') { |
| | | if (cell.funcType === 'print') { |
| | | if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { |
| | | let msg = getPrintSql(cell) |
| | | let msg = getPrintSql(cell, item) |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'print', ...msg}) |
| | | } |
| | |
| | | cell.modal.fields.forEach(form => { |
| | | // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单 |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(form.type) && form.resourceType === '1') { |
| | | let msg = getFormSql(form) |
| | | let msg = getFormSql(form, '表单') |
| | | |
| | | sqls.push({uuid: form.uuid, type: 'form', ...msg}) |
| | | } else if (form.type === 'popSelect') { |
| | |
| | | }) |
| | | } |
| | | |
| | | filterComponent(cell.config.components, _mainSearch) |
| | | filterComponent(cell.config.components, _mainSearch, '-' + cell.label) |
| | | } |
| | | } |
| | | } |
| | | |
| | | let getSearches = (searches) => { |
| | | let sFields = [] |
| | | let query = false |
| | | searches.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | |
| | | } else { |
| | | sFields.push(item.field) |
| | | } |
| | | |
| | | if (query) return |
| | | |
| | | query = item.query !== 'false' |
| | | }) |
| | | |
| | | return { sFields, query } |
| | | return sFields |
| | | } |
| | | |
| | | let getSysDefaultSql = (btn, component) => { |
| | |
| | | |
| | | if (verify.workFlow === 'true' && process) { |
| | | if (verify.flowType === 'start') { |
| | | _sql = _sql.replace(/@start_type@/ig, `'开始'`) |
| | | // works_flow_error 流程错误 |
| | | let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'start_type'] |
| | | let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade'] |
| | | worksReFields.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | } else { |
| | | _sql = _sql.replace(/@check_type@/ig, verify.flowType === 'reject' ? `'驳回'` : `'审核'`) |
| | | _sql = _sql.replace(/@notice_type@/ig, `'抄送'`) |
| | | // works_flow_error 流程错误 |
| | | // works_flow_countersign 会签/或签标记 会签为 Y |
| | | // works_begin_branch 驳回至开始分支(line.mknode === 'startEdge') |
| | | // works_flow_sign_field 会签 标记字段 statuscharone/statuschartwo/statuscharthree/statuscharfour/statuscharfive |
| | | // works_flow_sign_label 会签 标记值 ***/***/已审核 |
| | | // works_flow_sign_values 会签标记拼接值(除本人外) |
| | | let worksReFields = ['works_flow_error', 'works_flow_countersign', 'works_flow_sign_values', 'works_begin_branch', 'works_flow_sign_label', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'check_type', 'notice_type', 'check_userids', 'notice_userids', 'works_flow_sign'] |
| | | let worksReFields = ['works_flow_error', 'works_flow_countersign', 'works_flow_sign_values', 'works_begin_branch', 'works_flow_sign_label', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'check_userids', 'notice_userids', 'works_flow_sign'] |
| | | worksReFields.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (btn.procMode === 'system') { |
| | | // if (btn.procMode === 'system' || btn.returnValue === 'true') { |
| | | // _sql += ` |
| | | // aaa: if @ErrorCode!='' |
| | | // insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@` |
| | | // } else if (btn.output) { |
| | | // _sql += ` |
| | | // aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | // } else { |
| | | // _sql += ` |
| | | // aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | // } |
| | | |
| | | if (/@ErrorCode='(ENT|NNT|FNT|NMNT|CNT|-2NT)'/ig.test(_sql)) { |
| | | _sql = _sql.replace(/@ErrorCode='(ENT|NNT|FNT|NMNT|CNT|-2NT)'[\S\s]+\sgoto\s+aaa($|\s)/ig, (word) => { |
| | | return word.replace(/goto aaa/, 'goto mk_ent') |
| | | }) |
| | | _sql += ` |
| | | aaa: if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@` |
| | | if 1=2 |
| | | begin |
| | | mk_ent: |
| | | set @ErrorCode=left(@ErrorCode,1) |
| | | end |
| | | ` |
| | | } |
| | | |
| | | if (btn.procMode === 'system' || btn.returnValue === 'true') { |
| | | _sql += callback |
| | | } else if (btn.output) { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id |
| | | ${callback} |
| | | ` |
| | | } else { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ${callback} |
| | | ` |
| | | } |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | |
| | | |
| | | let reps = [] |
| | | let decSql = [`@tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50),@mk_deleted int,@bid nvarchar(50)`] |
| | | let secSql = [`@ErrorCode='',@retmsg='', @BillCode='',@BVoucher='',@FIBVoucherDate='',@FiYear='',@ModularDetailCode='', @mk_deleted=1, @bid=@BID@`] |
| | | let secSql = [`@ErrorCode='S',@retmsg='', @BillCode='',@BVoucher='',@FIBVoucherDate='',@FiYear='',@ModularDetailCode='', @mk_deleted=1, @bid=@BID@`] |
| | | |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { |
| | |
| | | |
| | | decSql = [...decSql, ..._declares] |
| | | |
| | | _sql = `Declare ${decSql.join(',')} |
| | | // INSERT INTO s_paas_api_log (appkey,api_name,api_count,menuname,createuserid,createuser,createstaff,cdefine1,cdefine2) |
| | | // SELECT @appkey@,'sPC_TableData_InUpDe',1,@menuname@,@UserID@,@username@,@fullname@,@SessionUid@,@LoginUID@ |
| | | _sql = `/* ${btn.logLabel} */ |
| | | BEGIN TRY |
| | | begin TRAN |
| | | |
| | | Declare ${decSql.join(',')} |
| | | /* 凭证及用户信息初始化赋值 */ |
| | | select ${secSql.join(',')} |
| | | ${_sql} |
| | | ` |
| | | _sql = _sql.replace(/\n\s{8,10}/g, '\n') |
| | | _sql = _sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(_sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | let map = new Map() |
| | | reps.push(...sysVars) |
| | | reps = reps.filter(n => { |
| | | if (map.has(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | map.set(n.toLowerCase(), true) |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | |
| | | _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | |
| | | if (/\$check@|@check\$/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$check@/ig, '@mk_check_begin@').replace(/@check\$/ig, '@mk_check_end@') |
| | | reps.push('mk_check_begin', 'mk_check_end') |
| | | if (btn.procMode === 'system') { |
| | | if (/\$check@|@check\$/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | } else { |
| | | if (/\$check@|@check\$/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$check@/ig, '@mk_check_begin@').replace(/@check\$/ig, '@mk_check_end@') |
| | | reps.push('mk_check_begin', 'mk_check_end') |
| | | } |
| | | } |
| | | if (/@db@/ig.test(_sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | reps = Array.from(new Set([...reps, ...colreps])) |
| | | _sql = _sql.replace(/\n\x20{8,10}/g, '\n').replace(/\n{3,}/g, '\n\n').replace(/^\s+|\s+$/g, '').replace(/\t+|\v+/g, '') |
| | | |
| | | reps = reps.filter(n => { |
| | | if (sysVars.includes(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps = [...reps, ...colreps] |
| | | |
| | | return { LText: _sql, reps } |
| | | return { LText: _sql, md5: md5(_sql), reps } |
| | | } |
| | | |
| | | let getSysBackSql = (btn, component) => { |
| | |
| | | } |
| | | |
| | | _sql += ` |
| | | ${_prev} |
| | | /* 外部接口入参 */ |
| | | @mk_outer_params@ |
| | | ${_back} |
| | | ` |
| | | ${_prev} |
| | | /* 外部接口入参 */ |
| | | @mk_outer_params@ |
| | | ${_back} |
| | | ` |
| | | |
| | | // if (btn.output) { |
| | | // _sql += ` |
| | | // aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | // } else { |
| | | // _sql += ` |
| | | // aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | // } |
| | | if (/@ErrorCode='(ENT|NNT|FNT|NMNT|CNT|-2NT)'/ig.test(_sql)) { |
| | | _sql = _sql.replace(/@ErrorCode='(ENT|NNT|FNT|NMNT|CNT|-2NT)'[\S\s]+\sgoto\s+aaa($|\s)/ig, (word) => { |
| | | return word.replace(/goto aaa/, 'goto mk_ent') |
| | | }) |
| | | _sql += ` |
| | | if 1=2 |
| | | begin |
| | | mk_ent: |
| | | set @ErrorCode=left(@ErrorCode,1) |
| | | end |
| | | ` |
| | | } |
| | | if (btn.output) { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id |
| | | ${callback} |
| | | ` |
| | | } else { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ${callback} |
| | | ` |
| | | } |
| | | |
| | | let syses = ['tbid', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'mk_deleted', 'bid', 'UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`] |
| | | let secSql = [`@ErrorCode='',@retmsg=''`] |
| | | let secSql = [`@ErrorCode='S',@retmsg=''`] |
| | | |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { |
| | |
| | | |
| | | decSql = [...decSql, ..._declares] |
| | | |
| | | _sql = `Declare ${decSql.join(',')} |
| | | _sql = `/* ${btn.logLabel}(回调) */ |
| | | BEGIN TRY |
| | | begin TRAN |
| | | |
| | | Declare ${decSql.join(',')} |
| | | /* 初始化赋值 */ |
| | | select ${secSql.join(',')} |
| | | ${_sql} |
| | | ` |
| | | |
| | | _sql = _sql.replace(/\n\s{8,10}/g, '\n') |
| | | _sql = _sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(_sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | let map = new Map() |
| | | reps.push(...sysVars) |
| | | reps = reps.filter(n => { |
| | | if (map.has(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | map.set(n.toLowerCase(), true) |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | |
| | | reps.push('db') |
| | | } |
| | | |
| | | reps = Array.from(new Set([...reps, ...colreps])) |
| | | _sql = _sql.replace(/\n\x20{8,10}/g, '\n').replace(/\n{3,}/g, '\n\n').replace(/^\s+|\s+$/g, '').replace(/\t+|\v+/g, '') |
| | | |
| | | return { LText: _sql, reps, tbs: tables } |
| | | reps = reps.filter(n => { |
| | | if (sysVars.includes(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps = [...reps, ...colreps] |
| | | |
| | | return { LText: _sql, md5: md5(_sql), reps, tbs: tables } |
| | | } |
| | | |
| | | let getDataSource = (item, mainSearch = []) => { |
| | | let getDataSource = (item, mainSearch = [], type) => { |
| | | if (!item.setting || item.setting.interType !== 'system') return |
| | | |
| | | let searches = item.search || [] |
| | |
| | | searches = [...searches, ...mainSearch] |
| | | } |
| | | item.$searches = fromJS(searches).toJS() |
| | | let { sFields, query } = getSearches(searches) |
| | | let sFields = getSearches(searches) |
| | | |
| | | let _columns = [] |
| | | if (item.subtype === 'dualdatacard') { |
| | |
| | | } |
| | | }) |
| | | |
| | | // if (_customScript || _tailScript) { |
| | | // _tailScript += `${_tailScript} |
| | | // aaa: |
| | | // if @ErrorCode!='' |
| | | // insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | // ` |
| | | // } |
| | | |
| | | let _search = '' |
| | | if (item.setting.execute !== 'false') { |
| | | _dataresource = item.setting.dataresource || '' |
| | | _search = '@mk_search@' |
| | | } |
| | | |
| | | if (type === 'print') { |
| | | _search = '' |
| | | } |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | |
| | | |
| | | item.setting.dataresource = _dataresource |
| | | item.setting.customScript = _customScript |
| | | |
| | | let _search = '@search@' |
| | | if (item.setting.queryType === 'statistics' || !query) { |
| | | _search = '' |
| | | } |
| | | |
| | | let testSql = _dataresource + _customScript + _tailScript |
| | | |
| | | let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`] |
| | | let secSql = [`@ErrorCode='',@retmsg =''`] |
| | | let secSql = [`@ErrorCode='S',@retmsg =''`] |
| | | |
| | | let reps = [] |
| | | if (_customScript || _tailScript) { |
| | | reps.push('UserID', 'time_id') |
| | | } |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | syses.forEach(s => { |
| | |
| | | } |
| | | }) |
| | | |
| | | decSql = `declare ${decSql.join(',')} |
| | | select ${secSql.join(',')}` |
| | | decSql = `declare ${decSql.join(',')}${type === 'print' ? '@mk_print_declare@' : ''} |
| | | select ${secSql.join(',')}${type === 'print' ? '@mk_print_select@' : ''}` |
| | | |
| | | // 不需要单引号:orderBy、pageSize、pageIndex、db |
| | | let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'ID', 'BID', 'time_id', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'datam', 'typename'] |
| | | let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'ID', 'BID', 'time_id', 'datam', 'typename'] |
| | | |
| | | if (item.hasExtend) { |
| | | regs.push('mk_time') |
| | |
| | | let LText = '' |
| | | let DateCount = '' |
| | | if (_dataresource) { |
| | | /*system_query*/ |
| | | if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql)) { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | LText = `select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } else if (item.setting.laypage === 'true' && item.setting.order) { |
| | | LText = `/*system_query*/select top @pageSize@ ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${_dataresource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` |
| | | LText = `select top @pageSize@ ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${_dataresource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` |
| | | reps.push('pageSize', 'orderBy', 'pageIndex') |
| | | if (item.subtype === 'dualdatacard') { |
| | | DateCount = `/*system_query*/select count(1) as total from (select distinct ${item.setting.primaryKey || 'ID'} from ${_dataresource} ${_search})a` |
| | | DateCount = `select count(1) as total from (select distinct ${item.setting.primaryKey || 'ID'} from ${_dataresource} ${_search})a` |
| | | } else { |
| | | DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` |
| | | DateCount = `select count(1) as total from ${_dataresource} ${_search}` |
| | | } |
| | | } else if (item.setting.$top) { |
| | | if (item.setting.order) { |
| | | LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} order by @orderBy@ ` |
| | | LText = `select top 1 ${arr_field} from ${_dataresource} ${_search} order by @orderBy@ ` |
| | | reps.push('orderBy') |
| | | } else { |
| | | LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} ` |
| | | LText = `select top 1 ${arr_field} from ${_dataresource} ${_search} ` |
| | | } |
| | | } else if (item.setting.$fixOrder) { |
| | | LText = `select ${arr_field} from ${_dataresource} ${_search} order by ${item.setting.order} ` |
| | | } else if (item.setting.order) { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} order by @orderBy@ ` |
| | | LText = `select ${arr_field} from ${_dataresource} ${_search} order by @orderBy@ ` |
| | | reps.push('orderBy') |
| | | } else { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | LText = `select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } |
| | | } |
| | | |
| | | if (_customScript) { |
| | | _customScript = `${decSql} |
| | | ${_customScript} |
| | | let sub_name = '' |
| | | let tabid = '' |
| | | let parid = '' |
| | | let sub_field = '' |
| | | |
| | | if (item.subtype === 'dualdatacard') { |
| | | arr_field = item.columns.map(col => col.field).join(',') |
| | | sub_name = item.setting.subdata |
| | | tabid = item.setting.primaryKey || '' |
| | | parid = item.setting.subBID || '' |
| | | sub_field = item.subColumns.map(col => col.field).join(',') |
| | | } |
| | | |
| | | // INSERT INTO s_paas_api_log (appkey,api_name,api_count,menuname,createuserid,createuser,createstaff,cdefine1,cdefine2) |
| | | // SELECT @appkey@,'sPC_Get_TableData',1,@menuname@,@UserID@,@username@,@fullname@,@SessionUid@,@LoginUID@ |
| | | let sql = '' |
| | | |
| | | if (item.setting.transact === 'true') { |
| | | sql = `/* ${item.setting.$name} */ |
| | | BEGIN TRY |
| | | begin TRAN |
| | | |
| | | SELECT obj_name='@mk_obj_name@',prm_field='',str_field='', |
| | | arr_field='${arr_field}',tabid='${tabid}',parid='${parid}',sub_name='${sub_name}',sub_field='${sub_field}' |
| | | ` |
| | | if (DateCount) { |
| | | DateCount = `${DateCount} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode,@retmsg,@UserID@ |
| | | ` |
| | | } else if (LText) { |
| | | LText = `${LText} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode,@retmsg,@UserID@ |
| | | ` |
| | | } else { |
| | | _customScript = `${_customScript} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } |
| | | } else if (_tailScript && DateCount) { |
| | | LText = `${decSql} |
| | | ${LText} |
| | | ` |
| | | DateCount = `${DateCount} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } else if (_tailScript) { |
| | | LText = `${decSql} |
| | | ${LText} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | |
| | | _tailScript += `${_tailScript} |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ${callback} |
| | | ` |
| | | } else { |
| | | LText = `${decSql} |
| | | ${LText} |
| | | sql = `/* ${item.setting.$name} */ |
| | | SELECT obj_name='@mk_obj_name@',prm_field='',str_field='', |
| | | arr_field='${arr_field}',tabid='${tabid}',parid='${parid}',sub_name='${sub_name}',sub_field='${sub_field}' |
| | | ` |
| | | |
| | | _tailScript += `${_tailScript} |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ` |
| | | } |
| | | |
| | | reps = Array.from(new Set(reps)) |
| | | if (DateCount) { |
| | | sql += `UNION ALL |
| | | SELECT obj_name='DateCount',prm_field='total',str_field='', |
| | | arr_field='',tabid='',parid='',sub_name='',sub_field='' |
| | | ` |
| | | } |
| | | // sql += `UNION ALL |
| | | // SELECT obj_name='mk_error_code',prm_field='ErrorCode,retmsg',str_field='', |
| | | // arr_field='',tabid='',parid='',sub_name='',sub_field='' |
| | | // ` |
| | | sql += ` |
| | | ${decSql} |
| | | ${_customScript} |
| | | ${LText} |
| | | ${DateCount} |
| | | ${_tailScript} |
| | | ` |
| | | |
| | | // LText = LText.replace(/\n\s{6,8}/g, '\n') |
| | | // DateCount = DateCount.replace(/\n\s{6,8}/g, '\n') |
| | | // _customScript = _customScript.replace(/\n\s{6,8}/g, '\n') |
| | | // LText = LText.replace(/\n\s+\/\*/g, `\n/*`) |
| | | // DateCount = DateCount.replace(/\n\s+\/\*/g, `\n/*`) |
| | | // _customScript = _customScript.replace(/\n\s+\/\*/g, `\n/*`) |
| | | let map = new Map() |
| | | reps.push(...sysVars) |
| | | reps = reps.filter(n => { |
| | | if (map.has(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | map.set(n.toLowerCase(), true) |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | if (['orderBy', 'pageSize', 'pageIndex'].includes(n)) return |
| | | |
| | | LText = LText.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | DateCount = DateCount.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | _customScript = _customScript.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | if (/\$@/ig.test(testSql)) { |
| | | LText = LText.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | DateCount = DateCount.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | _customScript = _customScript.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(testSql)) { |
| | | if (/@db@/ig.test(sql)) { |
| | | reps.push('db') |
| | | } |
| | | reps.push('mk_obj_name') |
| | | |
| | | // let sql = '' |
| | | // let sub_name = '' |
| | | // let tabid = '' |
| | | // let parid = '' |
| | | // let sub_field = '' |
| | | sql = sql.replace(/\n\x20{6,8}/g, '\n').replace(/\n{3,}/g, '\n\n').replace(/^\s+|\s+$/g, '').replace(/\t+|\v+/g, '') |
| | | |
| | | // if (item.subtype === 'dualdatacard') { |
| | | // arr_field = item.columns.map(col => col.field).join(',') |
| | | // sub_name = item.setting.subdata |
| | | // tabid = item.setting.primaryKey || '' |
| | | // parid = item.setting.subBID || '' |
| | | // sub_field = item.subColumns.map(col => col.field).join(',') |
| | | // } |
| | | reps = reps.filter(n => { |
| | | if (sysVars.includes(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | // sql += ` |
| | | // SELECT obj_name='data',prm_field='',str_field='', |
| | | // arr_field='${arr_field}',tabid='${tabid}',parid='${parid}',sub_name='${sub_name}',sub_field='${sub_field}' |
| | | // ` |
| | | return true |
| | | }) |
| | | |
| | | // if (DateCount) { |
| | | // sql += `UNION ALL |
| | | // SELECT obj_name='DateCount',prm_field='total',str_field='', |
| | | // arr_field='',tabid='',parid='',sub_name='',sub_field='' |
| | | // ` |
| | | // } |
| | | |
| | | return {LText, DateCount, customScript: _customScript, reps} |
| | | return {LText: sql, md5: md5(sql), reps, luser: /@userid@/ig.test(testSql)} |
| | | } |
| | | |
| | | let getExcelInSql = (item) => { |
| | |
| | | ` |
| | | } |
| | | |
| | | sql = `create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50)) |
| | | sql = `/* ${item.logLabel} */ |
| | | BEGIN TRY |
| | | begin TRAN |
| | | |
| | | create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50)) |
| | | Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)@mk_init_declare@ |
| | | |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | Select @ErrorCode='S',@retmsg=''@mk_init_select@ |
| | | ${_initCustomScript} |
| | | |
| | | Insert into #${sheet} (${fields},jskey,BID) |
| | |
| | | ${_uniquesql} |
| | | ${_prevCustomScript} |
| | | ${_insert}` |
| | | |
| | | let mk_ent = '' |
| | | if (/@ErrorCode='(ENT|NNT|FNT|NMNT|CNT|-2NT)'/ig.test(sql + _backCustomScript)) { |
| | | mk_ent = ` |
| | | if 1=2 |
| | | begin |
| | | mk_ent: |
| | | set @ErrorCode=left(@ErrorCode,1) |
| | | end |
| | | ` |
| | | } |
| | | |
| | | if (btn.workFlow === 'true' && process) { |
| | | if (btn.flowSql === 'true') { |
| | |
| | | ${_backCustomScript} |
| | | |
| | | drop table #${sheet} |
| | | ${mk_ent} |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ${callback}` |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | sql = sql.replace(/@start_type@/ig, `'开始'`) |
| | | // works_flow_error 流程错误 |
| | | let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'start_type'] |
| | | let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade'] |
| | | worksReFields.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | |
| | | ${_backCustomScript} |
| | | |
| | | drop table #${sheet} |
| | | ${mk_ent} |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ${callback}` |
| | | } |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | if (/@ErrorCode='(ENT|NNT|FNT|NMNT|CNT|-2NT)'/ig.test(sql)) { |
| | | sql = sql.replace(/@ErrorCode='(ENT|NNT|FNT|NMNT|CNT|-2NT)'[\S\s]+\sgoto\s+aaa($|\s)/ig, (word) => { |
| | | return word.replace(/goto aaa/, 'goto mk_ent') |
| | | }) |
| | | } |
| | | |
| | | let reps = [] |
| | |
| | | sql = sql.replace(/@mk_init_declare@/ig, decSql) |
| | | sql = sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(sql)) { |
| | |
| | | } |
| | | }) |
| | | |
| | | let map = new Map() |
| | | reps.push(...sysVars) |
| | | reps = reps.filter(n => { |
| | | if (map.has(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | map.set(n.toLowerCase(), true) |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | sql = sql.replace(/\n\s{6,10}/g, '\n') |
| | | sql = sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/\$check@|@check\$/ig.test(sql)) { |
| | | sql = sql.replace(/\$check@/ig, '@mk_check_begin@').replace(/@check\$/ig, '@mk_check_end@') |
| | | reps.push('mk_check_begin', 'mk_check_end') |
| | | } |
| | | if (/@db@/ig.test(sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: sql, reps} |
| | | sql = sql.replace(/\n\x20{6,10}/g, '\n').replace(/\n{3,}/g, '\n\n').replace(/^\s+|\s+$/g, '').replace(/\t+|\v+/g, '') |
| | | |
| | | reps = reps.filter(n => { |
| | | if (sysVars.includes(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | return {LText: sql, md5: md5(sql), reps} |
| | | } |
| | | |
| | | let getEditTableSql = (btn, cols, columns) => { |
| | |
| | | ` |
| | | } |
| | | |
| | | sql = `create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(256)) |
| | | sql = `/* ${btn.logLabel} */ |
| | | BEGIN TRY |
| | | begin TRAN |
| | | |
| | | create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(256)) |
| | | Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)@mk_init_declare@ |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | Select @ErrorCode='S',@retmsg=''@mk_init_select@ |
| | | |
| | | ${_initCustomScript} |
| | | Insert into #${sheet} (${fields},jskey,data_type,BID) |
| | |
| | | |
| | | drop table #${sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ${callback}` |
| | | |
| | | let reps = [] |
| | | let decSql = [] |
| | |
| | | sql = sql.replace(/@mk_init_declare@/ig, decSql) |
| | | sql = sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | let regs = ['BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | let regs = ['BID', 'time_id', 'datam', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(sql)) { |
| | |
| | | } |
| | | }) |
| | | |
| | | let map = new Map() |
| | | reps.push(...sysVars) |
| | | reps = reps.filter(n => { |
| | | if (map.has(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | map.set(n.toLowerCase(), true) |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | sql = sql.replace(/\n\s{6,10}/g, '\n') |
| | | sql = sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: sql, reps} |
| | | sql = sql.replace(/\n\x20{6,10}/g, '\n').replace(/\n{3,}/g, '\n\n').replace(/^\s+|\s+$/g, '').replace(/\t+|\v+/g, '') |
| | | |
| | | reps = reps.filter(n => { |
| | | if (sysVars.includes(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | return {LText: sql, md5: md5(sql), reps} |
| | | } |
| | | |
| | | let getExcelOutSql = (btn, component) => { |
| | |
| | | item.setting.queryType = btn.verify.queryType |
| | | item.setting.laypage = btn.pagination |
| | | item.setting.order = btn.verify.order || '' |
| | | item.setting.$name = btn.logLabel || '' |
| | | |
| | | if (btn.Ot === 'requiredOnce') { |
| | | item.setting.primaryKey = btn.verify.primaryKey || component.setting.primaryKey || 'ID' |
| | |
| | | return msg |
| | | } |
| | | |
| | | let getPrintSql = (btn) => { |
| | | let getPrintSql = (btn, component) => { |
| | | let item = {setting: {}, columns: btn.verify.columns || [], search: [], useMSearch: 'false'} |
| | | |
| | | item.setting.interType = 'system' |
| | |
| | | item.setting.queryType = btn.verify.setting.queryType |
| | | item.setting.laypage = 'false' |
| | | item.setting.order = btn.verify.setting.order || '' |
| | | item.setting.$name = btn.logLabel || '' |
| | | item.setting.transact = 'true' |
| | | item.setting.$fixOrder = true |
| | | |
| | | item.scripts = btn.verify.scripts || [] |
| | | |
| | | let msg = getDataSource(item, []) |
| | | let msg = getDataSource(item, [], 'print') |
| | | |
| | | msg.LText = msg.LText.replace(/@mk_obj_name@/ig, 'data') |
| | | msg.reps = msg.reps.filter(n => n !== 'mk_obj_name') |
| | | |
| | | let formkeys = [] |
| | | let colreps = [] |
| | | let _declares = [] |
| | | let _init = [] |
| | | if (btn.execMode === 'pop' && btn.modal && btn.modal.fields) { |
| | | btn.modal.fields.forEach(item => { |
| | | if (!item.field) return |
| | | let _key = item.field.toLowerCase() |
| | | |
| | | if (!new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(msg.LText)) return |
| | | |
| | | formkeys.push(_key) |
| | | colreps.push(item.field) |
| | | |
| | | let _item = { |
| | | key: item.field, |
| | | fieldlen: item.fieldlength || 50, |
| | | writein: item.writein !== 'false', |
| | | type: item.type, |
| | | isconst: item.constant === 'true' |
| | | } |
| | | |
| | | if (_item.type === 'datemonth') { |
| | | _item.type = 'text' |
| | | } else if (_item.type === 'number' || _item.type === 'rate') { |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (_item.type === 'date') { |
| | | _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' |
| | | } else if (_item.type === 'datetime') { |
| | | _item.type = 'date' |
| | | } else if (item.declare === 'decimal') { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } |
| | | |
| | | if (_item.type === 'number' || _item.type === 'rate') { |
| | | _init.push(`@${_key}=@mk_${_key}_mk@`) |
| | | } else if (_item.type === 'date') { |
| | | _init.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (_item.type === 'select' || _item.type === 'link' || _item.type === 'radio') { |
| | | _init.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (_item.isconst) { |
| | | _init.push(`@${_key}=N'@mk_${_key}_mk@'`) |
| | | } else { |
| | | _init.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | | |
| | | if (_item.fieldlen && _item.fieldlen > 4000) { |
| | | _item.fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${_item.fieldlen})` |
| | | |
| | | if (_item.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | } else if (_item.type === 'number') { |
| | | _type = `decimal(18,${_item.fieldlen})` |
| | | } else if (_item.type === 'rate') { |
| | | _type = `decimal(18,2)` |
| | | } |
| | | |
| | | _declares.push(`@${_key} ${_type}`) |
| | | }) |
| | | } |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (btn.Ot !== 'notRequired' && component.columns.length > 0) { |
| | | component.columns.forEach(col => { |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (formkeys.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(msg.LText)) return |
| | | if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(msg.LText)) return |
| | | |
| | | colreps.push(col.field) |
| | | |
| | | if (col.type === 'number') { |
| | | _init.push(`@${_key}=@mk_${_key}_mk@`) |
| | | } else { |
| | | _init.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | | |
| | | _declares.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) |
| | | }) |
| | | } |
| | | |
| | | _declares = _declares.length ? ',' + _declares.join(',') : '' |
| | | _init = _init.length ? ',' + _init.join(',') : '' |
| | | |
| | | msg.LText = msg.LText.replace('@mk_print_declare@', _declares) |
| | | msg.LText = msg.LText.replace('@mk_print_select@', _init) |
| | | |
| | | msg.reps = [...msg.reps, ...colreps] |
| | | |
| | | return msg |
| | | } |
| | | |
| | | let getPaySql = (btn, component) => { |
| | | let _sql = `Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid nvarchar(50)@mk_init_declare@ |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | ` |
| | | let _sql = `/* ${btn.logLabel} */ |
| | | BEGIN TRY |
| | | begin TRAN |
| | | |
| | | Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid nvarchar(50)@mk_init_declare@ |
| | | Select @ErrorCode='S',@retmsg=''@mk_init_select@ |
| | | ` |
| | | |
| | | btn.verify.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | |
| | | |
| | | if (btn.output) { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id |
| | | ${callback}` |
| | | } else { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | select @ErrorCode as ErrorCode,@retmsg as retmsg |
| | | ${callback}` |
| | | } |
| | | |
| | | let reps = [] |
| | |
| | | } |
| | | }) |
| | | |
| | | let regs = ['ID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | let regs = ['ID', 'time_id', 'datam', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(_sql)) { |
| | |
| | | _sql = _sql.replace(/@mk_init_declare@/ig, decSql) |
| | | _sql = _sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | let map = new Map() |
| | | reps.push(...sysVars) |
| | | reps = reps.filter(n => { |
| | | if (map.has(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | map.set(n.toLowerCase(), true) |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | reps = [...reps, ...colreps] |
| | | |
| | | _sql = _sql.replace(/\n\s{6,8}/g, '\n') |
| | | |
| | | if (/\$@/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: _sql, reps} |
| | | _sql = _sql.replace(/\n\x20{6,8}/g, '\n').replace(/\n{3,}/g, '\n\n').replace(/^\s+|\s+$/g, '').replace(/\t+|\v+/g, '') |
| | | |
| | | reps = reps.filter(n => { |
| | | if (sysVars.includes(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps = [...reps, ...colreps] |
| | | |
| | | return {LText: _sql, md5: md5(_sql), reps} |
| | | } |
| | | |
| | | let getFormSql = (item) => { |
| | | let getFormSql = (item, tname) => { |
| | | let arrfield = [item.valueField, item.valueText] |
| | | |
| | | if (item.type === 'checkcard') { |
| | |
| | | |
| | | decSql = decSql.join(',') |
| | | secSql = secSql.join(',') |
| | | decSql = decSql ? `Declare ${decSql} select ${secSql}` : '' |
| | | |
| | | if (decSql) { |
| | | sql = `Declare ${decSql} select ${secSql} |
| | | ${sql} |
| | | ` |
| | | } |
| | | sql = `/* ${item.label}(${tname}) */ |
| | | SELECT obj_name='${item.field}',prm_field='',str_field='', |
| | | arr_field='${arrfield}',tabid='',parid='',sub_name='',sub_field='' |
| | | |
| | | let regs = ['ID', 'BID', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang'] |
| | | ${decSql} |
| | | ${sql} |
| | | |
| | | select 'S' as ErrorCode,'' as retmsg |
| | | ` |
| | | |
| | | let regs = ['ID', 'BID', 'datam'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.push(...sysVars) |
| | | |
| | | reps.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: sql, reps} |
| | | // reps.push('mk_obj_name') |
| | | |
| | | sql = sql.replace(/\n\x20{6,8}/g, '\n').replace(/\n{3,}/g, '\n\n').replace(/^\s+|\s+$/g, '').replace(/\t+|\v+/g, '') |
| | | |
| | | reps = reps.filter(n => { |
| | | if (sysVars.includes(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | return {LText: sql, md5: md5(sql), reps} |
| | | } |
| | | |
| | | let getPopSelectSql = (item) => { |
| | |
| | | item.dataSource = '(' + item.dataSource + ') tb' |
| | | } |
| | | |
| | | let sql = '' |
| | | let LText = '' |
| | | let DateCount = '' |
| | | let _search = '' |
| | | let reps = [] |
| | | let sFields = [] |
| | | |
| | | if (item.searchKey) { |
| | | _search = '@search@' |
| | | _search = '@mk_search@' |
| | | sFields = item.searchKey.split(',') |
| | | } |
| | | |
| | | // 不需要单引号:orderBy、pageSize、pageIndex、db |
| | | let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'ID', 'BID', 'time_id', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'datam'] |
| | | let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'ID', 'BID', 'time_id', 'datam'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(item.dataSource)) { |
| | |
| | | } |
| | | }) |
| | | |
| | | if (item.laypage === 'true') { |
| | | sql = `/*system_query*/select top @pageSize@ ${arrfield} from (select ${arrfield} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${item.dataSource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` |
| | | DateCount = `/*system_query*/select count(1) as total from ${item.dataSource} ${_search}` |
| | | |
| | | reps.push('pageSize', 'orderBy', 'pageIndex') |
| | | } else { |
| | | sql = `/*system_query*/select ${arrfield} from ${item.dataSource} ${_search} order by @orderBy@ ` |
| | | reps.push('orderBy') |
| | | } |
| | | |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['mk_departmentcode', 'mk_organization', 'mk_user_type'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(item.dataSource)) { |
| | | if (['mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else { |
| | |
| | | |
| | | decSql = decSql.join(',') |
| | | secSql = secSql.join(',') |
| | | decSql = decSql ? `Declare ${decSql} select ${secSql}` : '' |
| | | |
| | | if (decSql) { |
| | | sql = `Declare ${decSql} select ${secSql} |
| | | ${sql} |
| | | if (item.laypage === 'true') { |
| | | /*system_query*/ |
| | | LText = `select top @pageSize@ ${arrfield} from (select ${arrfield} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${item.dataSource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` |
| | | DateCount = `select count(1) as total from ${item.dataSource} ${_search}` |
| | | |
| | | reps.push('pageSize', 'orderBy', 'pageIndex') |
| | | } else { |
| | | LText = `select ${arrfield} from ${item.dataSource} ${_search} order by @orderBy@ ` |
| | | reps.push('orderBy') |
| | | } |
| | | |
| | | let sql = `SELECT obj_name='data',prm_field='',str_field='', |
| | | arr_field='${arrfield}',tabid='',parid='',sub_name='',sub_field='' |
| | | ` |
| | | |
| | | if (DateCount) { |
| | | sql += `UNION ALL |
| | | SELECT obj_name='DateCount',prm_field='total',str_field='', |
| | | arr_field='',tabid='',parid='',sub_name='',sub_field='' |
| | | ` |
| | | } |
| | | |
| | | sql += ` |
| | | ${decSql} |
| | | ${LText} |
| | | ${DateCount} |
| | | |
| | | select 'S' as ErrorCode,'' as retmsg |
| | | ` |
| | | |
| | | let map = new Map() |
| | | reps.push(...sysVars) |
| | | reps = reps.filter(n => { |
| | | if (map.has(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | map.set(n.toLowerCase(), true) |
| | | |
| | | return true |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | if (['orderBy', 'pageSize', 'pageIndex'].includes(n)) return |
| | | |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | DateCount = DateCount.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | DateCount = DateCount.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | if (/@db@/ig.test(sql)) { |
| | | reps.push('db') |
| | | } |
| | | |
| | | return {LText: sql, DateCount, reps} |
| | | |
| | | sql = sql.replace(/\n\x20{6,8}/g, '\n').replace(/\n{3,}/g, '\n\n').replace(/^\s+|\s+$/g, '').replace(/\t+|\v+/g, '') |
| | | |
| | | reps = reps.filter(n => { |
| | | if (sysVars.includes(n.toLowerCase())) { |
| | | return false |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | return {LText: sql, md5: md5(sql), reps} |
| | | } |
| | | |
| | | let _mainSearch = [] |
| | |
| | | if (search.length > 0) { |
| | | search.forEach(cell => { |
| | | if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { |
| | | let msg = getFormSql(cell) |
| | | let msg = getFormSql(cell, '搜索') |
| | | |
| | | sqls.push({uuid: cell.uuid, type: 'sForm', ...msg}) |
| | | } |
| | |
| | | |
| | | m.setting.laypage = 'false' |
| | | m.setting.$top = true |
| | | m.setting.$name = (config.MenuName || '') + '-' + (m.name || '') |
| | | |
| | | let msg = getDataSource(m, _mainSearch) |
| | | |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from './utils.js' |
| | | |
| | | const getBackendQueryParam = (setting, search, orderBy, pageIndex, pageSize, id, BID, year, dataName) => { |
| | | let item = window.GLOB.CacheData.get('sql_' + setting.uuid) |
| | | |
| | | let searchKeys = null |
| | | if (setting.dataresource) { |
| | | searchKeys = [] |
| | | |
| | | if (search.length) { |
| | | searchKeys = Utils.getSearchkeys(search) |
| | | } |
| | | |
| | | if (id) { |
| | | if (/^excel:/.test(id)) { |
| | | id = id.replace(/^excel:/, '') |
| | | searchKeys.push({ |
| | | key: setting.primaryKey || 'ID', |
| | | match: '', |
| | | type: 'text_in', |
| | | value: id |
| | | }) |
| | | } else { |
| | | searchKeys.push({ |
| | | key: setting.primaryKey || 'ID', |
| | | match: '03', |
| | | type: 'text', |
| | | value: id |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | let values = { |
| | | time_id: Utils.getguid(), |
| | | roleid: sessionStorage.getItem('role_id') || '', |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | mk_nation: sessionStorage.getItem('nation') || '', |
| | | mk_province: sessionStorage.getItem('province') || '', |
| | | mk_city: sessionStorage.getItem('city') || '', |
| | | mk_district: sessionStorage.getItem('district') || '', |
| | | mk_address: sessionStorage.getItem('address') || '', |
| | | orderby: orderBy || '', |
| | | pagesize: setting.laypage ? pageSize : '9999', |
| | | pageindex: pageIndex, |
| | | id: id || '', |
| | | bid: BID || '', |
| | | typename: 'admin', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | mk_obj_name: dataName || 'data' |
| | | } |
| | | |
| | | if (setting.hasExtend) { |
| | | values.mk_time = setting.extendTime |
| | | } |
| | | if (setting.$re_year) { |
| | | values.mk_year = year |
| | | } |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | values.db = window.GLOB.externalDatabase |
| | | } |
| | | if (item.works_flow_code) { |
| | | values.works_flow_code = item.works_flow_code |
| | | } |
| | | |
| | | item.urlkeys && item.urlkeys.forEach(key => { |
| | | values[key] = item.urlparam[key] |
| | | }) |
| | | |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | |
| | | allSearch.forEach(cell => { |
| | | values[cell.key.toLowerCase()] = cell.value |
| | | }) |
| | | |
| | | let exps = [] |
| | | |
| | | if (searchKeys) { |
| | | exps.push({ |
| | | key: 'mk_search', |
| | | value: searchKeys |
| | | }) |
| | | } |
| | | |
| | | item.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (values.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let md5_id = '' |
| | | if (window.GLOB.probation) { |
| | | md5_id = md5(item.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000)) |
| | | md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18) |
| | | } |
| | | |
| | | let cell = { |
| | | id: item.id, |
| | | exps: exps, |
| | | menuname: setting.$name || '', |
| | | md5_id: md5_id |
| | | } |
| | | |
| | | if (dataName) { |
| | | cell.dataName = dataName |
| | | cell.luser = item.luser |
| | | return cell |
| | | } |
| | | |
| | | let param = { |
| | | $backend: true, |
| | | data: [cell] |
| | | } |
| | | |
| | | if (setting.database === 'sso' && window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | export default class DataUtils { |
| | | /** |
| | | * @description 数据源统一查询 |
| | |
| | | let param = null |
| | | |
| | | if (setting.interType === 'system') { |
| | | param = this.getDefaultQueryParam(setting, search, orderBy, pageIndex, pageSize, id, BID, year) |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + setting.uuid)) { |
| | | param = getBackendQueryParam(setting, search, orderBy, pageIndex, pageSize, id, BID, year) |
| | | } else { |
| | | param = this.getDefaultQueryParam(setting, search, orderBy, pageIndex, pageSize, id, BID, year) |
| | | param.BID = BID || '' |
| | | param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | } else { |
| | | param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, id, year) |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | // 数据管理权限 |
| | | if (sessionStorage.getItem('dataM') === 'true') { |
| | | param.dataM = 'Y' |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | // 数据管理权限 |
| | | if (sessionStorage.getItem('dataM') === 'true') { |
| | | param.dataM = 'Y' |
| | | } |
| | | } |
| | | |
| | | return param |
| | |
| | | param.menuname = setting.$name |
| | | } |
| | | |
| | | // if (window.backend && window.GLOB.CacheData.has('sql_' + setting.uuid)) { |
| | | // let item = window.GLOB.CacheData.get('sql_' + setting.uuid) |
| | | |
| | | // let values = { |
| | | // userid: sessionStorage.getItem('UserID') || '', |
| | | // time_id: Utils.getguid(), |
| | | // username: userName, |
| | | // fullname: fullName, |
| | | // roleid: RoleID, |
| | | // mk_departmentcode: departmentcode, |
| | | // mk_organization: organization, |
| | | // mk_user_type: mk_user_type, |
| | | // mk_nation: nation, |
| | | // mk_province: province, |
| | | // mk_city: city, |
| | | // mk_district: district, |
| | | // mk_address: address, |
| | | // orderby: orderBy, |
| | | // pagesize: setting.laypage ? pageSize : '9999', |
| | | // pageindex: pageIndex, |
| | | // id: id || '', |
| | | // bid: BID || '', |
| | | // loginuid: sessionStorage.getItem('LoginUID') || '', |
| | | // sessionuid: localStorage.getItem('SessionUid') || '', |
| | | // appkey: window.GLOB.appkey || '', |
| | | // lang: sessionStorage.getItem('lang'), |
| | | // typename: 'admin', |
| | | // datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | // datam_begin: sessionStorage.getItem('dataM') === 'true' ? '/*' : '', |
| | | // datam_end: sessionStorage.getItem('dataM') === 'true' ? '*/' : '', |
| | | // } |
| | | |
| | | // if (setting.hasExtend) { |
| | | // values.mk_time = setting.extendTime |
| | | // } |
| | | // if (setting.$re_year) { |
| | | // values.mk_year = year |
| | | // } |
| | | // if (window.GLOB.externalDatabase !== null) { |
| | | // values.db = window.GLOB.externalDatabase |
| | | // } |
| | | // if (item.works_flow_code) { |
| | | // values.works_flow_code = item.works_flow_code |
| | | // } |
| | | // item.urlkeys.forEach(key => { |
| | | // values[key] = item.urlparam[key] |
| | | // }) |
| | | |
| | | // let Ltext = item.LText |
| | | // let DateCount = item.DateCount |
| | | // let customScript = item.customScript |
| | | |
| | | // item.reps.forEach(n => { |
| | | // let key = n.toLowerCase() |
| | | // if (values.hasOwnProperty(key)) { |
| | | // Ltext = Ltext.replace(new RegExp('@' + key + '@', 'ig'), values[key]) |
| | | // DateCount = DateCount.replace(new RegExp('@' + key + '@', 'ig'), values[key]) |
| | | // customScript = customScript.replace(new RegExp('@' + key + '@', 'ig'), values[key]) |
| | | // } |
| | | // }) |
| | | |
| | | // if (search.length) { |
| | | |
| | | // } |
| | | // } |
| | | |
| | | param.custom_script = Utils.formatOptions(_customScript, param.exec_type) |
| | | param.LText = Utils.formatOptions(LText, param.exec_type) |
| | | param.DateCount = Utils.formatOptions(DateCount, param.exec_type) |
| | |
| | | /** |
| | | * @description 生成单个组件sPC_Get_structured_data请求参数 |
| | | */ |
| | | export function getStructDefaultParam (component, searchlist, first) { |
| | | export function getStructDefaultParam (component, searchlist, first, BID) { |
| | | const { columns, setting, dataName, format, uuid } = component |
| | | |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + uuid)) { |
| | | return getBackendQueryParam(setting, searchlist, setting.order, 1, 1000, '', BID, '', dataName) |
| | | } |
| | | |
| | | let _dataresource = setting.dataresource |
| | | let _customScript = setting.customScript |
| | |
| | | |
| | | return { |
| | | uuid: uuid, |
| | | name: dataName, |
| | | dataName: dataName, |
| | | $name: setting.$name, |
| | | columns: columns, |
| | | par_tablename: '', |
| | |
| | | * @description 生成sPC_Get_structured_data请求参数 |
| | | */ |
| | | export function getStructuredParams (params, config, BID) { |
| | | if (window.backend && params[0].exps) { |
| | | let param = { |
| | | $backend: true, |
| | | data: params.map(item => { |
| | | let cell = {...item} |
| | | |
| | | delete cell.dataName |
| | | delete cell.luser |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | if (config.cacheUseful === 'true') { |
| | | param.time_limit = config.cacheTime |
| | | |
| | | if (config.timeUnit === 'day') { |
| | | param.time_limit = param.time_limit * 1440 |
| | | } else if (config.timeUnit === 'hour') { |
| | | param.time_limit = param.time_limit * 60 |
| | | } |
| | | |
| | | if (params.findIndex(item => item.luser) > -1) { |
| | | param.data_md5 = md5(window.GLOB.appkey + params[0].id + sessionStorage.getItem('UserID')) |
| | | } else { |
| | | param.data_md5 = md5(window.GLOB.appkey + params[0].id) |
| | | } |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | let LText_field = [] |
| | | let diffUser = false |
| | | |
| | |
| | | } |
| | | |
| | | item.columns.forEach(cell => { |
| | | LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`) |
| | | LText_field.push(`Select '${item.dataName}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`) |
| | | }) |
| | | return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(_sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort` |
| | | return `Select '${item.dataName}' as tablename,'${window.btoa(window.encodeURIComponent(_sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort` |
| | | }) |
| | | |
| | | let param = { |
| | |
| | | return searchText.join(' AND ') |
| | | } |
| | | |
| | | static getSearchkeys (searches) { |
| | | let searchText = [] |
| | | let matchs = { |
| | | 'like': '01', |
| | | 'not like': '02', |
| | | '=': '03', |
| | | '>': '04', |
| | | '<': '05', |
| | | '>=': '06', |
| | | '<=': '07', |
| | | } |
| | | |
| | | searches.forEach(item => { |
| | | if (item.forbid || !item.value) return |
| | | |
| | | let cell = { |
| | | key: item.key, |
| | | match: item.match, |
| | | type: 'text', |
| | | value: item.value |
| | | } |
| | | |
| | | if (item.type === 'text' || item.type === 'select') { // 综合搜索,文本或下拉,所有字段拼接 |
| | | if (/,/.test(item.key)) { |
| | | cell.type = 'text_or' |
| | | } |
| | | } else if (item.type === 'multi') { |
| | | cell.type = 'text_multi' |
| | | } else if (item.type === 'date') { |
| | | let _val = item.value |
| | | let timetail = '' |
| | | |
| | | if (item.match === '<' || item.match === '<=') { // 时间为<=时,匹配后一天的0点,匹配方式为< |
| | | cell.match = '<' |
| | | if (item.precision === 'day') { |
| | | _val = moment(_val, 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') |
| | | } |
| | | } |
| | | if (item.match === '=') { |
| | | timetail = '' |
| | | } else if (item.precision === 'day') { |
| | | timetail = ' 00:00:00.000' |
| | | } else if (item.precision === 'hour') { |
| | | timetail = ':00:00.000' |
| | | } else if (item.precision === 'minute') { |
| | | timetail = ':00.000' |
| | | } else if (item.precision === 'second') { |
| | | timetail = '.000' |
| | | } |
| | | |
| | | cell.value = _val + timetail |
| | | } |
| | | |
| | | if (item.type === 'datemonth') { // 月-过滤条件,从月开始至结束,结束时间为月末加一天的0点,方式为< |
| | | if (item.match === '=') { |
| | | searchText.push(cell) |
| | | } else { |
| | | let _startval = moment(item.value, 'YYYY-MM').startOf('month').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | let _endval = moment(item.value, 'YYYY-MM').endOf('month').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | |
| | | searchText.push({ |
| | | key: item.key, |
| | | match: '>=', |
| | | type: 'text', |
| | | value: _startval |
| | | }, { |
| | | key: item.key, |
| | | match: '<', |
| | | type: 'text', |
| | | value: _endval |
| | | }) |
| | | } |
| | | } else if (item.type === 'dateweek') { // 周-过滤条件 |
| | | let _startval = moment(item.value, 'YYYY-MM-DD' ).startOf('week').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | let _endval = moment(item.value, 'YYYY-MM-DD').endOf('week').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | |
| | | searchText.push({ |
| | | key: item.key, |
| | | match: '>=', |
| | | type: 'text', |
| | | value: _startval |
| | | }, { |
| | | key: item.key, |
| | | match: '<', |
| | | type: 'text', |
| | | value: _endval |
| | | }) |
| | | } else if (item.type === 'daterange') { |
| | | let val = item.value.split(',') |
| | | let _startval = '' |
| | | let _endval = '' |
| | | |
| | | if (item.precision === 'day') { |
| | | _startval = val[0] + ' 00:00:00.000' |
| | | _endval = moment(val[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | } else if (item.precision === 'hour') { |
| | | _startval = val[0] + ':00:00.000' |
| | | _endval = val[1] + ':00:00.000' |
| | | } else if (item.precision === 'minute') { |
| | | _startval = val[0] + ':00.000' |
| | | _endval = val[1] + ':00.000' |
| | | } else if (item.precision === 'second') { |
| | | _startval = val[0] + '.000' |
| | | _endval = val[1] + '.000' |
| | | } |
| | | |
| | | let _skey = item.key |
| | | let _ekey = item.key |
| | | |
| | | if (/,/.test(item.key)) { |
| | | _skey = item.key.split(',')[0] |
| | | _ekey = item.key.split(',')[1] |
| | | } |
| | | |
| | | searchText.push({ |
| | | key: _skey, |
| | | match: '>=', |
| | | type: 'text', |
| | | value: _startval |
| | | }, { |
| | | key: _ekey, |
| | | match: '<', |
| | | type: 'text', |
| | | value: _endval |
| | | }) |
| | | } else if (item.type === 'range') { |
| | | let val = item.value.split(',') |
| | | |
| | | searchText.push({ |
| | | key: item.key, |
| | | match: '>=', |
| | | type: 'text', |
| | | value: val[0] || -999999999 |
| | | }, { |
| | | key: item.key, |
| | | match: '<=', |
| | | type: 'text', |
| | | value: val[1] || 999999999 |
| | | }) |
| | | } else { |
| | | searchText.push(cell) |
| | | } |
| | | }) |
| | | |
| | | searchText.forEach(item => { |
| | | item.match = matchs[item.match] || '01' |
| | | }) |
| | | |
| | | return searchText |
| | | } |
| | | |
| | | /** |
| | | * @description 获取搜索用于正则替换 |
| | | * @param {Array} searches 搜索条件 |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Col, Row, Spin, notification, Button, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(params.param))) |
| | | |
| | | sessionStorage.setItem('dataM', param.dataM || '') |
| | | |
| | | this.setState({ |
| | | BID: param.id || '', |
| | | tempId: param.tempId, |
| | |
| | | |
| | | config.components = config.components.filter(item => !['tabs', 'search'].includes(item.type)) |
| | | |
| | | if (window.backend && config.allSqls) { |
| | | let urlparam = urlParam || {} |
| | | let keys = Object.keys(urlparam) |
| | | config.allSqls.forEach(item => { |
| | | item.id = md5(window.GLOB.appkey + item.v_id) |
| | | if (item.type === 'datasource' || item.type === 'excelOut') { |
| | | item.urlkeys = keys |
| | | item.urlparam = urlparam |
| | | if (config.flow_code) { |
| | | item.works_flow_code = config.flow_code |
| | | } |
| | | } |
| | | window.GLOB.CacheData.set('sql_' + item.uuid, item) |
| | | }) |
| | | } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | |
| | |
| | | component.setting.sync = 'false' |
| | | return component |
| | | } |
| | | |
| | | component.setting.uuid = component.uuid |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | |
| | | |
| | | component.setting.customScript = _customScript // 整理后自定义脚本 |
| | | component.setting.tailScript = _tailScript // 后置自定义脚本 |
| | | |
| | | if (window.backend && config.allSqls) { |
| | | component.setting.sync = 'false' |
| | | } else if (_tailScript) { |
| | | component.setting.sync = 'false' |
| | | } |
| | | |
| | | // floor 组件的层级 |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | |
| | | } |
| | | return |
| | | } |
| | | |
| | | inter.setting.uuid = inter.uuid |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | |
| | | reloadTabs = () => { |
| | | if (this.reloading) return |
| | | |
| | | let time = new Date().getTime() |
| | | |
| | | let oldTime = sessionStorage.getItem('mk_reloadTabs') |
| | | |
| | | if (oldTime && time - oldTime < 180000) return |
| | | |
| | | sessionStorage.setItem('mk_reloadTabs', time) |
| | | |
| | | this.reloading = true |
| | | |
| | | Api.getAppVersion(true).then(() => { |
| | |
| | | import React, {Component} from 'react' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Menu, Popover, Modal, notification } from 'antd' |
| | | import { EditOutlined, PlusOutlined, SettingOutlined, ApiOutlined } from '@ant-design/icons' |
| | | import { EditOutlined, PlusOutlined, SettingOutlined, ApiOutlined, SoundOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | {item.children.map(cell => { |
| | | return ( |
| | | <Menu.Item key={cell.MenuID}> |
| | | <span className={'editable-menu-item ' + (cell.up_action ? 'unupdate' : '')} onDoubleClick={() => this.editmenu(cell)}>{cell.PageParam && cell.PageParam.interfaces === 'true' ? <ApiOutlined title="菜单中使用了外部接口" /> : null}{cell.MenuName}</span> |
| | | <span className={'editable-menu-item ' + (cell.up_action ? 'unupdate' : '')} onDoubleClick={() => this.editmenu(cell)}>{cell.PageParam && cell.PageParam.interfaces === 'true' ? <ApiOutlined title="菜单中使用了外部接口" /> : null}{cell.PageParam && cell.PageParam.msg === 'true' ? <SoundOutlined title="菜单中发送了消息" /> : null}{cell.MenuName}</span> |
| | | </Menu.Item> |
| | | ) |
| | | })} |
| | |
| | | top: 11px; |
| | | color: orange; |
| | | } |
| | | .anticon-sound { |
| | | position: absolute; |
| | | left: 25px; |
| | | top: 11px; |
| | | color: orange; |
| | | } |
| | | .anticon-api + .anticon-sound { |
| | | left: 5px; |
| | | } |
| | | } |
| | | |
| | | .editable-menu-item.unupdate { |
| | |
| | | import Header from '@/components/header' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Sidemenu from '@/components/sidemenu' |
| | | import QueryLog from '@/components/querylog' |
| | | // import QueryLog from '@/components/querylog' |
| | | import ImgScale from '@/components/imgScale' |
| | | |
| | | // import './index.scss' |
| | |
| | | {navBar === 'shutter' || navBar === 'menu_board_navigation' ? |
| | | <Tabview key="tabview"/> : |
| | | <Breadview key="breadview"/>} |
| | | {window.GLOB.systemType === 'production' ? <QueryLog /> : null} |
| | | {/* {window.GLOB.systemType === 'production' ? <QueryLog /> : null} */} |
| | | <ImgScale /> |
| | | </div> |
| | | ) |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import { langs } from '@/store/options' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | | import { getTables, getFuncsAndInters, getOutMessage, getLangTrans, getAllSqls } from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import '@/assets/css/design.scss' |
| | |
| | | } else if (this.checklog()) { |
| | | if (sessionStorage.getItem('langList') && !config.trans) { |
| | | |
| | | // } else if (window.backend && config.enabled && !config.allSqls) { |
| | | } else if (window.backend && config.enabled && !config.allSqls) { |
| | | |
| | | } else { |
| | | notification.success({ |
| | |
| | | delete config.force |
| | | } |
| | | |
| | | // let sqls = [] |
| | | // delete config.allSqls |
| | | // if (window.backend && config.enabled) { |
| | | // sqls = getAllSqls(config) |
| | | let long_data = '' |
| | | if (window.backend && config.enabled) { |
| | | let sqls = getAllSqls(config) |
| | | let _t = moment().format('YYYYMMDDHHmmss') |
| | | let getguid = () => { |
| | | let uuid = '' |
| | | for (let i = 0; i < 18; i++) { |
| | | uuid += String.fromCharCode(Math.floor(Math.random() * 26) + 65) |
| | | } |
| | | return uuid |
| | | } |
| | | |
| | | // config.allSqls = sqls |
| | | // } |
| | | long_data = [] |
| | | let oriIds = {} |
| | | if (config.allSqls) { |
| | | config.allSqls.forEach(item => { |
| | | if (!item.md5) return |
| | | oriIds[item.uuid + item.md5] = item.v_id |
| | | }) |
| | | } |
| | | |
| | | config.allSqls = sqls.map(item => { |
| | | let v_id = _t + getguid() |
| | | |
| | | if (oriIds[item.uuid + item.md5]) { |
| | | v_id = oriIds[item.uuid + item.md5] |
| | | } |
| | | |
| | | long_data.push(`${md5(window.GLOB.appkey + v_id)},${item.uuid},${v_id},${window.btoa(window.encodeURIComponent(item.LText))}`) |
| | | |
| | | return { |
| | | uuid: item.uuid, |
| | | v_id: v_id, |
| | | type: item.type, |
| | | reps: item.reps, |
| | | md5: item.md5 || '', |
| | | luser: item.luser === true |
| | | } |
| | | }) |
| | | |
| | | long_data = long_data.join(';') |
| | | } else { |
| | | delete config.allSqls |
| | | } |
| | | |
| | | if (config.cacheUseful !== 'true') { |
| | | config.components = this.resetSyncQuery(config.components) |
| | |
| | | } |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | let msg = getOutMessage(config) |
| | | let urlFields = config.urlFields ? config.urlFields.join(',') : '' |
| | | let langSql = getLangTrans(config) |
| | | |
| | |
| | | EasyCode: config.easyCode || '', |
| | | Template: 'CustomPage', |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}), |
| | | PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, msg, urlFields}), |
| | | open_edition: config.open_edition, |
| | | // LText: '', |
| | | // LTexttb: '', |
| | | long_data: long_data, |
| | | debug_md5: key, |
| | | debug_url: url, |
| | | debug_list: window.btoa(tbs), |
| | |
| | | reloadTabs = () => { |
| | | if (this.reloading) return |
| | | |
| | | let time = new Date().getTime() |
| | | |
| | | let oldTime = sessionStorage.getItem('mk_reloadTabs') |
| | | |
| | | if (oldTime && time - oldTime < 180000) return |
| | | |
| | | sessionStorage.setItem('mk_reloadTabs', time) |
| | | |
| | | this.reloading = true |
| | | |
| | | Api.getAppVersion(true).then(() => { |
| | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils, { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | | import MenuUtils, { getTables, getFuncsAndInters, getOutMessage, getLangTrans, getAllSqls } from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import '@/assets/css/design.scss' |
| | |
| | | delete config.force |
| | | } |
| | | |
| | | let long_data = '' |
| | | if (window.backend && config.enabled) { |
| | | let sqls = getAllSqls(config) |
| | | let _t = moment().format('YYYYMMDDHHmmss') |
| | | let getguid = () => { |
| | | let uuid = '' |
| | | for (let i = 0; i < 18; i++) { |
| | | uuid += String.fromCharCode(Math.floor(Math.random() * 26) + 65) |
| | | } |
| | | return uuid |
| | | } |
| | | |
| | | long_data = [] |
| | | let oriIds = {} |
| | | if (config.allSqls) { |
| | | config.allSqls.forEach(item => { |
| | | if (!item.md5) return |
| | | oriIds[item.uuid + item.md5] = item.v_id |
| | | }) |
| | | } |
| | | |
| | | config.allSqls = sqls.map(item => { |
| | | let v_id = _t + getguid() |
| | | |
| | | if (oriIds[item.uuid + item.md5]) { |
| | | v_id = oriIds[item.uuid + item.md5] |
| | | } |
| | | |
| | | long_data.push(`${md5(window.GLOB.appkey + v_id)},${item.uuid},${v_id},${window.btoa(window.encodeURIComponent(item.LText))}`) |
| | | |
| | | return { |
| | | uuid: item.uuid, |
| | | v_id: v_id, |
| | | type: item.type, |
| | | reps: item.reps, |
| | | md5: item.md5 || '', |
| | | luser: item.luser === true |
| | | } |
| | | }) |
| | | |
| | | long_data = long_data.join(';') |
| | | } else { |
| | | delete config.allSqls |
| | | } |
| | | |
| | | if (config.cacheUseful !== 'true') { |
| | | config.components = this.resetSyncQuery(config.components) |
| | | } |
| | |
| | | menus_used_list = window.btoa(window.encodeURIComponent(menus_used_list || 'del')) |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | let msg = getOutMessage(config) |
| | | roleParam.interfaces = interfaces |
| | | let langSql = getLangTrans(config) |
| | | |
| | |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | | Typename: sessionStorage.getItem('typename'), |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'webPage', interfaces}), |
| | | PageParam: JSON.stringify({Template: 'webPage', interfaces, msg}), |
| | | open_edition: config.open_edition, |
| | | menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))), |
| | | long_data: long_data, |
| | | // LText: '', |
| | | // LTexttb: '', |
| | | menus_used_list, |
| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | | import { getTables, getFuncsAndInters, getOutMessage, getLangTrans, getAllSqls } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | delete config.force |
| | | } |
| | | |
| | | let long_data = '' |
| | | if (window.backend && config.enabled) { |
| | | let sqls = getAllSqls(config) |
| | | let _t = moment().format('YYYYMMDDHHmmss') |
| | | let getguid = () => { |
| | | let uuid = '' |
| | | for (let i = 0; i < 18; i++) { |
| | | uuid += String.fromCharCode(Math.floor(Math.random() * 26) + 65) |
| | | } |
| | | return uuid |
| | | } |
| | | |
| | | long_data = [] |
| | | let oriIds = {} |
| | | if (config.allSqls) { |
| | | config.allSqls.forEach(item => { |
| | | if (!item.md5) return |
| | | oriIds[item.uuid + item.md5] = item.v_id |
| | | }) |
| | | } |
| | | |
| | | config.allSqls = sqls.map(item => { |
| | | let v_id = _t + getguid() |
| | | |
| | | if (oriIds[item.uuid + item.md5]) { |
| | | v_id = oriIds[item.uuid + item.md5] |
| | | } |
| | | |
| | | long_data.push(`${md5(window.GLOB.appkey + v_id)},${item.uuid},${v_id},${window.btoa(window.encodeURIComponent(item.LText))}`) |
| | | |
| | | return { |
| | | uuid: item.uuid, |
| | | v_id: v_id, |
| | | type: item.type, |
| | | reps: item.reps, |
| | | md5: item.md5 || '', |
| | | luser: item.luser === true |
| | | } |
| | | }) |
| | | |
| | | long_data = long_data.join(';') |
| | | } else { |
| | | delete config.allSqls |
| | | } |
| | | |
| | | if (config.cacheUseful !== 'true') { |
| | | config.components = this.resetSyncQuery(config.components) |
| | | } |
| | |
| | | } |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | let msg = getOutMessage(config) |
| | | roleParam.interfaces = interfaces |
| | | let langSql = getLangTrans(config) |
| | | |
| | |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | | Typename: 'pc', |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'webPage', interfaces}), |
| | | PageParam: JSON.stringify({Template: 'webPage', interfaces, msg}), |
| | | menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))), |
| | | open_edition: config.open_edition, |
| | | long_data: long_data, |
| | | // LText: '', |
| | | // LTexttb: '', |
| | | menus_used_list, |
| | |
| | | import { Spin, notification, Button, Table, Modal, Tree, Input, Empty } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | import { ApiOutlined } from '@ant-design/icons' |
| | | import { ApiOutlined, SoundOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | title: '菜单名称', dataIndex: 'MenuName', key: 'MenuName', align: 'center', render: (text, record) => { |
| | | if (record.extra || this.state.appKeys.includes(record.MenuID)) { |
| | | return <span style={{color: '#1890ff'}}>{text}</span> |
| | | } else if (record.interfaces === 'true') { |
| | | return <span><ApiOutlined style={{color: 'orange', marginRight: '5px'}} title="菜单中使用了外部接口" />{text}</span> |
| | | } else if (record.interfaces === 'true' || record.msg === 'true') { |
| | | return <span>{record.interfaces === 'true' ? <ApiOutlined style={{color: 'orange', marginRight: '5px'}} title="菜单中使用了外部接口" /> : null}{record.msg === 'true' ? <SoundOutlined style={{color: 'orange', marginRight: '5px'}} title="菜单中发送了消息" /> : null}{text}</span> |
| | | } |
| | | return text |
| | | } |
| | |
| | | let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist))) |
| | | item.nodes = pageParam |
| | | item.interfaces = pageParam.interfaces || 'false' |
| | | item.msg = pageParam.msg || 'false' |
| | | |
| | | if (pageParam.type) { |
| | | item.type = pageParam.type |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import { langs } from '@/store/options' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | | import { getTables, getFuncsAndInters, getOutMessage, getLangTrans, getAllSqls } from '@/utils/utils-custom.js' |
| | | import SourceElement from '@/templates/zshare/dragsource' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import Source from './source' |
| | |
| | | } else if (this.checklog()) { |
| | | if (sessionStorage.getItem('langList') && !config.trans) { |
| | | |
| | | // } else if (window.backend && config.enabled && !config.allSqls) { |
| | | } else if (window.backend && config.enabled && !config.allSqls) { |
| | | |
| | | } else { |
| | | notification.success({ |
| | |
| | | delete config.force |
| | | } |
| | | |
| | | // let sqls = [] |
| | | // delete config.allSqls |
| | | // if (window.backend && config.enabled) { |
| | | // sqls = getAllSqls(config) |
| | | let long_data = '' |
| | | if (window.backend && config.enabled) { |
| | | let sqls = getAllSqls(config) |
| | | let _t = moment().format('YYYYMMDDHHmmss') |
| | | let getguid = () => { |
| | | let uuid = '' |
| | | for (let i = 0; i < 18; i++) { |
| | | uuid += String.fromCharCode(Math.floor(Math.random() * 26) + 65) |
| | | } |
| | | return uuid |
| | | } |
| | | |
| | | // config.allSqls = sqls |
| | | // } |
| | | long_data = [] |
| | | let oriIds = {} |
| | | if (config.allSqls) { |
| | | config.allSqls.forEach(item => { |
| | | if (!item.md5) return |
| | | oriIds[item.uuid + item.md5] = item.v_id |
| | | }) |
| | | } |
| | | |
| | | config.allSqls = sqls.map(item => { |
| | | let v_id = _t + getguid() |
| | | |
| | | if (oriIds[item.uuid + item.md5]) { |
| | | v_id = oriIds[item.uuid + item.md5] |
| | | } |
| | | |
| | | long_data.push(`${md5(window.GLOB.appkey + v_id)},${item.uuid},${v_id},${window.btoa(window.encodeURIComponent(item.LText))}`) |
| | | |
| | | return { |
| | | uuid: item.uuid, |
| | | v_id: v_id, |
| | | type: item.type, |
| | | reps: item.reps, |
| | | md5: item.md5 || '', |
| | | luser: item.luser === true |
| | | } |
| | | }) |
| | | |
| | | long_data = long_data.join(';') |
| | | } else { |
| | | delete config.allSqls |
| | | } |
| | | |
| | | let tbs = [] |
| | | let btns = this.getMenuMessage(tbs) |
| | |
| | | } |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | let msg = getOutMessage(config) |
| | | let urlFields = config.urlFields ? config.urlFields.join(',') : '' |
| | | let langSql = getLangTrans(config) |
| | | |
| | |
| | | EasyCode: config.easyCode || '', |
| | | Template: 'BaseTable', |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}), |
| | | PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, msg, urlFields}), |
| | | open_edition: config.open_edition, |
| | | // LText: '', |
| | | // LTexttb: '', |
| | | long_data: long_data, |
| | | debug_md5: key, |
| | | debug_url: url, |
| | | debug_list: window.btoa(tbs), |