| | |
| | | async loadmaindata () { |
| | | const { setting, BIDs, search } = this.state |
| | | let param = '' |
| | | let requireFields = search.filter(item => item.required && !item.value) |
| | | let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) |
| | | |
| | | if (requireFields.length > 0) { |
| | | let labels = requireFields.map(item => item.label) |
| | | labels = Array.from(new Set(labels)) |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['form.required.input'] + requireFields.map(item => item.label).join('、') + ' !', |
| | | message: this.state.dict['form.required.input'] + labels.join('、') + ' !', |
| | | duration: 3 |
| | | }) |
| | | return |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | let regoptions = null |
| | | if (setting.queryType === 'statistics' || param.custom_script) { |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | |
| | | let options = allSearch.map(item => { |
| | | regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: item.value |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | } |
| | | |
| | | options.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | _search = '' |
| | | } |
| | | |
| | |
| | | DateCount = '' |
| | | } |
| | | |
| | | if (param.custom_script) { |
| | | regoptions.push({ |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: _orderBy |
| | | }) |
| | | if (setting.laypage !== 'false') { |
| | | regoptions.push({ |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: pageSize |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: pageIndex |
| | | }) |
| | | } |
| | | |
| | | regoptions.forEach(item => { |
| | | param.custom_script = param.custom_script.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | param.custom_script = Utils.formatOptions(param.custom_script) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field |
| | | arr_field: arr_field, |
| | | custom_script: setting.customScript || '', |
| | | default_sql: setting.default || 'true' |
| | | } |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | let regoptions = null |
| | | if (setting.queryType === 'statistics' || param.custom_script) { |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | let options = allSearch.map(item => { |
| | | |
| | | regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: item.value |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | } |
| | | |
| | | options.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | _search = '' |
| | | } |
| | | |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | | let DateCount = `select count(1) as total from ${_dataresource} ${_search}` |
| | | |
| | | if (setting.laypage === 'false') { |
| | | LText = `select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | DateCount = '' |
| | | } |
| | | |
| | | if (param.custom_script) { |
| | | regoptions.push({ |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: _orderBy |
| | | }) |
| | | if (setting.laypage !== 'false') { |
| | | regoptions.push({ |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: pageSize |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: pageIndex |
| | | }) |
| | | } |
| | | |
| | | regoptions.forEach(item => { |
| | | param.custom_script = param.custom_script.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | param.custom_script = Utils.formatOptions(param.custom_script) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | let param = '' |
| | | let _BID = this.props.BID |
| | | |
| | | let requireFields = search.filter(item => item.required && !item.value) |
| | | let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) |
| | | |
| | | if (requireFields.length > 0) { |
| | | let labels = requireFields.map(item => item.label) |
| | | labels = Array.from(new Set(labels)) |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['form.required.input'] + requireFields.map(item => item.label).join('、') + ' !', |
| | | message: this.state.dict['form.required.input'] + labels.join('、') + ' !', |
| | | duration: 3 |
| | | }) |
| | | return |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | let regoptions = null |
| | | if (setting.queryType === 'statistics' || param.custom_script) { |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | |
| | | let options = allSearch.map(item => { |
| | | regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: item.value |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | } |
| | | |
| | | options.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | _search = '' |
| | | } |
| | | |
| | |
| | | DateCount = '' |
| | | } |
| | | |
| | | if (param.custom_script) { |
| | | regoptions.push({ |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: _orderBy |
| | | }) |
| | | if (setting.laypage !== 'false') { |
| | | regoptions.push({ |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: pageSize |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: pageIndex |
| | | }) |
| | | } |
| | | |
| | | regoptions.forEach(item => { |
| | | param.custom_script = param.custom_script.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | param.custom_script = Utils.formatOptions(param.custom_script) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | const { setting, search } = this.state |
| | | let param = '' |
| | | |
| | | let requireFields = search.filter(item => item.required && !item.value) |
| | | let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) |
| | | |
| | | if (requireFields.length > 0) { |
| | | let labels = requireFields.map(item => item.label) |
| | | labels = Array.from(new Set(labels)) |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['form.required.input'] + requireFields.map(item => item.label).join('、') + ' !', |
| | | message: this.state.dict['form.required.input'] + labels.join('、') + ' !', |
| | | duration: 3 |
| | | }) |
| | | return |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | let regoptions = null |
| | | if (setting.queryType === 'statistics' || param.custom_script) { |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | |
| | | let options = allSearch.map(item => { |
| | | regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: item.value |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | } |
| | | |
| | | options.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | _search = '' |
| | | } |
| | | |
| | |
| | | DateCount = '' |
| | | } |
| | | |
| | | if (param.custom_script) { |
| | | regoptions.push({ |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: _orderBy |
| | | }) |
| | | if (setting.laypage !== 'false') { |
| | | regoptions.push({ |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: pageSize |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: pageIndex |
| | | }) |
| | | } |
| | | |
| | | regoptions.forEach(item => { |
| | | param.custom_script = param.custom_script.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | param.custom_script = Utils.formatOptions(param.custom_script) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { DatePicker, Tooltip } from 'antd' |
| | | import { DatePicker, Tooltip, Icon } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | |
| | | class DateGroup extends Component { |
| | | static propTpyes = { |
| | | card: PropTypes.object // 字典项 |
| | | card: PropTypes.object, // 搜索条件 |
| | | onGroupChange: PropTypes.func // 搜索内容切换 |
| | | } |
| | | |
| | | state = { |
| | | active: '', |
| | | quarterId: Utils.getuuid(), |
| | | yearId: Utils.getuuid(), |
| | | dateRange: '' |
| | | dateRange: '', |
| | | initDateRange: '', |
| | | initType: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | } |
| | | this.setState({ |
| | | active: card.initval[0], |
| | | dateRange: _dateRange |
| | | dateRange: _dateRange, |
| | | initDateRange: _dateRange, |
| | | initType: card.initval[0] |
| | | }) |
| | | } |
| | | } |
| | | |
| | | changeTab = () => { |
| | | |
| | | } |
| | | |
| | | onChange = (date, type) => { |
| | |
| | | this.setState({ |
| | | active: type, |
| | | dateRange: values |
| | | }, () => { |
| | | this.props.onGroupChange() |
| | | }) |
| | | } |
| | | |
| | | clearTime = () => { |
| | | this.setState({ |
| | | active: '', |
| | | dateRange: '' |
| | | }, () => { |
| | | this.props.onGroupChange() |
| | | }) |
| | | } |
| | | |
| | | reset = () => { |
| | | const { initDateRange, initType } = this.state |
| | | |
| | | this.setState({ |
| | | active: initType, |
| | | dateRange: initDateRange |
| | | }) |
| | | } |
| | | |
| | | getSearchItems = () => { |
| | | const { card } = this.props |
| | | const { dateRange, active } = this.state |
| | | let items = [] |
| | | |
| | | items.push({ |
| | | type: 'daterange', |
| | | key: card.datefield, |
| | | value: dateRange, |
| | | label: card.label, |
| | | match: 'between', |
| | | required: card.required === 'true' |
| | | }) |
| | | |
| | | if (card.transfer === 'true') { |
| | | items.push({ |
| | | type: card.type, |
| | | key: card.field, |
| | | value: active, |
| | | label: card.label, |
| | | match: '=', |
| | | required: card.required === 'true' |
| | | }) |
| | | } |
| | | |
| | | return items |
| | | } |
| | | |
| | | render() { |
| | |
| | | </span>) |
| | | } |
| | | })} |
| | | <div className="table-search-date-group-value">{dateRange ? dateRange.join(' ~ ') : ''}</div> |
| | | |
| | | {dateRange ? <div className="table-search-date-group-value"> |
| | | {dateRange.join(' ~ ')} |
| | | <Icon type="close-circle" onClick={this.clearTime} className="ant-calendar-picker-clear" /> |
| | | </div> : null} |
| | | {!dateRange && card.required === 'true' ? <div className="ant-form-explain">请选择{card.label}!</div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | margin-right: 2px; |
| | | padding: 2px 7px; |
| | | } |
| | | .ant-tag-checkable:active { |
| | | background-color: #ffffff; |
| | | } |
| | | .ant-tag-checkable-checked { |
| | | border-color: #1890ff; |
| | | } |
| | |
| | | line-height: 20px; |
| | | font-size: 12px; |
| | | bottom: -15px; |
| | | color: rgba(0, 0, 0, 0.45); |
| | | padding-right: 25px; |
| | | |
| | | .ant-calendar-picker-clear { |
| | | cursor: pointer; |
| | | right: 5px; |
| | | pointer-events: unset; |
| | | } |
| | | } |
| | | // .group-week-picker { |
| | | // .ant-calendar { |
| | | // margin-top: -15px; |
| | | // } |
| | | // } |
| | | .table-search-date-group-value:hover { |
| | | .ant-calendar-picker-clear { |
| | | opacity: 0.8; |
| | | } |
| | | } |
| | | .ant-form-explain { |
| | | color: #f5222d; |
| | | position: absolute; |
| | | bottom: -18px; |
| | | } |
| | | } |
| | | |
| | | @media screen and (min-width: 1600px) { |
| | | .table-search-date-group { |
| | | .ant-tag-checkable { |
| | |
| | | label: null, // 提示文字 |
| | | required: null, // 是否必填 |
| | | searchlist: null, // 搜索项 |
| | | groups: null, // 组合搜索项 |
| | | formId: Utils.getuuid() // 搜索表单Id |
| | | } |
| | | |
| | |
| | | _list.push(item) |
| | | }) |
| | | |
| | | let _groups = [] |
| | | _list = _list.map(item => { |
| | | if (item.type === 'link') { |
| | | let supItem = _list.filter(form => form.field === item.linkField)[0] |
| | |
| | | } else { |
| | | item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) |
| | | } |
| | | } else if (item.type === 'group') { |
| | | _groups.push(JSON.parse(JSON.stringify(item))) |
| | | } |
| | | |
| | | return item |
| | |
| | | label: label, |
| | | style: style, |
| | | required: required, |
| | | searchlist: _list |
| | | searchlist: _list, |
| | | groups: _groups |
| | | }) |
| | | } |
| | | |
| | |
| | | <Select |
| | | showSearch |
| | | mode="multiple" |
| | | onChange={this.searchChange} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | getPopupContainer={() => document.getElementById(this.state.formId)} |
| | | > |
| | |
| | | } else if (item.type === 'group') { |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label} className={item.required ? 'group-required' : ''}> |
| | | <DateGroup card={item} /> |
| | | <Form.Item label={item.label} className={item.required === 'true' ? 'group-required' : ''}> |
| | | <DateGroup ref={item.uuid} card={item} onGroupChange={this.searchChange} /> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件重置 |
| | | */ |
| | | handleReset = () => { |
| | | // 重置 |
| | | const { groups } = this.state |
| | | |
| | | if (groups.length > 0) { |
| | | groups.forEach(item => { |
| | | this.refs[item.uuid].reset() |
| | | }) |
| | | } |
| | | this.props.form.resetFields() |
| | | this.props.form.validateFields((err, values) => { |
| | | // 异步获取更新后的时间组 |
| | | this.setState({}, () => { |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getFieldsValues = (values) => { |
| | | const { groups } = this.state |
| | | // 获取搜索条件值 |
| | | let search = [] |
| | | Object.keys(values).forEach(key => { |
| | |
| | | required: this.state.required[key] |
| | | }) |
| | | }) |
| | | |
| | | if (groups.length > 0) { |
| | | groups.forEach(item => { |
| | | let items = this.refs[item.uuid].getSearchItems() |
| | | search.push(...items) |
| | | }) |
| | | } |
| | | |
| | | return search |
| | | } |
| | | |
| | |
| | | return form |
| | | }) |
| | | }) |
| | | if (this.props.form.getFieldValue('initval') !== undefined) { |
| | | |
| | | let _initval = this.props.form.getFieldValue('initval') |
| | | if (_initval && !values.includes(_initval[0])) { |
| | | this.props.form.setFieldsValue({initval: ''}) |
| | | } |
| | | } |
| | |
| | | class CustomForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | tableName: PropTypes.string, // 表名 |
| | | setting: PropTypes.object, // 设置 |
| | | searches: PropTypes.array, // 搜索条件 |
| | | systemScripts: PropTypes.array, // 系统脚本 |
| | | customScripts: PropTypes.array, // 自定义脚本 |
| | | scriptsChange: PropTypes.func // 表单 |
| | |
| | | |
| | | state = { |
| | | editItem: null, |
| | | loading: false |
| | | loading: false, |
| | | usefulFields: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { searches } = this.props |
| | | let _usefulFields = searches.map(item => { |
| | | if (item.type === 'group') { |
| | | if (item.transfer === 'true') { |
| | | return item.field + ', ' + item.datefield |
| | | } else { |
| | | return item.datefield |
| | | } |
| | | } else { |
| | | return item.field |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | usefulFields: _usefulFields.join(', ') |
| | | }) |
| | | } |
| | | |
| | | edit = (record) => { |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { searches, setting } = this.props |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | |
| | | LText: _initsql + values.sql + tail |
| | | } |
| | | |
| | | let allSearch = Utils.initMainSearch(searches) |
| | | allSearch = Utils.getAllSearchOptions(allSearch) |
| | | |
| | | let regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | |
| | | regoptions.push({ |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: setting.order |
| | | }) |
| | | if (setting.laypage !== 'false') { |
| | | regoptions.push({ |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 10 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }) |
| | | } |
| | | |
| | | regoptions.forEach(item => { |
| | | param.LText = param.LText.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { systemScripts, tableName } = this.props |
| | | const { systemScripts, setting } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { usefulFields } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | return ( |
| | | <Form {...formItemLayout} className="modal-menu-setting-script"> |
| | | <Row gutter={24}> |
| | | {tableName ? <Col span={8}> |
| | | {setting.tableName ? <Col span={8}> |
| | | <Form.Item label={'表名'} style={{whiteSpace: 'nowrap', margin: 0}}> |
| | | {tableName} |
| | | {setting.tableName} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={16}> |
| | |
| | | </Col> |
| | | <Col span={24} className="sqlfield"> |
| | | <Form.Item label={'可用字段'}> |
| | | id, bid, loginuid, sessionuid, userid, appkey |
| | | id, bid, loginuid, sessionuid, userid, appkey{usefulFields ? ', ' + usefulFields : ''} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8} style={{whiteSpace: 'nowrap'}}> |
| | |
| | | value: search.initval, |
| | | required: search.required === 'true' |
| | | } |
| | | if (item.type === 'date') { |
| | | if (item.type === 'group') { |
| | | let copy = fromJS(item).toJS() |
| | | copy.key = search.datefield |
| | | |
| | | item.value = search.initval && search.initval[0] ? search.initval[0] : '@$@' |
| | | item.match = '=' |
| | | |
| | | copy.type = 'daterange' |
| | | copy.match = 'between' |
| | | copy.value = [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')] |
| | | |
| | | if (search.transfer === 'true') { |
| | | newsearches.push(item) |
| | | } |
| | | newsearches.push(copy) |
| | | return |
| | | } else if (item.type === 'date') { |
| | | item.value = moment().format('YYYY-MM-DD') |
| | | } else if (item.type === 'datemonth') { |
| | | item.value = moment().format('YYYY-MM') |
| | |
| | | _search = '' |
| | | } |
| | | |
| | | let LText = `select ${setting.laypage !== 'false' ? 'top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable ${setting.laypage !== 'false' ? 'where rows > 0' : ''} order by tmptable.rows` |
| | | let LText = `select ${setting.laypage !== 'false' ? 'top @pageSize@' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${_dataresource} ${_search}) tmptable ${setting.laypage !== 'false' ? 'where rows > (@pageSize@ * (@pageIndex@ - 1))' : ''} order by tmptable.rows` |
| | | let _scripts = fromJS(this.state.systemScripts).toJS() |
| | | _scripts[0].value = LText |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { formlist, view, setting, scriptsColumns, systemScripts } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | {view ==='custom' ? <div> |
| | | <CustomScript |
| | | dict={this.props.dict} |
| | | tableName={setting.tableName} |
| | | setting={setting} |
| | | customScripts={setting.scripts} |
| | | searches={config.search} |
| | | systemScripts={systemScripts} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |
| | |
| | | key: 'transfer', |
| | | label: '传递', |
| | | initVal: card.transfer || 'false', |
| | | tooltip: '数据查询时,类型字段是否作为参数传递。', |
| | | tooltip: '数据查询时,类型字段是否作为参数传递,类型字段对应值为 {"日": "day", "周": "week", "月": "month", "季": "quarter", "年": "year", "自定义": "customized"}。', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['header.form.true'] |
| | |
| | | } |
| | | |
| | | if (newsearches[item.key]) { |
| | | newsearches[item.key + '1'] = _val ? _val + timetail : null |
| | | newsearches[item.key + '1'] = _val ? _val + timetail : '' |
| | | } else { |
| | | newsearches[item.key] = _val ? _val + timetail : null |
| | | newsearches[item.key] = _val ? _val + timetail : '' |
| | | } |
| | | } else if (item.type === 'datemonth') { |
| | | // 月-过滤条件,从月开始至结束 |
| | | let _startval = null |
| | | let _endval = null |
| | | let _startval = '' |
| | | let _endval = '' |
| | | |
| | | if (item.value) { |
| | | _startval = moment(item.value, 'YYYY-MM').startOf('month').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | |
| | | _endval = moment(item.value[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') |
| | | } |
| | | |
| | | newsearches[item.key] = item.value ? item.value[0] + ' 00:00:00.000' : null |
| | | newsearches[item.key + '1'] = item.value ? _endval + ' 00:00:00.000' : null |
| | | newsearches[item.key] = item.value ? item.value[0] + ' 00:00:00.000' : '' |
| | | newsearches[item.key + '1'] = item.value ? _endval + ' 00:00:00.000' : '' |
| | | } else if (item.type === 'daterange') { |
| | | let _endval = '' |
| | | if (item.value) { |
| | | _endval = moment(item.value[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') |
| | | } |
| | | |
| | | newsearches[item.key] = item.value ? item.value[0] + ' 00:00:00.000' : null |
| | | newsearches[item.key + '1'] = item.value ? _endval + ' 00:00:00.000' : null |
| | | newsearches[item.key] = item.value ? item.value[0] + ' 00:00:00.000' : '' |
| | | newsearches[item.key + '1'] = item.value ? _endval + ' 00:00:00.000' : '' |
| | | } else if (item.type === 'text') { |
| | | item.key.split(',').forEach(field => { // 综合搜索,所字段拼接 |
| | | newsearches[field] = item.value |