| | |
| | | message: this.props.dict['header.password.new.required'] |
| | | }, |
| | | { |
| | | min: 6, |
| | | message: this.props.dict['header.password.minlen'] |
| | | pattern: /^[0-9a-zA-Z!@#$%^&*()_]*$/ig, |
| | | message: '密码只允许包含数字、字母以及!@#$%&*()_。' |
| | | }, |
| | | { |
| | | max: 12, |
| | | max: 50, |
| | | message: this.props.dict['header.password.maxlen'] |
| | | }, |
| | | { |
| | |
| | | 'header.form.position': 'Position', |
| | | 'header.form.execSuccess': 'Success', |
| | | 'header.form.execError': 'Failure', |
| | | 'header.form.messageTip': '信息提示', |
| | | 'header.form.errorTime': '停留时间', |
| | | 'header.form.refresh.never': 'Don\'t refresh', |
| | | 'header.form.refresh.view': 'Refresh the page', |
| | | 'header.form.refresh.grid': 'Refresh the table', |
| | |
| | | 'header.form.position': '显示位置', |
| | | 'header.form.execSuccess': '执行成功', |
| | | 'header.form.execError': '执行失败', |
| | | 'header.form.messageTip': '信息提示', |
| | | 'header.form.errorTime': '停留时间', |
| | | 'header.form.refresh.never': '不刷新', |
| | | 'header.form.refresh.view': '刷新页面', |
| | | 'header.form.refresh.grid': '刷新表格', |
| | |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | _search = _search ? 'where ' + _search : '' |
| | | |
| | | _search = _search ? 'where ' + _search : '' |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field |
| | | } |
| | | |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | | let DateCount = `select count(1) as total from ${setting.dataresource} ${_search}` |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | 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}` |
| | | console.log(LText) |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | console.log(LText) |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | | let DateCount = `select count(1) as total from ${setting.dataresource} ${_search}` |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | 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}` |
| | | console.log(LText) |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | console.log(LText) |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | position: relative; |
| | | min-height: 200px; |
| | | padding-top: 16px; |
| | | > .top-search { |
| | | padding: 0 0px 20px; |
| | | } |
| | | > .button-list { |
| | | padding: 10px 0px 5px; |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import moment from 'moment' |
| | | import { Button, Affix, Modal, notification, Spin } from 'antd' |
| | | import { Button, Affix, Modal, notification, Spin, message } from 'antd' |
| | | import MutilForm from '@/tabviews/tableshare/mutilform' |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | |
| | | configMap: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | console.log(this.props.type) |
| | | } |
| | | |
| | | refreshdata = (item, type) => { |
| | | this.props.refreshdata(item, type) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (item, record) => { |
| | | const { setting } = this.props |
| | | |
| | |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(btn) |
| | | this.execSuccess(btn, res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | } |
| | |
| | | let errorMsg = '' |
| | | result.forEach(res => { |
| | | if (res.status) { |
| | | |
| | | errorMsg = res |
| | | } else { |
| | | iserror = true |
| | | errorMsg = res.message |
| | | errorMsg = res |
| | | } |
| | | }) |
| | | if (!iserror) { |
| | | this.execSuccess(btn) |
| | | this.execSuccess(btn, errorMsg) |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: errorMsg, |
| | | duration: 15 |
| | | }) |
| | | this.refreshdata(btn, 'error') |
| | | this.execError(errorMsg, btn) |
| | | } |
| | | _resolve() |
| | | }) |
| | |
| | | response.func = btn.callbackFunc |
| | | return Api.genericInterface(response) |
| | | } else { |
| | | this.execSuccess(btn) |
| | | this.execSuccess(btn, response) |
| | | _resolve() |
| | | } |
| | | } else { |
| | |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | this.execSuccess(btn) |
| | | this.execSuccess(btn, res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | } |
| | |
| | | result.forEach(res => { |
| | | if (!res.status) { |
| | | iserror = true |
| | | errorMsg = res.message |
| | | errorMsg = res |
| | | } else { |
| | | errorMsg = res |
| | | } |
| | | }) |
| | | if (iserror) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: errorMsg, |
| | | duration: 15 |
| | | }) |
| | | this.refreshdata(btn, 'error') |
| | | this.execError(errorMsg, btn) |
| | | _resolve() |
| | | return |
| | | } |
| | |
| | | return Promise.all(deffers) |
| | | } else { |
| | | _resolve() |
| | | this.execSuccess(btn) |
| | | this.execSuccess(btn, errorMsg) |
| | | } |
| | | }).then(result => { |
| | | if (!result) return |
| | |
| | | result.forEach(res => { |
| | | if (!res.status) { |
| | | iserror = true |
| | | errorMsg = res.message |
| | | errorMsg = res |
| | | } else { |
| | | errorMsg = res |
| | | } |
| | | }) |
| | | if (iserror) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: errorMsg, |
| | | duration: 15 |
| | | }) |
| | | this.refreshdata(btn, 'error') |
| | | this.execError(errorMsg, btn) |
| | | return |
| | | } else { |
| | | this.execSuccess(btn) |
| | | this.execSuccess(btn, errorMsg) |
| | | } |
| | | _resolve() |
| | | }) |
| | |
| | | } |
| | | } |
| | | |
| | | execSuccess = (btn) => { |
| | | /** |
| | | * @description 操作成功后处理 |
| | | * 1、excel导出,成功后取消导出按钮加载中状态 |
| | | * 2、状态码为 S 时,显示成功信息后系统默认信息 |
| | | * 3、状态码为 -1 时,不显示任何信息 |
| | | * 4、模态框执行成功后是否关闭 |
| | | * 5、通知主列表刷新 |
| | | */ |
| | | execSuccess = (btn, res) => { |
| | | if (btn.OpenType === 'excelOut') { |
| | | this.setState({ |
| | | loadingUuid: '' |
| | | }) |
| | | } else { |
| | | } else if (res && res.ErrCode === 'S') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.success'], |
| | | message: res.ErrMesg || this.props.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | } else if (res && res.ErrCode === '-1') { |
| | | |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { |
| | |
| | | this.refreshdata(btn, 'success') |
| | | } |
| | | |
| | | /** |
| | | * @description 操作失败后处理 |
| | | * 1、状态码为 E、N、F、NM 时,显示相应提示信息 |
| | | * 2、excel导出,失败后取消导出按钮加载中状态 |
| | | * 3、通知主列表刷新 |
| | | */ |
| | | execError = (res, btn) => { |
| | | if (!res.ErrCode || res.ErrCode === 'E') { |
| | | if (res.ErrCode === 'E') { |
| | | Modal.error({ |
| | | title: res.message || res.ErrMesg, |
| | | }) |
| | | } else if (res.ErrCode === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: 15 |
| | | duration: btn.errorTime || 15 |
| | | }) |
| | | } else if (res.ErrCode === 'E') { |
| | | Modal.error({ |
| | | title: res.message || res.ErrMesg |
| | | } else if (res.ErrCode === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.errorTime || 15 |
| | | }) |
| | | } else if (res.ErrCode === 'NM') { |
| | | message.error(res.message || res.ErrMesg) |
| | | } |
| | | |
| | | if (btn.OpenType === 'excelOut') { |
| | |
| | | this.refreshdata(btn, 'error') |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮配置信息错误提示 |
| | | */ |
| | | actionSettingError = () => { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取按钮配置信息 |
| | | */ |
| | | improveAction = (action) => { |
| | | const { configMap, execAction } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取下拉表单选项信息 |
| | | */ |
| | | improveActionForm = () => { |
| | | const { configMap, execAction } = this.state |
| | | let subfields = [] |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 模态框(表单),确认 |
| | | */ |
| | | handleOk = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | |
| | | }, () => {}) |
| | | } |
| | | |
| | | /** |
| | | * @description 模态框(表单),取消 |
| | | */ |
| | | handleCancel = () => { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 显示模态框 |
| | | */ |
| | | getModels = () => { |
| | | const { execAction } = this.state |
| | | |
| | |
| | | |
| | | render() { |
| | | return ( |
| | | <Form className="ant-advanced-search-form subtable-main-search" onSubmit={this.handleSearch}> |
| | | <Form className="ant-advanced-search-form top-search" onSubmit={this.handleSearch}> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |
| | |
| | | .ant-advanced-search-form.subtable-main-search { |
| | | padding: 0px 0px 20px; |
| | | .ant-advanced-search-form.top-search { |
| | | padding: 0px 24px 20px; |
| | | border-bottom: 1px solid #efefef; |
| | | .ant-form-item { |
| | | display: flex; |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Button, Modal, message } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | |
| | | state = { |
| | | formlist: null, |
| | | openType: null, |
| | | errorType: 'E', |
| | | interType: null, |
| | | position: null, |
| | | reqOptionSgl: [{ |
| | |
| | | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _opentype = this.props.formlist.filter(form => form.key === 'OpenType')[0].initVal |
| | | let _intertype = this.props.formlist.filter(form => form.key === 'intertype')[0].initVal |
| | | let _position = this.props.formlist.filter(form => form.key === 'position')[0].initVal |
| | | let _opentype = '' |
| | | let _intertype = '' |
| | | let _position = '' |
| | | let _errorType = '' |
| | | let _options = null |
| | | |
| | | this.props.formlist.forEach(form => { |
| | | if (form.key === 'OpenType') { |
| | | _opentype = form.initVal |
| | | } else if (form.key === 'intertype') { |
| | | _intertype = form.initVal |
| | | } else if (form.key === 'position') { |
| | | _position = form.initVal |
| | | } else if (form.key === 'errorTip') { |
| | | _errorType = form.initVal |
| | | } |
| | | }) |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面(内部),可选模板 |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | | } else if (_opentype === 'outerpage') { // 新页面(外部),需要页面地址 |
| | |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'method'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'sql', 'sqlType'] |
| | | } |
| | | } |
| | | this.setState({ |
| | | openType: _opentype, |
| | | interType: _intertype, |
| | | position: _position, |
| | | errorType: _errorType, |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'class') { |
| | | item.options = btnClasses |
| | |
| | | } |
| | | } else { |
| | | if (this.state.interType === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | | } |
| | | this.setState({ |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'errorTip') { |
| | | this.setState({ |
| | | errorType: value |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | | if (['pop', 'prompt', 'exec'].includes(this.state.openType)) { |
| | | _options.push('errorTip', 'errorTime') |
| | | } |
| | | this.setState({ |
| | | interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | showError = () => { |
| | | const { errorType } = this.state |
| | | |
| | | if (errorType === 'S') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '执行成功!', |
| | | duration: 2 |
| | | }) |
| | | } else if (errorType === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: 15 |
| | | }) |
| | | } else if (errorType === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: 15 |
| | | }) |
| | | } else if (errorType === 'E') { |
| | | Modal.error({ |
| | | title: '执行失败!' |
| | | }) |
| | | } else if (errorType === 'NM') { |
| | | message.error('执行失败!') |
| | | } |
| | | } |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | } else if (item.type === 'number') { // 文本搜索 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })(<InputNumber min={1} max={10000} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={12} key={index} className={item.key === 'errorTip' ? 'with-button' : ''}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | {item.key === 'errorTip' ? <Button onClick={this.showError}>查看</Button> : null} |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'radio') { |
| | |
| | | width: 86%; |
| | | } |
| | | } |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | .anticon-question-circle { |
| | | color: #c49f47; |
| | | position: relative; |
| | | left: -3px; |
| | | } |
| | | .with-button { |
| | | .ant-form-item-control-wrapper { |
| | | padding-right: 63px; |
| | | } |
| | | .ant-btn { |
| | | position: absolute; |
| | | right: 12px; |
| | | top: 4.5px; |
| | | } |
| | | } |
| | | } |
| | |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'errorTip', |
| | | label: this.state.dict['header.form.messageTip'], |
| | | initVal: card.errorTip || 'E', |
| | | tooltip: '该选项为提示效果展示,选择提示类型后,可点击按钮查看,自定义函数中设置 ErrCode 为(S、-1、E、N、F、NM)时,会以对应方式展示提示信息。', |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | options: [{ |
| | | MenuID: 'S', |
| | | text: 'S(提醒框-0)' |
| | | }, { |
| | | MenuID: '-1', |
| | | text: '-1(不提示)' |
| | | }, { |
| | | MenuID: 'N', |
| | | text: 'N(提醒框-1)' |
| | | }, { |
| | | MenuID: 'F', |
| | | text: 'F(提醒框-2)' |
| | | }, { |
| | | MenuID: 'E', |
| | | text: 'E(确认框)' |
| | | }, { |
| | | MenuID: 'NM', |
| | | text: 'NM(顶部提示)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'errorTime', |
| | | label: this.state.dict['header.form.errorTime'], |
| | | initVal: card.errorTime || 15, |
| | | tooltip: '执行结果中设置 ErrCode 为 N 或 F 时有效', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'icon', |
| | | label: this.state.dict['header.form.icon'], |
| | | initVal: card.icon, |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | pageTemplate: '', |
| | | url: '', |
| | |
| | | position: 'grid', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | pageTemplate: '', |
| | | url: '', |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'prompt', |
| | | pageTemplate: '', |
| | | url: '', |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Button, Modal, message } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | |
| | | state = { |
| | | formlist: null, |
| | | openType: null, |
| | | errorType: 'E', |
| | | interType: null, |
| | | position: null, |
| | | reqOptionSgl: [{ |
| | |
| | | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _opentype = this.props.formlist.filter(form => form.key === 'OpenType')[0].initVal |
| | | let _intertype = this.props.formlist.filter(form => form.key === 'intertype')[0].initVal |
| | | let _position = this.props.formlist.filter(form => form.key === 'position')[0].initVal |
| | | let _opentype = '' |
| | | let _intertype = '' |
| | | let _position = '' |
| | | let _errorType = '' |
| | | let _options = null |
| | | |
| | | this.props.formlist.forEach(form => { |
| | | if (form.key === 'OpenType') { |
| | | _opentype = form.initVal |
| | | } else if (form.key === 'intertype') { |
| | | _intertype = form.initVal |
| | | } else if (form.key === 'position') { |
| | | _position = form.initVal |
| | | } else if (form.key === 'errorTip') { |
| | | _errorType = form.initVal |
| | | } |
| | | }) |
| | | |
| | | if (_opentype === 'excelIn' || _opentype === 'excelOut') { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'method'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'sql', 'sqlType'] |
| | | } |
| | | } |
| | | this.setState({ |
| | | openType: _opentype, |
| | | interType: _intertype, |
| | | position: _position, |
| | | errorType: _errorType, |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'class') { |
| | | item.options = btnClasses |
| | |
| | | } |
| | | } else { |
| | | if (this.state.interType === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | | } |
| | | this.setState({ |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'errorTip') { |
| | | this.setState({ |
| | | errorType: value |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | | if (['pop', 'prompt', 'exec'].includes(this.state.openType)) { |
| | | _options.push('errorTip', 'errorTime') |
| | | } |
| | | this.setState({ |
| | | interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | showError = () => { |
| | | const { errorType } = this.state |
| | | |
| | | if (errorType === 'S') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '执行成功!', |
| | | duration: 2 |
| | | }) |
| | | } else if (errorType === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: 15 |
| | | }) |
| | | } else if (errorType === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: 15 |
| | | }) |
| | | } else if (errorType === 'E') { |
| | | Modal.error({ |
| | | title: '执行失败!' |
| | | }) |
| | | } else if (errorType === 'NM') { |
| | | message.error('执行失败!') |
| | | } |
| | | } |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | } else if (item.type === 'number') { // 文本搜索 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })(<InputNumber min={1} max={10000} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={12} key={index} className={item.key === 'errorTip' ? 'with-button' : ''}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | {item.key === 'errorTip' ? <Button onClick={this.showError}>查看</Button> : null} |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'radio') { |
| | |
| | | position: relative; |
| | | left: -3px; |
| | | } |
| | | .with-button { |
| | | .ant-form-item-control-wrapper { |
| | | padding-right: 63px; |
| | | } |
| | | .ant-btn { |
| | | position: absolute; |
| | | right: 12px; |
| | | top: 4.5px; |
| | | } |
| | | } |
| | | } |
| | |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'errorTip', |
| | | label: this.state.dict['header.form.messageTip'], |
| | | initVal: card.errorTip || 'E', |
| | | tooltip: '该选项为提示效果展示,选择提示类型后,可点击按钮查看,自定义函数中设置 ErrCode 为(S、-1、E、N、F、NM)时,会以对应方式展示提示信息。', |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | options: [{ |
| | | MenuID: 'S', |
| | | text: 'S(提醒框-0)' |
| | | }, { |
| | | MenuID: '-1', |
| | | text: '-1(不提示)' |
| | | }, { |
| | | MenuID: 'N', |
| | | text: 'N(提醒框-1)' |
| | | }, { |
| | | MenuID: 'F', |
| | | text: 'F(提醒框-2)' |
| | | }, { |
| | | MenuID: 'E', |
| | | text: 'E(确认框)' |
| | | }, { |
| | | MenuID: 'NM', |
| | | text: 'NM(顶部提示)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'errorTime', |
| | | label: this.state.dict['header.form.errorTime'], |
| | | initVal: card.errorTime || 15, |
| | | tooltip: '执行结果中设置 ErrCode 为 N 或 F 时有效', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'icon', |
| | | label: this.state.dict['header.form.icon'], |
| | | initVal: card.icon, |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | icon: 'plus', |
| | | class: 'green' |
| | |
| | | position: 'grid', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | icon: 'form', |
| | | class: 'purple' |
| | |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'prompt', |
| | | icon: 'delete', |
| | | class: 'red' |
| | |
| | | newcard.position = 'toolbar' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.errorTime = 15 |
| | | newcard.callbackFunc = '' |
| | | newcard.pageTemplate = '' |
| | | newcard.url = '' |