| | |
| | | import Utils from '@/utils/utils.js' |
| | | |
| | | import UniqueForm from './uniqueform' |
| | | import ContrastForm from './contrastform' |
| | | import CustomForm from './customform' |
| | | import CustomScript from './customscript' |
| | | import BillcodeForm from './billcodeform' |
| | |
| | | state = { |
| | | verify: {}, |
| | | fields: [], |
| | | usefulfields: '', |
| | | orderModular: [], |
| | | orderModularDetail: [], |
| | | voucher: [], |
| | |
| | | { |
| | | title: '字段名', |
| | | dataIndex: 'field', |
| | | width: '45%' |
| | | width: '35%' |
| | | }, |
| | | { |
| | | title: '报错编码', |
| | | dataIndex: 'errorCode', |
| | | width: '15%' |
| | | width: '12%' |
| | | }, |
| | | { |
| | | title: '验证类型', |
| | | dataIndex: 'verifyType', |
| | | width: '13%', |
| | | render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证' |
| | | }, |
| | | { |
| | | title: '状态', |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | </div>) |
| | | } |
| | | ], |
| | | contrastColumns: [ |
| | | { |
| | | title: '内容1', |
| | | dataIndex: 'frontfield', |
| | | width: '13%' |
| | | }, |
| | | { |
| | | title: '运算符', |
| | | dataIndex: 'operator', |
| | | width: '13%' |
| | | }, |
| | | { |
| | | title: '内容2', |
| | | dataIndex: 'backfield', |
| | | width: '13%', |
| | | }, |
| | | { |
| | | title: '提示信息', |
| | | dataIndex: 'errmsg', |
| | | width: '13%' |
| | | }, |
| | | { |
| | | title: '报错编码', |
| | | dataIndex: 'errorCode', |
| | | width: '13%' |
| | | }, |
| | | { |
| | | title: '状态', |
| | | dataIndex: 'status', |
| | | width: '15%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['header.form.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | {this.props.dict['header.form.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '20%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'contrast')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | | cancelText={this.props.dict['header.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'contrast') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'contrast', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'contrast', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'contrast')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | </div>) |
| | | } |
| | | ], |
| | |
| | | ], |
| | | orderColumns: [ |
| | | { |
| | | title: '函数变量', |
| | | title: this.props.dict['header.form.funcvar'], |
| | | dataIndex: 'fieldName', |
| | | width: '13%', |
| | | render: (text, record) => (`${record.fieldName || ''}(${record.field})`) |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { columns } = this.props |
| | | let _verify = this.props.card.verify || {} |
| | | |
| | | this.setState({ |
| | | verify: { |
| | | invalid: _verify.invalid || 'false', |
| | | uniques: _verify.uniques || [], |
| | | contrasts: _verify.contrasts || [], |
| | | accountdate: _verify.accountdate || 'false', |
| | | customverifys: _verify.customverifys || [], |
| | | billcodes: _verify.billcodes || [], |
| | |
| | | _fields = _LongParam.fields |
| | | } |
| | | |
| | | let _usefulfields = [] |
| | | _fields.forEach(_f => { |
| | | if (_f.field) { |
| | | _usefulfields.push(_f.field) |
| | | } |
| | | }) |
| | | |
| | | if (columns && columns.length > 0) { |
| | | columns.forEach(_f => { |
| | | if (_f.field) { |
| | | _usefulfields.push(_f.field) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _usefulfields = Array.from(new Set(_usefulfields)) |
| | | _usefulfields = _usefulfields.join(', ') |
| | | |
| | | |
| | | this.setState({ |
| | | fields: _fields |
| | | fields: _fields, |
| | | usefulfields: _usefulfields |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | }) |
| | | } |
| | | |
| | | contrastChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | | if (values.uuid) { |
| | | verify.contrasts = verify.contrasts.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | values.uuid = Utils.getuuid() |
| | | verify.contrasts.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | customChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | |
| | | verify.billcodes = verify.billcodes.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'scripts') { |
| | | verify.scripts = verify.scripts.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'contrast') { |
| | | verify.contrasts = verify.contrasts.filter(item => item.uuid !== record.uuid) |
| | | } |
| | | |
| | | this.setState({ verify: verify }) |
| | |
| | | this.orderForm.edit(record) |
| | | } else if (type === 'scripts') { |
| | | this.scriptsForm.edit(record) |
| | | } else if (type === 'contrast') { |
| | | this.contrastForm.edit(record) |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } else if (type === 'unique') { |
| | | verify.uniques = verify.uniques.map(item => { |
| | | if (item.uuid === record.uuid) { |
| | | return record |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else if (type === 'contrast') { |
| | | verify.contrasts = verify.contrasts.map(item => { |
| | | if (item.uuid === record.uuid) { |
| | | return record |
| | | } else { |
| | |
| | | } else { |
| | | verify.customverifys.splice(index + 1, 0, record) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } else if (type === 'unique') { |
| | | verify.uniques = verify.uniques.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | |
| | | } else { |
| | | verify.uniques.splice(index + 1, 0, record) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | } else if (type === 'contrast') { |
| | | verify.contrasts = verify.contrasts.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.contrasts.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.contrasts.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.contrasts.splice(index + 1, 0, record) |
| | | } |
| | | } else if (type === 'ordercode') { |
| | | verify.billcodes = verify.billcodes.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | |
| | | } else { |
| | | verify.billcodes.splice(index + 1, 0, record) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } else if (type === 'scripts') { |
| | | verify.scripts = verify.scripts.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | |
| | | } else { |
| | | verify.scripts.splice(index + 1, 0, record) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | voucherChange = (voucher) => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | // const { getFieldDecorator } = this.props.form |
| | | const { verify, fields, uniqueColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state |
| | | const { verify, fields, uniqueColumns, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | <TabPane tab="比较验证" key="2x"> |
| | | <ContrastForm |
| | | dict={this.props.dict} |
| | | contrastChange={this.contrastChange} |
| | | wrappedComponentRef={(inst) => this.contrastForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.contrasts} |
| | | columns={contrastColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="唯一性验证" key="2"> |
| | | <UniqueForm |
| | | fields={fields} |
| | |
| | | <TabPane tab="自定义验证" key="3"> |
| | | <CustomForm |
| | | dict={this.props.dict} |
| | | usefulfields={this.state.usefulfields} |
| | | customChange={this.customChange} |
| | | wrappedComponentRef={(inst) => this.customForm = inst} |
| | | /> |
| | |
| | | </TabPane> |
| | | <TabPane tab="自定义脚本" key="6"> |
| | | <CustomScript |
| | | fields={fields} |
| | | usefulfields={this.state.usefulfields} |
| | | dict={this.props.dict} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |