| | |
| | | config.method = 'post' |
| | | if (config.url.includes('LoginAndRedirect') || config.url.includes('getjsonresult')) { |
| | | config.data = qs.stringify(config.data) |
| | | } else if (config.url.includes('Upload')) { |
| | | config.headers = { 'Content-Type': 'multipart/form-data' } |
| | | } else { |
| | | config.headers.token = sessionStorage.getItem('TOKEN') || '' |
| | | config.data = JSON.stringify(config.data) |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 文件上传 |
| | | */ |
| | | getFileUpload (file) { |
| | | const param = new FormData() |
| | | param.append('file', file) |
| | | param.append('RootPath', 'Content/images/upload/') |
| | | |
| | | return axios({ |
| | | url: '/zh-CN/Home/Upload', |
| | | data: param |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取页面配置信息 |
| | | * @param {String} MenuNo 页面菜单参数 |
| | | */ |
| | |
| | | type: template.type, |
| | | PageParam: {OpenType: 'newtab', Template: template.type}, |
| | | LongParam: template.baseconfig, |
| | | isSubtable: template.isSubtable, // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID |
| | | } |
| | | }) |
| | |
| | | {this.state.tabview === 'template' && <Tabs defaultActiveKey="1"> |
| | | <TabPane tab="系统模板" key="1"> |
| | | <Row> |
| | | {this.state.sysTemplates.map(template => { |
| | | {this.state.sysTemplates.map((template, index) => { |
| | | return ( |
| | | <Col key={template.type} span={8}> |
| | | <Col key={`${index}`} span={8}> |
| | | <Card |
| | | title={template.title}> |
| | | <img onClick={() => {this.previewPicture(template)}} src={template.url} alt=""/> |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { template } = this.props |
| | | let type = 'sys' |
| | | if (!template || !template.isSystem) { |
| | | type = 'user' |
| | | } |
| | | |
| | | return ( |
| | | <div> |
| | | {this.state.url && |
| | | {this.state.url && this.props.template && |
| | | <div className={'preview-box ' + (this.state.show ? 'active' : '')} onClick={this.close}> |
| | | <Button shape="circle" icon="close"></Button> |
| | | <Button type="primary" onClick={() => {this.props.confirm(this.props.template)}}>使用模板</Button> |
| | | <Button type="primary" onClick={() => {this.props.confirm(this.props.template, type)}}>使用模板</Button> |
| | | {this.state.url && <img src={this.state.url} alt=""/>} |
| | | </div> |
| | | } |
| | |
| | | {icon && <Icon type={icon} />} |
| | | {text} |
| | | </div> |
| | | {menutype !== 'iframe' ? <Icon className="edit" type="edit" onClick={edit} /> : null} |
| | | {menutype === 'CommonTable' ? <Icon className="edit" type="edit" onClick={edit} /> : null} |
| | | <Icon className="close" type="close" onClick={close} /> |
| | | </div> |
| | | ) |
| | |
| | | 'header.form.picture': '图片', |
| | | 'header.form.number': '数字', |
| | | 'header.form.colspan': '合并列', |
| | | 'header.form.select': '选择', |
| | | 'header.form.multiselect': '多选', |
| | | 'header.form.select': '下拉选择', |
| | | 'header.form.multiselect': '下拉多选', |
| | | 'header.form.link': '关联菜单', |
| | | 'header.form.dateday': '日期(天)', |
| | | 'header.form.datetime': '日期(秒)', |
| | |
| | | } |
| | | })) |
| | | |
| | | app.use(proxy('/Upload', { // 登录接口 |
| | | target: `http://qingqiumarket.cn/${service}/zh-CN/Home/Upload`, |
| | | secure: false, |
| | | changeOrigin: true, |
| | | pathRewrite: { |
| | | '^/Upload': '/' |
| | | } |
| | | })) |
| | | |
| | | app.use(proxy('/local', { |
| | | target: 'http://127.0.0.1:8888', |
| | | secure: false, |
| | |
| | | if (item.type === 'link') { |
| | | arrfield = arrfield + ',' + item.linkField |
| | | } |
| | | |
| | | let _sql = Utils.getSelectQuerySql(item) |
| | | _sql = Utils.formatOptions(_sql) |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: item.dataSourceSql, |
| | | LText: _sql, |
| | | obj_name: 'data', |
| | | arr_field: arrfield |
| | | } |
| | |
| | | .ant-table-tbody > tr > td:last-child { |
| | | border-right: 0; |
| | | } |
| | | .ant-table-tbody > tr > td { |
| | | vertical-align: top; |
| | | .content { |
| | | position: relative; |
| | | z-index: 1; |
| | | word-wrap: break-word; |
| | | word-break: break-word; |
| | | } |
| | | } |
| | | .ant-table-tbody > tr > td.ant-table-column-has-actions { |
| | | position: relative; |
| | | .background { |
| | |
| | | if (item.type === 'link') { |
| | | arrfield = arrfield + ',' + item.linkField |
| | | } |
| | | |
| | | let _sql = Utils.getSelectQuerySql(item) |
| | | _sql = Utils.formatOptions(_sql) |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: item.dataSourceSql, |
| | | LText: _sql, |
| | | obj_name: 'data', |
| | | arr_field: arrfield |
| | | } |
| | |
| | | if (item.type === 'link') { |
| | | arrfield = arrfield + ',' + item.linkField |
| | | } |
| | | |
| | | let _sql = Utils.getSelectQuerySql(item) |
| | | _sql = Utils.formatOptions(_sql) |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: item.dataSourceSql, |
| | | LText: _sql, |
| | | obj_name: 'data', |
| | | arr_field: arrfield |
| | | } |
| | |
| | | if (execAction.groups.length > 0) { |
| | | execAction.groups.forEach(group => { |
| | | group.sublist.forEach(field => { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1' && field.dataSource) { |
| | | subfields.push(field) |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | execAction.fields.forEach(field => { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1' && field.dataSource) { |
| | | subfields.push(field) |
| | | } |
| | | }) |
| | |
| | | arrfield = arrfield + ',' + item.linkField |
| | | } |
| | | |
| | | let _sql = Utils.getSelectQuerySql(item) |
| | | console.log(_sql) |
| | | _sql = Utils.formatOptions(_sql) |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: item.dataSourceSql, |
| | | LText: _sql, |
| | | obj_name: 'data', |
| | | arr_field: arrfield |
| | | } |
| | |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | | this.execSubmit(this.state.execAction, this.state.tabledata, () => { |
| | | this.setState({ |
| | | confirmLoading: false |
| | | }) |
| | | }, res) |
| | | console.log(res) |
| | | // this.execSubmit(this.state.execAction, this.state.tabledata, () => { |
| | | // this.setState({ |
| | | // confirmLoading: false |
| | | // }) |
| | | // }, res) |
| | | }, () => {}) |
| | | } |
| | | |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Upload, message, Button, Icon, Progress } from 'antd' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' |
| | | let Url = '/Upload' |
| | | if (process.env.NODE_ENV === 'production') { |
| | | Url = document.location.origin + '/' + service + 'zh-CN/Home/Upload' |
| | | } |
| | | |
| | | class FileUpload extends Component { |
| | | static propTpyes = { |
| | | value: PropTypes.array // 按钮信息、表单列表 |
| | | } |
| | | |
| | | state = { |
| | | baseUrl: Url, |
| | | percent: 0, |
| | | showprogress: false |
| | | } |
| | | |
| | | init = async () => { |
| | | try { |
| | | const OSSData = await this.mockGetOSSData() |
| | | |
| | | this.setState({ |
| | | OSSData |
| | | }) |
| | | } catch (error) { |
| | | message.error(error) |
| | | } |
| | | } |
| | | |
| | | onChange = ({ fileList }) => { |
| | | const { onChange } = this.props |
| | | |
| | | if (onChange) { |
| | | onChange([...fileList]) |
| | | } |
| | | } |
| | | |
| | | onRemove = file => { |
| | | const { value, onChange } = this.props |
| | | |
| | | const files = value.filter(v => v.url !== file.url) |
| | | |
| | | if (onChange) { |
| | | onChange(files) |
| | | } |
| | | } |
| | | |
| | | getExtraData = file => { |
| | | const param = new FormData() |
| | | param.append('file', file) |
| | | param.append('RootPath', 'Content/images/upload/') |
| | | |
| | | return param |
| | | } |
| | | |
| | | shardupload = (file, shardSize, shardCount, i) => { |
| | | let start = i * shardSize |
| | | let end = Math.min(file.size, start + shardSize) |
| | | let form = new FormData() |
| | | |
| | | form.append('data', file.slice(start, end)) //slice方法用于切出文件的一部分 |
| | | form.append('name', file.name) |
| | | form.append('total', shardCount) |
| | | form.append('index', i + 1) |
| | | |
| | | if (i < shardCount) { |
| | | i++ |
| | | Api.getFileUpload(file).then(res => { |
| | | console.log(res) |
| | | if (res) { |
| | | this.setState({ |
| | | percent: Math.floor(100 * (i / shardCount)) |
| | | }) |
| | | this.shardupload(file, shardSize, shardCount, i) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | percent: 100 |
| | | }, () => { |
| | | setTimeout(() => { |
| | | this.setState({ |
| | | showprogress: false, |
| | | percent: 0 |
| | | }) |
| | | }, 200) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | beforeUpload = (file, fileList) => { |
| | | let shardSize = 200 * 1024 * 1024 |
| | | console.log(file) |
| | | |
| | | if (file.size > shardSize) { |
| | | this.setState({ |
| | | showprogress: true, |
| | | percent: 0 |
| | | }) |
| | | let shardCount = Math.ceil(file.size / shardSize) |
| | | this.shardupload(file, shardSize, shardCount, 0) |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { value } = this.props |
| | | const { showprogress, percent, baseUrl } = this.state |
| | | |
| | | const props = { |
| | | name: 'file', |
| | | disabled: showprogress, |
| | | fileList: value, |
| | | action: baseUrl, |
| | | method: 'post', |
| | | onChange: this.onChange, |
| | | onRemove: this.onRemove, |
| | | data: this.getExtraData, |
| | | beforeUpload: this.beforeUpload, |
| | | } |
| | | return ( |
| | | <Upload {...props}> |
| | | <Button> |
| | | <Icon type="upload" /> Click to Upload |
| | | </Button> |
| | | {showprogress ? <Progress percent={percent} size="small" /> : null} |
| | | </Upload> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default FileUpload |
New file |
| | |
| | | .main-form-field .ant-progress-small.ant-progress-line { |
| | | position: absolute; |
| | | bottom: -20px; |
| | | left: 0px; |
| | | } |
| | |
| | | import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd' |
| | | import moment from 'moment' |
| | | import Utils from '@/utils/utils.js' |
| | | import FileUpload from '../fileupload' |
| | | import './index.scss' |
| | | |
| | | const {MonthPicker} = DatePicker |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'fileupload') { |
| | | // let filelist = this.props.data ? this.props.data[item.field] : item.initval |
| | | let filelist = 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png,https://img.alicdn.com/tfs/TB1Ly5oS3HqK1RjSZFPXXcwapXa-238-54.png' |
| | | if (filelist) { |
| | | try { |
| | | filelist = filelist.split(',').map((url, index) => { |
| | | return { |
| | | uid: `${index}`, |
| | | name: url.slice(url.lastIndexOf('/') + 1), |
| | | status: 'done', |
| | | url: url, |
| | | origin: true |
| | | } |
| | | }) |
| | | } catch { |
| | | filelist = [] |
| | | } |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: filelist, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <FileUpload /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | |
| | | key: key, |
| | | value: values[key] ? values[key].join(',') : '' |
| | | }) |
| | | } else if (this.state.datatype[key] === 'fileupload') { |
| | | let vals = [] |
| | | |
| | | if (values[key].length > 0) { |
| | | values[key].forEach(_val => { |
| | | if (_val.origin && _val.url) { |
| | | vals.push(_val.url) |
| | | } else if (!_val.origin && _val.status === 'done' && _val.response) { |
| | | vals.push(Utils.getrealurl(_val.response)) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: vals.join(',') |
| | | }) |
| | | } else { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Button, Modal, message } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | |
| | | state = { |
| | | formlist: null, // 表单信息 |
| | | openType: null, // 打开方式 |
| | | errorType: 'E', // 报错类型 |
| | | interType: null, // 接口类型:内部、外部 |
| | | position: null, // 按钮位置 |
| | | reqOptionSgl: [{ |
| | |
| | | let _opentype = '' |
| | | let _intertype = '' |
| | | let _position = '' |
| | | let _errorType = '' |
| | | let _tabType = '' |
| | | let _linkTab = '' |
| | | let _options = null |
| | |
| | | _intertype = form.initVal |
| | | } else if (form.key === 'position') { |
| | | _position = form.initVal |
| | | } else if (form.key === 'errorTip') { |
| | | _errorType = form.initVal |
| | | } else if (form.key === 'tabType') { |
| | | _tabType = form.initVal |
| | | } else if (form.key === 'linkTab') { |
| | |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'sql', 'sqlType'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', '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', 'errorTip', 'errorTime', 'sql', 'sqlType'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | | } |
| | | this.setState({ |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'errorTip') { |
| | | this.setState({ |
| | | errorType: value |
| | | }) |
| | | } else if (key === 'tabType') { |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === 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('执行失败!') |
| | | } |
| | | } |
| | | |
| | |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={12} key={index} className={item.key === 'errorTip' ? 'with-button' : ''}> |
| | | <Col span={12} key={index}> |
| | | <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') { |
| | |
| | | |
| | | if (!_LongParam) { |
| | | _config = JSON.parse(JSON.stringify(Source.baseConfig)) |
| | | if (!menu.isSubtable) { // 不是选择主子表时,隐藏标签页 |
| | | _config.tabs = [] |
| | | } |
| | | } else { |
| | | _config = _LongParam |
| | | } |
| | |
| | | type: 'radio', |
| | | key: 'intertype', |
| | | label: this.state.dict['header.form.intertype'], |
| | | initVal: card.intertype, |
| | | initVal: card.intertype || 'inner', |
| | | required: true, |
| | | options: [{ |
| | | value: 'inner', |
| | |
| | | value: 'view', |
| | | text: this.state.dict['header.form.refresh.view'] |
| | | }] |
| | | }, |
| | | { |
| | | 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: [{ |
| | | value: 'S', |
| | | text: 'S(提醒框-0)' |
| | | }, { |
| | | value: '-1', |
| | | text: '-1(不提示)' |
| | | }, { |
| | | value: 'N', |
| | | text: 'N(提醒框-1)' |
| | | }, { |
| | | value: 'F', |
| | | text: 'F(提醒框-2)' |
| | | }, { |
| | | value: 'E', |
| | | text: 'E(确认框)' |
| | | }, { |
| | | value: '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', |
| | |
| | | if (this.state.formtemp !== 'gridbtn') { |
| | | this.formRef.handleConfirm().then(res => { |
| | | let isupdate = false |
| | | |
| | | if (res.type === 'search') { |
| | | if ((res.values.type === 'multiselect' || res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') { |
| | | let _datasource = res.values.dataSource |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + _datasource |
| | | if (res.values.type === 'link') { |
| | | sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + _datasource |
| | | } |
| | | if (res.values.orderBy) { |
| | | sql = sql + ' order by ' + res.values.orderBy + ' ' + res.values.orderType |
| | | } |
| | | |
| | | res.values.dataSourceSql = Utils.formatOptions(sql) |
| | | } |
| | | } |
| | | |
| | | if (res.type === 'action' && card.originCard && res.values.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | |
| | | }) |
| | | } |
| | | |
| | | selectChange = (val) => { |
| | | let _order = this.props.form.getFieldValue('order') |
| | | if (_order) return |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | order: `${val} desc`, |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { data, dict, menu, usefulFields } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | |
| | | })( |
| | | <Select |
| | | getPopupContainer={() => document.getElementById('commontable-setting-form')} |
| | | onChange={this.selectChange} |
| | | > |
| | | <Select.Option key='unset' value="">不设置</Select.Option> |
| | | {columns.length === 0 ? |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Select, DatePicker, Input, InputNumber } from 'antd' |
| | | import { Icon, Select, DatePicker, Input, InputNumber, Button } from 'antd' |
| | | import moment from 'moment' |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | |
| | | <DatePicker showTime defaultValue={card.initval ? moment().subtract(card.initval, 'days') : null} /> |
| | | // <DatePicker showTime defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD HH:mm:ss') : null} /> |
| | | } |
| | | {card.type === 'fileupload' && |
| | | <Button> |
| | | <Icon type="upload" /> 点击上传 |
| | | </Button> |
| | | } |
| | | <div className="input-mask"></div> |
| | | </div> |
| | | </div>} |
| | |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | if (!target) { |
| | | targetIndex++ |
| | | } |
| | | if (targetIndex < 0) { |
| | | targetIndex = 0 |
| | | } |
| | | // if (!target) { |
| | | targetIndex++ |
| | | // } |
| | | // if (targetIndex < 0) { |
| | | // targetIndex = 0 |
| | | // } |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | setCards(_cards) |
| | |
| | | value: 'link', |
| | | text: this.state.dict['header.form.link'] |
| | | }, { |
| | | value: 'fileupload', |
| | | text: '文件上传' |
| | | }, { |
| | | value: 'date', |
| | | text: this.state.dict['header.form.dateday'] |
| | | }, { |
| | |
| | | handleSubmit = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if ((res.type === 'multiselect' || res.type === 'select' || res.type === 'link') && res.resourceType === '1') { |
| | | let _datasource = res.dataSource |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | let sql = 'select ' + res.valueField + ',' + res.valueText + ' from ' + _datasource |
| | | if (res.type === 'link') { |
| | | sql = 'select ' + res.valueField + ',' + res.valueText + ',' + res.linkField + ' from ' + _datasource |
| | | } |
| | | if (res.orderBy) { |
| | | sql = sql + ' order by ' + res.orderBy + ' ' + res.orderType |
| | | } |
| | | |
| | | res.dataSourceSql = Utils.formatOptions(sql) |
| | | } |
| | | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | readonly: 'false', |
| | | required: 'false' |
| | | required: 'true' |
| | | } |
| | | }) |
| | | _config.groups[_config.groups.length - 1].sublist = [..._config.groups[_config.groups.length - 1].sublist, ..._additems] |
| | |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } else if (type === 'number') { |
| | | _options = [..._options, 'decimal'] |
| | | } else if (type === 'fileupload') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required'] |
| | | } |
| | | |
| | | if (type === 'select' || type === 'link') { |
| | |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } else if (value === 'number') { |
| | | _options = [..._options, 'decimal'] |
| | | } else if (value === 'fileupload') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required'] |
| | | } |
| | | |
| | | if (value === 'select' || value === 'link') { |
| | |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'initval') { |
| | | if (form.key === 'initval' && value !== 'fileupload') { |
| | | form.hidden = false |
| | | } |
| | | return form |
| | |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '文件上传', |
| | | subType: 'fileupload', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '时间框(天)', |
| | | subType: 'date', |
| | | url: '' |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Button, Modal, message } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | |
| | | state = { |
| | | formlist: null, |
| | | openType: null, |
| | | errorType: 'E', |
| | | interType: null, |
| | | position: null, |
| | | reqOptionSgl: [{ |
| | |
| | | let _opentype = '' |
| | | let _intertype = '' |
| | | let _position = '' |
| | | let _errorType = '' |
| | | let _tabType = '' |
| | | let _linkTab = '' |
| | | let _options = null |
| | |
| | | _intertype = form.initVal |
| | | } else if (form.key === 'position') { |
| | | _position = form.initVal |
| | | } else if (form.key === 'errorTip') { |
| | | _errorType = form.initVal |
| | | } else if (form.key === 'tabType') { |
| | | _tabType = form.initVal |
| | | } else if (form.key === 'linkTab') { |
| | |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'sql', 'sqlType'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', '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', 'errorTip', 'errorTime', 'sql', 'sqlType'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'errorTip') { |
| | | this.setState({ |
| | | errorType: value |
| | | }) |
| | | } else if (key === 'tabType') { |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === 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 => { |
| | |
| | | } |
| | | } |
| | | |
| | | showError = () => { |
| | | const { errorType } = this.state |
| | | // 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('执行失败!') |
| | | } |
| | | } |
| | | // 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('执行失败!') |
| | | // } |
| | | // } |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={12} key={index} className={item.key === 'errorTip' ? 'with-button' : ''}> |
| | | <Col span={12} key={index}> |
| | | <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') { |
| | |
| | | text: this.state.dict['header.form.refresh.subgrid'] |
| | | }] |
| | | }, |
| | | { |
| | | 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: [{ |
| | | value: 'S', |
| | | text: 'S(提醒框-0)' |
| | | }, { |
| | | value: '-1', |
| | | text: '-1(不提示)' |
| | | }, { |
| | | value: 'N', |
| | | text: 'N(提醒框-1)' |
| | | }, { |
| | | value: 'F', |
| | | text: 'F(提醒框-2)' |
| | | }, { |
| | | value: 'E', |
| | | text: 'E(确认框)' |
| | | }, { |
| | | value: '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: '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: [{ |
| | | // value: 'S', |
| | | // text: 'S(提醒框-0)' |
| | | // }, { |
| | | // value: '-1', |
| | | // text: '-1(不提示)' |
| | | // }, { |
| | | // value: 'N', |
| | | // text: 'N(提醒框-1)' |
| | | // }, { |
| | | // value: 'F', |
| | | // text: 'F(提醒框-2)' |
| | | // }, { |
| | | // value: 'E', |
| | | // text: 'E(确认框)' |
| | | // }, { |
| | | // value: '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', |
| | |
| | | if (this.state.formtemp !== 'gridbtn') { |
| | | this.formRef.handleConfirm().then(res => { |
| | | let isupdate = false |
| | | |
| | | if (res.type === 'search') { |
| | | if ((res.values.type === 'multiselect' || res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') { |
| | | let _datasource = res.values.dataSource |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + _datasource |
| | | if (res.values.type === 'link') { |
| | | sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + _datasource |
| | | } |
| | | if (res.values.orderBy) { |
| | | sql = sql + ' order by ' + res.values.orderBy + ' ' + res.values.orderType |
| | | } |
| | | |
| | | res.values.dataSourceSql = Utils.formatOptions(sql) |
| | | } |
| | | } |
| | | |
| | | if (res.type === 'action' && card.originCard && res.values.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | |
| | | title: '基础表格', |
| | | type: 'CommonTable', |
| | | url: nortable, |
| | | baseconfig: '' |
| | | baseconfig: '', |
| | | isSystem: true |
| | | }, |
| | | { |
| | | title: '主子表表格', |
| | | type: 'CommonTable', |
| | | url: nortable, |
| | | baseconfig: '', |
| | | isSystem: true, |
| | | isSubtable: true |
| | | } |
| | | ] |
| | | |
| | |
| | | } else { |
| | | baseurl = 'http://qingqiumarket.cn/' + service |
| | | } |
| | | if (!/Content\/images\/upload\//.test(url)) { |
| | | baseurl = baseurl + 'Content/images/upload/' |
| | | } |
| | | let realurl = url.match(/^http/) || url.match(/^\/\//) ? url : baseurl + url |
| | | return realurl |
| | | } |
| | | |
| | | /** |
| | | * @description 获取下拉搜索查询sql |
| | | * @return {String} item 搜索条件信息 |
| | | */ |
| | | static getSelectQuerySql (item) { |
| | | let _datasource = item.dataSource |
| | | let sql = '' |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | if (item.type === 'link') { |
| | | sql = 'select ' + item.valueField + ',' + item.valueText + ',' + item.linkField + ' from ' + _datasource |
| | | } else { |
| | | sql = 'select ' + item.valueField + ',' + item.valueText + ' from ' + _datasource |
| | | } |
| | | |
| | | if (item.orderBy) { |
| | | sql = sql + ' order by ' + item.orderBy + ' ' + item.orderType |
| | | } |
| | | |
| | | return sql |
| | | } |
| | | |
| | | /** |
| | | * @description 使用系统函数时(sPC_TableData_InUpDe ),生成sql语句 |
| | | * @return {String} type 执行类型 |
| | | * @return {String} table 表名 |