| | |
| | | dataIndex: 'field', |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | width: '28%' |
| | | }, |
| | | { |
| | |
| | | columnChange = (values) => { |
| | | const { columns } = this.state |
| | | |
| | | let fields = columns.map(item => item.field) |
| | | if (fields.includes(values.field)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | values.uuid = Utils.getuuid() |
| | | |
| | | this.setState({ columns: [...columns, values] }) |
| | |
| | | * @description 更新搜索条件配置信息 |
| | | */ |
| | | updatesearch = (config) => { |
| | | |
| | | this.setState({ |
| | | config: config |
| | | }) |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { menu } = this.props |
| | | |
| | | let supList = [] |
| | | if (menu.supMenuList && menu.supMenuList.length > 0) { |
| | | supList = menu.supMenuList |
| | | } else if (menu.fstMenuList && menu.FstId) { |
| | | let _menu = menu.fstMenuList.filter(cell => cell.MenuID === menu.FstId)[0] |
| | | supList = _menu ? _menu.children : [] |
| | | } |
| | | |
| | | this.setState({ |
| | | menulist: menu.fstMenuList, |
| | | submenulist: menu.supMenuList |
| | | submenulist: supList |
| | | }) |
| | | } |
| | | |
| | |
| | | sm: { span: 24 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form" id="subqazxcvbn"> |
| | | <Row gutter={24}> |
| | |
| | | class ExcelInColumn extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | columns: PropTypes.array, // 列名集合 |
| | | columnChange: PropTypes.func // 修改函数 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null, // 编辑元素 |
| | | type: 'Nvarchar(50)', |
| | | locked: false |
| | | } |
| | | |
| | | edit = (record) => { |
| | | this.setState({ |
| | | editItem: record, |
| | | type: record.type || 'Nvarchar(50)' |
| | | }, () => { |
| | | if (!/^Nvarchar/.test(record.type)) { |
| | | this.props.form.setFieldsValue({ |
| | | min: record.min, |
| | | max: record.max |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | Column: record.Column, |
| | | Text: record.Text, |
| | | required: record.required || 'true', |
| | | import: record.import || 'true', |
| | | type: record.type |
| | | }) |
| | | if (record.type === 'Int' || /^Decimal/ig.test(record.type)) { |
| | | this.setState({ |
| | | locked: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | locked: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | typeChange = (val) => { |
| | |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | // const { columns } = this.props |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | |
| | | if (/^Nvarchar/ig.test(values.type)) { |
| | | values.limit = values.type.match(/\d+/) ? values.type.match(/\d+/)[0] : '20000' |
| | | } else if (/^Decimal/ig.test(values.type)) { |
| | |
| | | |
| | | this.props.columnChange(values) |
| | | this.setState({ |
| | | editItem: null, |
| | | locked: false, |
| | | type: 'Nvarchar(50)' |
| | | }) |
| | |
| | | } |
| | | } |
| | | |
| | | let haslimit = !/^Nvarchar/.test(this.state.type) |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="verify-form"> |
| | | <Row gutter={24}> |
| | | <Col span={7}> |
| | | <Col span={6}> |
| | | <Form.Item label={dict['model.form.field']}> |
| | | {getFieldDecorator('Column', { |
| | | initialValue: '', |
| | |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Col span={6}> |
| | | <Form.Item label={dict['model.name']}> |
| | | {getFieldDecorator('Text', { |
| | | initialValue: '', |
| | |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Col span={6}> |
| | | <Form.Item label={dict['model.form.type']}> |
| | | {getFieldDecorator('type', { |
| | | initialValue: 'Nvarchar(50)' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="mk-green"> |
| | | {dict['model.save']} |
| | | </Button> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Col span={6}> |
| | | <Form.Item label={dict['model.required']}> |
| | | {getFieldDecorator('required', { |
| | | initialValue: 'true' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={dict['model.import']}> |
| | | <Col span={6}> |
| | | <Form.Item style={{marginBottom: 0}} label={dict['model.import']}> |
| | | {getFieldDecorator('import', { |
| | | initialValue: 'true' |
| | | })( |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {haslimit ? <Col span={7}> |
| | | <Form.Item label={'最小值'}> |
| | | <Col span={6}> |
| | | <Form.Item style={{marginBottom: 0}} label={'最小值'}> |
| | | {getFieldDecorator('min', { |
| | | initialValue: '' |
| | | })(<InputNumber />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {haslimit ? <Col span={7}> |
| | | <Form.Item label={'最大值'}> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item style={{marginBottom: 0}} label={'最大值'}> |
| | | {getFieldDecorator('max', { |
| | | initialValue: '' |
| | | })(<InputNumber />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item style={{marginBottom: 0}} label={' '} colon={false}> |
| | | <Button onClick={this.handleConfirm} type="primary" className="mk-green"> |
| | | {dict['model.add']} |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |
| | |
| | | import UniqueForm from './uniqueform' |
| | | import ColumnForm from './columnform' |
| | | import CustomScript from './customscript' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | { |
| | | title: this.props.dict['model.form.field'], |
| | | dataIndex: 'Column', |
| | | width: '16%', |
| | | width: '14%', |
| | | inputType: 'input', |
| | | unique: true, |
| | | editable: true |
| | | }, |
| | | { |
| | | title: this.props.dict['model.name'], |
| | | dataIndex: 'Text', |
| | | width: '15%', |
| | | width: '14%', |
| | | inputType: 'input', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: this.props.dict['model.form.type'], |
| | | dataIndex: 'type', |
| | | width: '12%', |
| | | editable: true |
| | | width: '15%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | | { value: 'Nvarchar(10)', text: 'Nvarchar(10)' }, |
| | | { value: 'Nvarchar(20)', text: 'Nvarchar(20)' }, |
| | | { value: 'Nvarchar(50)', text: 'Nvarchar(50)' }, |
| | | { value: 'Nvarchar(100)', text: 'Nvarchar(100)' }, |
| | | { value: 'Nvarchar(256)', text: 'Nvarchar(256)' }, |
| | | { value: 'Nvarchar(512)', text: 'Nvarchar(512)' }, |
| | | { value: 'Nvarchar(1024)', text: 'Nvarchar(1024)' }, |
| | | { value: 'Nvarchar(2048)', text: 'Nvarchar(2048)' }, |
| | | { value: 'Nvarchar(max)', text: 'Nvarchar(max)' }, |
| | | { value: 'Int', text: 'Int' }, |
| | | { value: 'Decimal(18,0)', text: 'Decimal(18,0)' }, |
| | | { value: 'Decimal(18,2)', text: 'Decimal(18,2)' }, |
| | | { value: 'Decimal(18,4)', text: 'Decimal(18,4)' }, |
| | | { value: 'Decimal(18,6)', text: 'Decimal(18,6)' }, |
| | | { value: 'date', text: 'date' } |
| | | ] |
| | | }, |
| | | { |
| | | title: this.props.dict['model.required'], |
| | | dataIndex: 'required', |
| | | width: '10%', |
| | | editable: true, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.required === 'true' ? this.props.dict['model.true'] : this.props.dict['model.false'] |
| | | }, |
| | | { |
| | |
| | | dataIndex: 'import', |
| | | width: '10%', |
| | | editable: true, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.import !== 'false' ? this.props.dict['model.true'] : this.props.dict['model.false'] |
| | | }, |
| | | { |
| | | title: '最小值', |
| | | dataIndex: 'min', |
| | | width: '10%', |
| | | required: false, |
| | | inputType: 'number', |
| | | unlimit: true, |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '最大值', |
| | | dataIndex: 'max', |
| | | width: '10%', |
| | | required: false, |
| | | inputType: 'number', |
| | | unlimit: true, |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | ( |
| | | <div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'columns')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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 |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'columns') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div> |
| | | ) |
| | | } |
| | | ], |
| | | uniqueColumns: [ |
| | | { |
| | | title: '字段名', |
| | | title: '列名', |
| | | dataIndex: 'fieldlabel', |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | width: '35%' |
| | | width: '25%', |
| | | editable: true, |
| | | inputType: 'multiStr', |
| | | options: [] |
| | | }, |
| | | { |
| | | title: '报错编码', |
| | | dataIndex: 'errorCode', |
| | | width: '12%' |
| | | width: '12%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | | { value: 'E', text: 'E' }, |
| | | { value: 'N', text: 'N' }, |
| | | { value: 'F', text: 'F' }, |
| | | { value: 'NM', text: 'NM' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '验证类型', |
| | | dataIndex: 'verifyType', |
| | | width: '13%', |
| | | render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证' |
| | | width: '12%', |
| | | render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证', |
| | | inputType: 'select', |
| | | editable: true, |
| | | options: [ |
| | | { value: 'physical', text: '物理验证' }, |
| | | { value: 'logic', text: '逻辑验证' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '状态', |
| | | title: '是否启用', |
| | | dataIndex: 'status', |
| | | width: '15%', |
| | | width: '12%', |
| | | editable: true, |
| | | required: false, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '25%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ], |
| | | scriptsColumns: [ |
| | | { |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { columns, card } = this.props |
| | | const { card } = this.props |
| | | let _verify = fromJS(card.verify || {range: 1}).toJS() |
| | | let _columns = _verify.columns || [] |
| | | |
| | | // 同步显示列 |
| | | if (_columns.length === 0) { |
| | | columns.forEach(col => { |
| | | if (!col.field) return |
| | | let _type = 'Nvarchar(50)' |
| | | let _limit = '50' |
| | | if (col.type === 'number' && !col.decimal) { |
| | | _type = 'Int' |
| | | _limit = '' |
| | | } else if (col.type === 'number') { |
| | | _type = 'Decimal(18,' + col.decimal + ')' |
| | | _limit = col.decimal |
| | | } |
| | | |
| | | let _cell = { |
| | | uuid: col.uuid, |
| | | Column: col.field, |
| | | Text: col.label, |
| | | type: _type, |
| | | limit: _limit, |
| | | import: 'true', |
| | | required: 'true' |
| | | } |
| | | |
| | | if (_type !== 'Nvarchar(50)') { |
| | | _cell.min = 0 |
| | | _cell.max = 999999 |
| | | } |
| | | |
| | | _columns.push(_cell) |
| | | }) |
| | | } else { |
| | | // 旧数据兼容 |
| | | _columns = _columns.map(col => { |
| | | col.required = col.required || 'true' |
| | |
| | | |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: { |
| | |
| | | scripts: _verify.scripts || [], |
| | | uniques: _verify.uniques || [] |
| | | } |
| | | }, () => { |
| | | this.resetUniqueColumns() |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | resetUniqueColumns = () => { |
| | | const { uniqueColumns, verify } = this.state |
| | | |
| | | this.setState({uniqueColumns: uniqueColumns.map(col => { |
| | | if (col.dataIndex === 'field') { |
| | | col.options = verify.columns.map(c => { |
| | | return { |
| | | field: c.Column, |
| | | label: c.Text |
| | | } |
| | | }) |
| | | col.options.unshift({ |
| | | field: 'BID', |
| | | label: 'BID' |
| | | }) |
| | | } |
| | | |
| | | return col |
| | | })}) |
| | | } |
| | | |
| | | columnFieldInput = () => { |
| | |
| | | ...verify, |
| | | columns: _columns |
| | | } |
| | | }, () => { |
| | | this.resetUniqueColumns() |
| | | }) |
| | | } |
| | | |
| | |
| | | ...verify, |
| | | columns: [] |
| | | } |
| | | }, () => { |
| | | _this.resetUniqueColumns() |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | columnChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | | if (values.uuid) { |
| | | verify.columns = verify.columns.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | let fields = verify.columns.map(item => item.Column) |
| | | if (fields.includes(values.Column)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: values.Column + '字段已存在!', |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | return |
| | | } |
| | | |
| | | values.uuid = Utils.getuuid() |
| | | verify.columns.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.resetUniqueColumns() |
| | | }) |
| | | } |
| | | |
| | | changeColumns = (columns) => { |
| | | const { verify } = this.state |
| | | |
| | | columns = columns.map(col => { |
| | | if (/^Nvarchar/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/) ? col.type.match(/\d+/)[0] : '20000' |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/ig)[1] |
| | | col.required = 'true' |
| | | } else if (/^int/ig.test(col.type)) { |
| | | col.required = 'true' |
| | | } else { |
| | | col.limit = '' |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | |
| | | this.setState({verify: {...verify, columns}}, () => { |
| | | this.resetUniqueColumns() |
| | | }) |
| | | } |
| | | |
| | | uniqueChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | | if (values.uuid) { |
| | | verify.uniques = verify.uniques.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | values.status = 'true' |
| | | values.uuid = Utils.getuuid() |
| | | verify.uniques.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | changeUniques = (uniques) => { |
| | | const { verify } = this.state |
| | | |
| | | let change = {} |
| | | verify.columns.forEach(col => { |
| | | change[col.Column] = col.Text |
| | | }) |
| | | |
| | | uniques = uniques.map(item => { |
| | | item.status = item.status || 'true' |
| | | |
| | | if (Array.isArray(item.field)) { |
| | | item.fieldlabel = item.field.map(field => { |
| | | return change[field] || '' |
| | | }) |
| | | |
| | | item.fieldlabel = item.fieldlabel.join(',') |
| | | item.field = item.field.join(',') |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({verify: {...verify, uniques}}) |
| | | } |
| | | |
| | | scriptsChange = (values) => { |
| | |
| | | } |
| | | |
| | | handleEdit = (record, type) => { |
| | | if (type === 'columns') { |
| | | this.columnForm.edit(record) |
| | | } else if (type === 'scripts') { |
| | | if (type === 'scripts') { |
| | | this.scriptsForm.edit(record) |
| | | } else if (type === 'unique') { |
| | | this.uniqueForm.edit(record) |
| | | } |
| | | |
| | | let node = document.getElementById('verify-excel-box-tab').parentNode |
| | |
| | | } |
| | | |
| | | let _loading = false |
| | | if (this.columnForm && this.columnForm.state.editItem) { |
| | | _loading = true |
| | | this.setState({activeKey: 'excelcolumn'}) |
| | | } else if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | | if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | | _loading = true |
| | | this.setState({activeKey: 'scripts'}) |
| | | } else if (this.uniqueForm && this.uniqueForm.state.editItem) { |
| | | _loading = true |
| | | this.setState({activeKey: 'unique'}) |
| | | } |
| | | |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { |
| | |
| | | {verify.columns.length ? <span className="count-tip">{verify.columns.length}</span> : null} |
| | | </span> |
| | | } key="excelcolumn"> |
| | | <ColumnForm |
| | | dict={this.props.dict} |
| | | columns={verify.columns} |
| | | columnChange={this.columnChange} |
| | | wrappedComponentRef={(inst) => this.columnForm = inst} |
| | | /> |
| | | <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 |
| | | rowKey="uuid" |
| | | className="custom-table excel-custom-table" |
| | | dataSource={verify.columns} |
| | | columns={excelColumns} |
| | | pagination={false} |
| | | /> |
| | | <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>注:数值类型(int 或 decimal),内容为必填;最大值和最小值在类型为数值时有效。</Col> |
| | | <EditTable data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/> |
| | | </TabPane> |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | | <span> |
| | |
| | | {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null} |
| | | </span> |
| | | } key="unique"> |
| | | <UniqueForm |
| | | fields={verify.columns} |
| | | dict={this.props.dict} |
| | | uniqueChange={this.uniqueChange} |
| | | wrappedComponentRef={(inst) => this.uniqueForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.uniques} |
| | | columns={uniqueColumns} |
| | | pagination={false} |
| | | /> |
| | | <UniqueForm fields={verify.columns} dict={this.props.dict} uniqueChange={this.uniqueChange}/> |
| | | <EditTable data={verify.uniques} columns={uniqueColumns} onChange={this.changeUniques}/> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | | <span> |
| | |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | .add { |
| | | padding-top: 4px; |
| | | } |
| | | } |
| | | .custom-table .ant-empty { |
| | | margin: 20px 8px!important; |
| | |
| | | float: right; |
| | | right: -9px; |
| | | margin-right: 10px; |
| | | top: -40px; |
| | | top: 10px; |
| | | z-index: 1; |
| | | } |
| | | } |
| | |
| | | uniqueChange: PropTypes.func // 修改函数 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null // 编辑元素 |
| | | } |
| | | |
| | | edit = (record) => { |
| | | this.setState({ |
| | | editItem: record |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | field: record.field.split(','), |
| | | errorCode: record.errorCode, |
| | | verifyType: record.verifyType || 'physical' |
| | | }) |
| | | } |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | const { fields } = this.props |
| | | let change = {} |
| | | |
| | | fields.forEach(col => { |
| | | change[col.Column] = col.Text |
| | | }) |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | values.fieldlabel = values.field.map(field => { |
| | | let item = fields.filter(cell => cell.Column === field)[0] |
| | | let label = '' |
| | | if (item) { |
| | | label = item.Text |
| | | } |
| | | return label |
| | | return change[field] || '' |
| | | }) |
| | | |
| | | values.fieldlabel = values.fieldlabel.join(',') |
| | | values.field = values.field.join(',') |
| | | |
| | | this.setState({ |
| | | editItem: null |
| | | }, () => { |
| | | this.props.uniqueChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | field: [], |
| | | }) |
| | |
| | | return ( |
| | | <Form {...formItemLayout} className="verify-form" id="verifycard1"> |
| | | <Row gutter={24}> |
| | | <Col span={8}> |
| | | <Col span={7}> |
| | | <Form.Item label={'列名'}> |
| | | {getFieldDecorator('field', { |
| | | initialValue: [], |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Col span={7}> |
| | | <Form.Item label={'报错编码'}> |
| | | {getFieldDecorator('errorCode', { |
| | | initialValue: 'E', |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Col span={7}> |
| | | <Form.Item label={'验证类型'}> |
| | | {getFieldDecorator('verifyType', { |
| | | initialValue: 'physical', |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={4} className="add"> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} className="mk-green"> |
| | | 保存 |
| | | 添加 |
| | | </Button> |
| | | </Col> |
| | | </Row> |
| | |
| | | class ExcelOutColumn extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | columns: PropTypes.array, // 列名集合 |
| | | columnChange: PropTypes.func // 修改函数 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null // 编辑元素 |
| | | } |
| | | |
| | | edit = (record) => { |
| | | this.setState({ |
| | | editItem: record |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | Column: record.Column, |
| | | Text: record.Text, |
| | | Width: record.Width |
| | | }) |
| | | } |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | |
| | | this.props.columnChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | Column: '', |
| | | Text: '', |
| | |
| | | </Col> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="mk-green"> |
| | | 保存 |
| | | 添加 |
| | | </Button> |
| | | </Col> |
| | | </Row> |
| | |
| | | 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 } from 'antd' |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Radio } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | |
| | | import ColumnForm from './columnform' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | { |
| | | title: this.props.dict['model.form.field'], |
| | | dataIndex: 'Column', |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: this.props.dict['model.name'], |
| | | dataIndex: 'Text', |
| | | inputType: 'input', |
| | | editable: true, |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: this.props.dict['model.form.columnWidth'], |
| | | dataIndex: 'Width', |
| | | inputType: 'number', |
| | | min: 5, |
| | | max: 200, |
| | | editable: true, |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | ( |
| | | <div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'columns')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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 |
| | | 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> |
| | | </Popconfirm> |
| | | </div> |
| | | ) |
| | | } |
| | | ] |
| | | } |
| | |
| | | columnChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | | if (values.uuid) { |
| | | verify.columns = verify.columns.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | let fields = verify.columns.map(item => item.Column) |
| | | if (fields.includes(values.Column)) { |
| | | notification.warning({ |
| | |
| | | } |
| | | values.uuid = Utils.getuuid() |
| | | verify.columns.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | |
| | | verify.columns = verify.columns.filter(item => item.uuid !== record.uuid) |
| | | |
| | | this.setState({ verify: verify }) |
| | | } |
| | | |
| | | handleEdit = (record, type) => { |
| | | this.columnForm.edit(record) |
| | | |
| | | let node = document.getElementById('verify-excelout-box-tab').parentNode |
| | | |
| | | if (node && node.scrollTop) { |
| | | let inter = Math.ceil(node.scrollTop / 10) |
| | | |
| | | let timer = setInterval(() => { |
| | | if (node.scrollTop - inter > 0) { |
| | | node.scrollTop = node.scrollTop - inter |
| | | } else { |
| | | node.scrollTop = 0 |
| | | clearInterval(timer) |
| | | } |
| | | }, 10) |
| | | } |
| | | } |
| | | |
| | | handleUpDown = (record, type, direction) => { |
| | |
| | | {verify.columns.length ? <span className="count-tip">{verify.columns.length}</span> : null} |
| | | </span> |
| | | } key="1"> |
| | | <ColumnForm |
| | | dict={this.props.dict} |
| | | columnChange={this.columnChange} |
| | | wrappedComponentRef={(inst) => this.columnForm = inst} |
| | | /> |
| | | <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 |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.columns} |
| | | columns={excelColumns} |
| | | pagination={false} |
| | | /> |
| | | <EditTable data={verify.columns} columns={excelColumns} onChange={(columns) => this.setState({verify: {...verify, columns}})}/> |
| | | </TabPane> |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | | <span> |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { is, fromJS } from 'immutable' |
| | | import { Switch } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | class ColorSketch extends Component { |
| | | static propTpyes = { |
| | | defaultValue: PropTypes.any, |
| | | value: PropTypes.any, |
| | | onChange: PropTypes.func |
| | | } |
| | | state = { |
| | | status: true, |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { defaultValue, value } = this.props |
| | | let initVal = 'true' |
| | | |
| | | if (this.props['data-__meta']) { |
| | | initVal = this.props['data-__meta'].initialValue |
| | | } else if (defaultValue) { |
| | | initVal = defaultValue |
| | | } else if (value) { |
| | | initVal = value |
| | | } |
| | | |
| | | if (initVal === 'false') { |
| | | initVal = false |
| | | } else { |
| | | initVal = true |
| | | } |
| | | |
| | | this.setState({status: initVal}) |
| | | } |
| | | |
| | | changeStatus = (val) => { |
| | | this.setState({ status: val }, () => { |
| | | let _val = val ? 'true' : 'false' |
| | | this.props.onChange && this.props.onChange(_val) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { status } = this.state |
| | | return ( |
| | | <Switch checkedChildren="是" unCheckedChildren="否" checked={status} onChange={this.changeStatus} /> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default ColorSketch |
New file |
| | |
| | | .color-sketch-block { |
| | | height: 25px; |
| | | width: 100%; |
| | | |
| | | .color-sketch-block-box { |
| | | display: inline-block; |
| | | width: calc(100% - 160px); |
| | | height: 100%; |
| | | border-radius: 2px; |
| | | background: #ffffff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==') left center; |
| | | } |
| | | .color-sketch-block-inner { |
| | | display: inline-block; |
| | | cursor: pointer; |
| | | border-radius: 2px; |
| | | box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | .color-sketch-value { |
| | | display: inline-block; |
| | | width: 160px; |
| | | padding-left: 10px; |
| | | height: 25px; |
| | | line-height: 25px; |
| | | vertical-align: top; |
| | | white-space: nowrap; |
| | | overflow: visible; |
| | | } |
| | | } |
| | | |
| | | .color-sketch-popover { |
| | | z-index: 1090!important; |
| | | .ant-popover-inner-content { |
| | | padding: 0; |
| | | .sketch-picker { |
| | | width: 250px!important; |
| | | } |
| | | } |
| | | } |
| | |
| | | import React, { Component } from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Input, InputNumber, Popconfirm, Form, Icon, Select, Radio, Cascader } from 'antd' |
| | | import { Table, Input, InputNumber, Popconfirm, Form, Icon, Select, Radio, Cascader, notification } from 'antd' |
| | | |
| | | import ColorSketch from '@/mob/colorsketch' |
| | | import CusSwitch from './cusSwitch' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | |
| | | |
| | | class EditableCell extends Component { |
| | | getInput = (form) => { |
| | | const { inputType, options } = this.props |
| | | const { inputType, options, min, max, unlimit } = this.props |
| | | |
| | | if (inputType === 'number') { |
| | | return <InputNumber min={12} max={50} precision={0} onPressEnter={() => this.getValue(form)} /> |
| | | if (inputType === 'number' && unlimit) { |
| | | return <InputNumber onPressEnter={() => this.getValue(form)} /> |
| | | } else if (inputType === 'number') { |
| | | return <InputNumber min={min} max={max} precision={0} onPressEnter={() => this.getValue(form)} /> |
| | | } else if (inputType === 'color') { |
| | | return <ColorSketch /> |
| | | } else if (inputType === 'switch') { |
| | | return <CusSwitch /> |
| | | } else if (inputType === 'select') { |
| | | return ( |
| | | <Select> |
| | | {options.map((item, i) => (<Select.Option key={i} value={item.field || item.value}> {item.label || item.text} </Select.Option>))} |
| | | </Select> |
| | | ) |
| | | } else if (inputType === 'multiStr') { |
| | | return ( |
| | | <Select mode="multiple"> |
| | | {options.map((item, i) => (<Select.Option key={i} value={item.field || item.value}> {item.label || item.text} </Select.Option>))} |
| | | </Select> |
| | | ) |
| | |
| | | message: ['number', 'text', 'input'].includes(inputType) ? `${eTDict['form.required.input']} ${title}!` : `${eTDict['form.required.select']} ${title}!`, |
| | | } |
| | | ], |
| | | initialValue: record[dataIndex], |
| | | initialValue: inputType === 'multiStr' ? (record[dataIndex] ? record[dataIndex].split(',') : []) : record[dataIndex], |
| | | })(this.getInput(form))} |
| | | </Form.Item> |
| | | ) : ( |
| | |
| | | <span style={{ color: '#1890ff', cursor: 'pointer'}} onClick={() => this.cancel(record.uuid)}>{eTDict['model.cancel']}</span> |
| | | </span> |
| | | ) : ( |
| | | <div className={'operation-btn' + (editingKey !== '' ? ' disabled' : '')}> |
| | | <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')}> |
| | | {!actions || actions.includes('edit') ? <span className="primary" onClick={() => {editingKey === '' && this.edit(record.uuid)}}><Icon type="edit" /></span> : null} |
| | | {!actions || actions.includes('up') ? <span className="primary" onClick={() => {editingKey === '' && this.handleUpDown(record.uuid, 'up')}}><Icon type="arrow-up" /></span> : null} |
| | | {!actions || actions.includes('down') ? <span className="danger" onClick={() => {editingKey === '' && this.handleUpDown(record.uuid, 'down')}}><Icon type="arrow-down" /></span> : null} |
| | |
| | | |
| | | this.setState({ |
| | | data: data || [], |
| | | oricolumns: fromJS(this.props.columns).toJS(), |
| | | columns |
| | | }) |
| | | } |
| | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.state.data), fromJS(nextProps.data))) { |
| | | this.setState({data: nextProps.data, editingKey: ''}) |
| | | } else if (!is(fromJS(this.state.oricolumns), fromJS(nextProps.columns))) { |
| | | let cols = {} |
| | | nextProps.columns.forEach(col => {cols[col.dataIndex] = col}) |
| | | |
| | | this.setState({ |
| | | oricolumns: fromJS(nextProps.columns).toJS(), |
| | | columns: this.state.columns.map(col => { |
| | | if (cols[col.dataIndex]) { |
| | | return cols[col.dataIndex] |
| | | } |
| | | return col |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | onSave = (record) => { |
| | | const { columns } = this.state |
| | | const newData = [...this.state.data] |
| | | const index = newData.findIndex(item => record.uuid === item.uuid) |
| | | |
| | | if (index === -1) return |
| | | if (index === -1) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据错误,无法找到行ID!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let unique = true |
| | | columns.forEach(col => { |
| | | if (col.unique !== true || !unique) return |
| | | |
| | | let _index = newData.findIndex(item => record.uuid !== item.uuid && record[col.dataIndex] === item[col.dataIndex]) |
| | | |
| | | if (_index > -1) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: col.title + '不可重复!', |
| | | duration: 5 |
| | | }) |
| | | unique = false |
| | | } |
| | | }) |
| | | |
| | | if (!unique) return |
| | | |
| | | newData.splice(index, 1, record) |
| | | this.setState({ data: newData, editingKey: '' }, () => { |
| | |
| | | } |
| | | |
| | | save(form, uuid) { |
| | | const { columns } = this.state |
| | | form.validateFields((error, row) => { |
| | | if (error) { |
| | | return; |
| | | } |
| | | const newData = [...this.state.data] |
| | | const index = newData.findIndex(item => uuid === item.uuid) |
| | | |
| | | let unique = true |
| | | columns.forEach(col => { |
| | | if (col.unique !== true || !unique) return |
| | | |
| | | let _index = newData.findIndex(item => uuid !== item.uuid && row[col.dataIndex] === item[col.dataIndex]) |
| | | |
| | | if (_index > -1) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: col.title + '不可重复!', |
| | | duration: 5 |
| | | }) |
| | | unique = false |
| | | } |
| | | }) |
| | | |
| | | if (!unique) return |
| | | |
| | | if (index > -1) { |
| | | const item = newData[index] |
| | | newData.splice(index, 1, { |
| | |
| | | inputType: col.inputType, |
| | | dataIndex: col.dataIndex, |
| | | options: col.options || [], |
| | | min: col.min || 0, |
| | | max: col.max || 500, |
| | | unlimit: col.unlimit, |
| | | required: col.required !== false ? true : false, |
| | | title: col.title, |
| | | editing: this.isEditing(record), |
| | |
| | | thead tr th:last-child { |
| | | text-align: center; |
| | | } |
| | | .operation-btn { |
| | | .edit-operation-btn { |
| | | display: block; |
| | | text-align: center; |
| | | span { |
| | |
| | | .danger { |
| | | color: #ff4d4f; |
| | | } |
| | | span:last-child { |
| | | margin-right: 0px; |
| | | } |
| | | .operation-btn.disabled { |
| | | } |
| | | .edit-operation-btn.disabled { |
| | | cursor: default; |
| | | span { |
| | | cursor: default; |
| | |
| | | import { Form, Row, Col, Select, Button, Input } from 'antd' |
| | | import './index.scss' |
| | | |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | contrastChange: PropTypes.func // 修改函数 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null // 编辑元素 |
| | | } |
| | | |
| | | edit = (record) => { |
| | | this.setState({ |
| | | editItem: record |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | frontfield: record.frontfield, |
| | | operator: record.operator, |
| | | backfield: record.backfield, |
| | | errmsg: record.errmsg, |
| | | errorCode: record.errorCode |
| | | }) |
| | | } |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | |
| | | this.setState({ |
| | | editItem: null |
| | | }, () => { |
| | | this.props.contrastChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | frontfield: '', |
| | | backfield: '', |
| | |
| | | </Col> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="mk-green"> |
| | | 保存 |
| | | {this.props.dict['model.add']} |
| | | </Button> |
| | | </Col> |
| | | <Col span={7}> |
| | |
| | | import CustomScript from './customscript' |
| | | import BillcodeForm from './billcodeform' |
| | | import VoucherForm from './voucherform' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | columnsFields: [], |
| | | uniqueColumns: [ |
| | | { |
| | | title: '字段名', |
| | | title: '名称', |
| | | dataIndex: 'fieldlabel', |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | width: '35%' |
| | | width: '20%', |
| | | editable: true, |
| | | inputType: 'multiStr', |
| | | options: [] |
| | | }, |
| | | { |
| | | title: '报错编码', |
| | | dataIndex: 'errorCode', |
| | | width: '12%' |
| | | width: '12%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | | { value: 'E', text: 'E' }, |
| | | { value: 'N', text: 'N' }, |
| | | { value: 'F', text: 'F' }, |
| | | { value: 'NM', text: 'NM' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '验证类型', |
| | | dataIndex: 'verifyType', |
| | | width: '13%', |
| | | render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证' |
| | | render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证', |
| | | inputType: 'select', |
| | | editable: true, |
| | | options: [ |
| | | { value: 'physical', text: '物理验证' }, |
| | | { value: 'logic', text: '逻辑验证' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '状态', |
| | | title: '是否启用', |
| | | dataIndex: 'status', |
| | | width: '15%', |
| | | width: '13%', |
| | | editable: true, |
| | | required: false, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '25%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ], |
| | | onceUniqueColumns: [ |
| | | { |
| | | title: '字段名', |
| | | dataIndex: 'field', |
| | | width: '45%' |
| | | title: '名称', |
| | | dataIndex: 'fieldlabel', |
| | | width: '30%' |
| | | }, |
| | | { |
| | | title: '状态', |
| | | dataIndex: 'status', |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | width: '30%', |
| | | editable: true, |
| | | inputType: 'multiStr', |
| | | options: [] |
| | | }, |
| | | { |
| | | title: '是否启用', |
| | | dataIndex: 'status', |
| | | width: '20%', |
| | | editable: true, |
| | | required: false, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '25%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ], |
| | | contrastColumns: [ |
| | | { |
| | | title: '内容1', |
| | | dataIndex: 'frontfield', |
| | | width: '13%' |
| | | width: '14%', |
| | | inputType: 'input', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '运算符', |
| | | dataIndex: 'operator', |
| | | width: '13%' |
| | | width: '14%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | | { value: '=', text: '=' }, |
| | | { value: '!=', text: '!=' }, |
| | | { value: '>', text: '>' }, |
| | | { value: '<', text: '<' }, |
| | | { value: '>=', text: '>=' }, |
| | | { value: '<=', text: '<=' }, |
| | | { value: 'in', text: 'in' }, |
| | | { value: 'like', text: 'like' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '内容2', |
| | | dataIndex: 'backfield', |
| | | width: '13%', |
| | | width: '14%', |
| | | inputType: 'input', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '提示信息', |
| | | dataIndex: 'errmsg', |
| | | width: '13%' |
| | | width: '14%', |
| | | inputType: 'input', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '报错编码', |
| | | dataIndex: 'errorCode', |
| | | width: '13%' |
| | | width: '14%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | | { value: 'E', text: 'E' }, |
| | | { value: 'N', text: 'N' }, |
| | | { value: 'F', text: 'F' }, |
| | | { value: 'NM', text: 'NM' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '状态', |
| | | title: '是否启用', |
| | | dataIndex: 'status', |
| | | width: '15%', |
| | | width: '13%', |
| | | editable: true, |
| | | required: false, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | |
| | | <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['model.edit']} onClick={() => this.handleEdit(record, 'contrast')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'contrast') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ], |
| | | customColumns: [ |
| | |
| | | columnsFields: _columns, |
| | | initsql: _sql, |
| | | defaultsql: _defaultsql, |
| | | usefulfields: _usefulfields.join(', ') |
| | | usefulfields: _usefulfields.join(', '), |
| | | uniqueColumns: this.state.uniqueColumns.map(col => { |
| | | if (col.dataIndex === 'field') { |
| | | col.options = _fields |
| | | } |
| | | return col |
| | | }), |
| | | onceUniqueColumns: this.state.onceUniqueColumns.map(col => { |
| | | if (col.dataIndex === 'field') { |
| | | col.options = _columns |
| | | } |
| | | return col |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | |
| | | contrastChange = (values) => { |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (values.uuid) { |
| | | verify.contrasts = verify.contrasts.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | values.status = 'true' |
| | | values.uuid = Utils.getuuid() |
| | | verify.contrasts.push(values) |
| | | } |
| | | |
| | | this.setState({ verify }) |
| | | } |
| | |
| | | |
| | | if (type === 'customverify') { |
| | | verify.customverifys = verify.customverifys.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'unique') { |
| | | verify.uniques = verify.uniques.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'ordercode') { |
| | | 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 }) |
| | |
| | | handleEdit = (record, type) => { |
| | | if (type === 'customverify') { |
| | | this.customForm.edit(record) |
| | | } else if (type === 'unique') { |
| | | this.uniqueForm.edit(record) |
| | | } else if (type === 'ordercode') { |
| | | this.orderForm.edit(record) |
| | | } else if (type === 'scripts') { |
| | | this.scriptsForm.edit(record) |
| | | } else if (type === 'contrast') { |
| | | this.contrastForm.edit(record) |
| | | } |
| | | |
| | | let node = document.getElementById('verify-card-box-tab').parentNode |
| | |
| | | |
| | | if (type === 'customverify') { |
| | | verify.customverifys = verify.customverifys.map(item => { |
| | | if (item.uuid === record.uuid) { |
| | | return record |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } 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 { |
| | |
| | | verify.customverifys.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.customverifys.splice(index + 1, 0, record) |
| | | } |
| | | } else if (type === 'unique') { |
| | | verify.uniques = verify.uniques.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.uniques.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.uniques.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.uniques.splice(index + 1, 0, record) |
| | | } |
| | | } 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) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | changeUniques = (uniques) => { |
| | | const { card } = this.props |
| | | const { verify, fields, columnsFields } = this.state |
| | | |
| | | let _fields = [] |
| | | let change = {} |
| | | if (card.Ot !== 'requiredOnce') { |
| | | _fields = fields |
| | | } else { |
| | | _fields = columnsFields |
| | | } |
| | | |
| | | _fields.forEach(col => { |
| | | change[col.field] = col.label |
| | | }) |
| | | |
| | | uniques = uniques.map(item => { |
| | | item.status = item.status || 'true' |
| | | |
| | | if (Array.isArray(item.field)) { |
| | | item.fieldlabel = item.field.map(field => { |
| | | return change[field] || '' |
| | | }) |
| | | |
| | | item.fieldlabel = item.fieldlabel.join(',') |
| | | item.field = item.field.join(',') |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({verify: {...verify, uniques}}) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { card } = this.props |
| | | let verify = fromJS(this.state.verify).toJS() |
| | |
| | | let _loading = false |
| | | if (this.customForm && this.customForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.uniqueForm && this.uniqueForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.orderForm && this.orderForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.contrastForm && this.contrastForm.state.editItem) { |
| | | _loading = true |
| | | } |
| | | |
| | |
| | | {verify.contrasts.length ? <span className="count-tip">{verify.contrasts.length}</span> : null} |
| | | </span> |
| | | } 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} |
| | | /> |
| | | <ContrastForm dict={this.props.dict} contrastChange={this.contrastChange}/> |
| | | <EditTable data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <span> |
| | |
| | | fields={card.Ot !== 'requiredOnce' ? fields : columnsFields} |
| | | dict={this.props.dict} |
| | | uniqueChange={this.uniqueChange} |
| | | wrappedComponentRef={(inst) => this.uniqueForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.uniques} |
| | | columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} |
| | | pagination={false} |
| | | /> |
| | | <EditTable data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <span> |
| | |
| | | import { Form, Row, Col, Select, Button } from 'antd' |
| | | import './index.scss' |
| | | |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | | btn: PropTypes.object, // 字典项 |
| | |
| | | uniqueChange: PropTypes.func // 修改函数 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null // 编辑元素 |
| | | } |
| | | |
| | | edit = (record) => { |
| | | const { btn } = this.props |
| | | |
| | | this.setState({ |
| | | editItem: record |
| | | }) |
| | | |
| | | let _value = { |
| | | field: record.field.split(',') |
| | | } |
| | | |
| | | if (btn.Ot !== 'requiredOnce') { |
| | | _value.errorCode = record.errorCode |
| | | _value.verifyType = record.verifyType || 'physical' |
| | | } |
| | | |
| | | this.props.form.setFieldsValue(_value) |
| | | } |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | const { fields } = this.props |
| | | let change = {} |
| | | |
| | | fields.forEach(col => { |
| | | change[col.field] = col.label |
| | | }) |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | values.fieldlabel = values.field.map(field => { |
| | | let item = fields.filter(cell => cell.field === field)[0] |
| | | let label = '' |
| | | if (item) { |
| | | label = item.label |
| | | } |
| | | return label |
| | | return change[field] || '' |
| | | }) |
| | | |
| | | values.fieldlabel = values.fieldlabel.join(',') |
| | | values.field = values.field.join(',') |
| | | |
| | | this.setState({ |
| | | editItem: null |
| | | }, () => { |
| | | this.props.uniqueChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | field: [], |
| | | }) |
| | |
| | | return ( |
| | | <Form {...formItemLayout} className="verify-form" id="verifycard1"> |
| | | <Row gutter={24}> |
| | | <Col span={8}> |
| | | <Col span={7}> |
| | | <Form.Item label={'字段名'}> |
| | | {getFieldDecorator('field', { |
| | | initialValue: [], |
| | |
| | | mode="multiple" |
| | | > |
| | | {fields.map(item => ( |
| | | <Select.Option key={item.uuid} value={item.field}>{item.field}</Select.Option> |
| | | <Select.Option key={item.uuid} value={item.field}>{item.label}</Select.Option> |
| | | ))} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {btn.Ot !== 'requiredOnce' ? <Col span={6}> |
| | | {btn.Ot !== 'requiredOnce' ? <Col span={7}> |
| | | <Form.Item label={'报错编码'}> |
| | | {getFieldDecorator('errorCode', { |
| | | initialValue: 'E', |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {btn.Ot !== 'requiredOnce' ? <Col span={6}> |
| | | {btn.Ot !== 'requiredOnce' ? <Col span={7}> |
| | | <Form.Item label={'验证类型'}> |
| | | {getFieldDecorator('verifyType', { |
| | | initialValue: 'physical', |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={4} className="add"> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} className="mk-green"> |
| | | 保存 |
| | | {this.props.dict['model.add']} |
| | | </Button> |
| | | </Col> |
| | | </Row> |
| | |
| | | let _sql = '' |
| | | |
| | | let _initvars = [] // 已赋值字段集 |
| | | let _initfields = [] |
| | | let _initFormfields = [] |
| | | let _initColfields = [] |
| | | let _declarefields = [] |
| | | |
| | | // 获取字段键值对 |
| | |
| | | val = 0 |
| | | } |
| | | } |
| | | _initfields.push(`@${_key}=${val}`) |
| | | _initFormfields.push(`@${_key}=${val}`) |
| | | } else { |
| | | _initfields.push(`@${_key}='${form.value}'`) |
| | | _initFormfields.push(`@${_key}='${form.value}'`) |
| | | } |
| | | } |
| | | |
| | |
| | | _val = 0 |
| | | } |
| | | } |
| | | _initfields.push(`@${_key}=${_val}`) |
| | | _initColfields.push(`@${_key}=${_val}`) |
| | | } else { |
| | | _initfields.push(`@${_key}='${_val}'`) |
| | | _initColfields.push(`@${_key}='${_val}'`) |
| | | } |
| | | } |
| | | |
| | |
| | | Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@ModularDetailCode nvarchar(50)${_declarefields} |
| | | ` |
| | | |
| | | // 变量赋值 |
| | | _initfields = _initfields.join(',') |
| | | if (_initfields) { |
| | | // 表单变量赋值 |
| | | _initFormfields = _initFormfields.join(',') |
| | | if (_initFormfields) { |
| | | _sql += ` |
| | | |
| | | select ${_initfields} |
| | | /* 表单变量赋值 */ |
| | | select ${_initFormfields} |
| | | ` |
| | | } |
| | | // 显示列变量赋值 |
| | | _initColfields = _initColfields.join(',') |
| | | if (_initColfields) { |
| | | _sql += ` |
| | | /* 显示列变量赋值 */ |
| | | select ${_initColfields} |
| | | ` |
| | | } |
| | | |