From 547e5fe219ee7bee309ecd67db74bc8df66b5433 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 23 八月 2023 11:47:45 +0800 Subject: [PATCH] 2023-08-23 --- src/utils/utils-datamanage.js | 243 ++--- src/tabviews/custom/components/code/sand-box/index.jsx | 7 src/tabviews/custom/components/editor/braft-editor/index.jsx | 5 src/tabviews/custom/components/tree/antd-tree/index.jsx | 13 src/tabviews/zshare/actionList/popupbutton/index.jsx | 5 src/utils/utils-custom.js | 1 src/menu/components/card/balcony/options.jsx | 6 src/menu/components/share/actioncomponent/actionform/mkPrintTemps/index.scss | 0 src/tabviews/custom/popview/index.jsx | 15 src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx | 6 src/tabviews/basetable/index.jsx | 142 +-- src/views/billprint/index.jsx | 168 ++++ src/tabviews/subtabtable/index.jsx | 30 src/tabviews/commontable/index.jsx | 30 src/tabviews/custom/components/card/data-card/index.jsx | 19 src/tabviews/custom/components/card/prop-card/index.jsx | 13 src/menu/components/card/cardcellcomponent/index.jsx | 75 - src/menu/components/card/data-card/options.jsx | 6 src/menu/components/share/actioncomponent/formconfig.jsx | 12 src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx | 2 src/tabviews/custom/components/table/normal-table/index.jsx | 16 src/tabviews/custom/components/chart/antv-pie/index.jsx | 5 src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 11 src/components/mkIcon/index.jsx | 21 src/menu/components/share/actioncomponent/actionform/index.jsx | 26 src/tabviews/custom/components/carousel/prop-card/index.jsx | 11 src/tabviews/custom/index.jsx | 78 + src/tabviews/treepage/index.jsx | 5 src/tabviews/custom/components/chart/antv-scatter/index.jsx | 11 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 8 src/tabviews/custom/components/table/base-table/index.jsx | 16 src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 5 src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx | 26 src/components/header/index.jsx | 2 src/tabviews/custom/components/card/double-data-card/index.jsx | 19 src/tabviews/custom/components/chart/antv-G6/index.jsx | 6 src/menu/datasource/verifycard/customscript/index.jsx | 4 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 364 +------- src/tabviews/custom/components/carousel/data-card/index.jsx | 13 src/tabviews/custom/components/table/edit-table/index.jsx | 16 src/tabviews/custom/components/calendar/index.jsx | 5 src/tabviews/custom/components/form/simple-form/index.jsx | 7 src/tabviews/subtable/index.jsx | 30 src/tabviews/custom/components/iframe/index.jsx | 7 src/tabviews/custom/components/chart/custom-chart/index.jsx | 11 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 247 ------ src/index.js | 2 src/tabviews/custom/components/form/tab-form/index.jsx | 7 src/views/sso/index.jsx | 2 src/tabviews/custom/components/card/table-card/index.jsx | 13 src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 31 src/menu/components/share/actioncomponent/actionform/mkPrintTemps/index.jsx | 89 ++ src/tabviews/debugtable/index.jsx | 10 src/menu/datasource/verifycard/settingform/index.jsx | 24 src/tabviews/custom/components/interfaces/interItem/index.jsx | 2 src/menu/components/share/actioncomponent/index.jsx | 76 - src/tabviews/zshare/actionList/printbutton/index.jsx | 71 + src/tabviews/custom/components/form/step-form/index.jsx | 7 src/tabviews/custom/components/card/balcony/index.jsx | 9 src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx | 13 src/templates/zshare/verifycard/baseform/index.jsx | 58 - src/views/login/index.jsx | 3 62 files changed, 942 insertions(+), 1,243 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 032fd3d..7db59b7 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -30,7 +30,7 @@ systems: [], searchkey: '', thdMenuList: [], - debug: sessionStorage.getItem('debug') === 'true', + debug: sessionStorage.getItem('debug') === 'true' && window.GLOB.memberLevel > 0, collapse: sessionStorage.getItem('collapse') === 'true' } diff --git a/src/components/mkIcon/index.jsx b/src/components/mkIcon/index.jsx index fd157d7..3427f4b 100644 --- a/src/components/mkIcon/index.jsx +++ b/src/components/mkIcon/index.jsx @@ -46,12 +46,8 @@ } 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}) } } @@ -65,6 +61,8 @@ } getIcons = () => { + const { selectIcon } = this.state + Api.getCloudConfig({ func: 's_get_icons' }).then(res => { if (!res.status) { notification.warning({ @@ -84,6 +82,13 @@ 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) + } }) } @@ -92,7 +97,9 @@ 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() diff --git a/src/index.js b/src/index.js index 55ef356..df31aa8 100644 --- a/src/index.js +++ b/src/index.js @@ -223,7 +223,7 @@ 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) { diff --git a/src/menu/components/card/balcony/options.jsx b/src/menu/components/card/balcony/options.jsx index 81b6603..5ae1c32 100644 --- a/src/menu/components/card/balcony/options.jsx +++ b/src/menu/components/card/balcony/options.jsx @@ -35,10 +35,6 @@ roleList = [] } - if (wrap.datatype === 'public' && MenuType === 'billPrint') { - wrap.datatype = 'static' - } - const balconyWrapForm = [ { type: 'text', @@ -69,7 +65,7 @@ options: [ {value: 'dynamic', label: '鍔ㄦ��'}, {value: 'static', label: '闈欐��'}, - {value: 'public', label: '鍏叡鏁版嵁婧�', disabled: MenuType === 'billPrint'}, + {value: 'public', label: '鍏叡鏁版嵁婧�'}, ], controlFields: [ {field: 'empty', values: ['dynamic']}, diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 5e871c2..22adfb8 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -1,13 +1,11 @@ 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' @@ -316,64 +314,21 @@ 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) + }) + } } /** diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index 37be9fa..7f8f0cb 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -62,10 +62,6 @@ } } - if (wrap.datatype === 'public' && MenuType === 'billPrint') { - wrap.datatype = 'static' - } - const cardWrapForm = [ { type: 'text', @@ -103,7 +99,7 @@ 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: [ diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 4a4bd91..e83ff55 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -7,6 +7,7 @@ import asyncComponent from '@/utils/asyncComponent' import KeyInterface from '@/components/keyInterface' +import MkPrintTemps from './mkPrintTemps' import './index.scss' const { TextArea } = Input @@ -353,7 +354,12 @@ } } 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') @@ -381,7 +387,9 @@ 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') { @@ -923,6 +931,12 @@ } 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' @@ -995,6 +1009,10 @@ 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 => { @@ -1016,6 +1034,10 @@ return col }) } + + if (values.verify) { + values.verify.scripts = [] + } } if (values.OpenType === 'form') { diff --git a/src/menu/components/share/actioncomponent/actionform/mkPrintTemps/index.jsx b/src/menu/components/share/actioncomponent/actionform/mkPrintTemps/index.jsx new file mode 100644 index 0000000..efc3032 --- /dev/null +++ b/src/menu/components/share/actioncomponent/actionform/mkPrintTemps/index.jsx @@ -0,0 +1,89 @@ +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 \ No newline at end of file diff --git a/src/menu/components/share/actioncomponent/actionform/mkPrintTemps/index.scss b/src/menu/components/share/actioncomponent/actionform/mkPrintTemps/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/menu/components/share/actioncomponent/actionform/mkPrintTemps/index.scss diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index c246b60..957a299 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -12,7 +12,6 @@ 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 = [] @@ -399,12 +398,11 @@ options: pageTemps }, { - type: 'select', + type: 'printTemps', key: 'printTemp', label: '鎵撳嵃妯℃澘', initVal: card.printTemp || '', - required: true, - options: printTemps + required: true }, { type: isApp ? 'select' : 'cascader', @@ -1282,7 +1280,6 @@ */ 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 || [] @@ -1504,12 +1501,11 @@ options: pageTemps }, { - type: 'select', + type: 'printTemps', key: 'printTemp', label: '鎵撳嵃妯℃澘', initVal: card.printTemp || '', - required: true, - options: printTemps + required: true }, { type: 'cascader', diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 8f601ee..516e8c2 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -4,9 +4,7 @@ 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' @@ -211,67 +209,23 @@ 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) + }) + } } /** diff --git a/src/menu/datasource/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx index abbf7e0..7e7af73 100644 --- a/src/menu/datasource/verifycard/customscript/index.jsx +++ b/src/menu/datasource/verifycard/customscript/index.jsx @@ -98,7 +98,8 @@ editItem: null }) this.props.form.setFieldsValue({ - sql: ' ' + sql: ' ', + position: 'front' }) } @@ -117,7 +118,6 @@ } 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) diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index f4c917f..c47b78b 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -27,16 +27,24 @@ 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 === '涓昏〃' } @@ -82,7 +90,7 @@ } } - this.setState({modules, innerRules, innertip, setting: _setting, ismain}) + this.setState({modules, innerRules, innertip, setting: _setting, ismain, MenuType}) } handleConfirm = () => { @@ -181,7 +189,7 @@ 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: { @@ -349,7 +357,7 @@ </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> @@ -421,7 +429,7 @@ </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" /> @@ -535,7 +543,7 @@ )} </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" /> @@ -552,7 +560,7 @@ )} </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 || '' diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index a64ab5f..3eff170 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -341,50 +341,10 @@ 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] @@ -426,51 +386,12 @@ 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] @@ -479,6 +400,62 @@ 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) => { @@ -511,6 +488,7 @@ 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)) { diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 43da736..ab15b41 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -45,7 +45,6 @@ shortcuts: null, // 蹇嵎閿� actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -301,6 +300,16 @@ 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) @@ -441,6 +450,8 @@ resetContrl: config.setting.resetContrl, } + config.setting.arr_field = _arrField.join(',') + this.setState({ pageSize: config.setting.pageSize || 10, loadingview: false, @@ -453,7 +464,6 @@ setting: config.setting, actions: _actions, columns: _columns, - arr_field: _arrField.join(','), BID: param && param.$BID ? param.$BID : '', search: Utils.initMainSearch(config.search) }, () => { @@ -556,14 +566,14 @@ * @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) @@ -647,14 +657,14 @@ * @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) { @@ -846,16 +856,14 @@ * @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 }) } diff --git a/src/tabviews/custom/components/calendar/index.jsx b/src/tabviews/custom/components/calendar/index.jsx index 7b1f9d6..051b672 100644 --- a/src/tabviews/custom/components/calendar/index.jsx +++ b/src/tabviews/custom/components/calendar/index.jsx @@ -67,7 +67,6 @@ BID: BData ? (BData.$BID || '') : '', BData: BData, config: _config, - arr_field: _config.columns.map(col => col.field).join(','), search: _config.$searches }) } @@ -208,7 +207,7 @@ } 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({ @@ -238,7 +237,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index a383d6d..e3cc44f 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -118,8 +118,7 @@ syncConfig, data: _data, BID: BID || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -339,10 +338,8 @@ if (config.uuid !== menuId) return callback({ - arr_field: '', orderBy: '', search: [], - menuName: config.name }) } @@ -355,7 +352,7 @@ } 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) @@ -384,7 +381,7 @@ } 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) { diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index c727c59..0360c81 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -195,8 +195,7 @@ BData: BData || '', config: _config, card: _card, - search: _config.$searches, - arr_field: _config.columns.map(col => col.field).join(',') + search: _config.$searches }) } @@ -682,7 +681,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, search, orderBy } = this.state + const { config, search, orderBy } = this.state if (config.uuid !== menuId) return @@ -698,15 +697,13 @@ } 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 @@ -754,7 +751,7 @@ } 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) { @@ -870,7 +867,7 @@ * @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) { // 涓昏〃鎼滅储鏉′欢 @@ -888,7 +885,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index 6738f88..9dea605 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -149,6 +149,8 @@ } _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) { @@ -189,8 +191,7 @@ subconfig: subconfig, wrapStyle: wrapStyle, card: _card, - search: _config.$searches, - arr_field: _config.columns.map(col => col.field).join(',') + search: _config.$searches }) } @@ -523,7 +524,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, search, orderBy } = this.state + const { config, search, orderBy } = this.state if (config.uuid !== menuId) return @@ -539,15 +540,13 @@ } 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 @@ -598,7 +597,7 @@ } 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) { @@ -771,7 +770,7 @@ * @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) { // 涓昏〃鎼滅储鏉′欢 @@ -789,7 +788,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index ed061cf..f8dcefe 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -47,7 +47,7 @@ if (BData) { BID = BData.$BID || '' } - + if (_config.wrap.datatype === 'dynamic') { _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' @@ -118,8 +118,7 @@ data: _data, BID: BID || '', BData: BData || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -472,10 +471,8 @@ } callback({ - arr_field: '', orderBy: '', - search: searches, - menuName: config.name + search: searches }) } @@ -488,7 +485,7 @@ } 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) @@ -528,7 +525,7 @@ } 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) { diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index f0af9bf..74582e6 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -99,8 +99,7 @@ BData: BData || '', data: _data, config: _config, - search: _config.$searches, - arr_field: _config.columns.map(col => col.field).join(',') + search: _config.$searches }) } @@ -308,7 +307,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, search } = this.state + const { config, search } = this.state if (config.uuid !== menuId) return @@ -324,15 +323,13 @@ } 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({ @@ -366,7 +363,7 @@ } 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) { diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index da5ef60..8740cfd 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -94,8 +94,7 @@ BID: BID || '', BData: BData || '', config: _config, - card: _card, - arr_field: _config.columns.map(col => col.field).join(',') + card: _card }) } @@ -305,7 +304,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config } = this.state + const { config } = this.state if (config.uuid !== menuId) return @@ -315,15 +314,13 @@ } 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({ @@ -351,7 +348,7 @@ } 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) { diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index 3c91f7b..dcbb04b 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -90,8 +90,7 @@ data: _data, BID: BID || '', BData: BData || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -303,10 +302,8 @@ } callback({ - arr_field: '', orderBy: '', - search: searches, - menuName: config.name + search: searches }) } @@ -319,7 +316,7 @@ } async loadData (type) { - const { config, arr_field, BID, BData } = this.state + const { config, BID, BData } = this.state if (config.wrap.datatype === 'static') { this.setState({ @@ -351,7 +348,7 @@ } 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) { diff --git a/src/tabviews/custom/components/chart/antv-G6/index.jsx b/src/tabviews/custom/components/chart/antv-G6/index.jsx index e0084f9..ad28222 100644 --- a/src/tabviews/custom/components/chart/antv-G6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-G6/index.jsx @@ -805,7 +805,6 @@ BID: '', BData: '', plot: null, - arr_field : '', chartId: Utils.getuuid(), empty: true } @@ -860,7 +859,6 @@ config: _config, BID: BID || '', BData: BData || '', - arr_field: _config.columns.map(col => col.field).join(','), plot: _config.plot }) @@ -1126,7 +1124,7 @@ } 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([]))) { @@ -1151,7 +1149,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 36cdc3f..00c7926 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -344,7 +344,6 @@ BID: BID || '', vFields: vFields, vstFields: vstFields, - arr_field: _config.columns.map(col => col.field).join(','), plot: _config.plot, search: _config.$searches, transfield @@ -518,7 +517,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, search } = this.state + const { config, search } = this.state if (config.uuid !== menuId) return @@ -534,7 +533,6 @@ } callback({ - arr_field: arr_field, orderBy: config.setting.order || '', search: searches, menuName: config.name @@ -545,7 +543,7 @@ * @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([]))) { @@ -578,7 +576,7 @@ } 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) { diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index e60f4cf..5274412 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -120,7 +120,6 @@ this.setState({ config: _config, BID: BID || '', - arr_field: _config.columns.map(col => col.field).join(','), plot: _config.plot }) } @@ -301,7 +300,7 @@ } async loadData (type) { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� let _data = null @@ -336,7 +335,7 @@ } 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) { diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index ab5d785..a8bb8d5 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -90,7 +90,6 @@ 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 @@ -260,7 +259,7 @@ } 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([]))) { @@ -293,7 +292,7 @@ } 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) { diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index a5a495f..dffbc8d 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -83,7 +83,6 @@ config: _config, BID: BID || '', empty: this.data.length === 0, - arr_field: _config.columns.map(col => col.field).join(','), plot: _config.plot, search: _config.$searches }) @@ -262,7 +261,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, search } = this.state + const { config, search } = this.state if (config.uuid !== menuId) return @@ -278,10 +277,8 @@ } callback({ - arr_field: arr_field, orderBy: config.setting.order || '', - search: searches, - menuName: config.name + search: searches }) } @@ -289,7 +286,7 @@ * @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 }) @@ -325,7 +322,7 @@ } 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) { diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index de60a68..d505a48 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -72,7 +72,6 @@ config: _config, empty: this.data.length === 0, BID: BID || '', - arr_field: _config.columns.map(col => col.field).join(','), plot: _config.plot, search: _config.$searches }) @@ -253,7 +252,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, search } = this.state + const { config, search } = this.state if (config.uuid !== menuId) return @@ -269,10 +268,8 @@ } callback({ - arr_field: arr_field, orderBy: config.setting.order || '', - search: searches, - menuName: config.name + search: searches }) } @@ -280,7 +277,7 @@ * @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({ @@ -318,7 +315,7 @@ } 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) { diff --git a/src/tabviews/custom/components/code/sand-box/index.jsx b/src/tabviews/custom/components/code/sand-box/index.jsx index 4119dea..b27d86c 100644 --- a/src/tabviews/custom/components/code/sand-box/index.jsx +++ b/src/tabviews/custom/components/code/sand-box/index.jsx @@ -72,8 +72,7 @@ this.setState({ data: _data, BID: BID || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -205,7 +204,7 @@ } async loadData (type) { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.wrap.datatype === 'static') { this.setState({ @@ -236,7 +235,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/editor/braft-editor/index.jsx b/src/tabviews/custom/components/editor/braft-editor/index.jsx index ccef7cc..163424a 100644 --- a/src/tabviews/custom/components/editor/braft-editor/index.jsx +++ b/src/tabviews/custom/components/editor/braft-editor/index.jsx @@ -63,7 +63,6 @@ data: _data, BID: BID || '', config: _config, - arr_field: _config.columns.map(col => col.field).join(','), }) } @@ -168,7 +167,7 @@ } 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) @@ -203,7 +202,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index bd481d5..60be28f 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -74,8 +74,7 @@ group: _group, BID: BID || '', BData: BData || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -223,7 +222,7 @@ } async loadData () { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.wrap.datatype === 'static') { this.setState({ @@ -254,7 +253,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index 6ce4ec2..cd83384 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -114,8 +114,7 @@ step: _group.sort - 1, BID: BID || '', BData: BData || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -283,7 +282,7 @@ } async loadData (type) { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.wrap.datatype === 'static') { this.setState({ @@ -314,7 +313,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 90e0224..6286532 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -88,8 +88,7 @@ group: _config.subcards[0], BID: BID || '', BData: BData || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -236,7 +235,7 @@ } async loadData () { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.wrap.datatype === 'static') { this.setState({ @@ -267,7 +266,7 @@ }) 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) { diff --git a/src/tabviews/custom/components/iframe/index.jsx b/src/tabviews/custom/components/iframe/index.jsx index ff983aa..3737715 100644 --- a/src/tabviews/custom/components/iframe/index.jsx +++ b/src/tabviews/custom/components/iframe/index.jsx @@ -69,8 +69,7 @@ linkUrl: linkUrl, data: _data, BID: BID || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -174,7 +173,7 @@ } async loadData () { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.wrap.datatype === 'static') { this.setState({ @@ -198,7 +197,7 @@ } 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) { diff --git a/src/tabviews/custom/components/interfaces/interItem/index.jsx b/src/tabviews/custom/components/interfaces/interItem/index.jsx index 893397e..fe1514e 100644 --- a/src/tabviews/custom/components/interfaces/interItem/index.jsx +++ b/src/tabviews/custom/components/interfaces/interItem/index.jsx @@ -110,7 +110,7 @@ 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) { diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index c05ea6d..2fd32cd 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -25,7 +25,6 @@ config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -82,7 +81,6 @@ 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') { @@ -100,7 +98,7 @@ * @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({ @@ -137,7 +135,7 @@ }) 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) { @@ -264,7 +262,7 @@ * @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) { // 涓昏〃鎼滅储鏉′欢 @@ -282,7 +280,7 @@ }) 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) { @@ -513,7 +511,7 @@ * @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 @@ -529,10 +527,8 @@ } callback({ - arr_field: arr_field, orderBy: orderBy || setting.order, - search: searches, - menuName: config.name + search: searches }) } diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index fc305fe..495a171 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -27,7 +27,6 @@ config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -173,7 +172,6 @@ setting: setting, actions: _config.action, columns: _columns, - arr_field: _config.columns.map(col => col.field).join(','), search: _config.$searches }, () => { if (_config.setting.onload === 'true') { @@ -190,7 +188,7 @@ * @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({ @@ -222,7 +220,7 @@ }) 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) { @@ -303,7 +301,7 @@ * @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) { // 涓昏〃鎼滅储鏉′欢 @@ -321,7 +319,7 @@ }) 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) { @@ -440,7 +438,7 @@ * @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 @@ -456,10 +454,8 @@ } callback({ - arr_field: arr_field, orderBy: orderBy || setting.order, - search: searches, - menuName: config.name + search: searches }) } diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 9b114c1..e2aac93 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -29,7 +29,6 @@ config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -149,7 +148,6 @@ setting: setting, actions: _config.action, columns: _config.cols, - arr_field: _config.columns.map(col => col.field).join(','), search: _config.$searches }) } @@ -354,7 +352,7 @@ * @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({ @@ -395,7 +393,7 @@ } 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) { @@ -524,7 +522,7 @@ * @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) { // 涓昏〃鎼滅储鏉′欢 @@ -542,7 +540,7 @@ }) 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) { @@ -762,7 +760,7 @@ * @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 @@ -778,10 +776,8 @@ } callback({ - arr_field: arr_field, orderBy: orderBy || setting.order, - search: searches, - menuName: config.name + search: searches }) } diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index 46af8a6..e915def 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -99,7 +99,6 @@ BData: BData || '', data: _data, config: _config, - arr_field: _config.columns.map(col => col.field).join(',') }) } @@ -300,7 +299,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config } = this.state + const { config } = this.state if (config.uuid !== menuId) return @@ -310,15 +309,13 @@ } 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({ @@ -350,7 +347,7 @@ } 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) { diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx index 1d974f3..6aad5fb 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.jsx +++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx @@ -77,8 +77,7 @@ selected: _config.wrap.selected === 'true', config: _config, data: _data, - BID: BID || '', - arr_field: _config.columns.map(col => col.field).join(',') + BID: BID || '' }) } @@ -234,7 +233,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config } = this.state + const { config } = this.state if (config.uuid !== menuId) return @@ -244,10 +243,8 @@ } callback({ - arr_field: arr_field, orderBy: config.setting.order || '', - search: searches, - menuName: config.name + search: searches }) } @@ -273,7 +270,7 @@ * @description 鏁版嵁鍔犺浇 */ async loadData (type) { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ @@ -301,7 +298,7 @@ } 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) { diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index c859a83..8cf3efe 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -50,7 +50,6 @@ class CustomPage extends Component { static propTpyes = { param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鍙傛暟 - Tab: PropTypes.string, // 寮圭獥鏍囩 MenuID: PropTypes.string, // 鑿滃崟Id MenuName: PropTypes.string, // 鑿滃崟鍚嶇О changeTemp: PropTypes.func @@ -189,19 +188,13 @@ }) } - 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 || '' @@ -278,9 +271,7 @@ this.loadmaindata(params) } - if (!this.props.Tab) { - this.setShortcut() - } + this.setShortcut() }) } else { this.setState({ @@ -334,7 +325,7 @@ } } - 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 @@ -441,7 +432,7 @@ _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 => { @@ -465,7 +456,7 @@ 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)) { @@ -526,7 +517,7 @@ 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 @@ -574,7 +565,7 @@ 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) @@ -631,7 +622,7 @@ 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) @@ -673,7 +664,7 @@ 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) @@ -697,7 +688,7 @@ 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) @@ -801,14 +792,14 @@ }) } - 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 || {} @@ -820,6 +811,20 @@ 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' + } } } @@ -937,6 +942,7 @@ 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)) { @@ -957,9 +963,15 @@ } 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} ` } @@ -979,17 +991,21 @@ 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) @@ -1077,12 +1093,20 @@ 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} ` } @@ -1103,17 +1127,21 @@ 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 }) @@ -1201,9 +1229,9 @@ } resetActiveMenu = (menuId) => { - const { MenuID, Tab } = this.props + const { MenuID } = this.props - if (MenuID !== menuId || Tab) return + if (MenuID !== menuId) return this.setShortcut() } diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 8e0d448..5fc621c 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -604,6 +604,20 @@ } } + 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 = '' @@ -717,6 +731,7 @@ 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)) { diff --git a/src/tabviews/debugtable/index.jsx b/src/tabviews/debugtable/index.jsx index afcae04..9f52daa 100644 --- a/src/tabviews/debugtable/index.jsx +++ b/src/tabviews/debugtable/index.jsx @@ -27,22 +27,22 @@ 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) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index b1652cf..64cc21a 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -39,7 +39,6 @@ config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -229,6 +228,16 @@ 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) @@ -343,6 +352,8 @@ resetContrl: config.setting.resetContrl, } + config.setting.arr_field = _arrField.join(',') + this.setState({ pageSize: config.setting.pageSize || 10, BID: this.props.BID || '', @@ -355,7 +366,6 @@ 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)) { // 鍒濆鍖栧彲鍔犺浇 @@ -429,7 +439,7 @@ */ 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) { // 涓昏〃鎼滅储鏉′欢 @@ -441,7 +451,7 @@ }) 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) @@ -515,7 +525,7 @@ */ 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) { // 涓昏〃鎼滅储鏉′欢 @@ -527,7 +537,7 @@ }) 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) { @@ -687,8 +697,8 @@ * @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 @@ -698,10 +708,8 @@ } callback({ - arr_field: arr_field, orderBy: orderBy || setting.order, - search: searches, - menuName: Tab.label + search: searches }) } diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 878eeba..0218924 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -34,7 +34,6 @@ config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -201,6 +200,16 @@ 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(',') @@ -300,6 +309,8 @@ resetContrl: config.setting.resetContrl, } + config.setting.arr_field = _arrField.join(',') + this.setState({ pageSize: config.setting.pageSize || 10, loadingview: false, @@ -309,7 +320,6 @@ setting: config.setting, actions: _actions, columns: _columns, - arr_field: _arrField.join(','), search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { if (config.setting.onload !== 'false') { // 鍒濆鍖栧彲鍔犺浇 @@ -365,7 +375,7 @@ */ 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() @@ -374,7 +384,7 @@ }) 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) @@ -490,7 +500,7 @@ */ 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() @@ -499,7 +509,7 @@ }) 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) { @@ -623,16 +633,14 @@ * @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 }) } diff --git a/src/tabviews/treepage/index.jsx b/src/tabviews/treepage/index.jsx index 05e053c..00b7d2f 100644 --- a/src/tabviews/treepage/index.jsx +++ b/src/tabviews/treepage/index.jsx @@ -186,6 +186,8 @@ }) } + config.setting.arr_field = `${config.setting.valueField},${config.setting.labelField},${config.setting.parentField}` + this.setState({ BID: param && param.$BID ? param.$BID : '', loadingview: false, @@ -261,8 +263,7 @@ 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) { diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index d5489f8..30bcbf7 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -7,6 +7,7 @@ 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' @@ -18,13 +19,10 @@ selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� disabled: PropTypes.any, // 琛屾寜閽鐢� } state = { - excelName: '', // 鏂囦欢鍚� - search: '', // 鎼滅储鏉′欢 loading: false, // 瀵煎嚭涓� hidden: false, disabled: false @@ -88,22 +86,6 @@ } 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 瑙﹀彂鎸夐挳鎿嶄綔 @@ -126,17 +108,17 @@ 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 @@ -154,10 +136,11 @@ 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) { @@ -175,40 +158,13 @@ } } - 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) { @@ -358,7 +314,9 @@ message: '瀵煎嚭鎸夐挳璁剧疆閿欒锛�', duration: 5 }) - this.updateStatus('over') + this.setState({ + loading: false + }) } } else if (btn.intertype === 'outer' && btn.innerFunc) { // 鍒嗛〉锛屼笖涓ゆ璇锋眰 this.getExcelOutDoubleData(viewParam, 1, pageSize, []) @@ -457,12 +415,7 @@ 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 @@ -618,13 +571,9 @@ 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 = [] @@ -759,20 +708,16 @@ 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>` }, '') @@ -806,71 +751,10 @@ // 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' // 鍚庡彴瑙g爜 - 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') - }) } /** @@ -912,190 +796,88 @@ /** * @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 ? '' : '/*涓嶆墽琛岄粯璁ql*/\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 diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index 747af96..efd9c5c 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -9,7 +9,6 @@ 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 { @@ -128,7 +127,7 @@ 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) } @@ -250,7 +249,6 @@ 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 { @@ -287,7 +285,6 @@ 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}> diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 9654827..fdc3ac2 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -976,10 +976,15 @@ 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} ` } @@ -989,16 +994,28 @@ _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) @@ -1086,36 +1103,12 @@ 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 = '' @@ -1126,17 +1119,27 @@ 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} diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx index 76aa845..9f4f640 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx @@ -1,7 +1,8 @@ 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' @@ -115,7 +116,8 @@ }) this.props.form.setFieldsValue({ - sql: record.sql + sql: record.sql, + position: record.position || 'front' }) } @@ -214,7 +216,8 @@ }) this.props.form.setFieldsValue({ - sql: ' ' + sql: ' ', + position: 'front' }) } @@ -277,6 +280,23 @@ {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 diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx index 04fa4a8..10dcfb6 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx @@ -216,13 +216,18 @@ </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', { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index 99a32d2..a99543e 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -1,7 +1,7 @@ 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' @@ -12,7 +12,6 @@ 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' @@ -31,7 +30,6 @@ verify: {}, debugId: '', activeKey: 'setting', - defaultscript: '', // 鑷畾涔夎剼鏈� excelColumns: [ { title: '瀛楁', @@ -160,20 +158,18 @@ ) } }, - // { - // 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', @@ -221,14 +217,10 @@ _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' @@ -244,16 +236,6 @@ 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 = [] @@ -372,8 +354,7 @@ 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' }) } @@ -417,53 +398,6 @@ 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) => { @@ -582,9 +516,7 @@ 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} @@ -667,111 +599,6 @@ } 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: '鑷畾涔塻ql璇彞涓紝涓嶅彲鍑虹幇瀛楃 -- 锛屾敞閲婅鐢� /*鍐呭*/', - duration: 5 - }) - return - } else if (/,,/ig.test(values.sql)) { - notification.warning({ - top: 92, - message: '鑷畾涔塻ql璇彞涓紝涓嶅彲鍑虹幇杩炵画鐨勮嫳鏂囬�楀彿锛�,,锛�', - 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} }) } @@ -896,13 +723,7 @@ 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') { @@ -1075,8 +896,7 @@ 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 }, @@ -1126,39 +946,6 @@ 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: '璇疯緭鍏ql!' - } - ] - })(<CodeMirror />)} - </Form.Item> - </Col> - </Row> - </Form> </TabPane> : null} <TabPane tab="淇℃伅鎻愮ず" key="message"> <Form {...formItemLayout}> diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx index 9a443b9..6b955e5 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx @@ -65,12 +65,6 @@ }) _regoptions.push({ - reg: new RegExp('@userName@', 'ig'), - value: `''` - }, { - reg: new RegExp('@fullName@', 'ig'), - value: `''` - }, { reg: new RegExp('@orderBy@', 'ig'), value: verify.order }, { diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index 2cb282d..3e57618 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -66,12 +66,10 @@ 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> } } }, @@ -335,6 +333,29 @@ }) } + 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({ diff --git a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx index a86f41a..30cbbed 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx @@ -334,7 +334,7 @@ </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> diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index b5d04f2..611e4ef 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -3,11 +3,9 @@ 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'] @@ -25,8 +23,7 @@ state = { wxTemps: [], selectTemp: null, - miniTemps: [], - printTemps: [] + miniTemps: [] } componentDidMount() { @@ -80,47 +77,6 @@ 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 || []}) } } @@ -324,7 +280,7 @@ 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 }, @@ -467,13 +423,7 @@ </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> diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 9f42868..5871f20 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -270,6 +270,7 @@ if (interfaces && interfaces.length > 0) { interfaces.forEach(item => { + if (item.uuid === selfId) return modules.push({ value: item.uuid, label: item.name diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index 5be52b3..be72648 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -6,7 +6,6 @@ /** * @description 鏁版嵁婧愬悕绉帮紝鐢ㄤ簬缁熶竴鏌ヨ * @param {Object} setting 鏁版嵁婧愯缃� - * @param {String} arrFields 鏌ヨ瀛楁 * @param {Array} search 鎼滅储鏉′欢 * @param {String} orderBy 鎺掑簭鏂瑰紡 * @param {Number} pageIndex 椤电爜 @@ -14,11 +13,11 @@ * @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) } @@ -99,18 +98,14 @@ /** * @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') || '' @@ -126,39 +121,13 @@ 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) @@ -168,37 +137,55 @@ 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 : '' } } @@ -211,42 +198,52 @@ 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}' @@ -334,28 +331,6 @@ ` } - _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 { @@ -364,16 +339,21 @@ } }) - 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) @@ -447,7 +427,6 @@ 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 @@ -464,12 +443,12 @@ _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) { @@ -478,9 +457,9 @@ } 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) { @@ -508,6 +487,7 @@ $name: setting.$name, columns: columns, par_tablename: '', + order: setting.order || '', type: format === 'array' ? format : '', primaryKey: setting.primaryKey || '', foreign_key: '', @@ -524,10 +504,18 @@ 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 @@ -536,24 +524,14 @@ 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) { @@ -579,9 +557,6 @@ if (config.MenuName) { param.menuname = config.MenuName } - // if (transaction) { - // param.func = 'sPC_Get_structured_data_try' - // } let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index d125630..7779306 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -322,6 +322,10 @@ 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 => { @@ -434,19 +438,31 @@ 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} ` } @@ -467,17 +483,21 @@ 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 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ @@ -485,9 +505,8 @@ 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 @@ -521,8 +540,10 @@ 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) } @@ -576,6 +597,92 @@ 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 @@ -598,14 +705,13 @@ 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} ` } // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 @@ -678,6 +784,40 @@ 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 涓昏〃鏁版嵁鍔犺浇 */ @@ -686,7 +826,9 @@ 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) { @@ -698,6 +840,14 @@ 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) } }) @@ -718,7 +868,7 @@ } _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] diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 4d8e6c8..b0a2552 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -433,6 +433,7 @@ AppID: window.GLOB.appId, TimeStamp: timeStamp, appkey: window.GLOB.appkey, + SessionUid: localStorage.getItem('SessionUid') || '', userid: _id, LoginUID: _id, nonc: Utils.getuuid() @@ -704,7 +705,7 @@ 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 } diff --git a/src/views/sso/index.jsx b/src/views/sso/index.jsx index ee192db..053eaf1 100644 --- a/src/views/sso/index.jsx +++ b/src/views/sso/index.jsx @@ -135,7 +135,7 @@ 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 } -- Gitblit v1.8.0