| | |
| | | systems: [], |
| | | searchkey: '', |
| | | thdMenuList: [], |
| | | debug: sessionStorage.getItem('debug') === 'true', |
| | | debug: sessionStorage.getItem('debug') === 'true' && window.GLOB.memberLevel > 0, |
| | | collapse: sessionStorage.getItem('collapse') === 'true' |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | componentDidMount() { |
| | | if (!window.GLOB.designView) { |
| | | if (window.GLOB.systemIcons) { |
| | | this.setState({cusicons: window.GLOB.systemIcons}) |
| | | } else { |
| | | this.getIcons() |
| | | } |
| | | if (!window.GLOB.designView && window.GLOB.systemIcons) { |
| | | this.setState({cusicons: window.GLOB.systemIcons}) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | getIcons = () => { |
| | | const { selectIcon } = this.state |
| | | |
| | | Api.getCloudConfig({ func: 's_get_icons' }).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | |
| | | window.GLOB.systemIcons = icons |
| | | |
| | | this.setState({cusicons: icons}) |
| | | |
| | | if (icons.length > 0 && selectIcon && /<svg/.test(selectIcon)) { |
| | | setTimeout(() => { |
| | | let node = document.getElementById('mk-custom-tab') |
| | | node && node.click() |
| | | }, 200) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({visible: true}) |
| | | |
| | | if (cusicons.length > 0 && selectIcon && /<svg/.test(selectIcon)) { |
| | | if (!window.GLOB.designView && !window.GLOB.systemIcons) { |
| | | this.getIcons() |
| | | } else if (cusicons.length > 0 && selectIcon && /<svg/.test(selectIcon)) { |
| | | setTimeout(() => { |
| | | let node = document.getElementById('mk-custom-tab') |
| | | node && node.click() |
| | |
| | | let lang = localStorage.getItem(_href + 'lang') || (config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') |
| | | sessionStorage.setItem('lang', lang) |
| | | |
| | | let _level = 10 |
| | | let _level = 0 |
| | | let _Mlevel = sessionStorage.getItem('Member_Level') |
| | | |
| | | if (_Mlevel) { |
| | |
| | | roleList = [] |
| | | } |
| | | |
| | | if (wrap.datatype === 'public' && MenuType === 'billPrint') { |
| | | wrap.datatype = 'static' |
| | | } |
| | | |
| | | const balconyWrapForm = [ |
| | | { |
| | | type: 'text', |
| | |
| | | options: [ |
| | | {value: 'dynamic', label: '动态'}, |
| | | {value: 'static', label: '静态'}, |
| | | {value: 'public', label: '公共数据源', disabled: MenuType === 'billPrint'}, |
| | | {value: 'public', label: '公共数据源'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'empty', values: ['dynamic']}, |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, Button, notification } from 'antd' |
| | | import { Modal, Button } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { getCardCellForm } from './formconfig' |
| | | import { queryPrintSql } from '@/utils/option.js' |
| | | import { getActionForm, getBaseTableActionForm } from '@/menu/components/share/actioncomponent/formconfig' |
| | | import Utils, { FuncUtils } from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | |
| | | let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId) |
| | | |
| | | this.checkPrintTemp().then(() => { |
| | | if (cards.subtype === 'basetable') { |
| | | this.setState({ |
| | | actvisible: true, |
| | | card: card, |
| | | formlist: getBaseTableActionForm(card, functip, cards, usefulFields, modules) |
| | | }) |
| | | } else { |
| | | let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] |
| | | |
| | | this.setState({ |
| | | actvisible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, cards, usefulFields, modules, anchors, side) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if (cards.subtype === 'basetable') { |
| | | this.setState({ |
| | | actvisible: true, |
| | | card: card, |
| | | formlist: getBaseTableActionForm(card, functip, cards, usefulFields, modules) |
| | | }) |
| | | } else { |
| | | let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] |
| | | |
| | | checkPrintTemp = () => { |
| | | return new Promise(resolve => { |
| | | if (!window.GLOB.printTemps) { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: Utils.formatOptions(queryPrintSql), |
| | | obj_name: 'data', |
| | | arr_field: 'PN,ID,Images' |
| | | } |
| | | |
| | | 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) // 云端数据验证 |
| | | |
| | | Api.getCloudConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | let temps = (res.data || []).map(temp => { |
| | | return { |
| | | value: temp.ID, |
| | | text: temp.PN |
| | | } |
| | | }) |
| | | window.GLOB.printTemps = temps |
| | | resolve() |
| | | }, () => { |
| | | resolve() |
| | | }) |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | this.setState({ |
| | | actvisible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, cards, usefulFields, modules, anchors, side) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | if (wrap.datatype === 'public' && MenuType === 'billPrint') { |
| | | wrap.datatype = 'static' |
| | | } |
| | | |
| | | const cardWrapForm = [ |
| | | { |
| | | type: 'text', |
| | |
| | | options: [ |
| | | {value: 'dynamic', label: '动态', priKeyType: 'static'}, |
| | | {value: 'static', label: '静态', priKeyType: 'static'}, |
| | | {value: 'public', label: '公共数据源', priKeyType: 'static', disabled: MenuType === 'billPrint'}, |
| | | {value: 'public', label: '公共数据源', priKeyType: 'static'}, |
| | | ], |
| | | linkFields: ['priKeyType'], |
| | | controlFields: [ |
| | |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import KeyInterface from '@/components/keyInterface' |
| | | import MkPrintTemps from './mkPrintTemps' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | } |
| | | } else if (openType === 'excelOut') { |
| | | reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') |
| | | reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredOnce'].includes(op.value)) |
| | | |
| | | if (appType === 'mob') { |
| | | reOptions.Ot = requireOptions.filter(op => ['notRequired'].includes(op.value)) |
| | | } else { |
| | | reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredOnce'].includes(op.value)) |
| | | } |
| | | |
| | | if (this.record.intertype === 'outer') { |
| | | shows.push('innerFunc', 'sysInterface', 'outerFunc') |
| | |
| | | if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { |
| | | shows.push('resetPageIndex') |
| | | } |
| | | if (this.record.Ot !== 'notRequired' && this.record.Ot !== 'requiredOnce') { |
| | | if (this.record.Ot !== 'notRequired' && appType === 'mob') { |
| | | this.record.Ot = 'notRequired' |
| | | } else if (this.record.Ot !== 'notRequired' && this.record.Ot !== 'requiredOnce') { |
| | | this.record.Ot = 'notRequired' |
| | | } |
| | | } else if (openType === 'popview') { |
| | |
| | | } |
| | | |
| | | content = <TextArea rows={2} readOnly={item.readonly}/> |
| | | } else if (item.type === 'printTemps') { |
| | | rules = [ |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <MkPrintTemps /> |
| | | } else if (item.type === 'keyinterface') { |
| | | span = 24 |
| | | className = 'textarea' |
| | |
| | | |
| | | values.verify.sheet = values.verify.sheet || 'Sheet1' |
| | | } |
| | | |
| | | if (values.verify) { |
| | | values.verify.scripts = [] |
| | | } |
| | | } else if (card.OpenType === 'excelIn' && values.OpenType === 'excelOut') { |
| | | if (values.verify && values.verify.columns && values.verify.columns.length > 0) { |
| | | values.verify.columns = values.verify.columns.map(col => { |
| | |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | if (values.verify) { |
| | | values.verify.scripts = [] |
| | | } |
| | | } |
| | | |
| | | if (values.OpenType === 'form') { |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import { Select, notification } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { queryPrintSql } from '@/utils/option.js' |
| | | |
| | | class MKSelect extends Component { |
| | | constructor(props) { |
| | | super(props) |
| | | |
| | | this.state = { |
| | | options: window.GLOB.printTemps || [] |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | | if (!window.GLOB.printTemps) { |
| | | this.getPrintTemp() |
| | | } |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | getPrintTemp = () => { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: Utils.formatOptions(queryPrintSql), |
| | | obj_name: 'data', |
| | | arr_field: 'PN,ID,Images' |
| | | } |
| | | |
| | | 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) // 云端数据验证 |
| | | |
| | | Api.getCloudConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | let temps = (res.data || []).map(temp => { |
| | | return { |
| | | value: temp.ID, |
| | | text: temp.PN |
| | | } |
| | | }) |
| | | window.GLOB.printTemps = temps |
| | | |
| | | this.setState({options: temps}) |
| | | }) |
| | | } |
| | | |
| | | selectChange = (val) => { |
| | | this.props.onChange(val) |
| | | } |
| | | |
| | | render() { |
| | | const { value } = this.props |
| | | const { options } = this.state |
| | | |
| | | return ( |
| | | <Select |
| | | showSearch |
| | | allowClear |
| | | value={value} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onSelect={this.selectChange} |
| | | onChange={(val) => val === undefined && this.selectChange('')} |
| | | > |
| | | {options.map(option => |
| | | <Select.Option key={option.value} value={option.value}>{option.text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default MKSelect |
| | |
| | | export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = [], side) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let viewType = sessionStorage.getItem('editMenuType') // 弹窗 popview |
| | | let printTemps = window.GLOB.printTemps || [] |
| | | let setting = config.setting || {} |
| | | let columns = side === 'sub' && config.subColumns ? config.subColumns : (config.columns || []) |
| | | let appMenus = [] |
| | |
| | | options: pageTemps |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'printTemps', |
| | | key: 'printTemp', |
| | | label: '打印模板', |
| | | initVal: card.printTemp || '', |
| | | required: true, |
| | | options: printTemps |
| | | required: true |
| | | }, |
| | | { |
| | | type: isApp ? 'select' : 'cascader', |
| | |
| | | */ |
| | | export function getBaseTableActionForm (card, functip, config, usefulFields, modules) { |
| | | let viewType = sessionStorage.getItem('editMenuType') // 弹窗 popview |
| | | let printTemps = window.GLOB.printTemps || [] |
| | | let setting = config.setting || {} |
| | | let columns = config.columns || [] |
| | | |
| | |
| | | options: pageTemps |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'printTemps', |
| | | key: 'printTemp', |
| | | label: '打印模板', |
| | | initVal: card.printTemp || '', |
| | | required: true, |
| | | options: printTemps |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | |
| | | import { Modal, notification, Button } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { FuncUtils } from '@/utils/utils.js' |
| | | import { queryPrintSql } from '@/utils/option.js' |
| | | import { getActionForm, getBaseTableActionForm } from './formconfig' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | |
| | | let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId) |
| | | |
| | | this.checkPrintTemp().then(() => { |
| | | if (config.subtype === 'basetable') { |
| | | delete card.eleType // 区分按钮位置 |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getBaseTableActionForm(card, functip, config, usefulFields, modules) |
| | | }) |
| | | } else { |
| | | let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || [] |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, config, usefulFields, modules, anchors) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if (config.subtype === 'basetable') { |
| | | delete card.eleType // 区分按钮位置 |
| | | |
| | | checkPrintTemp = () => { |
| | | return new Promise(resolve => { |
| | | if (!window.GLOB.printTemps) { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: Utils.formatOptions(queryPrintSql), |
| | | obj_name: 'data', |
| | | arr_field: 'PN,ID,Images' |
| | | } |
| | | |
| | | 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) // 云端数据验证 |
| | | |
| | | Api.getCloudConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | let temps = (res.data || []).map(temp => { |
| | | return { |
| | | value: temp.ID, |
| | | text: temp.PN |
| | | } |
| | | }) |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getBaseTableActionForm(card, functip, config, usefulFields, modules) |
| | | }) |
| | | } else { |
| | | let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || [] |
| | | |
| | | window.GLOB.printTemps = temps |
| | | resolve() |
| | | }, () => { |
| | | resolve() |
| | | }) |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, config, usefulFields, modules, anchors) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | editItem: null |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | sql: ' ' |
| | | sql: ' ', |
| | | position: 'front' |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | values.position = values.position || 'front' |
| | | |
| | | let _quot = values.sql.match(/'{1}/g) |
| | | let _lparen = values.sql.match(/\({1}/g) |
| | |
| | | modules: [], |
| | | innerRules: [], |
| | | innertip: '', |
| | | MenuType: '', |
| | | ismain: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, setting } = this.props |
| | | |
| | | let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, config.uuid, window.GLOB.customMenu.interfaces) |
| | | let menu = window.GLOB.customMenu |
| | | let MenuType = '' |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | | } |
| | | |
| | | let modules = MenuUtils.getSupModules(menu.components, config.uuid, menu.interfaces) |
| | | let ismain = false |
| | | |
| | | if (window.GLOB.customMenu.Template === 'BaseTable') { |
| | | if (menu.Template === 'BaseTable') { |
| | | ismain = config.name === '主表' |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | this.setState({modules, innerRules, innertip, setting: _setting, ismain}) |
| | | this.setState({modules, innerRules, innertip, setting: _setting, ismain, MenuType}) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | render() { |
| | | const { columns, config } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { setting, modules, innerRules, innertip } = this.state |
| | | const { setting, modules, innerRules, innertip, MenuType } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | </Col> : null} |
| | | {setting.interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> |
| | | <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={ |
| | | <Tooltip placement="topLeft" title={`使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 ''、 @$ -> */ 或 '';查询替换符 $select@ -> /* 或 ''、 @select$ -> */ 或 '';统计替换符 $sum@ -> /* 或 ''、 @sum$ -> */ 或 ''。`}> |
| | | <Tooltip placement="topLeft" title={`使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 ''、 @$ -> */ 或 ''。`}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 数据源 |
| | | </Tooltip> |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!['navbar', 'balcony', 'menubar'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') ? <Col span={8}> |
| | | {!['navbar', 'balcony', 'menubar'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') && MenuType !== 'billPrint' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'该组件如果受其他组件控制,请选项相应的组件,没有时选“无”。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.type === 'interface' && setting.supModule && setting.supModule[0] === 'empty' ? <Col span={8}> |
| | | {config.type === 'interface' && ((setting.supModule && setting.supModule[0] === 'empty') || MenuType === 'billPrint') ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="初始化加载将在页面加载前执行。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.type === 'interface' ? <Col span={8}> |
| | | {config.type === 'interface' && MenuType !== 'billPrint' ? <Col span={8}> |
| | | <Form.Item label="定时器"> |
| | | {getFieldDecorator('timer', { |
| | | initialValue: setting.timer || '' |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = 'popview' |
| | | |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | | if (item.setting.supModule && ids.includes(item.setting.supModule)) { |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | ids = ids.filter(id => id !== item.setting.supModule) |
| | | } |
| | | |
| | | if (ids.length === 0) { |
| | | cell.syncComponentId = '' |
| | | } else { |
| | | cell.syncComponentIds = ids |
| | | } |
| | | } |
| | | } |
| | | cell = this.resetButton(item, cell) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | |
| | | item.action = item.action.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = 'popview' |
| | | cell.$toolbtn = true |
| | | cell = this.resetButton(item, cell) |
| | | |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | | if (item.setting.supModule && ids.includes(item.setting.supModule)) { |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | ids = ids.filter(id => id !== item.setting.supModule) |
| | | } |
| | | |
| | | if (ids.length === 0) { |
| | | cell.syncComponentId = '' |
| | | } else { |
| | | cell.syncComponentIds = ids |
| | | } |
| | | } |
| | | } |
| | | cell.$toolbtn = true |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | resetButton = (item, cell) => { |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = 'popview' |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'excelOut') { // 导出 |
| | | cell.$menuName = item.name |
| | | |
| | | if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) { |
| | | cell.errorType = 'error1' |
| | | } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom' && item.setting.interType !== 'system') { |
| | | cell.errorType = 'error2' |
| | | } |
| | | } |
| | | |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | | if (item.setting.supModule && ids.includes(item.setting.supModule)) { |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | ids = ids.filter(id => id !== item.setting.supModule) |
| | | } |
| | | |
| | | if (ids.length === 0) { |
| | | cell.syncComponentId = '' |
| | | } else { |
| | | cell.syncComponentIds = ids |
| | | } |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | | getPrinter = (item, parentId) => { |
| | |
| | | return component |
| | | } |
| | | |
| | | component.setting.arr_field = component.columns.map(col => col.field).join(',') |
| | | component.setting.useMSearch = component.setting.useMSearch === 'true' |
| | | if (component.setting.useMSearch) { |
| | | if (!window.GLOB.SearchBox.has(component.$searchId)) { |
| | |
| | | shortcuts: null, // 快捷键 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: [], // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | |
| | | item.$old = true |
| | | item.ContainerId = this.state.ContainerId |
| | | |
| | | if (item.OpenType === 'excelOut') { // 导出 |
| | | item.$menuName = MenuName |
| | | |
| | | if (!item.verify || !item.verify.columns || item.verify.columns.length === 0) { |
| | | item.errorType = 'error1' |
| | | } else if (item.intertype === 'system' && item.verify.dataType !== 'custom' && config.setting.interType !== 'system') { |
| | | item.errorType = 'error2' |
| | | } |
| | | } |
| | | |
| | | if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 打印机设置 |
| | | let _item = window.GLOB.UserCacheMap.get(this.props.MenuID + item.uuid) |
| | | |
| | |
| | | resetContrl: config.setting.resetContrl, |
| | | } |
| | | |
| | | config.setting.arr_field = _arrField.join(',') |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | loadingview: false, |
| | |
| | | setting: config.setting, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | | BID: param && param.$BID ? param.$BID : '', |
| | | search: Utils.initMainSearch(config.search) |
| | | }, () => { |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | async loadmaindata (id) { |
| | | const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize, absFields, autoMatic } = this.state |
| | | const { setting, search, orderBy, BID, pageIndex, pageSize, absFields, autoMatic } = this.state |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(setting, search, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | |
| | |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, search, orderBy, BID, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(setting, search, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { MenuName, MenuID } = this.props |
| | | const { arr_field, orderBy, search, setting} = this.state |
| | | const { MenuID } = this.props |
| | | const { orderBy, search, setting } = this.state |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: search, |
| | | menuName: MenuName |
| | | search: search |
| | | }) |
| | | } |
| | | |
| | |
| | | BID: BData ? (BData.$BID || '') : '', |
| | | BData: BData, |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | search: _config.$searches |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, search, year } = this.state |
| | | const { config, BID, search, year } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 99999, BID, '', year) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 99999, BID, '', year) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | syncConfig, |
| | | data: _data, |
| | | BID: BID || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | callback({ |
| | | arr_field: '', |
| | | orderBy: '', |
| | | search: [], |
| | | menuName: config.name |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, BData } = this.state |
| | | const { config, BID, BData } = this.state |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | | MKEmitter.emit('reloadData', config.wrap.publicId) |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | BData: BData || '', |
| | | config: _config, |
| | | card: _card, |
| | | search: _config.$searches, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | search: _config.$searches |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, search, orderBy } = this.state |
| | | const { config, search, orderBy } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy ||config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | orderBy: orderBy || config.setting.order || '', |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | | async loadData (id, type) { |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, selected, orderBy } = this.state |
| | | const { config, pageIndex, pageSize, search, BID, BData, selected, orderBy } = this.state |
| | | |
| | | if (config.setting.supModule && !BID && config.wrap.supKey !== 'false') { // BID 不存在时,不做查询 |
| | | this.loaded = true |
| | |
| | | } |
| | | |
| | | let _orderBy = orderBy || config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadLinedata (id) { |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, orderBy } = this.state |
| | | const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | } |
| | | |
| | | _config.setting.sub_field = subconfig.columns.map(col => col.field).join(',') |
| | | _config.setting.all_field = _config.setting.arr_field + ',' + _config.setting.sub_field |
| | | |
| | | let pageOptions = ['10', '25', '50', '100', '500', '1000'] |
| | | |
| | | if (!_config.setting.laypage) { |
| | |
| | | subconfig: subconfig, |
| | | wrapStyle: wrapStyle, |
| | | card: _card, |
| | | search: _config.$searches, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | search: _config.$searches |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, search, orderBy } = this.state |
| | | const { config, search, orderBy } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | | async loadData (id, type) { |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, selected, card, orderBy } = this.state |
| | | const { config, pageIndex, pageSize, search, BID, BData, selected, card, orderBy } = this.state |
| | | |
| | | if (config.setting.supModule && !BID && config.wrap.supKey !== 'false') { // BID 不存在时,不做查询 |
| | | this.loaded = true |
| | |
| | | } |
| | | |
| | | let _orderBy = orderBy || config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadLinedata (id) { |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, orderBy } = this.state |
| | | const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' |
| | | |
| | |
| | | data: _data, |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: '', |
| | | orderBy: '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData (type, btn) { |
| | | const { config, arr_field, BID, BData, selected } = this.state |
| | | const { config, BID, BData, selected } = this.state |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | | MKEmitter.emit('reloadData', config.wrap.publicId) |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | BData: BData || '', |
| | | data: _data, |
| | | config: _config, |
| | | search: _config.$searches, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | search: _config.$searches |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, search } = this.state |
| | | const { config, search } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, pageIndex, search, BID, BData } = this.state |
| | | const { config, pageIndex, search, BID, BData } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, pageIndex, config.setting.pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | card: _card, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | card: _card |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config } = this.state |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, BData } = this.state |
| | | const { config, BID, BData } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | data: _data, |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: '', |
| | | orderBy: '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, BData } = this.state |
| | | const { config, BID, BData } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | BID: '', |
| | | BData: '', |
| | | plot: null, |
| | | arr_field : '', |
| | | chartId: Utils.getuuid(), |
| | | empty: true |
| | | } |
| | |
| | | config: _config, |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | if (!is(fromJS(this.data), fromJS([]))) { |
| | |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | BID: BID || '', |
| | | vFields: vFields, |
| | | vstFields: vstFields, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | | search: _config.$searches, |
| | | transfield |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, search } = this.state |
| | | const { config, search } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, search } = this.state |
| | | const { config, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | if (!is(fromJS(this.data), fromJS([]))) { |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | this.setState({ |
| | | config: _config, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | let _data = null |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | this.setState({ |
| | | config: _config, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | | title: config.plot.title, |
| | | search: _config.$searches |
| | |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, search, BID } = this.state |
| | | const { config, search, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | if (!is(fromJS(this.data), fromJS([]))) { |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | config: _config, |
| | | BID: BID || '', |
| | | empty: this.data.length === 0, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | | search: _config.$searches |
| | | }) |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, search } = this.state |
| | | const { config, search } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, search } = this.state |
| | | const { config, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ empty: true }) |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | config: _config, |
| | | empty: this.data.length === 0, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | | search: _config.$searches |
| | | }) |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, search } = this.state |
| | | const { config, search } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, search } = this.state |
| | | const { config, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | this.setState({ |
| | | data: _data, |
| | | BID: BID || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | data: _data, |
| | | BID: BID || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData () { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | | MKEmitter.emit('reloadData', config.wrap.publicId) |
| | |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | group: _group, |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData () { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | step: _group.sort - 1, |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | group: _config.subcards[0], |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData () { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | linkUrl: linkUrl, |
| | | data: _data, |
| | | BID: BID || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData () { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | |
| | | this.loading = true |
| | | |
| | | let param = UtilsDM.getQueryDataParams(config.setting, config.columns.map(col => col.field).join(','), [], config.setting.order, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, [], config.setting.order, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: [], // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | |
| | | setting: setting, |
| | | actions: _config.action, |
| | | columns: _config.cols, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | search: _config.$searches |
| | | }, () => { |
| | | if (_config.setting.onload === 'true') { |
| | |
| | | * @param { String } repage 表格是否重置页码 |
| | | */ |
| | | async loadmaindata (reset, repage, id) { |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, orderBy, search, setting} = this.state |
| | | const { config, orderBy, search, setting } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: [], // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | |
| | | setting: setting, |
| | | actions: _config.action, |
| | | columns: _columns, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | search: _config.$searches |
| | | }, () => { |
| | | if (_config.setting.onload === 'true') { |
| | |
| | | * @param { String } repage 表格是否重置页码 |
| | | */ |
| | | async loadmaindata (reset, repage) { |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, orderBy, search, setting} = this.state |
| | | const { config, orderBy, search, setting } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: [], // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | |
| | | setting: setting, |
| | | actions: _config.action, |
| | | columns: _config.cols, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | search: _config.$searches |
| | | }) |
| | | } |
| | |
| | | * @param { String } repage 表格是否重置页码 |
| | | */ |
| | | async loadmaindata (reset, repage, id, type) { |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (setting.supModule && !BID && setting.supKey !== 'false') { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config, orderBy, search, setting} = this.state |
| | | const { config, orderBy, search, setting} = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | BData: BData || '', |
| | | data: _data, |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config } = this.state |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, BData } = this.state |
| | | const { config, BID, BData } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, config.setting.pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, config.setting.pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | selected: _config.wrap.selected === 'true', |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | BID: BID || '' |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { arr_field, config } = this.state |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | class CustomPage extends Component { |
| | | static propTpyes = { |
| | | param: PropTypes.any, // 其他页面传递的参数 |
| | | Tab: PropTypes.string, // 弹窗标签 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | MenuName: PropTypes.string, // 菜单名称 |
| | | changeTemp: PropTypes.func |
| | |
| | | }) |
| | | } |
| | | |
| | | let popview = 'CustomPage' |
| | | |
| | | if (config.version === 2.0) { |
| | | popview = 'popview' |
| | | } |
| | | |
| | | config.$cache = config.cacheLocal === 'true' |
| | | config.$time = config.localCacheTime || 0 |
| | | |
| | | let initInters = [] |
| | | |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters) |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache, config.$time, config.MenuName, MenuID, MenuID) |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID) |
| | | |
| | | let params = [] |
| | | let BID = param.$BID || '' |
| | |
| | | this.loadmaindata(params) |
| | | } |
| | | |
| | | if (!this.props.Tab) { |
| | | this.setShortcut() |
| | | } |
| | | this.setShortcut() |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | } |
| | | } |
| | | |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) => { |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) => { |
| | | return components.filter(item => { |
| | | item.$pageId = pageId |
| | | item.$cache = cache |
| | |
| | | _searchId = tab.uuid |
| | | } |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, _searchId, tab.uuid) |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid) |
| | | |
| | | if (_searchId === tab.uuid) { |
| | | tab.components.forEach(cell => { |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) { |
| | |
| | | item.action = item.action.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | cell = this.resetButton(item, cell) |
| | | |
| | | cell.$toolbtn = true |
| | | |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | cell = this.resetButton(item, cell) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | cell = this.resetButton(item, cell) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | cell = this.resetButton(item, cell) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | cell = this.resetButton(item, cell) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | |
| | | }) |
| | | } |
| | | |
| | | resetButton = (item, cell, popview) => { |
| | | resetButton = (item, cell) => { |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | cell.$view = 'popview' |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'excelOut') { // 导出 |
| | | cell.$menuName = item.name |
| | | |
| | | if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) { |
| | | cell.errorType = 'error1' |
| | | } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom') { |
| | | if (item.setting.interType !== 'system') { |
| | | cell.errorType = 'error2' |
| | | } else if (item.type === 'balcony' || item.subtype === 'propcard') { |
| | | cell.errorType = 'error2' |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | return component |
| | | } |
| | | |
| | | component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' |
| | | component.setting.useMSearch = component.setting.useMSearch === 'true' |
| | | if (component.setting.useMSearch) { |
| | | if (!window.GLOB.SearchBox.has(component.$searchId)) { |
| | |
| | | } |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | component.scripts && component.scripts.forEach(script => { |
| | | if (script.status !== 'false') { |
| | | if (script.status === 'false') return |
| | | if (script.position !== 'back') { |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _tailScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } |
| | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | regs.forEach(cell => { |
| | | component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) |
| | | _customScript = _customScript.replace(cell.reg, cell.value) |
| | | _tailScript = _tailScript.replace(cell.reg, cell.value) |
| | | }) |
| | | |
| | | component.setting.customScript = _customScript // 整理后自定义脚本 |
| | | component.setting.tailScript = _tailScript // 后置自定义脚本 |
| | | |
| | | if (component.setting.laypage) { |
| | | component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) |
| | |
| | | inter.setting.onload = 'false' |
| | | } |
| | | |
| | | inter.setting.arr_field = inter.columns.map(col => col.field).join(',') |
| | | |
| | | if (inter.setting.interType !== 'system') return inter |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | inter.scripts.forEach(script => { |
| | | if (script.status !== 'false') { |
| | | if (script.status === 'false') return |
| | | if (script.position !== 'back') { |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _tailScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } |
| | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | inter.setting.dataresource = inter.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | inter.setting.dataresource = inter.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _tailScript = _tailScript.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) |
| | | _tailScript = _tailScript.replace(cell.reg, cell.value) |
| | | }) |
| | | |
| | | inter.setting.customScript = _customScript // 整理后自定义脚本 |
| | | inter.setting.tailScript = _tailScript // 后置自定义脚本 |
| | | |
| | | return inter |
| | | }) |
| | |
| | | } |
| | | |
| | | resetActiveMenu = (menuId) => { |
| | | const { MenuID, Tab } = this.props |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId || Tab) return |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.setShortcut() |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'excelOut') { // 导出 |
| | | cell.$menuName = item.name |
| | | |
| | | if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) { |
| | | cell.errorType = 'error1' |
| | | } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom') { |
| | | if (item.setting.interType !== 'system') { |
| | | cell.errorType = 'error2' |
| | | } else if (item.type === 'balcony' || item.subtype === 'propcard') { |
| | | cell.errorType = 'error2' |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | return component |
| | | } |
| | | |
| | | component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' |
| | | component.setting.useMSearch = component.setting.useMSearch === 'true' |
| | | if (component.setting.useMSearch) { |
| | | if (!window.GLOB.SearchBox.has(component.$searchId)) { |
| | |
| | | interType: 'system', |
| | | execute: true, |
| | | laypage: true, |
| | | dataresource: '(select * from s_debug_value_log where createuserid=@userid@) tb' |
| | | }, |
| | | arr_field: 'ID,Sort,CDefine1,CDefine2,CDefine3,CDefine4,CDefine5,CDefine6,CDefine7,createdate' |
| | | dataresource: '(select * from s_debug_value_log where createuserid=@userid@) tb', |
| | | arr_field: 'ID,Sort,CDefine1,CDefine2,CDefine3,CDefine4,CDefine5,CDefine6,CDefine7,createdate' |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 子表数据加载 |
| | | */ |
| | | async loadmaindata () { |
| | | const { setting, arr_field } = this.state |
| | | const { setting } = this.state |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, [], 'sort', 1, 50, '') |
| | | let param = UtilsDM.getQueryDataParams(setting, [], 'sort', 1, 50, '') |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | |
| | |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: [], // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | |
| | | item.$menuId = this.props.MenuID |
| | | item.$old = true |
| | | |
| | | if (item.OpenType === 'excelOut') { // 导出 |
| | | item.$menuName = Tab.label |
| | | |
| | | if (!item.verify || !item.verify.columns || item.verify.columns.length === 0) { |
| | | item.errorType = 'error1' |
| | | } else if (item.intertype === 'system' && item.verify.dataType !== 'custom' && config.setting.interType !== 'system') { |
| | | item.errorType = 'error2' |
| | | } |
| | | } |
| | | |
| | | if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 打印机设置 |
| | | let _item = window.GLOB.UserCacheMap.get(Tab.uuid + item.uuid) |
| | | |
| | |
| | | resetContrl: config.setting.resetContrl, |
| | | } |
| | | |
| | | config.setting.arr_field = _arrField.join(',') |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | BID: this.props.BID || '', |
| | |
| | | setting: config.setting, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(config.search) |
| | | }, () => { |
| | | if (config.setting.onload !== 'false' && (!Tab.supMenu || this.props.BID || Tab.isTreeNode)) { // 初始化可加载 |
| | |
| | | */ |
| | | async loadmaindata (id) { |
| | | const { mainSearch } = this.props |
| | | const { setting, BID, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, BID, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | |
| | |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { mainSearch } = this.props |
| | | const { setting, BID, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, BID, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { Tab, mainSearch, MenuID } = this.props |
| | | const { arr_field, orderBy, search, setting} = this.state |
| | | const { mainSearch, MenuID } = this.props |
| | | const { orderBy, search, setting} = this.state |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: searches, |
| | | menuName: Tab.label |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: [], // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | |
| | | |
| | | if (item.OpenType === 'popview') return |
| | | |
| | | if (item.OpenType === 'excelOut') { // 导出 |
| | | item.$menuName = Tab.label |
| | | |
| | | if (!item.verify || !item.verify.columns || item.verify.columns.length === 0) { |
| | | item.errorType = 'error1' |
| | | } else if (item.intertype === 'system' && item.verify.dataType !== 'custom' && config.setting.interType !== 'system') { |
| | | item.errorType = 'error2' |
| | | } |
| | | } |
| | | |
| | | if (item.controlField) { |
| | | if (/,/ig.test(item.controlVal)) { |
| | | item.controlVals = item.controlVal.split(',') |
| | |
| | | resetContrl: config.setting.resetContrl, |
| | | } |
| | | |
| | | config.setting.arr_field = _arrField.join(',') |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | loadingview: false, |
| | |
| | | setting: config.setting, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(config.search), // 搜索条件初始化(含有时间格式,需要转化) |
| | | }, () => { |
| | | if (config.setting.onload !== 'false') { // 初始化可加载 |
| | |
| | | */ |
| | | async loadmaindata (id) { |
| | | const { BID } = this.props |
| | | const { setting, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | |
| | |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { BID } = this.props |
| | | const { setting, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { Tab, MenuID } = this.props |
| | | const { arr_field, orderBy, search, setting} = this.state |
| | | const { MenuID } = this.props |
| | | const { orderBy, search, setting} = this.state |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: search, |
| | | menuName: Tab.label |
| | | search: search |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | config.setting.arr_field = `${config.setting.valueField},${config.setting.labelField},${config.setting.parentField}` |
| | | |
| | | this.setState({ |
| | | BID: param && param.$BID ? param.$BID : '', |
| | | loadingview: false, |
| | |
| | | loading: true |
| | | }) |
| | | |
| | | let arr_field = `${setting.valueField},${setting.labelField},${setting.parentField}` |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, [], setting.order, '', '', BID) |
| | | let param = UtilsDM.getQueryDataParams(setting, [], setting.order, '', '', BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | // import './index.scss' |
| | |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | btn: PropTypes.object, // 按钮 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | disabled: PropTypes.any, // 行按钮禁用 |
| | | } |
| | | |
| | | state = { |
| | | excelName: '', // 文件名 |
| | | search: '', // 搜索条件 |
| | | loading: false, // 导出中 |
| | | hidden: false, |
| | | disabled: false |
| | |
| | | } |
| | | MKEmitter.removeListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮状态改变 |
| | | */ |
| | | updateStatus = (type, name) => { |
| | | if (type === 'start') { |
| | | this.setState({ |
| | | loading: true, |
| | | excelName: name |
| | | }) |
| | | } else if (type === 'over') { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | |
| | | return |
| | | } |
| | | |
| | | if (!btn.verify || !btn.verify.columns || btn.verify.columns.length === 0) { |
| | | if (btn.errorType === 'error1') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请设置导出列!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.intertype === 'system' && setting.interType !== 'system' && btn.verify.dataType !== 'custom') { |
| | | } else if (btn.errorType === 'error2') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '导出按钮配置错误!', |
| | | message: '按钮需自定义导出数据源!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | triggerExcelout = (viewParam) => { |
| | | const { btn } = this.props |
| | | |
| | | let name = `${viewParam.menuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` |
| | | let pageSize = 1000 |
| | | |
| | | if (((btn.intertype === 'system' && btn.verify.dataType === 'custom' && btn.verify.useSearch === 'true') || btn.intertype !== 'system' || btn.verify.dataType !== 'custom') && btn.search === 'true' && viewParam.search && viewParam.search.length > 0) { |
| | | if (btn.intertype === 'system' && btn.verify.dataType === 'custom' && btn.verify.useSearch === 'false') { |
| | | viewParam.search = [] |
| | | } else if (((btn.intertype === 'system' && btn.verify.dataType === 'custom' && btn.verify.useSearch === 'true') || btn.intertype !== 'system' || btn.verify.dataType !== 'custom') && btn.search === 'true' && viewParam.search && viewParam.search.length > 0) { |
| | | let valid = false |
| | | viewParam.search.forEach(item => { |
| | | if (item.value || item.value === 0) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (btn.intertype === 'system') { // 使用系统函数 |
| | | if (btn.verify.dataType !== 'custom' && !viewParam.arr_field) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮需自定义导出数据!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.verify.dataType === 'custom') { |
| | | viewParam.arr_field = [] |
| | | btn.verify.columns.forEach(col => { |
| | | if (col.Column && col.Column !== '$Index') { |
| | | viewParam.arr_field.push(col.Column) |
| | | } |
| | | }) |
| | | viewParam.arr_field = viewParam.arr_field.join(',') |
| | | |
| | | viewParam.orderBy = btn.verify.order || '' |
| | | } |
| | | } |
| | | if (btn.intertype === 'system' && btn.verify.enable === 'true') { |
| | | this.setState({search: fromJS(viewParam.search).toJS()}) |
| | | } |
| | | if (btn.intertype === 'system' && btn.verify.dataType === 'custom' && btn.verify.useSearch === 'false') { |
| | | viewParam.search = [] |
| | | } |
| | | |
| | | viewParam.orderBy = viewParam.orderBy || viewParam.arr_field.split(',')[0] |
| | | |
| | | this.updateStatus('start', name) |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | if (btn.pagination !== 'true') { |
| | | if (btn.intertype === 'system') { // 使用系统函数 |
| | | let param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search) |
| | | let param = this.getExcelDefaultParam(viewParam.orderBy, viewParam.search) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | |
| | | message: '导出按钮设置错误!', |
| | | duration: 5 |
| | | }) |
| | | this.updateStatus('over') |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | } |
| | | } else if (btn.intertype === 'outer' && btn.innerFunc) { // 分页,且两步请求 |
| | | this.getExcelOutDoubleData(viewParam, 1, pageSize, []) |
| | |
| | | const { btn } = this.props |
| | | let param = null |
| | | if (btn.intertype === 'system') { // 使用系统函数 |
| | | if (!viewParam.arr_field) { |
| | | this.execError({ErrCode: 'N', message: '未设置显示列!'}) |
| | | return |
| | | } |
| | | |
| | | param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | param = this.getExcelDefaultParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | } else if (btn.intertype === 'inner') { // 使用内部函数 |
| | | param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | param.func = btn.innerFunc |
| | |
| | | table.push(_row) |
| | | }) |
| | | |
| | | this.table2excel(column, table, this.state.excelName.replace(/\.xlsx/ig, '.xls')) |
| | | this.table2excel(column, table) |
| | | |
| | | if (btn.verify.enable === 'true' && btn.verify.script) { |
| | | this.execCustomScript() |
| | | } else { |
| | | this.execSuccess({ErrCode: 'S', message: '导出成功!'}) |
| | | } |
| | | this.execSuccess({ErrCode: 'S', message: '导出成功!'}) |
| | | } else { |
| | | let letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| | | let cols = [] |
| | |
| | | const wb = XLSX.utils.book_new() |
| | | XLSX.utils.book_append_sheet(wb, ws, btn.verify.sheet || 'Sheet1') |
| | | |
| | | XLSX.writeFile(wb, this.state.excelName) |
| | | XLSX.writeFile(wb, `${btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}.xlsx`) |
| | | |
| | | if (btn.verify.enable === 'true' && btn.verify.script) { |
| | | this.execCustomScript() |
| | | } else { |
| | | this.execSuccess({ErrCode: 'S', message: '导出成功!'}) |
| | | } |
| | | this.execSuccess({ErrCode: 'S', message: '导出成功!'}) |
| | | } |
| | | } catch (e) { |
| | | this.execError({ErrCode: 'N', message: 'Excel生成失败!'}) |
| | | } |
| | | } |
| | | |
| | | table2excel = (column, data, excelName) => { |
| | | table2excel = (column, data) => { |
| | | let thead = column.reduce((result, item) => { |
| | | return result + `<th>${item.title}</th>` |
| | | }, '') |
| | |
| | | // let url = 'data:application/vnd.ms-excel;base64,' + window.btoa(unescape(encodeURIComponent(html))) |
| | | let link = document.createElement('a') |
| | | link.href = url |
| | | link.download = excelName |
| | | link.download = `${this.props.btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}.xls` |
| | | document.body.appendChild(link) |
| | | link.click() |
| | | document.body.removeChild(link) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 执行自定义脚本 |
| | | */ |
| | | execCustomScript = () => { |
| | | const { btn } = this.props |
| | | const { search } = this.state |
| | | let script = btn.verify.script |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | script = script.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | script = script.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | let regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | |
| | | regoptions.forEach(item => { |
| | | script = script.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | menuname: btn.logLabel |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(script) |
| | | |
| | | if (window.GLOB.mkHS) { // 系统函数云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess({ErrCode: 'S', message: '导出成功!'}) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | this.updateStatus('over') |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * @description 获取默认存储过程请求参数 |
| | | */ |
| | | getExcelDefaultParam = (arr_field, orderBy, search, pagination = false, pageIndex = 1, pageSize = 9999) => { |
| | | getExcelDefaultParam = (orderBy, search, pagination = false, pageIndex = 1, pageSize = 9999) => { |
| | | const { setting, btn, selectedData, BID } = this.props |
| | | |
| | | let defaultSql = setting.execute || setting.default || 'true' |
| | | let customScript = setting.customScript || '' |
| | | let _dataresource = setting.dataresource || '' |
| | | let queryType = setting.queryType |
| | | let primaryKey = setting.primaryKey || 'ID' |
| | | |
| | | let _setting = {} |
| | | let _orderBy = orderBy || '' |
| | | if (btn.verify.dataType === 'custom') { |
| | | defaultSql = btn.verify.defaultSql || 'true' |
| | | _dataresource = btn.verify.dataresource || '' |
| | | queryType = btn.verify.queryType |
| | | // primaryKey = btn.verify.primaryKey || 'ID' |
| | | _setting.arr_field = [] |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | btn.verify.columns.forEach(col => { |
| | | if (col.Column && col.Column !== '$Index') { |
| | | _setting.arr_field.push(col.Column) |
| | | } |
| | | }) |
| | | _setting.arr_field = _setting.arr_field.join(',') |
| | | _setting.execute = btn.verify.defaultSql !== 'false' |
| | | _setting.dataresource = btn.verify.dataresource || '' |
| | | _setting.primaryKey = _setting.primaryKey || setting.primaryKey || 'ID' |
| | | |
| | | if (!_setting.execute) { |
| | | _setting.dataresource = '' |
| | | } |
| | | customScript = '' |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | btn.verify.scripts && btn.verify.scripts.forEach(script => { |
| | | if (script.status !== 'false') { |
| | | customScript += ` |
| | | if (script.status === 'false') return |
| | | if (script.position !== 'back') { |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _tailScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | _dataresource = _dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | customScript = customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _setting.dataresource = _setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | customScript = customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _setting.dataresource = _setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | } |
| | | |
| | | let custompage = /@pageSize@/i.test(_dataresource + customScript) |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | _search = _search ? 'where ' + _search : '' |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field, |
| | | custom_script: customScript, |
| | | default_sql: defaultSql, |
| | | menuname: btn.logLabel |
| | | } |
| | | _setting.customScript = _customScript // 整理后自定义脚本 |
| | | _setting.tailScript = _tailScript // 后置自定义脚本 |
| | | |
| | | if (btn.verify.dataType !== 'custom' && setting.sub_field) { |
| | | arr_field = arr_field + ',' + setting.sub_field |
| | | param.arr_field = arr_field |
| | | } |
| | | _setting.laypage = pagination |
| | | |
| | | // 数据管理权限 |
| | | if (sessionStorage.getItem('dataM') === 'true') { |
| | | param.dataM = 'Y' |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let RoleID = sessionStorage.getItem('role_id') || '' |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | let nation = sessionStorage.getItem('nation') || '' |
| | | let province = sessionStorage.getItem('province') || '' |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let district = sessionStorage.getItem('district') || '' |
| | | let address = sessionStorage.getItem('address') || '' |
| | | |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | let regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'${item.value}'` |
| | | if (_setting.laypage) { |
| | | _setting.custompage = /@pageSize@/i.test(_setting.dataresource + _setting.customScript) |
| | | } |
| | | }) |
| | | |
| | | regoptions.push({ |
| | | reg: new RegExp('@userName@', 'ig'), |
| | | value: userName |
| | | }, { |
| | | reg: new RegExp('@fullName@', 'ig'), |
| | | value: fullName |
| | | }, { |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: orderBy || '' |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: pageSize |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: pageIndex |
| | | }) |
| | | _setting.queryType = btn.verify.queryType |
| | | _setting.$name = btn.logLabel |
| | | |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | param.custom_script = param.custom_script.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | if (queryType === 'statistics') { // 统计数据源,内容替换 |
| | | _search = '' |
| | | _orderBy = btn.verify.order || '' |
| | | } else { |
| | | _setting = {...setting} |
| | | _setting.laypage = pagination |
| | | _setting.arr_field = _setting.all_field || _setting.arr_field |
| | | } |
| | | |
| | | let primaryId = '' |
| | | if (btn.Ot === 'requiredOnce' && selectedData && selectedData.length > 0) { |
| | | primaryId = selectedData.map(d => d.$$uuid || '').filter(Boolean).join(',') |
| | | if (_search && primaryId) { |
| | | _search += ` and ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` |
| | | } else if (primaryId) { |
| | | _search = `where ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` |
| | | } |
| | | primaryId = primaryId ? 'excel:' + primaryId : '' |
| | | } |
| | | |
| | | let LText = '' |
| | | |
| | | if (custompage) { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } else if (defaultSql !== 'false' && !pagination) { |
| | | LText = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else if (defaultSql !== 'false') { |
| | | 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 ` |
| | | } |
| | | |
| | | if (param.custom_script) { |
| | | param.custom_script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='',@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}' |
| | | ${param.custom_script} |
| | | ` |
| | | |
| | | if (LText) { |
| | | LText += ` |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } else { |
| | | param.custom_script += ` |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } |
| | | } else if (LText) { |
| | | LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='',@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}' |
| | | ${LText} |
| | | ` |
| | | } |
| | | |
| | | LText = LText.replace(/@ID@/ig, `'${primaryId || ''}'`) |
| | | param.custom_script = param.custom_script.replace(/@ID@/ig, `'${primaryId || ''}'`) |
| | | LText = LText.replace(/@BID@/ig, `'${BID}'`) |
| | | param.custom_script = param.custom_script.replace(/@BID@/ig, `'${BID}'`) |
| | | LText = LText.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | param.custom_script = param.custom_script.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | LText = LText.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | param.custom_script = param.custom_script.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | LText = LText.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | param.custom_script = param.custom_script.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | LText = LText.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | param.custom_script = param.custom_script.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | LText = LText.replace(/@typename@/ig, `'admin'`) |
| | | param.custom_script = param.custom_script.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true) { |
| | | param.custom_script && console.info(`${LText ? '' : '/*不执行默认sql*/\n'}${param.custom_script}`) |
| | | LText && console.info(LText) |
| | | } |
| | | let param = UtilsDM.getDefaultQueryParam(_setting, search, _orderBy, pageIndex, pageSize, primaryId, BID) |
| | | |
| | | param.custom_script = Utils.formatOptions(param.custom_script) |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.DateCount = '' |
| | | param.username = userName |
| | | param.fullname = fullName |
| | | |
| | | if (window.GLOB.mkHS) { // 云端数据验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | // 数据管理权限 |
| | | if (sessionStorage.getItem('dataM') === 'true') { |
| | | param.dataM = 'Y' |
| | | } |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | return param |
| | |
| | | import './index.scss' |
| | | |
| | | const SubTabTable = asyncSpinComponent(() => import('@/tabviews/subtabtable')) |
| | | const CustomPage = asyncSpinComponent(() => import('@/tabviews/custom')) |
| | | const PopView = asyncSpinComponent(() => import('@/tabviews/custom/popview')) |
| | | |
| | | class PopupButton extends Component { |
| | |
| | | |
| | | if (btn.uuid !== tabId) return |
| | | |
| | | if (btn.$view === 'CustomPage') { |
| | | if (btn.$view === 'popview') { |
| | | if (btn.popClose !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) |
| | | } |
| | |
| | | destroyOnClose |
| | | > |
| | | {!btn.$view ? <SubTabTable Tab={btn} MenuID={btn.linkTab} SupMenuID={this.props.MenuID} BID={popData ? primaryId : this.props.BID} BData={popData || this.props.BData}/> : null} |
| | | {btn.$view === 'CustomPage' ? <CustomPage Tab={btn} MenuID={btn.uuid} MenuName={btn.label} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null} |
| | | {btn.$view === 'popview' ? <PopView Tab={btn} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null} |
| | | </Modal> |
| | | } else { |
| | |
| | | destroyOnClose |
| | | > |
| | | {!btn.$view ? <SubTabTable Tab={btn} MenuID={btn.linkTab} SupMenuID={this.props.MenuID} BID={popData ? primaryId : this.props.BID} BData={popData || this.props.BData}/> : null} |
| | | {btn.$view === 'CustomPage' ? <CustomPage Tab={btn} MenuName={btn.label} MenuID={btn.uuid} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null} |
| | | {btn.$view === 'popview' ? <PopView Tab={btn} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null} |
| | | <div className="close-drawer"> |
| | | <Button onClick={this.popclose}> |
| | |
| | | |
| | | let _dataresource = btn.verify.setting.dataresource |
| | | let _customScript = '' |
| | | |
| | | let _tailScript = '' |
| | | btn.verify.scripts && btn.verify.scripts.forEach(script => { |
| | | if (script.status !== 'false') { |
| | | if (script.status === 'false') return |
| | | if (script.position !== 'back') { |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _tailScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } |
| | |
| | | _dataresource = '' |
| | | } |
| | | |
| | | let isDataM = sessionStorage.getItem('dataM') === 'true' |
| | | let regoptions = [ |
| | | { reg: /@ID@/ig, value: `'${ID}'`}, |
| | | { reg: /@BID@/ig, value: `'${BID || ''}'`}, |
| | | { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | | { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, |
| | | { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, |
| | | { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, |
| | | { reg: /@typename@/ig, value: `'admin'`}, |
| | | { reg: /\$@/ig, value: isDataM ? '/*' : ''}, |
| | | { reg: /@\$/ig, value: isDataM ? '*/' : ''}, |
| | | { reg: /@datam@/ig, value: isDataM ? `'Y'` : `''`}, |
| | | ] |
| | | |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | _customScript = _customScript.replace(item.reg, item.value) |
| | | _tailScript = _tailScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | _dataresource = _dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | let initsql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) |
| | |
| | | select ${_initvars.join(',')} |
| | | ` |
| | | } |
| | | |
| | | |
| | | if (_customScript) { |
| | | _customScript = `${initsql} |
| | | ${_customScript} |
| | | ` |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | | _customScript = _customScript.replace(/@select\$|\$select@/ig, '') |
| | | _dataresource = _dataresource.replace(/\$sum@/ig, '/*') |
| | | _dataresource = _dataresource.replace(/@sum\$/ig, '*/') |
| | | _customScript = _customScript.replace(/\$sum@/ig, '/*') |
| | | _customScript = _customScript.replace(/@sum\$/ig, '*/') |
| | | |
| | | _dataresource = _dataresource.replace(/@ID@/ig, `'${ID}'`) |
| | | _customScript = _customScript.replace(/@ID@/ig, `'${ID}'`) |
| | | _dataresource = _dataresource.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _customScript = _customScript.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _dataresource = _dataresource.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | _customScript = _customScript.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | _customScript = _customScript.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _customScript = _customScript.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _customScript = _customScript.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _dataresource = _dataresource.replace(/@typename@/ig, `'admin'`) |
| | | _customScript = _customScript.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | |
| | | let LText = '' |
| | | |
| | |
| | | if (_customScript) { |
| | | if (LText) { |
| | | LText = `${LText} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' |
| | | ` |
| | | } else { |
| | | _customScript = `${_customScript} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' |
| | | ` |
| | | } |
| | | } else if (_tailScript) { |
| | | LText = `${initsql} |
| | | ${LText} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' |
| | | ` |
| | | } else { |
| | | LText = `${initsql} |
| | | ${LText} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Button, notification, Tooltip, Select, Switch } from 'antd' |
| | | import { Form, Row, Col, Button, notification, Tooltip, Select, Switch, Radio } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | sql: record.sql |
| | | sql: record.sql, |
| | | position: record.position || 'front' |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | sql: ' ' |
| | | sql: ' ', |
| | | position: 'front' |
| | | }) |
| | | } |
| | | |
| | |
| | | {linefields ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'表单及行变量,系统会定义变量并赋值。'}>, {linefields}</Tooltip> : null} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8} style={{whiteSpace: 'nowrap'}}> |
| | | <Form.Item style={{marginBottom: 0}} label={ |
| | | <Tooltip placement="bottomLeft" title={'自定义脚本与数据源位置关系。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 执行位置 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('position', { |
| | | initialValue: 'front' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="front">前置</Radio> |
| | | <Radio value="back">后置</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item style={{marginBottom: 0}} label="快捷添加"> |
| | | <Select |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {/* {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> |
| | | <Form.Item label="主键"> |
| | | {btnType !== 'print' && dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="可自定义主键,空时默认为数据源主键。注:选行导出时使用。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 主键 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('primaryKey', { |
| | | initialValue: setting.primaryKey || 'ID', |
| | | initialValue: setting.primaryKey || '', |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} */} |
| | | </Col> : null} |
| | | {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> |
| | | <Form.Item label="排序方式"> |
| | | {getFieldDecorator('order', { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Radio, Spin, Typography, Popconfirm } from 'antd' |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Spin, Typography, Popconfirm } from 'antd' |
| | | import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | |
| | | import ColumnForm from './columnform' |
| | | import DataSource from './datasource' |
| | | import CustomScript from './customscript' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | |
| | | verify: {}, |
| | | debugId: '', |
| | | activeKey: 'setting', |
| | | defaultscript: '', // 自定义脚本 |
| | | excelColumns: [ |
| | | { |
| | | title: '字段', |
| | |
| | | ) |
| | | } |
| | | }, |
| | | // { |
| | | // title: '执行位置', |
| | | // dataIndex: 'position', |
| | | // width: '10%', |
| | | // render: (text, record) => { |
| | | // if (record.position === 'init') { |
| | | // return <span style={{color: 'orange'}}>初始化</span> |
| | | // } else if (record.position === 'front') { |
| | | // return <span style={{color: '#26C281'}}>sql前</span> |
| | | // } else { |
| | | // return <span style={{color: '#1890ff'}}>sql后</span> |
| | | // } |
| | | // } |
| | | // }, |
| | | { |
| | | title: '执行位置', |
| | | dataIndex: 'position', |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.position === 'back') { |
| | | return <span style={{color: 'orange'}}>后置</span> |
| | | } else { |
| | | return <span style={{color: '#26C281'}}>前置</span> |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: '状态', |
| | | dataIndex: 'status', |
| | |
| | | _verify = fromJS(card.verify).toJS() |
| | | } |
| | | |
| | | _verify.enable = _verify.enable || 'false' |
| | | _verify.dataType = _verify.dataType || 'default' |
| | | _verify.columns = _verify.columns || [] |
| | | _verify.scripts = _verify.scripts || [] |
| | | |
| | | if (card.intertype !== 'system') { |
| | | _verify.enable = 'false' |
| | | } |
| | | _verify.columns = _verify.columns.map(col => { |
| | | col.type = col.type || 'text' |
| | | col.output = col.output || 'true' |
| | |
| | | |
| | | return col |
| | | }) |
| | | |
| | | let defaultscript = '' |
| | | if (!_verify.script && card.intertype === 'system') { |
| | | let search = this.formatSearch(config.search) |
| | | search = Utils.joinMainSearchkey(search) |
| | | search = search.replace(/@\$@/ig, '') |
| | | search = search ? 'where ' + search : '' |
| | | |
| | | defaultscript = `update ${config.setting.tableName || ''} set idefine5= idefine5+1 ,modifydate=getdate(),cdefine5='已导出',modifyuserid=@userid@ ${search}` |
| | | } |
| | | |
| | | let appType = sessionStorage.getItem('appType') |
| | | let searches = [] |
| | |
| | | this.setState({ |
| | | verify: _verify, |
| | | searches: searches, |
| | | activeKey: card.intertype === 'system' && _verify.dataType === 'custom' ? 'setting' : 'columns', |
| | | defaultscript: defaultscript |
| | | activeKey: card.intertype === 'system' && _verify.dataType === 'custom' ? 'setting' : 'columns' |
| | | }) |
| | | } |
| | | |
| | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取全部搜索条件 |
| | | * @param {Array} searches 搜索条件数组 |
| | | */ |
| | | formatSearch (searches) { |
| | | if (!searches || searches.length === 0) return [] |
| | | |
| | | let newsearches = [] |
| | | searches.forEach(search => { |
| | | if (!search.field) return |
| | | |
| | | let item = { |
| | | key: search.field, |
| | | match: search.match, |
| | | type: search.type, |
| | | label: search.label, |
| | | value: search.initval, |
| | | required: search.required === 'true' |
| | | } |
| | | if (item.type === 'group') { |
| | | item.key = search.datefield |
| | | item.type = 'daterange' |
| | | item.match = 'between' |
| | | item.value = [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')].join(',') |
| | | |
| | | newsearches.push(item) |
| | | return |
| | | } else if (item.type === 'date') { |
| | | item.value = moment().format('YYYY-MM-DD') |
| | | } else if (item.type === 'datemonth') { |
| | | item.value = moment().format('YYYY-MM') |
| | | } else if (item.type === 'dateweek') { |
| | | item.value = moment().format('YYYY-MM-DD') |
| | | } else if (item.type === 'daterange') { |
| | | item.value = [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')].join(',') |
| | | } else if (item.type === 'multiselect' || (item.type === 'checkcard' && search.multiple === 'true')) { |
| | | item.type = 'multi' |
| | | item.value = '@$@' |
| | | } else { |
| | | item.value = '@$@' |
| | | } |
| | | newsearches.push(item) |
| | | }) |
| | | |
| | | return newsearches |
| | | } |
| | | |
| | | columnChange = (values) => { |
| | |
| | | return |
| | | } |
| | | |
| | | if (activeKey === 'backscript' && verify.enable === 'true') { |
| | | this.checkScript(resolve, reject) |
| | | } else if (activeKey === 'setting') { |
| | | if (activeKey === 'setting') { |
| | | this.settingForm.handleConfirm().then(res => { |
| | | let _verify = {...verify, ...res} |
| | | |
| | |
| | | } else { |
| | | resolve(verify) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | checkScript = (_resolve, _reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.sql = values.sql || '' |
| | | |
| | | let _quot = values.sql.match(/'{1}/g) |
| | | let _lparen = values.sql.match(/\({1}/g) |
| | | let _rparen = values.sql.match(/\){1}/g) |
| | | |
| | | _quot = _quot ? _quot.length : 0 |
| | | _lparen = _lparen ? _lparen.length : 0 |
| | | _rparen = _rparen ? _rparen.length : 0 |
| | | |
| | | if (_quot % 2 !== 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'sql中\'必须成对出现', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (_lparen !== _rparen) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'sql中()必须成对出现', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/--/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现字符 -- ,注释请用 /*内容*/', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'sql中不可使用' + error, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: values.sql |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | Api.genericInterface(param).then(res => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | if (res.status) { |
| | | let verify = {...this.state.verify, script: values.sql} |
| | | |
| | | this.setState({verify: verify}, () => { |
| | | _resolve(verify) |
| | | }) |
| | | } else { |
| | | Modal.error({ |
| | | title: res.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义脚本不可为空!', |
| | | duration: 5 |
| | | }) |
| | | _reject() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | changeEnable = (e) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: {...verify, enable: e.target.value} |
| | | }) |
| | | } |
| | | |
| | |
| | | const { card } = this.props |
| | | const { activeKey, verify } = this.state |
| | | |
| | | if (activeKey === 'backscript' && verify.enable === 'true') { |
| | | this.checkScript(() => { |
| | | this.setState({ |
| | | activeKey: val |
| | | }) |
| | | }, () => {}) |
| | | } else if (card.intertype !== 'system' || verify.dataType !== 'custom') { |
| | | if (card.intertype !== 'system' || verify.dataType !== 'custom') { |
| | | this.setState({activeKey: val}) |
| | | return |
| | | } else if (activeKey === 'setting') { |
| | |
| | | |
| | | render() { |
| | | const { card } = this.props |
| | | const { verify, excelColumns, defaultscript, scriptsColumns, activeKey, loading, searches } = this.state |
| | | const { getFieldDecorator } = this.props.form |
| | | const { verify, excelColumns, scriptsColumns, activeKey, loading, searches } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |
| | | /> |
| | | <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 回调脚本 |
| | | {verify.enable === 'true' ? <span className="count-tip">1</span> : null} |
| | | </span> |
| | | } key="backscript"> |
| | | <Form {...formItemLayout} className="verify-form"> |
| | | <Row gutter={24}> |
| | | <Col span={8}> |
| | | <Form.Item style={{marginBottom: 10}} label={'启用'}> |
| | | <Radio.Group defaultValue={verify.enable || 'false'} onChange={this.changeEnable}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <div style={{color: '#959595', fontSize: '13px', paddingTop: '30px', float: 'right'}}>执行成功后的回调函数。</div> |
| | | <Col span={24} className="sql"> |
| | | <Form.Item label={'sql'}> |
| | | {getFieldDecorator('sql', { |
| | | initialValue: verify.script || defaultscript, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入sql!' |
| | | } |
| | | ] |
| | | })(<CodeMirror />)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> : null} |
| | | <TabPane tab="信息提示" key="message"> |
| | | <Form {...formItemLayout}> |
| | |
| | | }) |
| | | |
| | | _regoptions.push({ |
| | | reg: new RegExp('@userName@', 'ig'), |
| | | value: `''` |
| | | }, { |
| | | reg: new RegExp('@fullName@', 'ig'), |
| | | value: `''` |
| | | }, { |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: verify.order |
| | | }, { |
| | |
| | | dataIndex: 'position', |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.position === 'init') { |
| | | return <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (record.position === 'front') { |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | if (record.position === 'back') { |
| | | return <span style={{color: 'orange'}}>后置</span> |
| | | } else { |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | return <span style={{color: '#26C281'}}>前置</span> |
| | | } |
| | | } |
| | | }, |
| | |
| | | }) |
| | | } |
| | | |
| | | handleEdit = (record, type) => { |
| | | let node = null |
| | | |
| | | if (type === 'scripts') { |
| | | this.scriptsForm.edit(record) |
| | | node = document.getElementById('mk-exout-script') |
| | | } |
| | | |
| | | |
| | | if (node && node.scrollTop) { |
| | | let inter = Math.ceil(node.scrollTop / 10) |
| | | |
| | | let timer = setInterval(() => { |
| | | if (node.scrollTop - inter > 0) { |
| | | node.scrollTop = node.scrollTop - inter |
| | | } else { |
| | | node.scrollTop = 0 |
| | | clearInterval(timer) |
| | | } |
| | | }, 10) |
| | | } |
| | | } |
| | | |
| | | showError = (errorType) => { |
| | | if (errorType === 'S') { |
| | | notification.success({ |
| | |
| | | </Col> : null} |
| | | {interType === 'system' ? <Col span={24} className="mk-through-line3"> |
| | | <Form.Item help={'数据ID:' + menu.MenuID} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } label={ |
| | | <Tooltip placement="topLeft" title={`使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 ''、 @$ -> */ 或 '';查询替换符 $select@ -> /* 或 ''、 @select$ -> */ 或 '';统计替换符 $sum@ -> /* 或 ''、 @sum$ -> */ 或 ''。`}> |
| | | <Tooltip placement="topLeft" title={`使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 ''、 @$ -> */ 或 ''。`}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 数据源 |
| | | </Tooltip> |
| | |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Select, Radio, Tooltip, Input, notification } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { queryPrintSql } from '@/utils/option.js' |
| | | import MkPrintTemps from '@/menu/components/share/actioncomponent/actionform/mkPrintTemps' |
| | | import './index.scss' |
| | | |
| | | const sysTempsIds = ['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'] |
| | |
| | | state = { |
| | | wxTemps: [], |
| | | selectTemp: null, |
| | | miniTemps: [], |
| | | printTemps: [] |
| | | miniTemps: [] |
| | | } |
| | | |
| | | componentDidMount() { |
| | |
| | | wxTemps = JSON.parse(wxTemps) |
| | | |
| | | this.resetTemps(wxTemps) |
| | | } |
| | | |
| | | this.checkPrintTemp() |
| | | } |
| | | |
| | | checkPrintTemp = () => { |
| | | if (!window.GLOB.printTemps) { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: Utils.formatOptions(queryPrintSql), |
| | | obj_name: 'data', |
| | | arr_field: 'PN,ID,Images' |
| | | } |
| | | |
| | | 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) // 云端数据验证 |
| | | |
| | | Api.getCloudConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | let temps = (res.data || []).map(temp => { |
| | | return { |
| | | value: temp.ID, |
| | | text: temp.PN |
| | | } |
| | | }) |
| | | |
| | | window.GLOB.printTemps = temps |
| | | |
| | | this.setState({printTemps: temps}) |
| | | }) |
| | | } else { |
| | | this.setState({printTemps: window.GLOB.printTemps || []}) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | render() { |
| | | const { unionFields, verify, notes, card, appType } = this.props |
| | | const { wxTemps, selectTemp, printTemps } = this.state |
| | | const { wxTemps, selectTemp } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | </Col> : null} |
| | | {verify.printEnable === 'true' ? <Col span={8}> |
| | | <Form.Item label="打印模板" required> |
| | | <Select value={verify.printTempId} onSelect={this.onPrintIdChange}> |
| | | {printTemps.map(option => |
| | | <Select.Option key={option.value} value={option.value}> |
| | | {option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | <MkPrintTemps value={verify.printTempId} onChange={this.onPrintIdChange}/> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}></Col> |
| | |
| | | |
| | | if (interfaces && interfaces.length > 0) { |
| | | interfaces.forEach(item => { |
| | | if (item.uuid === selfId) return |
| | | modules.push({ |
| | | value: item.uuid, |
| | | label: item.name |
| | |
| | | /** |
| | | * @description 数据源名称,用于统一查询 |
| | | * @param {Object} setting 数据源设置 |
| | | * @param {String} arrFields 查询字段 |
| | | * @param {Array} search 搜索条件 |
| | | * @param {String} orderBy 排序方式 |
| | | * @param {Number} pageIndex 页码 |
| | |
| | | * @param {String} BID 上级ID |
| | | * @return {Object} param |
| | | */ |
| | | static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, id, year) { |
| | | static getQueryDataParams (setting, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, id, year) { |
| | | let param = null |
| | | |
| | | if (setting.interType === 'system') { |
| | | param = this.getDefaultQueryParam(setting, arrFields, search, orderBy, pageIndex, pageSize, id, BID, year) |
| | | param = this.getDefaultQueryParam(setting, search, orderBy, pageIndex, pageSize, id, BID, year) |
| | | } else { |
| | | param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, id, year) |
| | | } |
| | |
| | | /** |
| | | * @description 获取系统存储过程的参数 |
| | | */ |
| | | static getDefaultQueryParam (setting, arrFields, search, orderBy, pageIndex, pageSize, id, BID, year) { |
| | | static getDefaultQueryParam (setting, search, orderBy, pageIndex, pageSize, id, BID, year) { |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | exec_type: 'y', |
| | | arr_field: arrFields, |
| | | arr_field: setting.arr_field, |
| | | default_sql: setting.execute ? 'true' : 'false' |
| | | } |
| | | |
| | | // if (setting.transaction === 'true') { |
| | | // param.func = 'sPC_Get_TableData_try' |
| | | // } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | |
| | | |
| | | let _dataresource = setting.dataresource |
| | | let _customScript = '' |
| | | let _tailScript = setting.tailScript || '' |
| | | |
| | | if (setting.customScript) { |
| | | _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) |
| | | Select @ErrorCode='',@retmsg ='',@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}' |
| | | ${setting.customScript} |
| | | ` |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | | _customScript = _customScript.replace(/@select\$|\$select@/ig, '') |
| | | _dataresource = _dataresource.replace(/\$sum@/ig, '/*') |
| | | _dataresource = _dataresource.replace(/@sum\$/ig, '*/') |
| | | _customScript = _customScript.replace(/\$sum@/ig, '/*') |
| | | _customScript = _customScript.replace(/@sum\$/ig, '*/') |
| | | |
| | | // _dataresource = _dataresource.replace(/@ID@/ig, `''`) |
| | | // _customScript = _customScript.replace(/@ID@/ig, `''`) |
| | | _dataresource = _dataresource.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _customScript = _customScript.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _dataresource = _dataresource.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | _customScript = _customScript.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | _customScript = _customScript.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _customScript = _customScript.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _customScript = _customScript.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _dataresource = _dataresource.replace(/@typename@/ig, `'admin'`) |
| | | _customScript = _customScript.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (setting.$re_year) { |
| | | _dataresource = _dataresource.replace(/@mk_year@/ig, year) |
| | | _customScript = _customScript.replace(/@mk_year@/ig, year) |
| | | } |
| | | |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | regoptions.push({ |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: orderBy |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: setting.laypage ? pageSize : '9999' |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: pageIndex |
| | | }) |
| | | regoptions.push( |
| | | { reg: /@orderBy@/ig, value: orderBy }, |
| | | { reg: /@pageSize@/ig, value: setting.laypage ? pageSize : '9999' }, |
| | | { reg: /@pageIndex@/ig, value: pageIndex}, |
| | | { reg: /@select\$|\$select@/ig, value: ''}, |
| | | { reg: /\$sum@/ig, value: '/*'}, |
| | | { reg: /@sum\$/ig, value: '*/'}, |
| | | { reg: /@ID@/ig, value: `'${id || ''}'`}, |
| | | { reg: /@BID@/ig, value: `'${BID || ''}'`}, |
| | | { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | | { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, |
| | | { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, |
| | | { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, |
| | | { reg: /@typename@/ig, value: `'admin'`}, |
| | | ) |
| | | |
| | | if (setting.$re_year) { |
| | | regoptions.push({ reg: /@mk_year@/ig, value: year }) |
| | | } |
| | | |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | _customScript = _customScript.replace(item.reg, item.value) |
| | | _tailScript = _tailScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | let _search = '' |
| | | |
| | | if (_dataresource) { |
| | | let id_search = '' |
| | | if (id) { |
| | | if (/^excel:/.test(id)) { |
| | | id_search = `${setting.primaryKey} in (select ID from dbo.SplitComma('${id.replace(/^excel:/, '')}'))` |
| | | } else { |
| | | id_search = `${setting.primaryKey || 'ID'}='${id}'` |
| | | orderBy = '' |
| | | } |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | if (id) { |
| | | _dataresource = _dataresource + ` where ${setting.primaryKey || 'ID'}='${id}'` |
| | | } |
| | | } else if (!id) { |
| | | _search = Utils.joinMainSearchkey(search) |
| | | if (_search) { |
| | | _search = 'where ' + _search |
| | | _dataresource = _dataresource + ` where ${id_search}` |
| | | } |
| | | } else if (id) { |
| | | _search = Utils.joinMainSearchkey(search) |
| | | _search = `where ${_search ? _search + ' AND ' : ''} ${setting.primaryKey || 'ID'}='${id}'` |
| | | _search = `where ${_search ? _search + ' AND ' : ''} ${id_search}` |
| | | } else { |
| | | _search = Utils.joinMainSearchkey(search) |
| | | _search = _search ? 'where ' + _search : '' |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | let LText = '' |
| | | let DateCount = '' |
| | | let arr_field = setting.all_field || setting.arr_field |
| | | |
| | | if (setting.sub_field) { |
| | | arrFields = arrFields + ',' + setting.sub_field |
| | | } |
| | | |
| | | if (_dataresource && setting.laypage && orderBy && !id) { |
| | | if (setting.custompage) { |
| | | LText = `/*system_query*/select ${arrFields} from ${_dataresource} ${_search} ` |
| | | } else { |
| | | LText = `/*system_query*/select top ${pageSize} ${arrFields} from (select ${arrFields} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` |
| | | if (setting.sub_field) { |
| | | DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` |
| | | if (_dataresource) { |
| | | if (setting.laypage && orderBy) { |
| | | if (setting.custompage) { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } else { |
| | | DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` |
| | | 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 ` |
| | | if (setting.sub_field) { |
| | | DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` |
| | | } else { |
| | | DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` |
| | | } |
| | | } |
| | | } else if (orderBy) { |
| | | LText = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else { |
| | | LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` |
| | | } |
| | | } else if (_dataresource && orderBy) { |
| | | LText = `/*system_query*/select ${arrFields} from (select ${arrFields} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else if (_dataresource) { |
| | | LText = `/*system_query*/select ${arrFields} from ${_dataresource} ${_search} ` |
| | | } |
| | | |
| | | if (_customScript) { |
| | | if (LText) { |
| | | LText = `${LText} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' |
| | | ` |
| | | } else { |
| | | _customScript = `${_customScript} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' |
| | | ` |
| | | } |
| | | } else if (_tailScript) { |
| | | LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) |
| | | Select @ErrorCode='',@retmsg ='',@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}' |
| | | ${LText} |
| | | ${_tailScript} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' |
| | | ` |
| | | } else { |
| | | LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) |
| | | Select @ErrorCode='',@retmsg ='',@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}' |
| | |
| | | ` |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@sum\$|\$sum@/ig, '') |
| | | _customScript = _customScript.replace(/@sum\$|\$sum@/ig, '') |
| | | _dataresource = _dataresource.replace(/\$select@/ig, '/*') |
| | | _dataresource = _dataresource.replace(/@select\$/ig, '*/') |
| | | _customScript = _customScript.replace(/\$select@/ig, '/*') |
| | | _customScript = _customScript.replace(/@select\$/ig, '*/') |
| | | |
| | | // _dataresource = _dataresource.replace(/@ID@/ig, `''`) |
| | | // _customScript = _customScript.replace(/@ID@/ig, `''`) |
| | | _dataresource = _dataresource.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _customScript = _customScript.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _dataresource = _dataresource.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | _customScript = _customScript.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | _customScript = _customScript.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _customScript = _customScript.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _dataresource = _dataresource.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _customScript = _customScript.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _dataresource = _dataresource.replace(/@typename@/ig, `'admin'`) |
| | | _customScript = _customScript.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | let regoptions = allSearch.map(item => { |
| | | return { |
| | |
| | | } |
| | | }) |
| | | |
| | | regoptions.push({ |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: orderBy |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 999999 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }) |
| | | regoptions.push( |
| | | { reg: /@orderBy@/ig, value: orderBy }, |
| | | { reg: /@pageSize@/ig, value: 999999 }, |
| | | { reg: /@pageIndex@/ig, value: 1}, |
| | | { reg: /\$select@/ig, value: '/*'}, |
| | | { reg: /@select\$/ig, value: '*/'}, |
| | | { reg: /@sum\$|\$sum@/ig, value: ''}, |
| | | { reg: /@ID@/ig, value: `''`}, |
| | | { reg: /@BID@/ig, value: `'${BID || ''}'`}, |
| | | { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | | { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, |
| | | { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, |
| | | { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, |
| | | { reg: /@typename@/ig, value: `'admin'`}, |
| | | ) |
| | | |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | |
| | | export function getStructDefaultParam (component, searchlist, first) { |
| | | const { columns, setting, dataName, format, uuid } = component |
| | | |
| | | let arr_field = columns.map(col => col.field) |
| | | let _dataresource = setting.dataresource |
| | | let _customScript = setting.customScript |
| | | |
| | |
| | | _customScript = _customScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | | _customScript = _customScript.replace(/@select\$|\$select@/ig, '') |
| | | _dataresource = _dataresource.replace(/\$sum@/ig, '/*') |
| | | _dataresource = _dataresource.replace(/@sum\$/ig, '*/') |
| | | _customScript = _customScript.replace(/\$sum@/ig, '/*') |
| | | _customScript = _customScript.replace(/@sum\$/ig, '*/') |
| | | // _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | | // _customScript = _customScript.replace(/@select\$|\$select@/ig, '') |
| | | // _dataresource = _dataresource.replace(/\$sum@/ig, '/*') |
| | | // _dataresource = _dataresource.replace(/@sum\$/ig, '*/') |
| | | // _customScript = _customScript.replace(/\$sum@/ig, '/*') |
| | | // _customScript = _customScript.replace(/@sum\$/ig, '*/') |
| | | |
| | | let _search = '' |
| | | if (setting.queryType !== 'statistics' && _dataresource) { |
| | |
| | | } |
| | | |
| | | if (setting.order && _dataresource) { |
| | | _dataresource = `select top 1000 ${arr_field.join(',')} from (select ${arr_field.join(',')} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` |
| | | _dataresource = `select top 1000 ${setting.arr_field} from (select ${setting.arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else if (_dataresource) { |
| | | _dataresource = `select top 1000 ${arr_field.join(',')} from ${_dataresource} ${_search} ` |
| | | _dataresource = `select top 1000 ${setting.arr_field} from ${_dataresource} ${_search} ` |
| | | } |
| | | |
| | | if (first) { |
| | |
| | | $name: setting.$name, |
| | | columns: columns, |
| | | par_tablename: '', |
| | | order: setting.order || '', |
| | | type: format === 'array' ? format : '', |
| | | primaryKey: setting.primaryKey || '', |
| | | foreign_key: '', |
| | |
| | | export function getStructuredParams (params, config, BID) { |
| | | let LText_field = [] |
| | | let diffUser = false |
| | | // let transaction = false |
| | | let loginId = `'${sessionStorage.getItem('LoginUID') || ''}'` |
| | | let sessionId = `'${localStorage.getItem('SessionUid') || ''}'` |
| | | let userId = `'${sessionStorage.getItem('UserID') || ''}'` |
| | | |
| | | let regoptions = [ |
| | | { reg: /@pageSize@/ig, value: 9999 }, |
| | | { reg: /@pageIndex@/ig, value: 1}, |
| | | { reg: /@ID@/ig, value: `''`}, |
| | | { reg: /@BID@/ig, value: `'${BID || ''}'`}, |
| | | { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | | { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, |
| | | { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, |
| | | { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, |
| | | { reg: /@typename@/ig, value: `'admin'`}, |
| | | ] |
| | | |
| | | let _LText = params.map((item, index) => { |
| | | let _script = item.script |
| | |
| | | if (!diffUser && (/@userid@/ig.test(item.sql) || /@userid@/ig.test(_script))) { |
| | | diffUser = true |
| | | } |
| | | // if (item.transaction) { |
| | | // transaction = true |
| | | // } |
| | | |
| | | _sql = _sql.replace(/@ID@/ig, `''`) |
| | | _script = _script.replace(/@ID@/ig, `''`) |
| | | _sql = _sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _script = _script.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | _sql = _sql.replace(/@LoginUID@/ig, loginId) |
| | | _script = _script.replace(/@LoginUID@/ig, loginId) |
| | | _sql = _sql.replace(/@SessionUid@/ig, sessionId) |
| | | _script = _script.replace(/@SessionUid@/ig, sessionId) |
| | | _sql = _sql.replace(/@UserID@/ig, userId) |
| | | _script = _script.replace(/@UserID@/ig, userId) |
| | | _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _script = _script.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _sql = _sql.replace(/@typename@/ig, `'admin'`) |
| | | _script = _script.replace(/@typename@/ig, `'admin'`) |
| | | _sql = _sql.replace(/@orderBy@/ig, item.order) |
| | | _script = _script.replace(/@orderBy@/ig, item.order) |
| | | |
| | | regoptions.forEach(cell => { |
| | | _sql = _sql.replace(cell.reg, cell.value) |
| | | _script = _script.replace(cell.reg, cell.value) |
| | | }) |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true) { |
| | |
| | | if (config.MenuName) { |
| | | param.menuname = config.MenuName |
| | | } |
| | | // if (transaction) { |
| | | // param.func = 'sPC_Get_structured_data_try' |
| | | // } |
| | | |
| | | let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) |
| | | |
| | |
| | | |
| | | window.GLOB.CacheData.set(tempId, {$BID: BID}) |
| | | |
| | | let initInters = [] |
| | | |
| | | this.formatInterSetting(config.interfaces, regs, initInters, params, BID) |
| | | |
| | | config.components = config.components.map(component => { |
| | | if (component.action) { |
| | | component.action = component.action.filter(cell => { |
| | |
| | | |
| | | if (component.wrap && component.wrap.datatype === 'static') { |
| | | component.format = '' |
| | | } else if (component.wrap && component.wrap.datatype === 'public') { |
| | | component.componentId = component.wrap.publicId |
| | | component.format = '' |
| | | } |
| | | |
| | | if (!component.setting) return component // 不使用系统函数时 |
| | | if (!component.format) return component // 没有动态数据 数据格式 array 或 object |
| | | |
| | | component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' |
| | | |
| | | if (component.setting.interType !== 'system') { // 不使用系统函数时 |
| | | component.setting.sync = 'false' |
| | | return component |
| | | } |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | component.scripts && component.scripts.forEach(script => { |
| | | if (script.status !== 'false') { |
| | | if (script.status === 'false') return |
| | | if (script.position !== 'back') { |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _tailScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } |
| | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | regs.forEach(cell => { |
| | | component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) |
| | | _customScript = _customScript.replace(cell.reg, cell.value) |
| | | _tailScript = _tailScript.replace(cell.reg, cell.value) |
| | | }) |
| | | |
| | | component.setting.customScript = _customScript // 整理后自定义脚本 |
| | | component.setting.tailScript = _tailScript // 后置自定义脚本 |
| | | |
| | | // floor 组件的层级 |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | |
| | | component.dataName = 'mk' + component.uuid.slice(-18) |
| | | let param = this.getDefaultParam(component) |
| | | _pars.push(param) |
| | | } else { |
| | | let arr_field = component.columns.map(col => col.field).join(',') |
| | | let param = UtilsDM.getQueryDataParams(component.setting, arr_field, [], component.setting.order || '', 1, 1000, BID) |
| | | } else if (component.subtype !== 'dualdatacard') { |
| | | let param = UtilsDM.getQueryDataParams(component.setting, [], component.setting.order || '', 1, 1000, BID) |
| | | |
| | | param.componentId = component.uuid |
| | | |
| | |
| | | auto: config.printPage === 'auto', |
| | | config |
| | | }, () => { |
| | | if (params.length === 0) { |
| | | if (params.length === 0 && initInters.length === 0) { |
| | | this.setState({loadingview: false, pages: [config.components]}) |
| | | } else if (initInters.length > 0) { |
| | | this.loadinit(initInters, params) |
| | | } else { |
| | | this.loadmaindata(params) |
| | | } |
| | |
| | | return cell |
| | | } |
| | | |
| | | formatInterSetting = (inters, regs, initInters, params, BID) => { |
| | | if (!inters) return [] |
| | | |
| | | let delay = 15 |
| | | inters.forEach(inter => { |
| | | if (inter.status !== 'true') return |
| | | |
| | | inter.setting.delay = delay |
| | | delay += 15 |
| | | |
| | | inter.setting.supModule = '' |
| | | inter.setting.arr_field = inter.columns.map(col => col.field).join(',') |
| | | |
| | | if (inter.setting.interType !== 'system') { |
| | | let param = UtilsDM.getQueryDataParams(inter.setting, [], inter.setting.order || '', 1, 1000, BID) |
| | | |
| | | param.componentId = inter.uuid |
| | | |
| | | if (inter.setting.loadlevel === 'init') { |
| | | initInters.push(param) |
| | | } else { |
| | | param.public = true |
| | | params.push(param) |
| | | } |
| | | return |
| | | } |
| | | |
| | | let _customScript = '' |
| | | let _tailScript = '' |
| | | inter.scripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | if (script.position !== 'back') { |
| | | _customScript += ` |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _tailScript += ` |
| | | ${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(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | inter.setting.dataresource = inter.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | _tailScript = _tailScript.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) |
| | | _tailScript = _tailScript.replace(cell.reg, cell.value) |
| | | }) |
| | | |
| | | inter.setting.customScript = _customScript // 整理后自定义脚本 |
| | | inter.setting.tailScript = _tailScript // 后置自定义脚本 |
| | | |
| | | let param = UtilsDM.getQueryDataParams(inter.setting, [], inter.setting.order || '', 1, 1000, BID) |
| | | |
| | | param.componentId = inter.uuid |
| | | |
| | | if (inter.setting.loadlevel === 'init') { |
| | | initInters.push(param) |
| | | } else { |
| | | param.public = true |
| | | params.push(param) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | reload = () => { |
| | | const { tempId } = this.state |
| | | |
| | |
| | | getDefaultParam = (component) => { |
| | | const { columns, setting, dataName, format } = component |
| | | |
| | | let arr_field = columns.map(col => col.field) |
| | | let _dataresource = setting.dataresource |
| | | let _customScript = setting.customScript |
| | | |
| | | if (setting.order && _dataresource) { |
| | | _dataresource = `select top 1000 ${arr_field.join(',')} from (select ${arr_field.join(',')} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource}) tmptable order by tmptable.rows ` |
| | | _dataresource = `select top 1000 ${setting.arr_field} from (select ${setting.arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource}) tmptable order by tmptable.rows ` |
| | | } else if (_dataresource) { |
| | | _dataresource = `select top 1000 ${arr_field.join(',')} from ${_dataresource} ` |
| | | _dataresource = `select top 1000 ${setting.arr_field} from ${_dataresource} ` |
| | | } |
| | | |
| | | // 测试系统打印查询语句 |
| | |
| | | return param |
| | | } |
| | | |
| | | loadinit = (initInters, params) => { |
| | | let deffers = initInters.map(item => { |
| | | let componentId = item.componentId |
| | | delete item.componentId |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(item).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | resolve() |
| | | } else { |
| | | let _data = { $$empty: true } |
| | | if (res.data && res.data[0]) { |
| | | _data = res.data[0] |
| | | } |
| | | window.GLOB.CacheData.set(componentId, _data) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | Promise.all(deffers).then(() => { |
| | | if (params.length === 0) { |
| | | this.setState({loadingview: false, pages: [this.state.config.components]}) |
| | | } else { |
| | | this.loadmaindata(params) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 主表数据加载 |
| | | */ |
| | |
| | | |
| | | let deffers = params.map(item => { |
| | | let componentId = item.componentId |
| | | let ispublic = item.public |
| | | delete item.componentId |
| | | delete item.public |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(item).then(res => { |
| | | if (!res.status) { |
| | |
| | | resolve(false) |
| | | } else { |
| | | res.componentId = componentId |
| | | |
| | | if (ispublic) { |
| | | let _data = { $$empty: true } |
| | | if (res.data && res.data[0]) { |
| | | _data = res.data[0] |
| | | } |
| | | window.GLOB.CacheData.set(componentId, _data) |
| | | } |
| | | resolve(res) |
| | | } |
| | | }) |
| | |
| | | } |
| | | |
| | | _results.forEach(res => { |
| | | if (res.componentId === item.uuid && res.data) { |
| | | if ((res.componentId === item.uuid || res.componentId === item.componentId) && res.data) { |
| | | item.dataArray = fromJS(res.data).toJS() |
| | | } else if (res.componentId === 'union' && res[item.dataName]) { |
| | | let data = res[item.dataName] |
| | |
| | | AppID: window.GLOB.appId, |
| | | TimeStamp: timeStamp, |
| | | appkey: window.GLOB.appkey, |
| | | SessionUid: localStorage.getItem('SessionUid') || '', |
| | | userid: _id, |
| | | LoginUID: _id, |
| | | nonc: Utils.getuuid() |
| | |
| | | |
| | | let memberLevel = res.member_level |
| | | |
| | | if (typeof(memberLevel) === 'number' && memberLevel > 10 && parseInt(memberLevel / 10) * 10 === memberLevel) { |
| | | if (typeof(memberLevel) === 'number' && memberLevel > 0 && parseInt(memberLevel / 10) * 10 === memberLevel) { |
| | | sessionStorage.setItem('Member_Level', md5('mksoft' + window.GLOB.appkey + new Date().getFullYear() + new Date().getMonth() + memberLevel)) |
| | | window.GLOB.memberLevel = memberLevel |
| | | } |
| | |
| | | |
| | | let memberLevel = res.member_level |
| | | |
| | | if (typeof(memberLevel) === 'number' && memberLevel > 10 && parseInt(memberLevel / 10) * 10 === memberLevel) { |
| | | if (typeof(memberLevel) === 'number' && memberLevel > 0 && parseInt(memberLevel / 10) * 10 === memberLevel) { |
| | | sessionStorage.setItem('Member_Level', md5('mksoft' + window.GLOB.appkey + new Date().getFullYear() + new Date().getMonth() + memberLevel)) |
| | | window.GLOB.memberLevel = memberLevel |
| | | } |