| | |
| | | text: '大于短信模板' |
| | | }] |
| | | }, { |
| | | MenuID: 'systemPayManage', |
| | | text: '支付', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | systems: ['local', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1594095599055qicg2eb642v5qglhnuo', |
| | | MenuNo: 's_weixin_pay_bdM', |
| | | MenuName: '微信支付', |
| | | text: '微信支付' |
| | | }] |
| | | }, { |
| | | MenuID: 'systemManageViewParam', |
| | | text: '系统参数', |
| | | PageParam: {Icon: 'folder'}, |
| | |
| | | menulist.forEach(menu => { |
| | | menu.children = menu.children.filter(item => !item.systems || item.systems.includes(options.sysType)) |
| | | }) |
| | | |
| | | menulist = menulist.filter(menu => menu.children.length > 0) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (!btn.verify || !btn.verify.columns || btn.verify.columns.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请设置导出列!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.triggerExcelout() |
| | |
| | | * @description Excel 生成 |
| | | */ |
| | | exportExcel = (data) => { |
| | | const { columns, btn } = this.props |
| | | const { btn } = this.props |
| | | if (data && data.length > 0) { |
| | | try { |
| | | let _header = [] |
| | | let _topRow = {} |
| | | let colwidth = [] |
| | | |
| | | let hidecolumns = [] |
| | | btn.verify.columns.forEach(col => { |
| | | if (!data[0].hasOwnProperty(col.Column)) return |
| | | if (_topRow[col.Column]) return |
| | | |
| | | let verifyColumn = {} // 记录验证信息中的Excel列配置 |
| | | if (btn.verify && btn.verify.columns && btn.verify.columns.length > 0) { |
| | | btn.verify.columns.forEach(col => { |
| | | if (col.export === 'false') { |
| | | hidecolumns.push(col.Column) |
| | | return |
| | | } |
| | | verifyColumn[col.Column] = col |
| | | }) |
| | | } |
| | | _header.push(col.Column) |
| | | _topRow[col.Column] = col.Text |
| | | |
| | | columns.forEach(col => { |
| | | if (col.Hide === 'true' || hidecolumns.includes(col.field)) { |
| | | hidecolumns.push(col.field) |
| | | return |
| | | } |
| | | if (!data[0].hasOwnProperty(col.field)) return |
| | | if (_topRow[col.field]) return |
| | | |
| | | if (verifyColumn[col.field]) { // 优先使用验证信息中的列设置 |
| | | _header.push(col.field) |
| | | _topRow[col.field] = verifyColumn[col.field].Text |
| | | |
| | | colwidth.push({width: verifyColumn[col.field].Width}) |
| | | } else { |
| | | _header.push(col.field) |
| | | _topRow[col.field] = col.label |
| | | |
| | | let _colwidth = Math.floor(col.Width / 6) |
| | | |
| | | if (!_colwidth || _colwidth < 5) { |
| | | _colwidth = 5 |
| | | } |
| | | |
| | | colwidth.push({width: _colwidth}) |
| | | } |
| | | }) |
| | | |
| | | if (btn.verify && btn.verify.columns && btn.verify.columns.length > 0) { |
| | | btn.verify.columns.forEach(col => { |
| | | if (hidecolumns.includes(col.Column)) return |
| | | if (!data[0].hasOwnProperty(col.Column)) return |
| | | if (_topRow[col.Column]) return |
| | | |
| | | _header.push(col.Column) |
| | | _topRow[col.Column] = col.Text |
| | | |
| | | colwidth.push({width: col.Width}) |
| | | }) |
| | | } |
| | | |
| | | Object.keys(data[0]).forEach(key => { |
| | | if (hidecolumns.includes(key)) return |
| | | if (_topRow[key]) return |
| | | |
| | | _header.push(key) |
| | | _topRow[key] = key |
| | | |
| | | colwidth.push({width: 12}) |
| | | colwidth.push({width: col.Width}) |
| | | }) |
| | | |
| | | let table = [] |
| | |
| | | wrappedComponentRef={(inst) => this.columnForm = inst} |
| | | /> |
| | | <Button className="excel-col-add mk-green" title="添加显示列字段" onClick={this.columnFieldInput}> |
| | | 快捷添加 |
| | | 同步显示列 |
| | | </Button> |
| | | <Table |
| | | bordered |
| | |
| | | .excel-col-add { |
| | | position: relative; |
| | | float: right; |
| | | top: -60px; |
| | | top: -40px; |
| | | } |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Button, Input, InputNumber, Radio } from 'antd' |
| | | import { Form, Row, Col, Button, Input, InputNumber } from 'antd' |
| | | import './index.scss' |
| | | |
| | | class ExcelOutColumn extends Component { |
| | |
| | | this.props.form.setFieldsValue({ |
| | | Column: record.Column, |
| | | Text: record.Text, |
| | | Width: record.Width, |
| | | export: record.export || 'true' |
| | | Width: record.Width |
| | | }) |
| | | } |
| | | |
| | |
| | | this.props.form.setFieldsValue({ |
| | | Column: '', |
| | | Text: '', |
| | | Width: 20, |
| | | export: 'true' |
| | | Width: 20 |
| | | }) |
| | | } |
| | | }) |
| | |
| | | <Button onClick={this.handleConfirm} type="primary" className="mk-green"> |
| | | 保存 |
| | | </Button> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={dict['model.export']}> |
| | | {getFieldDecorator('export', { |
| | | initialValue: 'true' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="true">{dict['model.true']}</Radio> |
| | | <Radio value="false">{dict['model.false']}</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | |
| | | { |
| | | title: this.props.dict['model.form.field'], |
| | | dataIndex: 'Column', |
| | | width: '20%' |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: this.props.dict['model.name'], |
| | | dataIndex: 'Text', |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: this.props.dict['model.export'], |
| | | dataIndex: 'export', |
| | | width: '20%', |
| | | editable: true, |
| | | render: (text, record) => record.export !== 'false' ? this.props.dict['model.true'] : this.props.dict['model.false'] |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: this.props.dict['model.form.columnWidth'], |
| | | dataIndex: 'Width', |
| | | width: '20%' |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: '操作', |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | let fields = verify.columns.map(item => item.Column) |
| | | if (fields.includes(values.Column)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: values.Column + '字段已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | values.uuid = Utils.getuuid() |
| | | verify.columns.push(values) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | columnFieldInput = () => { |
| | | const { config } = this.props |
| | | const { verify } = this.state |
| | | |
| | | let columns = fromJS(verify.columns).toJS() |
| | | let fields = columns.map(item => item.Column) |
| | | |
| | | config.columns.forEach(item => { |
| | | if (fields.includes(item.field)) return |
| | | fields.push(item.field) |
| | | |
| | | columns.push({ |
| | | Column: item.field, |
| | | Text: item.label, |
| | | Width: 20, |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | }) |
| | | |
| | | this.setState({ |
| | | verify: {...verify, columns: columns} |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { card } = this.props |
| | | const { verify, excelColumns, defaultscript } = this.state |
| | |
| | | columnChange={this.columnChange} |
| | | wrappedComponentRef={(inst) => this.columnForm = inst} |
| | | /> |
| | | <Button className="excel-col-add mk-green" title="添加显示列字段" onClick={this.columnFieldInput}> |
| | | 同步显示列 |
| | | </Button> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | |
| | | padding: 0 5px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | #verify-excelout-box-tab { |
| | | .ant-tabs-tabpane { |
| | | position: relative; |
| | | .excel-col-add { |
| | | position: relative; |
| | | float: right; |
| | | top: -5px; |
| | | z-index: 1; |
| | | } |
| | | } |
| | | } |
| | |
| | | right: 85px; |
| | | } |
| | | .ant-tabs-nav-container-scrolling { |
| | | margin-right: 50px; |
| | | margin-right: 100px; |
| | | .ant-tabs-tab-arrow-show { |
| | | > span { |
| | | padding-top: 10px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |