| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Radio, Input } from 'antd' |
| | | import { Form, Tabs, Row, Col, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Radio } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | |
| | | import ColumnForm from './columnform' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { TextArea } = Input |
| | | const { confirm } = Modal |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'columns', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'columns', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'columns') |
| | | }> |
| | | <span style={{color: '#ff4d4f', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | } |
| | | |
| | | _verify.enable = _verify.enable || 'false' |
| | | _verify.columns = _verify.columns || [] |
| | | _verify.columns = _verify.columns.map(col => { |
| | | col.Width = col.Width || 20 |
| | | return col |
| | | }) |
| | | |
| | | if (card.intertype !== 'inner' || card.innerFunc) { |
| | | // 同步显示列 |
| | | if (!_verify.columns || _verify.columns.length === 0) { |
| | | _verify.columns = [] |
| | | config.columns.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | | _verify.columns.push({ |
| | | Column: item.field, |
| | | Text: item.label, |
| | | Width: 20, |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (card.intertype !== 'system') { |
| | | _verify.enable = 'false' |
| | | } |
| | | |
| | | let defaultscript = '' |
| | | if (!_verify.script && card.intertype === 'inner' && !card.innerFunc) { |
| | | if (!_verify.script && card.intertype === 'system') { |
| | | let search = this.formatSearch(config.search) |
| | | search = Utils.joinMainSearchkey(search) |
| | | search = search ? 'where ' + search : '' |
| | |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(res => { |
| | |
| | | }) |
| | | } |
| | | |
| | | clearField = () => { |
| | | const { verify } = this.state |
| | | const _this = this |
| | | |
| | | confirm({ |
| | | content: `确定清空Excel列吗?`, |
| | | onOk() { |
| | | _this.setState({ |
| | | verify: { |
| | | ...verify, |
| | | columns: [] |
| | | } |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { card } = this.props |
| | | const { verify, excelColumns, defaultscript } = this.state |
| | |
| | | return ( |
| | | <div id="verify-excelout-box-tab"> |
| | | <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}> |
| | | <TabPane tab="Excel导出列" key="1"> |
| | | <TabPane tab={ |
| | | <span> |
| | | Excel导出列 |
| | | {verify.columns.length ? <span className="count-tip">{verify.columns.length}</span> : null} |
| | | </span> |
| | | } key="1"> |
| | | <ColumnForm |
| | | dict={this.props.dict} |
| | | columnChange={this.columnChange} |
| | |
| | | /> |
| | | <Button className="excel-col-add mk-green" title="添加显示列字段" onClick={this.columnFieldInput}> |
| | | 同步显示列 |
| | | </Button> |
| | | <Button className="excel-col-add mk-red" title="清空Excel列" onClick={this.clearField}> |
| | | 清空Excel列 |
| | | </Button> |
| | | <Table |
| | | bordered |
| | |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | {card.intertype === 'inner' && !card.innerFunc ? <TabPane tab="自定义脚本" key="6"> |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 自定义脚本 |
| | | {verify.enable === 'true' ? <span className="count-tip">1</span> : null} |
| | | </span> |
| | | } key="6"> |
| | | <Form {...formItemLayout} className="verify-form"> |
| | | <Row gutter={24}> |
| | | <Col span={8}> |
| | |
| | | message: this.props.dict['form.required.input'] + 'sql!' |
| | | } |
| | | ] |
| | | })(<TextArea rows={15} />)} |
| | | })(<CodeMirror />)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |