| | |
| | | } |
| | | .ant-modal-body { |
| | | padding: 0; |
| | | min-height: 150px; |
| | | |
| | | .mk-com-name { |
| | | position: absolute; |
| | |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('mkUpdateInter', this.mkUpdateInter) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('mkUpdateInter', this.mkUpdateInter) |
| | | } |
| | | |
| | | mkUpdateInter = (inter, split) => { |
| | | const { card } = this.state |
| | | |
| | | if (card.wrap.datatype === 'public' && card.wrap.publicId === inter.uuid) { |
| | | let _card = {...card, columns: fromJS(inter.columns).toJS()} |
| | | |
| | | split.delay = split.delay + 10 |
| | | |
| | | setTimeout(() => { |
| | | this.updateComponent(_card) |
| | | }, split.delay) |
| | | } |
| | | } |
| | | |
| | |
| | | } else { |
| | | let columns = card.columns.map(c => c.field) |
| | | |
| | | if (card.wrap.datatype === 'dynamic') { |
| | | if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { |
| | | card.errors.push({ level: 0, detail: '未设置数据源!'}) |
| | | } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) { |
| | |
| | | card.errors.push({ level: 0, detail: '未设置主键!'}) |
| | | } else if (!columns.includes(card.setting.primaryKey)) { |
| | | card.errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } |
| | | } |
| | | |
| | | if (card.errors.length === 0) { |
| | |
| | | |
| | | updateWrap = (res) => { |
| | | delete res.quick |
| | | this.updateComponent({...this.state.card, wrap: res}) |
| | | |
| | | let _card = {...this.state.card, wrap: res} |
| | | |
| | | if (res.datatype === 'public') { |
| | | let interfaces = window.GLOB.customMenu.interfaces || [] |
| | | |
| | | let d = interfaces.filter(m => m.uuid === res.publicId && m.status === 'true')[0] |
| | | |
| | | if (d) { |
| | | _card.columns = fromJS(d.columns).toJS() |
| | | } |
| | | } |
| | | |
| | | this.updateComponent(_card) |
| | | } |
| | | |
| | | render() { |
| | |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap) { |
| | | let modules = MenuUtils.getLinkModules(fromJS(window.GLOB.customMenu).toJS().components) || [] |
| | | let supmodules = MenuUtils.getSupModules(fromJS(window.GLOB.customMenu).toJS().components, '') || [] |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | |
| | | let modules = MenuUtils.getLinkModules(menu.components) || [] |
| | | let supmodules = MenuUtils.getSupModules(menu.components, '') || [] |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | let appType = sessionStorage.getItem('appType') |
| | | |
| | | let interfaces = [] |
| | | if (menu.interfaces) { |
| | | menu.interfaces.forEach(item => { |
| | | if (item.status === 'true') { |
| | | interfaces.push({ |
| | | value: item.uuid, |
| | | label: item.name |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (roleList) { |
| | | try { |
| | |
| | | options: [ |
| | | {value: 'dynamic', label: '动态'}, |
| | | {value: 'static', label: '静态'}, |
| | | {value: 'public', label: '公共数据源'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'empty', values: ['dynamic']} |
| | | {field: 'empty', values: ['dynamic']}, |
| | | {field: 'publicId', values: ['public']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'publicId', |
| | | label: '数据源', |
| | | initval: wrap.publicId || '', |
| | | required: true, |
| | | options: interfaces |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'linkType', |
| | | label: '受控类型', |
| | |
| | | .ant-btn { |
| | | padding: 0; |
| | | } |
| | | .card-detail-row { |
| | | min-height: 16px; |
| | | } |
| | | |
| | | .card-button-cell { |
| | | float: left; |
| | |
| | | let MenuType = '' |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | let laypage = setting && setting.laypage !== 'false' |
| | | let interfaces = (menu.interfaces || []).map(item => { |
| | | return { |
| | | let interfaces = [] |
| | | if (subtype === 'propcard' && menu.interfaces) { |
| | | menu.interfaces.forEach(item => { |
| | | if (item.status === 'true') { |
| | | interfaces.push({ |
| | | value: item.uuid, |
| | | label: item.name |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('mkUpdateInter', this.mkUpdateInter) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('mkUpdateInter', this.mkUpdateInter) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | |
| | | this.setState({card: {...card, subcards: []}}, () => { |
| | | this.updateComponent({...card, subcards: subcards}) |
| | | }) |
| | | } |
| | | |
| | | mkUpdateInter = (inter, split) => { |
| | | const { card } = this.state |
| | | |
| | | if (card.wrap.datatype === 'public' && card.wrap.publicId === inter.uuid) { |
| | | let _card = {...card, columns: fromJS(inter.columns).toJS()} |
| | | |
| | | split.delay = split.delay + 10 |
| | | |
| | | setTimeout(() => { |
| | | this.updateComponent(_card) |
| | | }, split.delay) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | // if (card.wrap.datatype === 'dynamic') { |
| | | |
| | | // } |
| | | |
| | | let columns = card.columns.map(c => c.field) |
| | | |
| | | if (card.wrap.datatype === 'dynamic') { |
| | | if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { |
| | | card.errors.push({ level: 0, detail: '未设置数据源!'}) |
| | | } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) { |
| | |
| | | card.errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } else if (!card.setting.supModule) { |
| | | card.errors.push({ level: 0, detail: '未设置上级组件!'}) |
| | | } |
| | | } |
| | | |
| | | if (card.errors.length === 0) { |
| | |
| | | _card.setting.supModule = '' |
| | | } |
| | | } else if (res.datatype === 'public') { |
| | | // let interfaces = window.GLOB.customMenu.interfaces || [] |
| | | let interfaces = window.GLOB.customMenu.interfaces || [] |
| | | |
| | | let d = interfaces.filter(m => m.uuid === res.publicId && m.status === 'true')[0] |
| | | |
| | | if (d) { |
| | | _card.columns = fromJS(d.columns).toJS() |
| | | } |
| | | } |
| | | |
| | | if (res.layout === 'flex') { |
| | |
| | | } |
| | | } |
| | | |
| | | .model-menu-card-cell-list { |
| | | .card-detail-row { |
| | | min-height: 21px; |
| | | } |
| | | } |
| | | |
| | | .ant-table-thead { |
| | | th { |
| | | position: relative; |
| | |
| | | background: #ffffff!important; |
| | | } |
| | | } |
| | | .model-menu-card-cell-list { |
| | | .card-detail-row { |
| | | min-height: 21px; |
| | | } |
| | | } |
| | | |
| | | .ant-table-thead { |
| | | th { |
| | |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const DataSource = asyncComponent(() => import('@/menu/datasource')) |
| | |
| | | return record |
| | | }) |
| | | |
| | | |
| | | this.setState({ interfaces }) |
| | | this.props.updateConfig({...config, interfaces}) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkUpdateInter', record, {delay: 0}) |
| | | }, 10) |
| | | } |
| | | |
| | | addInterface = () => { |
| | |
| | | _sync = _config.setting.sync === 'true' |
| | | |
| | | if (_sync && data) { |
| | | _data = data[_config.dataName] || {} |
| | | _data = data[_config.dataName] || {$$empty: true} |
| | | if (_data && Array.isArray(_data)) { |
| | | _data = _data[0] || {} |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | } else if (_sync && initdata) { |
| | |
| | | } |
| | | _sync = false |
| | | } |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.get(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | } |
| | | |
| | | if (_data) { |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | if (_config.setting.primaryKey) { |
| | | _data.$$uuid = _data[_config.setting.primaryKey] || '' |
| | | } |
| | | |
| | | if (_config.wrap.position === 'fixed' || _config.wrap.position === 'absolute') { |
| | |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | | MKEmitter.addListener('mkPublicData', this.mkPublicData) |
| | | } |
| | | |
| | | if (config.timer && config.wrap.datatype === 'dynamic') { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('mkPublicData', this.mkPublicData) |
| | | MKEmitter.removeListener('syncBalconyData', this.syncBalconyData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | |
| | | * @description 图表数据更新,刷新内容 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config, BID } = this.state |
| | | const { sync, config, BID, BData } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = {$$empty: true} |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] |
| | | if (_data && Array.isArray(_data)) { |
| | | _data = _data[0] |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | } |
| | | |
| | | if (_data) { |
| | | _data.$$BID = BID || '' |
| | | } |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } |
| | | } |
| | | |
| | | mkPublicData = (publicId, data) => { |
| | | const { config, BID, BData } = this.state |
| | | |
| | | if (config.wrap.datatype === 'public' && config.wrap.publicId === publicId) { |
| | | let _data = fromJS(data).toJS() |
| | | |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | |
| | | } |
| | | _sync = false |
| | | } |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.get(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | } |
| | | |
| | | _data.$$BID = BID || '' |
| | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (_config.wrap.datatype === 'public') { |
| | | if (_data.$$loaded && selected !== 'false') { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | | }, 200) |
| | | } |
| | | } else if (!_sync && selected !== 'false') { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | | MKEmitter.addListener('mkPublicData', this.mkPublicData) |
| | | } |
| | | |
| | | if (config.timer && config.wrap.datatype === 'dynamic') { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('mkPublicData', this.mkPublicData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | |
| | | } |
| | | } |
| | | |
| | | mkPublicData = (publicId, data) => { |
| | | const { config, selected, BID, BData } = this.state |
| | | |
| | | if (config.wrap.datatype === 'public' && config.wrap.publicId === publicId) { |
| | | let _data = fromJS(data).toJS() |
| | | |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}, () => { |
| | | if (selected !== 'false') { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | | }, 200) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | checkTopLine = () => { |
| | | const { config, data, selected } = this.state |
| | | |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | |
| | | import MkInterItem from './interItem' |
| | | // import './index.scss' |
| | | |
| | | class MkInterfaces extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, |
| | | interfaces: PropTypes.array |
| | | } |
| | | |
| | | state = {} |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { return false } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { interfaces, BID } = this.props |
| | | |
| | | return ( |
| | | <> |
| | | {interfaces.map(m => <MkInterItem key={m.uuid} config={m} BID={BID}/>)} |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default MkInterfaces |
New file |
| | |
| | | import {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { notification } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import TimerTask from '@/utils/timer-task.js' |
| | | |
| | | // import './index.scss' |
| | | |
| | | class MkInterItem extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 上级主键值 |
| | | config: PropTypes.object, // 配置信息 |
| | | } |
| | | |
| | | state = {} |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.props |
| | | |
| | | if (config.setting.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.setting.timer, config.setting.timerRepeats, () => {this.loadData()}) |
| | | } |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { return false } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | async loadData () { |
| | | const { config, BID } = this.props |
| | | |
| | | let param = UtilsDM.getQueryDataParams(config.setting, config.columns.map(col => col.field).join(','), [], config.setting.order, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let _data = { $$empty: true } |
| | | |
| | | if (result.data && result.data[0]) { |
| | | _data = result.data[0] |
| | | } |
| | | |
| | | _data.$$loaded = true |
| | | |
| | | MKEmitter.emit('mkPublicData', config.uuid, _data) |
| | | } else { |
| | | this.timer && this.timer.stop() |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | render() {return null} |
| | | } |
| | | |
| | | export default MkInterItem |
| | |
| | | import { notification, Spin, Row, Col } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM, { getStructuredParams, getStructDefaultParam } from '@/utils/utils-datamanage.js' |
| | | import { getStructuredParams, getStructDefaultParam } from '@/utils/utils-datamanage.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import NotFount from '@/components/404' |
| | |
| | | const TimeLine = asyncComponent(() => import('./components/timeline/normal-timeline')) |
| | | const Voucher = asyncComponent(() => import('./components/module/voucher')) |
| | | const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) |
| | | const MkInterfaces = asyncComponent(() => import('@/tabviews/custom/components/interfaces')) |
| | | |
| | | class CustomPage extends Component { |
| | | static propTpyes = { |
| | |
| | | |
| | | window.GLOB.CacheData.set(MenuID, param) |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID) |
| | | |
| | | // 获取主搜索条件 |
| | | let mainSearch = [] |
| | | config.components.forEach(component => { |
| | | if (component.type !== 'search') return |
| | | |
| | | component.search = component.search.map(item => { |
| | | item.oriInitval = item.initval |
| | | if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { |
| | | item.initval = param.$searchval |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | mainSearch = Utils.initMainSearch(component.search) |
| | | }) |
| | | |
| | | let params = [] |
| | | let BID = param.$BID || '' |
| | | let inherit = {} |
| | | |
| | | if (config.cacheUseful === 'true') { // 缓存继承 |
| | | inherit.cacheUseful = config.cacheUseful |
| | | inherit.timeUnit = config.timeUnit |
| | | inherit.cacheTime = config.cacheTime |
| | | } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs) |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces) |
| | | |
| | | // 获取主搜索条件 |
| | | let mainSearch = [] |
| | | config.components.forEach(component => { |
| | | if (component.type !== 'search') return |
| | | |
| | | component.search = component.search.map(item => { |
| | | item.oriInitval = item.initval |
| | | if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { |
| | | item.initval = param.$searchval |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | mainSearch = Utils.initMainSearch(component.search) |
| | | }) |
| | | |
| | | let params = [] |
| | | let BID = param.$BID || '' |
| | | let inherit = {} |
| | | |
| | | if (config.cacheUseful === 'true') { // 缓存继承 |
| | | inherit.cacheUseful = config.cacheUseful |
| | | inherit.timeUnit = config.timeUnit |
| | | inherit.cacheTime = config.cacheTime |
| | | } |
| | | |
| | | config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs, balMap) |
| | | |
| | | if ([...balMap.keys()].length > 0) { |
| | |
| | | config, |
| | | mainSearch |
| | | }, () => { |
| | | if (!params || params.length === 0) { |
| | | if (params.length === 0) { |
| | | setTimeout(() => { // 延时加载状态 |
| | | this.setState({ |
| | | loadingview: false |
| | |
| | | if (!this.props.Tab) { |
| | | this.setShortcut() |
| | | } |
| | | |
| | | this.loadData() |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | } |
| | | } |
| | | |
| | | loadData = () => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.interfaces || config.interfaces.length === 0) return |
| | | |
| | | let inters = [] |
| | | |
| | | config.interfaces.forEach(item => { |
| | | if (item.status !== 'true') return |
| | | |
| | | if (window.GLOB.systemType === 'production' && !item.proInterface) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: `《${item.name}》未设置正式系统地址!`, |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | item.MenuName = config.MenuName || '' |
| | | |
| | | inters.push(item) |
| | | }) |
| | | |
| | | // if (inters.length > 0) { |
| | | // this.loadOutResource(inters) |
| | | // } |
| | | } |
| | | |
| | | loadOutResource = (inters) => { |
| | | let setting = inters.shift() |
| | | let param = UtilsDM.getPrevQueryParams(setting, [], this.state.BID) |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { |
| | | if (inters.length > 0) { |
| | | this.loadOutResource(inters) |
| | | } |
| | | } else { |
| | | this.customOuterRequest(res, setting, inters) |
| | | } |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | customOuterRequest = (result, setting, inters) => { |
| | | let url = '' |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = setting.proInterface |
| | | } else { |
| | | url = setting.interface |
| | | } |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key |
| | | |
| | | let param = {} |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, setting.method, param, setting.cross).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | | if (typeof(res) === 'string') { |
| | | error = res.replace(/'/ig, '"') |
| | | } |
| | | |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: error |
| | | } |
| | | |
| | | this.customCallbackRequest(_result, setting, inters) |
| | | } else { |
| | | if (Array.isArray(res)) { |
| | | res = { data: res } |
| | | } |
| | | res.mk_api_key = mkey |
| | | this.customCallbackRequest(res, setting, inters) |
| | | } |
| | | }, (e) => { |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: e && e.statusText ? e.statusText : '' |
| | | } |
| | | |
| | | this.customCallbackRequest(_result, setting, inters) |
| | | }) |
| | | } |
| | | |
| | | customCallbackRequest = (result, setting, inters) => { |
| | | let errSql = '' |
| | | if (result.$ErrCode === 'E') { |
| | | errSql = ` |
| | | set @ErrorCode='E' |
| | | set @retmsg='${result.$ErrMesg}' |
| | | ` |
| | | delete result.$ErrCode |
| | | delete result.$ErrMesg |
| | | } |
| | | |
| | | let lines = UtilsDM.getCallBackSql(setting, result) |
| | | let param = {} |
| | | |
| | | if (setting.callbackType === 'script') { // 使用自定义脚本 |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | |
| | | param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, this.state.BID) |
| | | } else { |
| | | param.func = 's_ex_result_back' |
| | | param.s_ex_result = lines.map((item, index) => ({ |
| | | MenuID: this.props.MenuID || '', |
| | | MenuName: this.props.MenuName || '', |
| | | TableName: item.table, |
| | | LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), |
| | | Sort: index + 1 |
| | | })) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | console.info(sql.replace(/\n\s{10}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (inters.length > 0) { |
| | | this.loadOutResource(inters) |
| | | } |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId) => { |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces) => { |
| | | return components.filter(item => { |
| | | item.$pageId = pageId |
| | | |
| | |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.$pageId = pageId |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId) |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces) |
| | | return tab |
| | | }) |
| | | |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId) |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { |
| | |
| | | item.wrap.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0 |
| | | ) { |
| | | return false |
| | | } |
| | | |
| | | if (item.wrap.datatype === 'public') { |
| | | let inter = interfaces.filter(int => item.wrap.publicId === int.uuid)[0] |
| | | if (!inter) { |
| | | item.wrap.datatype = 'static' |
| | | } else { |
| | | item.setting = inter.setting |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | component.components = this.formatSetting(component.components, null, null, inherit, regs, balMap) |
| | | component = {...component, ...inherit} |
| | | return component |
| | | } else if (component.wrap && component.wrap.datatype === 'public') { |
| | | return component |
| | | } |
| | | |
| | | if (component.setting) { |
| | |
| | | }) |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatInterSetting = (inters, regs) => { |
| | | if (!inters) return [] |
| | | |
| | | let interfaces = inters.filter(m => m.status === 'true') |
| | | |
| | | let delay = 15 |
| | | return interfaces.map(inter => { |
| | | inter.setting.delay = delay |
| | | delay += 15 |
| | | |
| | | if (inter.setting.interType !== 'system') return inter |
| | | |
| | | let _customScript = '' |
| | | inter.scripts.forEach(script => { |
| | | if (script.status !== 'false') { |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } |
| | | }) |
| | | delete inter.scripts |
| | | |
| | | inter.setting.$name = '公共数据源-' + inter.setting.name |
| | | inter.setting.execute = inter.setting.execute !== 'false' |
| | | inter.setting.laypage = true |
| | | |
| | | if (!inter.setting.execute) { |
| | | inter.setting.dataresource = '' |
| | | } |
| | | if (/\s/.test(inter.setting.dataresource)) { |
| | | inter.setting.dataresource = '(' + inter.setting.dataresource + ') tb' |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | inter.setting.dataresource = inter.setting.dataresource.replace(/\$@/ig, '/*').replace(/@datam@/ig, '\'Y\'') |
| | | inter.setting.dataresource = inter.setting.dataresource.replace(/@\$/ig, '*/') |
| | | _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@datam@/ig, '\'Y\'') |
| | | _customScript = _customScript.replace(/@\$/ig, '*/') |
| | | } else { |
| | | inter.setting.dataresource = inter.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | regs.forEach(cell => { |
| | | inter.setting.dataresource = inter.setting.dataresource.replace(cell.reg, cell.value) |
| | | _customScript = _customScript.replace(cell.reg, cell.value) |
| | | }) |
| | | |
| | | inter.setting.customScript = _customScript // 整理后自定义脚本 |
| | | |
| | | return inter |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 主表数据加载 |
| | | */ |
| | |
| | | MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) |
| | | |
| | | window.GLOB.CacheData.delete(this.props.MenuID) |
| | | if (this.state.config) { |
| | | this.deleteCache(this.state.config.components) |
| | | this.state.config.interfaces.forEach(m => { |
| | | window.GLOB.CacheData.delete(m.uuid) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | debugChange = () => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { loadingview, viewlost, config, loading, shortcuts } = this.state |
| | | const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state |
| | | |
| | | return ( |
| | | <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}> |
| | | {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null} |
| | | <Row className="component-wrap">{this.getComponents()}</Row> |
| | | {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} |
| | | {config && window.GLOB.breakpoint ? <DebugTable /> : null} |
| | | {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} |
| | | {!window.GLOB.mkHS && config ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null} |
| | |
| | | } |
| | | } |
| | | |
| | | refreshByButtonResult = () => { |
| | | refreshDebugTable = () => { |
| | | const { loading } = this.state |
| | | |
| | | if (!loading) { |
| | |
| | | } |
| | | |
| | | componentDidMount() { |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | MKEmitter.addListener('refreshDebugTable', this.refreshDebugTable) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | MKEmitter.removeListener('refreshDebugTable', this.refreshDebugTable) |
| | | } |
| | | |
| | | render() { |
| | |
| | | return ( |
| | | <div className="debugtable"> |
| | | <RedoOutlined className="mk-debug-reload" onClick={() => this.loadmaindata()}/> |
| | | <Table size="middle" columns={columns} dataSource={data} loading={loading} scroll={{ x: '100%', y: false }}/> |
| | | <Table size="middle" columns={columns} dataSource={data} pagination={false} loading={loading} scroll={{ x: '100%', y: false }}/> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | |
| | | let item = { |
| | | type: type, |
| | | readonly: false, |
| | | readin: true, |
| | | writein: true, |
| | | fieldlen: fieldlen, |
| | |
| | | |
| | | if (form.type === 'number' || form.type === 'rate') { |
| | | let val = form.value |
| | | if (typeof(val) !== 'number') { |
| | | val = parseFloat(val) |
| | | if (isNaN(val)) { |
| | | val = 0 |
| | | } |
| | | } |
| | | _initFormfields.push(`@${_key}=${val}`) |
| | | } else if (['date', 'datemonth', 'datetime'].includes(form.type)) { |
| | | } else if (['date', 'datemonth'].includes(form.type)) { |
| | | _initFormfields.push(`@${_key}='${form.value || '1949-10-01'}'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='${form.value}'`) |
| | |
| | | } |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce') { |
| | | if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce' && columns && columns.length > 0) { |
| | | datavars = {...data, ...datavars} |
| | | |
| | | const setField = (col) => { |
| | |
| | | } |
| | | } |
| | | |
| | | if (columns && columns.length > 0) { |
| | | columns.forEach(col => { |
| | | if (col.type === 'colspan' || col.type === 'old_colspan') { |
| | | col.subcols.forEach(cell => { |
| | |
| | | setField(col) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // 变量声明 |
| | |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id, this.state.selines) |
| | | } |
| | | |
| | | if (window.GLOB.breakpoint) { |
| | | MKEmitter.emit('refreshDebugTable') |
| | | } |
| | | |
| | | btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | |
| | | if (tabId) { |
| | |
| | | let data = this.props.selectedData && this.props.selectedData[0] ? this.props.selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | | |
| | | if (window.GLOB.breakpoint) { |
| | | MKEmitter.emit('refreshDebugTable') |
| | | } |
| | | } |
| | | |
| | | handleModelConfig = (config) => { |
| | |
| | | |
| | | btnconfig.fields.forEach(item => { |
| | | if (!item.field) return |
| | | let _readin = item.readin !== 'false' |
| | | let _initval = item.initval |
| | | let _item = { |
| | | key: item.field, |
| | | readin: item.readin !== 'false' && item.readin !== 'top', |
| | | fieldlen: item.fieldlength || 50, |
| | | writein: item.writein !== 'false', |
| | | type: item.type |
| | | } |
| | | |
| | | if (item.type === 'linkMain' || item.type === 'funcvar') { |
| | | let _initval = item.initval |
| | | let _readin = item.readin !== 'false' |
| | | let _format = item.precision || 'day' // 时间格式化 |
| | | |
| | | if (item.type === 'funcvar') { |
| | | _initval = '' |
| | | _readin = false |
| | | _item.readin = false |
| | | } else if (item.type === 'linkMain') { |
| | | _readin = false |
| | | _item.readin = false |
| | | } else if (item.type === 'date') { |
| | | if (_format !== 'day') { |
| | | _format = 'YYYY-MM-DD HH:mm:ss' |
| | | } else { |
| | | _format = 'YYYY-MM-DD' |
| | | } |
| | | } else if (item.type === 'datetime') { |
| | | _item.type = 'date' |
| | | _format = 'YYYY-MM-DD HH:mm:ss' |
| | | } |
| | | |
| | | let key = item.field.toLowerCase() |
| | | |
| | | if (item.type === 'linkMain' && BData.hasOwnProperty(key)) { |
| | | if (_item.type === 'linkMain' && BData.hasOwnProperty(key)) { |
| | | _initval = BData[key] |
| | | } else if (_readin && _data.hasOwnProperty(key)) { |
| | | _initval = _data[key] |
| | | } else if (item.type === 'date' && _initval) { |
| | | _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD') |
| | | } else if (item.type === 'datemonth' && _initval) { |
| | | } else if (_item.type === 'date' && _initval) { |
| | | _initval = moment().subtract(_initval, 'days').format(_format) |
| | | } else if (_item.type === 'datemonth' && _initval) { |
| | | _initval = moment().subtract(_initval, 'month').format('YYYY-MM') |
| | | } else if (item.type === 'datetime' && _initval) { |
| | | _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD HH:mm:ss') |
| | | } |
| | | |
| | | if (_initval === undefined) { |
| | | _initval = '' |
| | | _item.value = _initval === undefined ? '' : _initval |
| | | |
| | | if (_item.type === 'number' || item.declare === 'decimal') { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (['text', 'textarea', 'linkMain'].includes(_item.type)) { |
| | | _item.value = _item.value + '' |
| | | _item.value = _item.value.replace(/\t*|\v*/g, '') // 去除制表符 |
| | | |
| | | if (item.interception !== 'false') { // 去除首尾空格 |
| | | _item.value = _item.value.replace(/(^\s*|\s*$)/g, '') |
| | | } |
| | | |
| | | let _fieldlen = item.fieldlength || 50 |
| | | if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') { |
| | | _fieldlen = item.fieldlength || 512 |
| | | } else if (item.type === 'number') { |
| | | _fieldlen = item.decimal ? item.decimal : 0 |
| | | } else if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_initval)) { // 特殊字段替换 |
| | | _initval = _initval.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (BID || '')) |
| | | if (_item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 特殊字段替换 |
| | | _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (BID || '')) |
| | | } |
| | | |
| | | let _type = item.type |
| | | |
| | | if (['date', 'datemonth', 'datetime'].includes(_type) && item.declareType === 'nvarchar(50)') { |
| | | _type = 'text' |
| | | } else if (item.type === 'rate') { |
| | | item.rateCount = item.rateCount || 5 |
| | | let allowHalf = item.allowHalf === 'true' |
| | | |
| | | if (allowHalf) { |
| | | _initval = parseFloat(_initval) |
| | | if (_initval % 0.5 !== 0) { |
| | | _initval = parseInt(_initval) |
| | | } |
| | | if (_item.type === 'text' && item.lenControl && item.lenControl !== 'limit') { |
| | | if (item.lenControl === 'left') { |
| | | _item.value = _item.value.substr(0, item.fieldlength) |
| | | } else { |
| | | _initval = parseInt(_initval) |
| | | _item.value = _item.value.slice(-item.fieldlength) |
| | | } |
| | | } |
| | | } else if (_item.type.indexOf('date') > -1) { |
| | | if (item.declareType === 'nvarchar(50)') { |
| | | _item.type = 'text' |
| | | } |
| | | } else if (_item.type === 'rate') { |
| | | let count = item.rateCount || 5 |
| | | _item.value = parseInt(_item.value) |
| | | |
| | | if (isNaN(_initval) || _initval < 0) { |
| | | _initval = 0 |
| | | } else if (_initval > item.rateCount) { |
| | | _initval = item.rateCount |
| | | if (isNaN(_item.value) || _item.value < 0) { |
| | | _item.value = 0 |
| | | } else if (_item.value > count) { |
| | | _item.value = count |
| | | } |
| | | } |
| | | |
| | | result.push({ |
| | | key: item.field, |
| | | readonly: item.readonly === 'true', |
| | | readin: item.readin !== 'false' && item.readin !== 'top', |
| | | fieldlen: _fieldlen, |
| | | writein: item.writein !== 'false', |
| | | type: _type, |
| | | value: _initval |
| | | }) |
| | | result.push(_item) |
| | | }) |
| | | |
| | | if (btnconfig.setting.display === 'exec') { |
| | |
| | | readin = false |
| | | item.readin = false |
| | | item.hidden = true |
| | | } else if (item.type === 'linkMain') { |
| | | readin = false |
| | | item.readin = false |
| | | } else if (item.type === 'number') { |
| | | item.decimal = item.decimal || 0 |
| | | item.fieldlength = item.decimal |
| | |
| | | if (readin && data.hasOwnProperty(key)) { |
| | | newval = data[key] |
| | | } |
| | | if (item.type === 'linkMain') { |
| | | newval = BData[key] || '$empty' |
| | | } else if (item.type === 'date') { // 时间搜索 |
| | | let format = 'YYYY-MM-DD' |
| | | if (item.type === 'linkMain' && BData.hasOwnProperty(key)) { |
| | | newval = BData[key] |
| | | } else if (item.type === 'date') { // 时间表单,提交值为天或秒 |
| | | let _format = 'YYYY-MM-DD HH:mm:ss' |
| | | if (item.precision === 'day') { |
| | | _format = 'YYYY-MM-DD' |
| | | } else if (item.precision === 'hour') { |
| | | format = 'YYYY-MM-DD HH' |
| | | } else if (item.precision === 'minute') { |
| | | format = 'YYYY-MM-DD HH:mm' |
| | | } else if (item.precision === 'second') { |
| | | format = 'YYYY-MM-DD HH:mm:ss' |
| | | } |
| | | |
| | | if (newval !== '$empty') { |
| | | newval = moment(newval, format).format(_format) |
| | | newval = moment(newval, 'YYYY-MM-DD HH:mm:ss').format(_format) |
| | | newval = newval === 'Invalid date' ? '$empty' : newval |
| | | } |
| | | if (newval === '$empty' && item.initval) { |
| | |
| | | if (newval === '$empty' && item.initval) { |
| | | newval = moment().subtract(item.initval, 'month').format('YYYY-MM') |
| | | } |
| | | // } else if (item.type === 'datetime') { |
| | | // if (newval !== '$empty') { |
| | | // newval = moment(newval, 'YYYY-MM-DD HH:mm:ss').format('YYYY-MM-DD HH:mm:ss') |
| | | // newval = newval === 'Invalid date' ? '$empty' : newval |
| | | // } |
| | | // if (newval === '$empty' && item.initval) { |
| | | // if (item.initval === '0') { |
| | | // newval = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // } else { |
| | | // newval = moment().subtract(item.initval, 'days').format('YYYY-MM-DD') + ' 00:00:00' |
| | | // } |
| | | // } |
| | | } else if (item.type === 'switch') { // 开关只接收固定值 |
| | | if (newval !== '$empty' && (newval === item.closeVal || newval === item.openVal)) { |
| | | |
| | |
| | | item.initval = '' |
| | | } |
| | | |
| | | if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && item.resourceType === '1') { |
| | | if (item.type === 'number') { |
| | | if (isNaN(item.initval)) { |
| | | item.initval = 0 |
| | | } |
| | | } else if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && item.resourceType === '1') { |
| | | deForms.push(item) |
| | | } else if (item.type === 'rate') { |
| | | item.rateCount = item.rateCount || 5 |
| | |
| | | } |
| | | |
| | | if (item.type === 'text') { |
| | | if (typeof(item.initval) === 'number') { |
| | | item.initval = item.initval + '' |
| | | } |
| | | let _rules = [{ |
| | | pattern: /^[^']*$/ig, |
| | | message: '不可使用英文状态的单引号!' |
| | |
| | | if (item.regular === 'number') { |
| | | _rules.push({ |
| | | pattern: /^[0-9.-]*$/, |
| | | message: formRule.input.numbermsg |
| | | message: item.regularText || formRule.input.numbermsg |
| | | }) |
| | | } else if (item.regular === 'letter') { |
| | | _rules.push({ |
| | | pattern: /^[a-zA-Z]*$/, |
| | | message: formRule.input.lettermsg |
| | | message: item.regularText || formRule.input.lettermsg |
| | | }) |
| | | } else if (item.regular === 'letter_number') { |
| | | _rules.push({ |
| | | pattern: /^[a-zA-Z0-9]*$/, |
| | | message: '请输入数字或字母' |
| | | message: item.regularText || '请输入数字或字母' |
| | | }) |
| | | } else if (item.regular === 'letter&number') { |
| | | _rules.push({ |
| | | pattern: /^[a-zA-Z0-9@_.]*$/, |
| | | message: '请输入数字、字母以及@_.' |
| | | message: item.regularText || '请输入数字、字母以及@_.' |
| | | }) |
| | | } else if (item.regular === 'phone') { |
| | | _rules.push({ |
| | | pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, |
| | | message: '请正确输入手机号' |
| | | message: item.regularText || '请正确输入手机号' |
| | | }) |
| | | } else if (item.regular === 'email') { |
| | | _rules.push({ |
| | | pattern: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/, |
| | | message: '请正确输入邮箱地址' |
| | | }) |
| | | } else if (item.regular === 'funcname') { |
| | | _rules.push({ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/, |
| | | message: formRule.input.funcname |
| | | message: item.regularText || '请正确输入邮箱地址' |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | let _item = { |
| | | type: item.type, |
| | | readonly: item.readonly, |
| | | readin: item.readin, |
| | | writein: item.writein, |
| | | fieldlen: item.fieldlength, |
| | |
| | | |
| | | if (item.type === 'funcvar') { |
| | | _item.value = '' |
| | | } else if (_item.value && (item.type === 'text' || item.type === 'textarea' || item.type === 'linkMain') && typeof(_item.value) === 'string') { |
| | | } else if (item.declare === 'decimal') { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (['text', 'textarea', 'linkMain'].includes(item.type)) { |
| | | _item.value = _item.value + '' |
| | | _item.value = _item.value.replace(/\t*|\v*/g, '') // 去除制表符 |
| | | |
| | | if (item.interception !== 'false') { // 去除首尾空格 |
| | |
| | | if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 特殊字段替换 |
| | | _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || '')) |
| | | } |
| | | } else if (item.type.indexOf('date') > -1) { |
| | | if (item.declareType === 'nvarchar(50)') { |
| | | _item.type = 'text' |
| | | } |
| | | } else if (item.declare === 'decimal' && ['select', 'link', 'radio', 'checkcard'].includes(item.type)) { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } |
| | | |
| | | if (item.type === 'text' && item.lenControl && item.lenControl !== 'limit') { |
| | | if (item.lenControl === 'left') { |
| | | _item.value = _item.value.substr(0, item.fieldlength) |
| | |
| | | _item.value = _item.value.slice(-item.fieldlength) |
| | | } |
| | | } |
| | | } else if (item.type.indexOf('date') > -1) { |
| | | if (item.declareType === 'nvarchar(50)') { |
| | | _item.type = 'text' |
| | | } |
| | | } |
| | | |
| | | search.push(_item) |
| | | }) |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'lenControl', |
| | | label: '长度控制', |
| | | initVal: card.lenControl || 'limit', |
| | | tooltip: '在设置字段长度后,对长度的控制方式。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'limit', |
| | | text: '限制输入' |
| | | }, { |
| | | value: 'left', |
| | | text: '左截' |
| | | }, { |
| | | value: 'right', |
| | | text: '右截' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'span', |
| | | min: 1, |
| | |
| | | }, { |
| | | value: 6, |
| | | text: 6 |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'lenControl', |
| | | label: '长度控制', |
| | | initVal: card.lenControl || 'limit', |
| | | tooltip: '在设置字段长度后,对长度的控制方式。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'limit', |
| | | text: '限制输入' |
| | | }, { |
| | | value: 'left', |
| | | text: '左截' |
| | | }, { |
| | | value: 'right', |
| | | text: '右截' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'regularText', |
| | | label: '正则提示', |
| | | initVal: card.regularText || '', |
| | | tooltip: '正则验证时的提示信息。', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'tooltip', |
| | | label: '悬浮提示', |
| | | tooltip: '鼠标悬浮于提示文字上方时,显示提示信息。', |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'placeholder', |
| | | label: '提示信息', |
| | | label: '输入提示', |
| | | tooltip: '字段预期值的提示信息。', |
| | | initVal: card.placeholder || '', |
| | | required: false |
| | |
| | | formula: ['label', 'type', 'marginTop', 'marginBottom', 'splitline', 'span', 'labelwidth', 'formula', 'eval', 'postfix'], |
| | | brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'span', 'labelwidth', 'tooltip', 'extra', 'encryption', 'marginTop', 'marginBottom'], |
| | | funcvar: ['span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'], |
| | | linkMain: ['readonly', 'required', 'hidden', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'interception', 'extra', 'marginTop', 'marginBottom'] |
| | | linkMain: ['readonly', 'required', 'hidden','declare', 'span', 'labelwidth', 'tooltip', 'interception', 'extra', 'marginTop', 'marginBottom'] |
| | | } |
| | | |
| | | class MainSearch extends Component { |
| | |
| | | if (this.record.enter === 'tab' || this.record.enter === 'sub') { |
| | | shows.push('tabField') |
| | | } |
| | | if (this.record.regular !== '') { |
| | | shows.push('regularText') |
| | | } |
| | | } else if (type === 'number') { |
| | | reTypes.initval = 'number' |
| | | reRequired.initval = true |
| | |
| | | if (sessionStorage.getItem('appType') === 'mob') { // 移动端右侧扩展信息 |
| | | shows.push('placeholder') |
| | | } |
| | | } else if (type === 'linkMain') { |
| | | if (this.record.declare === 'nvarchar') { |
| | | shows.push('fieldlength') |
| | | } else if (this.record.declare === 'decimal') { |
| | | shows.push('decimal') |
| | | } |
| | | } else if (['multiselect', 'select', 'link', 'radio', 'checkbox'].includes(type)) { |
| | | if (this.record.resourceType === '0') { // 自定义资源 |
| | | shows.push('options') |
| | |
| | | </Col> |
| | | <Col span={24} className="sql"> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" overlayStyle={{width: '320px', maxWidth: '320px'}} title={<><div>{'调试替换符 /*$breakpoint_begin_xxxx@ 、@breakpoint_end_xxxx$*/,在控制台中输入 window.debug = \'xxxx\' 会启用对应的调试语句,快捷键 ctrl+c 或在控制台中输入 window.debug = false 关闭调试。'}</div><div style={{height: '5px'}}></div><div>{'数据检查替换符 $check@ -> \'\'、 @check$ -> \'\',ErrorCode等于C时 $check@ -> /*、 @check$ -> */。注:1、需使用系统接口 2、行设置为“选择多行”时无效。'}</div></>}> |
| | | <Tooltip placement="topLeft" overlayStyle={{width: '320px', maxWidth: '320px'}} title={<><div>{'调试替换符 /*$breakpoint_begin_xxxx@ 、@breakpoint_end_xxxx$*/,在控制台中输入 window.debug = \'xxxx\' 会启用对应的调试语句,快捷键 ctrl+c 或在控制台中输入 window.debug = false 关闭调试。注:调试时字符 $breakpoint_proc@ 将被替换。'}</div><div style={{height: '5px'}}></div><div>{'数据检查替换符 $check@ -> \'\'、 @check$ -> \'\',ErrorCode等于C时 $check@ -> /*、 @check$ -> */。注:1、需使用系统接口 2、行设置为“选择多行”时无效。'}</div></>}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | sql |
| | | </Tooltip> |
| | |
| | | |
| | | let error = '' |
| | | |
| | | sql = sql.replace(/sys\.fn_sqlvarbasetostr\(HashBytes\('MD5'/ig, '') // 跳过MD5加密 |
| | | sql = sql.replace(/sys\.fn_/ig, '') // 跳过sys.fn_验证 |
| | | |
| | | chars.forEach(char => { |
| | | if (!error && char.reg.test(sql)) { |
| | |
| | | |
| | | if (form.type === 'number' || form.type === 'rate') { |
| | | let val = form.value |
| | | if (typeof(val) !== 'number') { |
| | | val = parseFloat(val) |
| | | if (isNaN(val)) { |
| | | val = 0 |
| | | } |
| | | } |
| | | _initFormfields.push(`@${_key}=${val}`) |
| | | } else if (['date', 'datemonth', 'datetime'].includes(form.type)) { |
| | | } else if (['date', 'datemonth'].includes(form.type)) { |
| | | _initFormfields.push(`@${_key}='${form.value || '1949-10-01'}'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='${form.value}'`) |
| | |
| | | } |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce') { |
| | | if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce' && columns && columns.length > 0) { |
| | | datavars = {...data, ...datavars} |
| | | |
| | | const setField = (col) => { |
| | |
| | | } |
| | | } |
| | | |
| | | if (columns && columns.length > 0) { |
| | | columns.forEach(col => { |
| | | if (col.type === 'colspan' || col.type === 'old_colspan') { |
| | | col.subcols.forEach(cell => { |
| | |
| | | setField(col) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // 变量声明 |
| | |
| | | end = /@breakpoint_end_[0-9a-z_]+\$\*\//ig |
| | | } |
| | | |
| | | _sql = _sql.replace(start, '').replace(end, '') |
| | | _sql = _sql.replace(start, '').replace(end, '').replace(/\$breakpoint_proc@/ig, window.GLOB.breakpoint) |
| | | _sql += ` |
| | | z_debug_end: select @ErrorCode='E',@retmsg='debug_end' goto aaa` |
| | | } |