| | |
| | | this.props.modifyTabview([menu]) |
| | | e.preventDefault() |
| | | } else { |
| | | let tabs = JSON.parse(JSON.stringify(this.props.tabviews)) |
| | | let tabs = fromJS(this.props.tabviews).toJS() |
| | | tabs = tabs.filter(tab => { |
| | | tab.selected = false |
| | | return tab.MenuID !== menu.MenuID |
| | | }) |
| | | menu.selected = true |
| | | tabs.push(menu) |
| | | this.props.modifyTabview(tabs) |
| | | |
| | | if (this.props.tabviews.length !== tabs.length) { |
| | | this.props.modifyTabview(fromJS(tabs).toJS()) |
| | | } |
| | | |
| | | this.setState({}, () => { |
| | | menu.selected = true |
| | | tabs.push(menu) |
| | | this.props.modifyTabview(tabs) |
| | | }) |
| | | |
| | | e.preventDefault() |
| | | } |
| | | } |
| | |
| | | handleTabview = (e, menu) => { |
| | | e.stopPropagation() |
| | | // 关闭tab页,重新选择显示页 |
| | | let tabs = JSON.parse(JSON.stringify(this.state.tabviews)) |
| | | let tabs = fromJS(this.state.tabviews).toJS() |
| | | tabs = tabs.filter(tab => { |
| | | return tab.MenuID !== menu.MenuID |
| | | }) |
| | |
| | | changeTab = (e, menu) => { |
| | | e.stopPropagation() |
| | | // 窗口切换 |
| | | let tabs = JSON.parse(JSON.stringify(this.state.tabviews)) |
| | | let tabs = fromJS(this.state.tabviews).toJS() |
| | | tabs = tabs.map(tab => { |
| | | tab.selected = false |
| | | |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="tab-handle-form-box"> |
| | | <Form {...formItemLayout} className="tab-manage-form-field" id="tab-handle-form-box"> |
| | | <Row gutter={24}> |
| | | <Col span={24}> |
| | | <Form.Item label="标签名称"> |
| | |
| | | .ant-advanced-search-form.main-form-field { |
| | | .tab-manage-form-field { |
| | | position: relative; |
| | | padding: 0px 24px 20px; |
| | | .ant-form-item { |
| | |
| | | _LongParam.groups.forEach(group => { |
| | | group.sublist = group.sublist.map(cell => { |
| | | // 数据源sql语句,预处理, 权限黑名单字段设置为隐藏表单 |
| | | if (['select', 'link', 'multiselect'].includes(cell.type) && cell.resourceType === '1') { |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { |
| | | let _option = Utils.getSelectQueryOptions(cell) |
| | | |
| | | if (this.props.dataManager) { // 数据权限 |
| | |
| | | } else { |
| | | _LongParam.fields = _LongParam.fields.map(cell => { |
| | | // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单 |
| | | if (['select', 'link', 'multiselect'].includes(cell.type) && cell.resourceType === '1') { |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { |
| | | let _option = Utils.getSelectQueryOptions(cell) |
| | | |
| | | if (this.props.dataManager) { // 数据权限 |
| | |
| | | _LongParam.groups.forEach(group => { |
| | | group.sublist = group.sublist.map(cell => { |
| | | // 数据源sql语句,预处理 |
| | | if (['select', 'link', 'multiselect'].includes(cell.type) && cell.resourceType === '1') { |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { |
| | | let _option = Utils.getSelectQueryOptions(cell) |
| | | |
| | | if (this.props.dataManager) { // 数据权限 |
| | |
| | | } else { |
| | | _LongParam.fields = _LongParam.fields.map(cell => { |
| | | // 数据源sql语句,预处理 |
| | | if (['select', 'link', 'multiselect'].includes(cell.type) && cell.resourceType === '1') { |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { |
| | | let _option = Utils.getSelectQueryOptions(cell) |
| | | |
| | | if (this.props.dataManager) { // 数据权限 |
| | |
| | | } |
| | | |
| | | let index = 0 |
| | | let isexit = false |
| | | let tabs = tabviews.map((tab, i) => { |
| | | let tabs = tabviews.filter((tab, i) => { |
| | | tab.selected = false |
| | | |
| | | if (tab.MenuID === MenuID) { |
| | | index = i |
| | | } else if (tab.MenuID === btn.uuid) { |
| | | tab.selected = true |
| | | isexit = true |
| | | } |
| | | |
| | | return tab |
| | | return tab.MenuID !== newtab.MenuID |
| | | }) |
| | | |
| | | if (!isexit) { |
| | | tabs.splice(index + 1, 0, newtab) |
| | | if (tabviews.length !== tabs.length) { |
| | | this.props.modifyTabview(fromJS(tabs).toJS()) |
| | | } |
| | | |
| | | this.setState({}, () => { |
| | | tabs.splice(index + 1, 0, newtab) |
| | | this.props.modifyTabview(tabs) |
| | | }) |
| | | |
| | | if (this.props.updateStatus) { |
| | | this.props.updateStatus('trigger') |
| | | } |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | |
| | | render() { |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Col, Row } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | class CheckCard extends Component { |
| | | static propTpyes = { |
| | | card: PropTypes.bool, // 卡片信息 |
| | | onChange: PropTypes.func // 数据切换 |
| | | } |
| | | |
| | | state = { |
| | | selectKeys: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { card } = this.props |
| | | |
| | | if (card.multiple === 'true') { |
| | | this.setState({ |
| | | selectKeys: card.initval ? card.initval.split(',') : [] |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | selectKeys: card.initval |
| | | }) |
| | | } |
| | | } |
| | | |
| | | changeCard = (item) => { |
| | | const { multiple } = this.props.card |
| | | const { selectKeys } = this.state |
| | | |
| | | if (multiple === 'true') { |
| | | let keys = [] |
| | | if (selectKeys.includes(item.$value)) { |
| | | keys = selectKeys.filter(key => key !== item.$value) |
| | | } else { |
| | | keys = [...selectKeys, item.$value] |
| | | } |
| | | |
| | | this.setState({ |
| | | selectKeys: keys |
| | | }, () => { |
| | | this.props.onChange && this.props.onChange(keys.join(',')) |
| | | }) |
| | | } else if (multiple !== 'true' && selectKeys !== item.$value) { |
| | | this.setState({ |
| | | selectKeys: item.$value |
| | | }, () => { |
| | | this.props.onChange && this.props.onChange(item.$value) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | getCards = () => { |
| | | const { display, width, options, fields, ratio, multiple } = this.props.card |
| | | const { selectKeys } = this.state |
| | | |
| | | let paddingTop = '100%' |
| | | if (ratio === '4:3') { |
| | | paddingTop = '75%' |
| | | } else if (ratio === '3:2') { |
| | | paddingTop = '66.7%' |
| | | } else if (ratio === '16:9') { |
| | | paddingTop = '56.25%' |
| | | } |
| | | |
| | | if (display !== 'picture') { |
| | | return options.map(item => { |
| | | let _active = false |
| | | if (multiple === 'true' && selectKeys.includes(item.$value)) { |
| | | _active = true |
| | | } else if (multiple !== 'true' && selectKeys === item.$value) { |
| | | _active = true |
| | | } |
| | | |
| | | return <Col span={width} key={item.key}> |
| | | <div className={'card-cell ' + (_active ? 'active' : '')} onClick={() => this.changeCard(item)}> |
| | | {fields.map(col => { |
| | | return <span key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span> |
| | | })} |
| | | </div> |
| | | </Col> |
| | | }) |
| | | } else { |
| | | return options.map(item => { |
| | | let _active = false |
| | | if (multiple === 'true' && selectKeys.includes(item.$value)) { |
| | | _active = true |
| | | } else if (multiple !== 'true' && selectKeys === item.$value) { |
| | | _active = true |
| | | } |
| | | |
| | | return <Col span={width} key={item.key}> |
| | | <div className={'card-pic-cell ' + (_active ? 'active' : '')} onClick={() => this.changeCard(item)} style={{paddingTop, backgroundImage: `url(${item.$url})`}}> |
| | | </div> |
| | | </Col> |
| | | }) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | return ( |
| | | <div className="check-card-form-box"> |
| | | <Row gutter={12}>{this.getCards()}</Row> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default CheckCard |
New file |
| | |
| | | .check-card-form-box { |
| | | margin-top: 10px; |
| | | margin-bottom: -10px; |
| | | .card-cell { |
| | | border: 1px solid #bcbcbc; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | margin-bottom: 12px; |
| | | line-height: 1.5; |
| | | transition: all 0.3s; |
| | | cursor: pointer; |
| | | span { |
| | | display: block; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | } |
| | | .card-cell:hover, .card-cell.active { |
| | | border-color: #1890ff; |
| | | background: #1890ff; |
| | | span { |
| | | color: #ffffff!important; |
| | | } |
| | | } |
| | | .card-pic-cell { |
| | | border: 1px solid #bcbcbc; |
| | | border-radius: 4px; |
| | | background-size: cover; |
| | | background-position: center; |
| | | margin-bottom: 12px; |
| | | line-height: 1.5; |
| | | cursor: pointer; |
| | | } |
| | | .card-pic-cell:hover, .card-pic-cell.active { |
| | | border-color: #1890ff; |
| | | box-shadow: 0px 0px 4px #1890ff; |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Switch } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | class CheckCard extends Component { |
| | | static propTpyes = { |
| | | Item: PropTypes.bool, // 表单 |
| | | onChange: PropTypes.func // 数据切换 |
| | | } |
| | | |
| | | state = { |
| | | defaultChecked: this.props.Item.initval === true |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { Item, onChange } = this.props |
| | | if (Item.initval === true) { |
| | | onChange && onChange(Item.openVal) |
| | | } else { |
| | | onChange && onChange(Item.closeVal) |
| | | } |
| | | } |
| | | |
| | | onChange = (val) => { |
| | | const { Item, onChange } = this.props |
| | | if (val) { |
| | | onChange && onChange(Item.openVal) |
| | | } else { |
| | | onChange && onChange(Item.closeVal) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { defaultChecked } = this.state |
| | | |
| | | return ( |
| | | <Switch defaultChecked={defaultChecked} onChange={this.onChange}/> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default CheckCard |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd' |
| | | import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification, Checkbox, Radio, Tooltip, Icon } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | import { formRule, calendarColors } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import FileUpload from '../fileupload' |
| | | import CustomSwitch from './customSwitch' |
| | | import CheckCard from './checkCard' |
| | | import './index.scss' |
| | | |
| | | const {MonthPicker} = DatePicker |
| | |
| | | writein[item.field] = item.writein !== 'false' |
| | | fieldlen[item.field] = _fieldlen |
| | | |
| | | if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { |
| | | if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect' || item.type === 'radio' || item.type === 'checkbox') { |
| | | if (item.setAll === 'true') { |
| | | item.options.unshift({ |
| | | key: Utils.getuuid(), |
| | |
| | | newval = window.decodeURIComponent(window.atob(newval)) |
| | | } catch (e) { |
| | | console.warn(e) |
| | | } |
| | | } else if (item.type === 'switch' && newval !== '') { // 开关只接收固定值 |
| | | if (newval !== item.closeVal && newval !== item.openVal) { |
| | | newval = '' |
| | | } else if (newval === item.openVal) { |
| | | newval = true |
| | | } else { |
| | | newval = false |
| | | } |
| | | } |
| | | |
| | |
| | | const { formlist } = this.state |
| | | |
| | | // 需要动态获取下拉菜单的表单 |
| | | let deForms = formlist.filter(item => ['select', 'link', 'multiselect'].includes(item.type) && item.resourceType === '1' && (item.type === 'link' || item.hidden !== 'true')) |
| | | let deForms = formlist.filter(item => ['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type) && item.resourceType === '1' && (item.type === 'link' || item.hidden !== 'true')) |
| | | |
| | | if (deForms.length === 0) { |
| | | return |
| | |
| | | delete result.status |
| | | |
| | | let _formlist = formlist.map(item => { |
| | | if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = result[item.field].map(cell => { |
| | | let _cell = { |
| | | key: Utils.getuuid(), |
| | | Value: cell[item.valueField], |
| | | Text: cell[item.valueText] |
| | | let _cell = { key: Utils.getuuid() } |
| | | |
| | | if (item.type !== 'checkcard') { |
| | | _cell.Value = cell[item.valueField] |
| | | _cell.Text = cell[item.valueText] |
| | | } else { |
| | | _cell.$value = cell[item.valueField] |
| | | _cell = {..._cell, ...cell} |
| | | } |
| | | |
| | | if (item.type === 'link') { |
| | | _cell.ParentID = cell[item.linkField] |
| | | } else if (item.type === 'select' && item.linkSubField && item.linkSubField.length > 0) { |
| | | } else if ((item.type === 'select' || item.type === 'radio') && item.linkSubField && item.linkSubField.length > 0) { |
| | | item.linkSubField.forEach(_field => { |
| | | _cell[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' |
| | | }) |
| | |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | | } else if (['select', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type)) { |
| | | item.options = item.oriOptions |
| | | } |
| | | return item |
| | |
| | | delete result.status |
| | | |
| | | let _formlist = formlist.map(item => { |
| | | if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = result[item.field].map(cell => { |
| | | let _cell = { |
| | | key: Utils.getuuid(), |
| | | Value: cell[item.valueField], |
| | | Text: cell[item.valueText] |
| | | let _cell = { key: Utils.getuuid() } |
| | | |
| | | if (item.type !== 'checkcard') { |
| | | _cell.Value = cell[item.valueField] |
| | | _cell.Text = cell[item.valueText] |
| | | } else { |
| | | _cell.$value = cell[item.valueField] |
| | | _cell = {..._cell, ...cell} |
| | | } |
| | | |
| | | if (item.type === 'link') { |
| | | _cell.ParentID = cell[item.linkField] |
| | | } else if (item.type === 'select' && item.linkSubField && item.linkSubField.length > 0) { |
| | | } else if ((item.type === 'select' || item.type === 'radio') && item.linkSubField && item.linkSubField.length > 0) { |
| | | item.linkSubField.forEach(_field => { |
| | | _cell[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' |
| | | }) |
| | |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | | } else if (['select', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type)) { |
| | | item.options = item.oriOptions |
| | | } |
| | | return item |
| | |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value, option) => { |
| | | selectChange = (_field, value) => { |
| | | const { record } = this.state |
| | | let formlist = fromJS(this.state.formlist).toJS() |
| | | |
| | |
| | | }) |
| | | |
| | | // 表单切换时,更新关联字段 |
| | | if (_field.type === 'select' && _field.linkSubField && _field.linkSubField.length > 0 && option.props.data) { |
| | | let _data = option.props.data |
| | | _field.linkSubField.forEach(subfield => { |
| | | if (this.props.form.getFieldValue(subfield) !== undefined) { |
| | | fieldsvalue[subfield] = (_data[subfield] || _data[subfield] === 0) ? _data[subfield] : '' |
| | | } else { |
| | | _record[subfield] = (_data[subfield] || _data[subfield] === 0) ? _data[subfield] : '' |
| | | } |
| | | }) |
| | | if ((_field.type === 'select' || _field.type === 'radio') && _field.linkSubField && _field.linkSubField.length > 0) { |
| | | let _data = _field.options.filter(op => op.Value === value)[0] |
| | | |
| | | if (_data) { |
| | | _field.linkSubField.forEach(subfield => { |
| | | if (this.props.form.getFieldValue(subfield) !== undefined) { |
| | | fieldsvalue[subfield] = (_data[subfield] || _data[subfield] === 0) ? _data[subfield] : '' |
| | | } else { |
| | | _record[subfield] = (_data[subfield] || _data[subfield] === 0) ? _data[subfield] : '' |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (subfields.length === 0) { |
| | |
| | | callback() |
| | | } |
| | | |
| | | getFields(formlist) { |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { cols } = this.state |
| | | const { cols, formlist } = this.state |
| | | |
| | | const fields = [] |
| | | let filtration = {} |
| | | |
| | | formlist.forEach((item, index) => { |
| | | if ((!item.field && item.type !== 'title' && item.type !== 'hint') || item.hidden === 'true' || item.type === 'funcvar') return |
| | | if (item.supField) { // 多层表单控制 |
| | | let _supVal = this.props.form.getFieldValue(item.supField) |
| | | |
| | | if (_supVal === undefined && filtration[item.supField]) { |
| | | _supVal = filtration[item.supField] |
| | | } |
| | | |
| | | if (item.supvalue.includes(_supVal)) { |
| | | let _subVal = this.props.form.getFieldValue(item.field) |
| | | filtration[item.field] = _subVal === undefined ? item.initval : _subVal |
| | | } else { |
| | | return |
| | | } |
| | | } |
| | | |
| | | let _colspan = 24 / cols |
| | | if (item.entireLine === 'true') { |
| | | _colspan = 24 |
| | | } |
| | | |
| | | if (item.type === 'title') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <p>{item.label}</p> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'hint') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item colon={!!item.label} label={item.label || ' '} className="hint"> |
| | | <div className="message">{item.message}</div> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'text') { |
| | |
| | | } |
| | | } |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | let precision = (item.decimal || item.decimal === 0) ? item.decimal : null |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: _initval, |
| | | rules: [ |
| | |
| | | ) |
| | | } else if (item.type === 'color') { // 颜色选择 |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Select onChange={(value, option) => {this.selectChange(item, value, option)}} disabled={item.readonly === 'true'}> |
| | | <Select disabled={item.readonly === 'true'}> |
| | | {calendarColors.map(option => |
| | | <Select.Option key={option.name} style={{background: option.value, color: '#ffffff'}} value={option.name}>{option.name}</Select.Option> |
| | | )} |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select' || item.type === 'link') { // 下拉搜索 |
| | | let hasSubField = false |
| | | if (item.linkSubField && item.linkSubField.length > 0) { // 存在关联字段,数据存储 |
| | | hasSubField = true |
| | | } |
| | | } else if (item.type === 'checkcard') { // 多选框 |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | } className="checkcard"> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<CheckCard card={item} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'switch') { // 多选框 |
| | | fields.push( |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<CustomSwitch Item={item} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'checkbox') { // 多选框 |
| | | let _initval = item.initval ? item.initval.split(',').filter(Boolean) : [] |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: _initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Checkbox.Group disabled={item.readonly === 'true'}> |
| | | {item.options.map(option => <Checkbox key={option.key} title={option.Text} value={option.Value}>{option.Text}</Checkbox>)} |
| | | </Checkbox.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'radio') { // 单选框 |
| | | fields.push( |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Radio.Group disabled={item.readonly === 'true'} onChange={(e) => {this.selectChange(item, e.target.value)}}> |
| | | {item.options.map(option => <Radio key={option.key} value={option.Value}>{option.Text}</Radio>)} |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select' || item.type === 'link') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value, option) => {this.selectChange(item, value, option)}} |
| | | onChange={(value) => {this.selectChange(item, value)}} |
| | | disabled={item.readonly === 'true'} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.key} data={hasSubField ? option : ''} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option> |
| | | <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | |
| | | } else if (item.type === 'multiselect') { // 多选 |
| | | let _initval = item.initval ? item.initval.split(',').filter(Boolean) : [] |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: _initval, |
| | | rules: [ |
| | |
| | | ) |
| | | } else if (item.type === 'date') { // 时间搜索 |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | ) |
| | | } else if (item.type === 'datemonth') { |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | ) |
| | | } else if (item.type === 'datetime') { |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: filelist, |
| | | rules: [ |
| | |
| | | ) |
| | | } else if (item.type === 'linkMain') { |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Col span={_colspan} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | // 函数变量字段,默认不显示 |
| | | } else if (item.type === 'textarea') { |
| | | let _max = item.fieldlength || 512 |
| | | let _labelcol = cols !== 3 ? 8 / cols : 3 |
| | | let _wrapcol = cols !== 3 ? 16 + (cols - 1) * 4 : 21 |
| | | let _style = {} |
| | | if (cols === 2 || cols === 4) { |
| | | _style.paddingLeft = '7px' |
| | | } |
| | | fields.push( |
| | | <Col span={24} key={index} className="textarea-row" style={{..._style}}> |
| | | <Form.Item label={item.label} labelCol={{xs: { span: 24 }, sm: { span: _labelcol }}} wrapperCol={ {xs: { span: 24 }, sm: { span: _wrapcol }} }> |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | } else if (this.state.datatype[key] === 'number') { |
| | | _value = values[key] |
| | | |
| | | } else if (this.state.datatype[key] === 'multiselect') { |
| | | } else if (this.state.datatype[key] === 'multiselect' || this.state.datatype[key] === 'checkbox') { |
| | | _value = values[key] ? values[key].join(',') : '' |
| | | |
| | | } else if (this.state.datatype[key] === 'fileupload') { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { formlist, cols } = this.state |
| | | const { cols } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | } |
| | | } |
| | | |
| | | let _formlist = [] |
| | | let rowIndex = 0 |
| | | let colIndex = 0 |
| | | let filtration = {} |
| | | |
| | | // 表单分行,避免排列不整齐 |
| | | formlist.forEach(item => { |
| | | if ((!item.field && item.type !== 'title') || item.hidden === 'true' || item.type === 'funcvar') return |
| | | if (item.supField) { // 多层表单控制 |
| | | let _supVal = this.props.form.getFieldValue(item.supField) |
| | | |
| | | if (_supVal === undefined && filtration[item.supField]) { |
| | | _supVal = filtration[item.supField] |
| | | } |
| | | |
| | | if (item.supvalue.includes(_supVal)) { |
| | | let _subVal = this.props.form.getFieldValue(item.field) |
| | | filtration[item.field] = _subVal === undefined ? item.initval : _subVal |
| | | } else { |
| | | return |
| | | } |
| | | } |
| | | |
| | | _formlist[rowIndex] = _formlist[rowIndex] || [] |
| | | if (item.type === 'textarea' || item.type === 'title') { |
| | | if (colIndex === 0) { |
| | | _formlist[rowIndex].push(item) |
| | | } else { |
| | | rowIndex++ |
| | | _formlist[rowIndex] = [item] |
| | | } |
| | | rowIndex++ |
| | | colIndex = 0 |
| | | } else { |
| | | _formlist[rowIndex].push(item) |
| | | colIndex++ |
| | | } |
| | | if (colIndex >= cols) { |
| | | rowIndex++ |
| | | colIndex = 0 |
| | | } |
| | | }) |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="main-form-box"> |
| | | {_formlist.map((formrow, index) => <Row key={index} gutter={24}>{this.getFields(formrow)}</Row>)} |
| | | <Row className={'cols' + cols} gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |
| | | } |
| | |
| | | .ant-advanced-search-form.main-form-field { |
| | | position: relative; |
| | | padding: 0px 24px 20px; |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | vertical-align: top; |
| | | } |
| | | .ant-form-item-label .anticon-question-circle { |
| | | color: #c49f47; |
| | | margin-right: 3px; |
| | | } |
| | | .ant-checkbox-group { |
| | | line-height: unset; |
| | | .ant-checkbox-wrapper { |
| | | margin-right: 8px; |
| | | } |
| | | .ant-checkbox-wrapper + .ant-checkbox-wrapper { |
| | | margin-left: 0; |
| | | } |
| | | } |
| | | .ant-form-item { |
| | | display: flex; |
| | | } |
| | | .ant-form-item.checkcard { |
| | | margin-bottom: 10px; |
| | | .ant-form-item-control { |
| | | line-height: 1.5; |
| | | } |
| | | } |
| | | .ant-form-item.hint { |
| | | margin-bottom: 0px; |
| | | .message { |
| | | margin-top: 9px; |
| | | line-height: 1.5; |
| | | color: rgba(0, 0, 0, 0.85); |
| | | } |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | flex: 1; |
| | |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | .textarea-row { |
| | | .ant-col-sm-3 { |
| | | width: 10.5%; |
| | | >.ant-row.cols2 .ant-col-24 { |
| | | .ant-form-item { |
| | | .ant-form-item-label { |
| | | width: 16%; |
| | | } |
| | | } |
| | | .ant-col-sm-21 { |
| | | width: 89.5%; |
| | | } |
| | | >.ant-row.cols3 .ant-col-24 { |
| | | .ant-form-item { |
| | | .ant-form-item-label { |
| | | width: 10.5%; |
| | | } |
| | | } |
| | | } |
| | | >.ant-row.cols4 .ant-col-24 { |
| | | .ant-form-item { |
| | | .ant-form-item-label { |
| | | width: 7.5%; |
| | | } |
| | | } |
| | | } |
| | | .ant-input-number { |
| | |
| | | this.setState({ |
| | | modaltype: 'search', |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, false, roleList) |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, false, roleList).map(item => { |
| | | if (item.key === 'type') { |
| | | item.options = item.options.filter(option => !['switch', 'checkbox', 'radio', 'checkcard', 'hint'].includes(option.value)) |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { fromJS } from 'immutable' |
| | | import { Col, Row } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | |
| | | class CheckCard extends Component { |
| | | static propTpyes = { |
| | |
| | | onChange: PropTypes.func, // 数据切换 |
| | | } |
| | | |
| | | state = { |
| | | selectKeys: null, // 选中数据id |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | |
| | | } |
| | | state = {} |
| | | |
| | | getCards = () => { |
| | | const { display, width, options, fields, ratio } = this.props |
| | |
| | | } |
| | | |
| | | render() { |
| | | |
| | | return ( |
| | | <div className="check-card-edit-box" style={{marginTop: '10px'}}> |
| | | <Row gutter={12}>{this.getCards()}</Row> |
| | |
| | | border: 1px solid #bcbcbc; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | margin-bottom: 12px; |
| | | span { |
| | | display: block; |
| | | overflow: hidden; |
| | |
| | | border-radius: 4px; |
| | | background-size: cover; |
| | | background-position: center; |
| | | margin-bottom: 12px; |
| | | } |
| | | } |
| | |
| | | } else if (card.type === 'switch') { |
| | | formItem = (<Switch style={{marginTop: '8px'}} checked={card.initval}/>) |
| | | } else if (card.type === 'radio') { |
| | | formItem = (<Radio.Group style={{marginTop: '8px'}} value={1}> |
| | | formItem = card.options && card.options.length > 0 ? (<Radio.Group value={card.initval}> |
| | | {card.options.map(cell => <Radio key={cell.key} value={cell.Value}>{cell.Text}</Radio>)} |
| | | </Radio.Group>) : (<Radio.Group value={1}> |
| | | <Radio value={1}>A</Radio> |
| | | <Radio value={2}>B</Radio> |
| | | <Radio value={3}>C</Radio> |
| | | <Radio value={4}>D</Radio> |
| | | </Radio.Group>) |
| | | } else if (card.type === 'checkbox') { |
| | | formItem = (<Checkbox.Group style={{marginTop: '8px'}} value={['A', 'C']}> |
| | | let _val = card.initval ? card.initval.split(',') : [] |
| | | formItem = card.options && card.options.length > 0 ? (<Checkbox.Group value={_val}> |
| | | {card.options.map(cell => <Checkbox key={cell.key} value={cell.Value}>{cell.Text}</Checkbox>)} |
| | | </Checkbox.Group>) : (<Checkbox.Group value={['A', 'C']}> |
| | | <Checkbox value="A">A</Checkbox> |
| | | <Checkbox value="B">B</Checkbox> |
| | | <Checkbox value="C">C</Checkbox> |
| | |
| | | padding-left: 12px; |
| | | padding-right: 12px; |
| | | } |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | |
| | | let sublist = group.sublist.filter(item => item.type === 'text' || item.type === 'number') |
| | | _inputfields = [..._inputfields, ...sublist] |
| | | |
| | | let suplist = group.sublist.filter(item => item.type === 'select' || item.type === 'link') |
| | | let suplist = group.sublist.filter(item => item.type === 'select' || item.type === 'link' || item.type === 'radio') |
| | | _formfields = [..._formfields, ...suplist] |
| | | }) |
| | | } else { |
| | | _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number') |
| | | |
| | | _formfields = config.fields.filter(item => item.type === 'select' || item.type === 'link') |
| | | _formfields = config.fields.filter(item => item.type === 'select' || item.type === 'link' || item.type === 'radio') |
| | | } |
| | | |
| | | let uniq = new Map() |
| | |
| | | width: 100%; |
| | | margin-top: 4px; |
| | | } |
| | | .ant-checkbox-group { |
| | | line-height: 40px; |
| | | .ant-checkbox-wrapper { |
| | | margin-right: 8px; |
| | | } |
| | | .ant-checkbox-wrapper + .ant-checkbox-wrapper { |
| | | margin-left: 0px; |
| | | } |
| | | } |
| | | .ant-radio-group { |
| | | line-height: 40px; |
| | | } |
| | | .ant-calendar-picker { |
| | | width: 100%; |
| | | margin-top: 4px; |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Button, notification, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import MutilForm from './mutilform' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | |
| | | |
| | | if (type === 'out') { |
| | | this.FormRef.handleConfirm().then(res => { |
| | | |
| | | this.setState({ |
| | | type: '', |
| | | loading: true, |
| | |
| | | }) |
| | | } else { |
| | | this.FormRef.handleConfirm().then(res => { |
| | | |
| | | this.setState({ |
| | | type: '', |
| | | btn: null, |
| | |
| | | visible: false, |
| | | param: null |
| | | }) |
| | | |
| | | |
| | | if (res.TryType === 'Y' && res.array_name) { |
| | | res.Return = 'N' |
| | | } |
| | | |
| | | this.createBtnInterfaceExec({...param, ...res}, config, btn) |
| | | }) |
| | | } |
| | |
| | | |
| | | delete param.hidden |
| | | |
| | | let _mainParam = JSON.parse(JSON.stringify(param)) |
| | | let _mainParam = fromJS(param).toJS() |
| | | |
| | | new Promise(resolve => { |
| | | // 获取云端存储过程信息 |
| | |
| | | Ltextgridparam: '', |
| | | Ltexttableparam: '', |
| | | Ltext: '', |
| | | menuType: menu.type |
| | | menuType: menu.type, |
| | | systemType: options.sysType |
| | | } |
| | | |
| | | this.setState({ |
| | | type: 'inner', |
| | | param: param, |
| | | visible: true, |
| | | btn: JSON.parse(JSON.stringify(btn)), |
| | | config: JSON.parse(JSON.stringify(config)), |
| | | btn: fromJS(btn).toJS(), |
| | | config: fromJS(config).toJS(), |
| | | formlist: [{ |
| | | type: 'text', |
| | | key: 'KunName', |
| | |
| | | key: 'Return', |
| | | label: '回执', |
| | | initval: 'N', |
| | | tooltip: '当选择需要事务,且填入了数组名称时,将不存在回执信息。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'Y', |
| | |
| | | value: 'N', |
| | | text: '不需要' |
| | | }] |
| | | }, { |
| | | type: 'text', |
| | | key: 'array_name', |
| | | label: '数组名称', |
| | | initval: menu.menuNo + btn.uuid.substr(-4), |
| | | tooltip: '批量操作时,需要填写数组名称。', |
| | | required: false |
| | | }] |
| | | }) |
| | | } |
| | |
| | | fieldlen: _fieldlen, |
| | | key: cell.field, |
| | | required: cell.required === 'true' ? 'required' : '', |
| | | writein: cell.required !== 'false', |
| | | value: cell.initval || '' |
| | | } |
| | | |
| | |
| | | |
| | | delete param.menuType |
| | | |
| | | _mainParam = JSON.parse(JSON.stringify(param)) |
| | | _mainParam = fromJS(param).toJS() |
| | | |
| | | return Api.getLocalConfig(param) |
| | | }).then(res => { |
| | |
| | | let primaryKey = setting.primaryKey || 'id' |
| | | let columns = config.columns.filter(col => !!col.field) |
| | | let verify = btn.verify || {} |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | | let _prevCustomScript = '' // 默认sql前执行脚本 |
| | | let _backCustomScript = '' // 默认sql后执行脚本 |
| | | |
| | | verify.scripts && verify.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | |
| | | if (item.position === 'init') { |
| | | _initCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${item.sql} |
| | | ` |
| | | } else if (item.position === 'front') { |
| | | _prevCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${item.sql} |
| | | ` |
| | | } else { |
| | | _backCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${item.sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode'] |
| | | |
| | | // 系统变量声明与设置初始值 |
| | | let _sql = `Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@ModularDetailCode nvarchar(50) |
| | | ` |
| | | let _sql = '' |
| | | |
| | | let _initvars = [] // 已赋值字段集 |
| | | let _initfields = [] |
| | |
| | | // 变量声明 |
| | | _declarefields = _declarefields.join(',') |
| | | if (_declarefields) { |
| | | _sql += `,${_declarefields} |
| | | ` |
| | | _declarefields = ',' + _declarefields |
| | | } |
| | | _sql = `/* 系统生成 */ |
| | | Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@ModularDetailCode nvarchar(50)${_declarefields} |
| | | |
| | | select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@ |
| | | ` |
| | | |
| | | // 变量赋值 |
| | | if (_initfields.length > 0) { |
| | |
| | | } |
| | | |
| | | // 初始化凭证及用户信息字段 |
| | | _sql += `select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='' |
| | | _sql += `select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='', @BillCode='', @ModularDetailCode='' |
| | | ` |
| | | |
| | | if (_initCustomScript) { |
| | | _sql += _initCustomScript |
| | | } |
| | | |
| | | // 启用账期验证 |
| | | if (verify.accountdate === 'true') { |
| | | _sql += `exec s_FIBVoucherDateCheck @ErrorCode=@ErrorCode OUTPUT,@retmsg=@retmsg OUTPUT |
| | | _sql += ` |
| | | /* 账期验证 */ |
| | | exec s_FIBVoucherDateCheck @ErrorCode=@ErrorCode OUTPUT,@retmsg=@retmsg OUTPUT |
| | | if @ErrorCode!='' |
| | | GOTO aaa |
| | | ` |
| | | } |
| | | |
| | | // 失效验证,添加数据时不用 |
| | | if (btn.sqlType !== 'insert' && verify.invalid === 'true') { |
| | | if (btn.sqlType !== 'insert' && verify.invalid === 'true' && setting.dataresource) { |
| | | let datasource = setting.dataresource |
| | | if (/\s/.test(datasource)) { // 拼接别名 |
| | | if (/\s/.test(datasource) && !/tb$/.test(datasource)) { // 拼接别名 |
| | | datasource = '(' + datasource + ') tb' |
| | | } |
| | | |
| | | _sql += `select @tbid='', @ErrorCode='',@retmsg='' |
| | | // 自定义脚本 |
| | | if (setting.interType === 'system' && setting.scripts && setting.scripts.length > 0) { |
| | | let _customScript = '' |
| | | setting.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | _customScript += ` |
| | | ${item.sql} |
| | | ` |
| | | }) |
| | | _sql += ` |
| | | /* 数据源自定义脚本,请注意变量定义是否重复 */ |
| | | ${_customScript} |
| | | ` |
| | | } |
| | | |
| | | _sql += ` |
| | | /* 失效验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid=${primaryKey} from ${datasource} where ${primaryKey} =@${primaryKey}@ |
| | | If @tbid='' |
| | | Begin |
| | |
| | | // 比较验证 |
| | | if (verify.contrasts && verify.contrasts.length > 0) { |
| | | verify.contrasts.forEach(item => { |
| | | _sql += `If ${item.frontfield} ${item.operator} ${item.backfield} |
| | | _sql += ` |
| | | /* 比较验证 */ |
| | | If ${item.frontfield} ${item.operator} ${item.backfield} |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}' |
| | | goto aaa |
| | | end |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | // 自定义验证 |
| | | if (verify.customverifys && verify.customverifys.length > 0) { |
| | | verify.customverifys.forEach(item => { |
| | | _sql += ` |
| | | /* 自定义验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select top 1 @tbid='X' from (${item.sql}) a |
| | | If @tbid ${item.result === 'true' ? '!=' : '='}'' |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}' |
| | | goto aaa |
| | | end |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | // 单号生成,使用上级id(BID)或列表数据,声明变量(检验) |
| | | if (verify.billcodes && verify.billcodes.length > 0) { |
| | | verify.billcodes.forEach(item => { |
| | | let _ModularDetailCode = '' |
| | | let _lpline = '' |
| | | if (item.TypeCharOne === 'Lp') { |
| | | if (item.linkField === 'BID' && BID) { // 替换bid |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@BID@,48)` |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${item.linkField}@,48)` |
| | | } |
| | | _ModularDetailCode = '@ModularDetailCode' |
| | | } else if (item.TypeCharOne === 'BN') { |
| | | |
| | | _ModularDetailCode = `'${item.TypeCharOne + '@' + item.linkField}@'` |
| | | } else { |
| | | _ModularDetailCode = `'${item.ModularDetailCode}'` |
| | | } |
| | | |
| | | let _declare = '' |
| | | let _key = item.field.toLowerCase() |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declare = `Declare @${_key} nvarchar(50)` |
| | | _vars.push(_key) |
| | | } |
| | | |
| | | _sql += ` |
| | | /* 单号生成 */ |
| | | ${_declare} |
| | | select @BillCode='', @${_key}='', @ModularDetailCode='' |
| | | ${_lpline} |
| | | exec s_get_BillCode |
| | | @ModularDetailCode=${_ModularDetailCode}, |
| | | @Type=${item.Type}, |
| | | @TypeCharOne='${item.TypeCharOne}', |
| | | @TypeCharTwo ='${item.TypeCharTwo}', |
| | | @BillCode =@BillCode output, |
| | | @ErrorCode =@ErrorCode output, |
| | | @retmsg=@retmsg output |
| | | if @ErrorCode!='' |
| | | goto aaa |
| | | set @${_key}=@BillCode |
| | | ` |
| | | }) |
| | | } |
| | |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | // 自定义验证 |
| | | if (verify.customverifys && verify.customverifys.length > 0) { |
| | | verify.customverifys.forEach(item => { |
| | | _sql += `select @tbid='', @ErrorCode='',@retmsg='' |
| | | select top 1 @tbid='X' from (${item.sql}) a |
| | | If @tbid ${item.result === 'true' ? '!=' : '='}'' |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}' |
| | | goto aaa |
| | | end |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | // 单号生成,使用上级id(BID)或列表数据,声明变量(检验) |
| | | if (verify.billcodes && verify.billcodes.length > 0) { |
| | | verify.billcodes.forEach(item => { |
| | | let _ModularDetailCode = '' |
| | | let _lpline = '' |
| | | if (item.TypeCharOne === 'Lp') { |
| | | if (item.linkField === 'BID' && BID) { // 替换bid |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${btn.uuid}'+@BID@,48)` |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${btn.uuid}'+@${item.linkField}@,48)` |
| | | } |
| | | _ModularDetailCode = '@ModularDetailCode' |
| | | } else if (item.TypeCharOne === 'BN') { |
| | | |
| | | _ModularDetailCode = `'${item.TypeCharOne + '@' + item.linkField}@'` |
| | | } else { |
| | | _ModularDetailCode = `'${item.ModularDetailCode}'` |
| | | } |
| | | |
| | | let _declare = '' |
| | | let _key = item.field.toLowerCase() |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declare = `Declare @${_key} nvarchar(50)` |
| | | _vars.push(_key) |
| | | } |
| | | |
| | | _sql += `${_declare} |
| | | select @BillCode='', @${_key}='', @ModularDetailCode='' |
| | | ${_lpline} |
| | | exec s_get_BillCode |
| | | @ModularDetailCode=${_ModularDetailCode}, |
| | | @Type=${item.Type}, |
| | | @TypeCharOne='${item.TypeCharOne}', |
| | | @TypeCharTwo ='${item.TypeCharTwo}', |
| | | @BillCode =@BillCode output, |
| | | @ErrorCode =@ErrorCode output, |
| | | @retmsg=@retmsg output |
| | | if @ErrorCode!='' |
| | | goto aaa |
| | | set @${_key}=@BillCode |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | let hasvoucher = false |
| | | |
| | |
| | | ` |
| | | } |
| | | |
| | | if (_prevCustomScript) { |
| | | _sql += _prevCustomScript |
| | | } |
| | | |
| | | let _actionType = null |
| | | let receiptKeys = [] // 回执字段 |
| | | |
| | |
| | | receiptKeys.push('bid') |
| | | } |
| | | |
| | | // 用于取用户信息 |
| | | let _user = `select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@ |
| | | ` |
| | | |
| | | // 添加、修改、逻辑删除、物理删除 |
| | | if (_actionType === 'insert') { |
| | | let keys = [] |
| | | let values = [] |
| | | |
| | | formlist.forEach(item => { |
| | | if (item.writein === false) return |
| | | |
| | | keys.push(item.key.toLowerCase()) |
| | | values.push('@' + item.key + '@') |
| | | }) |
| | |
| | | |
| | | keys = keys.join(',') |
| | | values = values.join(',') |
| | | _sql += _user |
| | | _sql += `insert into ${btn.sql} (${keys}) select ${values};` |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | insert into ${btn.sql} (${keys}) select ${values};` |
| | | } else if (_actionType === 'update') { |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | | formlist.forEach(item => { |
| | | _arr.push(item.key.toLowerCase()) |
| | | if (item.writein === false) return |
| | | |
| | | _arr.push(item.key.toLowerCase()) |
| | | _form.push(item.key + `=@${item.key}@`) |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | _form = _form.join(',') |
| | | _sql += `update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKey}@;` |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKey}@;` |
| | | } else if (_actionType === 'LogicDelete') { // 逻辑删除 |
| | | _sql += `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${primaryKey}=@${primaryKey}@;` |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${primaryKey}=@${primaryKey}@;` |
| | | |
| | | } else if (_actionType === 'delete') { // 物理删除 |
| | | let _msg = '' |
| | |
| | | } |
| | | }) |
| | | } |
| | | _sql += _user |
| | | _sql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select '删除表:${btn.sql} 数据: ${_msg}${primaryKey}='+@${primaryKey}@,@userid@,@username,@fullname delete ${btn.sql} where ${primaryKey}=@${primaryKey}@;` |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | insert into snote (remark,createuserid,CreateUser,CreateStaff) select '删除表:${btn.sql} 数据: ${_msg}${primaryKey}='+@${primaryKey}@,@userid@,@username,@fullname |
| | | delete ${btn.sql} where ${primaryKey}=@${primaryKey}@;` |
| | | } |
| | | |
| | | // 拼接自定义脚本 |
| | | if (verify.scripts && verify.scripts.length > 0) { |
| | | let _scripts = '' |
| | | verify.scripts.forEach(item => { |
| | | _scripts += ` |
| | | ${item.sql}` |
| | | }) |
| | | _sql += `${_scripts}` |
| | | if (_backCustomScript) { |
| | | _sql += _backCustomScript |
| | | } |
| | | |
| | | let _ltext = '' |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Radio, Select } from 'antd' |
| | | import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon } from 'antd' |
| | | import './index.scss' |
| | | |
| | | class MainSearch extends Component { |
| | |
| | | } |
| | | |
| | | state = { |
| | | |
| | | requireArr: true |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | |
| | | onChange = (value, key) => { |
| | | if (key === 'TryType' && value === 'N') { |
| | | this.setState({requireArr: false}) |
| | | } else if (key === 'TryType' && value === 'Y') { |
| | | this.setState({requireArr: true}) |
| | | } |
| | | } |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | |
| | | const { requireArr } = this.state |
| | | const fields = [] |
| | | |
| | | this.props.formlist.forEach((item, index) => { |
| | | if (!requireArr && item.key === 'array_name') return |
| | | |
| | | if (item.type === 'text') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | } else if (item.type === 'radio') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Radio.Group> |
| | | <Radio.Group onChange={(e) => this.onChange(e.target.value, item.key)}> |
| | | {item.options.map(op => { |
| | | return <Radio key={op.value} value={op.value}>{op.text}</Radio> |
| | | })} |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (this.state.data.length >= 20) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '最多可添加20项!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let item = { key: Utils.getuuid(), $value: `${this.state.data.length + 1}` } |
| | |
| | | .ant-form-item-control { |
| | | line-height: 1; |
| | | } |
| | | > td { |
| | | padding: 16px 10px; |
| | | } |
| | | .fileupload-form-container .ant-upload-list-picture-card .ant-upload-list-item { |
| | | width: 70px; |
| | | height: 70px; |
| | |
| | | |
| | | return ( |
| | | <EditableContext.Provider value={this.props.form}> |
| | | <div className="modal-card-data-table"> |
| | | <div className="modal-card-field-table"> |
| | | {this.state.data.length < 3 ? <Icon className="add-row" type="plus" onClick={this.handleAdd} /> : null} |
| | | <Table |
| | | components={components} |
| | |
| | | .modal-card-data-table { |
| | | .modal-card-field-table { |
| | | .add-row { |
| | | position: absolute; |
| | | z-index: 1; |
| | |
| | | .color-sketch-block { |
| | | width: 200px; |
| | | position: relative; |
| | | top: 2px; |
| | | top: 8px; |
| | | } |
| | | .ant-select { |
| | | width: 80px; |
| | | } |
| | | > td { |
| | | padding: 16px 10px; |
| | | } |
| | | } |
| | | .operation-btn { |
| | | span { |
| | |
| | | multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'entireLine', 'tooltip'], |
| | | link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkField', 'entireLine', 'tooltip'], |
| | | fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'entireLine', 'tooltip'], |
| | | switch: ['initval', 'openVal', 'closeVal', 'readonly', 'required', 'hidden', 'readin', 'entireLine', 'tooltip'], |
| | | switch: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'entireLine', 'tooltip'], |
| | | date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine', 'tooltip'], |
| | | datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine', 'tooltip'], |
| | | datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine', 'tooltip'], |
| | |
| | | } |
| | | |
| | | changeField = (data) => { |
| | | this.setState({cFields: data}) |
| | | this.setState({ |
| | | cFields: data, |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'fields') { |
| | | form.initVal = data |
| | | } |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | handleSubmit = (e) => { |
| | |
| | | .ant-form-item.text-area { |
| | | >.ant-form-item-control-wrapper { |
| | | width: 84%; |
| | | .ant-table-tbody > tr > td { |
| | | padding: 16px 10px; |
| | | } |
| | | } |
| | | >.ant-form-item-label { |
| | | width: 16%; |
| | |
| | | padding: 10px 16px; |
| | | } |
| | | .ant-table-tbody > tr > td { |
| | | padding: 0px 16px; |
| | | padding: 5px 16px; |
| | | } |
| | | .editable-cell-value-wrap { |
| | | cursor: pointer; |
| | |
| | | cursor: pointer; |
| | | } |
| | | .ant-form-explain { |
| | | .editable-row { |
| | | font-size: 12px; |
| | | } |
| | | font-size: 12px; |
| | | } |
| | | } |
| | |
| | | |
| | | if (item.type === 'link') { |
| | | arrfield.push(item.linkField) |
| | | } else if (item.type === 'select' && item.linkSubField && item.linkSubField.length > 0) { |
| | | } else if ((item.type === 'select' || item.type === 'radio') && item.linkSubField && item.linkSubField.length > 0) { |
| | | arrfield.push(...item.linkSubField) |
| | | } else if (item.type === 'checkcard') { |
| | | arrfield = item.fields.map(f => f.field) |
| | | arrfield.push(item.valueField) |
| | | } |
| | | |
| | | arrfield = Array.from(new Set(arrfield)) |
| | |
| | | arrfield = arrfield.join(',') |
| | | |
| | | if (item.orderBy) { |
| | | sql = `select ${arrfield} from (select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} ) a order by orderfield ${item.orderType}` |
| | | sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} ) a order by orderfield ${item.orderType}` |
| | | } else { |
| | | sql = 'select distinct ' + arrfield + ' from ' + _datasource |
| | | sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield} from ${_datasource})` |
| | | } |
| | | |
| | | return { |
| | |
| | | }) |
| | | |
| | | // 需要声明的变量集 |
| | | // let _vars = ['tbid', 'ErrorCode', 'retmsg', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'UserName', 'FullName', 'ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode'] |
| | | |
| | | // 主键字段 |
| | | let primaryKey = setting.primaryKey || 'id' |
| | | |
| | | // 系统变量声明与设置初始值 |
| | | let _sql = `/* 系统生成 */ |
| | | Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@ModularDetailCode nvarchar(50) |
| | | ` |
| | | // sql语句 |
| | | let _sql = '' |
| | | |
| | | // let _initvars = ['ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] // 已赋值字段集 |
| | | let _initvars = [] // 已赋值字段集 |
| | | let _initfields = [] |
| | | let _declarefields = [] |
| | |
| | | // 变量声明 |
| | | _declarefields = _declarefields.join(',') |
| | | if (_declarefields) { |
| | | _sql = `/* 系统生成 */ |
| | | Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@ModularDetailCode nvarchar(50),${_declarefields} |
| | | ` |
| | | _declarefields = ',' + _declarefields |
| | | } |
| | | _sql = `/* 系统生成 */ |
| | | Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@ModularDetailCode nvarchar(50)${_declarefields} |
| | | ` |
| | | |
| | | // 变量赋值 |
| | | _initfields = _initfields.join(',') |