| | |
| | | // 新建菜单:提交 |
| | | this.addMenuFormRef.handleConfirm().then(param => { |
| | | param.func = 'sPC_MainMenu_Add' |
| | | param.Sort = (this.state.menulist.length + 1) * 10 |
| | | param.Sort = (this.props.menulist.length + 1) * 10 |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | |
| | | this.setState({ |
| | | confirmLoading: false, |
| | | addMvisible: false, |
| | | menulist: null |
| | | }) |
| | | this.props.reload() |
| | | } else { |
| | |
| | | _this.setState({ |
| | | editMvisible: false, |
| | | editMenu: null, |
| | | menulist: null |
| | | }) |
| | | _this.props.reload() |
| | | } else { |
| | |
| | | } |
| | | |
| | | let _data = this.props.data ? this.props.data : [] |
| | | console.log(selectId) |
| | | console.log(pickup) |
| | | console.log(isSingleSelect) |
| | | |
| | | if (selectId && pickup && isSingleSelect) { |
| | | _data = _data.filter(item => item[setting.primaryKey] === selectId) |
| | | } |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'funcvar') { |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.linkfield || '', |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | |
| | | key: key, |
| | | value: vals.join(',') |
| | | }) |
| | | } else if (this.state.datatype[key] === 'funcvar') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | } else { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | |
| | | <Icon type="upload" /> 点击上传 |
| | | </Button> |
| | | } |
| | | {card.type === 'funcvar' && |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.linkfield} /> |
| | | } |
| | | <div className="input-mask"></div> |
| | | </div> |
| | | </div>} |
| | |
| | | selectedTables: [], // 已选表名 |
| | | originConfig: null, // 原始菜单 |
| | | groupVisible: false, // 全局配置模态框 |
| | | curgroup: null // 当前组,新建或编辑 |
| | | curgroup: null, // 当前组,新建或编辑 |
| | | formItems: [], // 表单可选类型 |
| | | billCodes: null // 按钮中定义的单号生成函数字段集 |
| | | } |
| | | |
| | | /** |
| | |
| | | // 主菜单已有选择的表名,模态框没有表名时,复制主菜单表名 |
| | | _config.tables = _config.tables.length === 0 ? _menu.tables : _config.tables |
| | | |
| | | let _formItems = JSON.parse(JSON.stringify((Source.searchItems))) |
| | | if (editAction && editAction.intertype === 'inner' && !editAction.innerFunc) { |
| | | _formItems.push({ |
| | | type: 'form', |
| | | label: '函数变量', |
| | | subType: 'funcvar', |
| | | url: '' |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | menu: _menu, |
| | | config: _config, |
| | | formItems: _formItems, |
| | | billCodes: editAction && editAction.verify && editAction.verify.billcodes ? editAction.verify.billcodes : [], |
| | | selectedTables: _config.tables || [], |
| | | originConfig: JSON.parse(JSON.stringify(_config)), |
| | | modalformlist: [ |
| | |
| | | * 3、设置编辑参数项-formlist |
| | | */ |
| | | handleForm = (card) => { |
| | | const { billCodes } = this.state |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | |
| | | }, { |
| | | value: 'datetime', |
| | | text: this.state.dict['header.form.datetime'] |
| | | }, { |
| | | value: 'funcvar', |
| | | text: '函数变量' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkfield', |
| | | label: '关联变量', |
| | | initVal: card.linkfield || '', |
| | | required: true, |
| | | options: billCodes.map(code => { |
| | | code.value = code.field |
| | | code.text = code.field |
| | | return code |
| | | }) |
| | | } |
| | | ] |
| | | }) |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { menu, config } = this.state |
| | | const { menu, config, formItems } = this.state |
| | | |
| | | return ( |
| | | <div className="modal-form-board"> |
| | |
| | | </Panel> |
| | | <Panel header={this.state.dict['header.menu.form']} key="1"> |
| | | <div className="search-element"> |
| | | {Source.searchItems.map((item, index) => { |
| | | {formItems.map((item, index) => { |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | </div> |
| | |
| | | > |
| | | {<ModalForm |
| | | dict={this.state.dict} |
| | | formlist={this.state.formlist} |
| | | card={this.state.card} |
| | | billCodes={this.state.billCodes} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | />} |
| | | </Modal> |
| | |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, |
| | | card: PropTypes.object |
| | | card: PropTypes.object, |
| | | billCodes: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let formlist = JSON.parse(JSON.stringify(this.props.formlist)) |
| | | |
| | | console.log(formlist) |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required'] // 默认显示项 |
| | |
| | | |
| | | if (type === 'link') { // 关联类型、增加关联字段 |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | console.log(type) |
| | | if (type === 'funcvar') { |
| | | _options = ['label', 'field', 'linkfield'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | if (value === 'link') { |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | if (value === 'funcvar') { |
| | | _options = ['label', 'field', 'linkfield'] |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: value, |
| | |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'initval' && value !== 'fileupload') { |
| | | if (form.key === 'initval' && value !== 'fileupload' && value !== 'funcvar') { |
| | | form.hidden = false |
| | | } |
| | | return form |
| | |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let rules = [] |
| | | if (item.key === 'field') { |
| | | rules = [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }] |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | }, |
| | | ...rules |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} |
| | | </Form.Item> |
| | |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | let isvalid = true |
| | | values.id = this.props.card.id |
| | | values.uuid = this.props.card.uuid |
| | | // 下拉菜单或关联菜单 |
| | | if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '0') { |
| | |
| | | values.options = [] |
| | | } |
| | | |
| | | if (!values.type) { |
| | | values.type = 'funcvar' |
| | | values.readonly = 'true' |
| | | } |
| | | if (isvalid) { |
| | | resolve(values) |
| | | } else { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Button, InputNumber } from 'antd' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Button, notification } from 'antd' |
| | | import './index.scss' |
| | | |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | billCode: PropTypes.object, // 表单 |
| | | billCodeChange: PropTypes.func // 表单 |
| | | modular: PropTypes.array, // 表单 |
| | | modularDetail: PropTypes.array, // 表单 |
| | | orderChange: PropTypes.func, // 表单 |
| | | orderCheck: PropTypes.func // 表单 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null, |
| | | modularDetail: [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (this.props.modular.length > 0) { |
| | | this.setState({ |
| | | modularDetail: this.props.modularDetail.filter(item => item.BID === this.props.modular[0].ID) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.modular), fromJS(nextProps.modular))) { |
| | | let _detail = nextProps.modularDetail.filter(item => item.BID === nextProps.modular[0].ID) |
| | | |
| | | this.setState({ |
| | | modularDetail: _detail |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | ModularCode: nextProps.modular[0].ID, |
| | | ModularDetailCode: _detail[0] ? _detail[0].ModularDetailCode : '' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | edit = (record) => { |
| | | let _detail = this.props.modularDetail.filter(item => item.BID === record.ModularCode) |
| | | let _modularDetailCode = '' |
| | | |
| | | if (_detail.filter(item => item.ModularDetailCode === record.ModularDetailCode).length > 0) { |
| | | _modularDetailCode = record.ModularDetailCode |
| | | } |
| | | |
| | | this.setState({ |
| | | editItem: record, |
| | | modularDetail: _detail |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | field: record.field, |
| | | TypeCharOne: record.TypeCharOne, |
| | | ModularCode: record.ModularCode, |
| | | ModularDetailCode: _modularDetailCode, |
| | | errmsg: record.errmsg, |
| | | errorCode: record.errorCode |
| | | }) |
| | | } |
| | | |
| | | voucherChange = (value) => { |
| | | let _detail = this.props.modularDetail.filter(item => item.BID === value) |
| | | |
| | | this.setState({ |
| | | modularDetail: _detail |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | ModularDetailCode: _detail[0] ? _detail[0].ModularDetailCode : '' |
| | | }) |
| | | } |
| | | |
| | | |
| | |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | values.field = values.field.join(',') |
| | | // 一级菜单值为20190203125926873D6029A9C511041719420时TypeCharTwo=TableCode,其他用BillCode |
| | | if (values.ModularCode === '20190203125926873D6029A9C511041719420') { |
| | | values.TypeCharTwo = 'TableCode' |
| | | } else { |
| | | values.TypeCharTwo = 'BillCode' |
| | | } |
| | | // 设置类型名称,用于列表显示 |
| | | let billType = { |
| | | Y: '单号', |
| | | n: '编码', |
| | | Lp: '行号', |
| | | BN: '批次', |
| | | } |
| | | values.billType = billType[values.TypeCharOne] |
| | | |
| | | this.props.uniqueChange(values) |
| | | // 设置凭证类型中文名 |
| | | let ModularCode = this.props.modular.filter(item => item.ID === values.ModularCode)[0] |
| | | values.ModularCodeName = ModularCode.NameNO |
| | | |
| | | // 设置流水号位数 |
| | | let _detail = this.state.modularDetail.filter(item => item.ModularDetailCode === values.ModularDetailCode)[0] |
| | | values.Type = _detail.Type |
| | | let _vaild = this.props.orderCheck(values) |
| | | |
| | | if (!_vaild) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段值不可重复', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.props.orderChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | field: '', |
| | | errmsg: '' |
| | | }) |
| | | } |
| | | }) |
| | |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { billCode } = this.props |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | sm: { span: 10 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | sm: { span: 14 } |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="custom-verify-form"> |
| | | <Form {...formItemLayout} className="verify-form"> |
| | | <Row gutter={24}> |
| | | <Col span={6}> |
| | | <Form.Item label={'字段'}> |
| | | {getFieldDecorator('field', { |
| | | initialValue: billCode.ModularDetailCode || '', |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '凭证标识!' |
| | | message: this.props.dict['form.required.input'] + '字段!' |
| | | }, |
| | | { |
| | | pattern: /^[0-9a-zA-Z_]*$/, |
| | | message: '名称只允许包含数字、字母和下划线,且以指定字符开始。' |
| | | }, |
| | | { |
| | | max: 50, |
| | | message: '名称不超过50个字符。' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'单号类型'}> |
| | | <Form.Item label={'类型'}> |
| | | {getFieldDecorator('TypeCharOne', { |
| | | initialValue: billCode.TypeCharOne || 'Y', |
| | | initialValue: 'Y', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '单号类型!' |
| | | message: this.props.dict['form.required.select'] + '类型!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'凭证类型'}> |
| | | {getFieldDecorator('ModularCode', { |
| | | initialValue: this.props.modular[0] ? this.props.modular[0].ID : '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '凭证类型!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.voucherChange(value)}} |
| | | > |
| | | {this.props.modular.map(option => |
| | | <Select.Option id={option.ID} key={option.ID} value={option.ID}> |
| | | {option.NameNO} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'凭证标识'}> |
| | | {getFieldDecorator('ModularDetailCode', { |
| | | initialValue: billCode.ModularDetailCode || '', |
| | | initialValue: this.state.modularDetail[0] ? this.state.modularDetail[0].ModularDetailCode : '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '凭证标识!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'流水码位数'}> |
| | | {getFieldDecorator('Type', { |
| | | initialValue: billCode.Type || 4, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '流水码位数!' |
| | | } |
| | | ] |
| | | })(<InputNumber defaultValue={4} min={1} max={10} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'类型'}> |
| | | {getFieldDecorator('TypeCharTwo', { |
| | | initialValue: billCode.TypeCharTwo || 'BillCode', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '类型!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select> |
| | | <Select.Option value="BillCode"> 业务 </Select.Option> |
| | | <Select.Option value="TableCode"> 主数据 </Select.Option> |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | > |
| | | {this.state.modularDetail.map(option => |
| | | <Select.Option id={option.ModularDetailCode} key={option.ModularDetailCode} value={option.ModularDetailCode}> |
| | | {option.CodeName} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'报错信息'}> |
| | | <Form.Item label={'提示信息'}> |
| | | {getFieldDecorator('errmsg', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '报错信息!' |
| | | message: this.props.dict['form.required.input'] + '提示信息!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | sql: record.sql, |
| | | result: record.result, |
| | | errmsg: record.errmsg, |
| | | errorCode: record.errorCode |
| | | }) |
| | |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | values.resultName = values.result === 'false' ? '不存在' : '存在' |
| | | |
| | | this.props.customChange(values) |
| | | this.setState({ |
| | |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | sql: '', |
| | | errmsg: '', |
| | | errorCode: 'E' |
| | | errmsg: '' |
| | | }) |
| | | } |
| | | }) |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="custom-verify-form" id="verifycard2"> |
| | | <Form {...formItemLayout} className="verify-form" id="verifycard2"> |
| | | <Row gutter={24}> |
| | | <Col span={10} className="sql"> |
| | | <Col span={21} className="sql"> |
| | | <Form.Item label={'sql'}> |
| | | {getFieldDecorator('sql', { |
| | | initialValue: '', |
| | |
| | | message: this.props.dict['form.required.input'] + 'sql!' |
| | | } |
| | | ] |
| | | })(<TextArea rows={3} />)} |
| | | })(<TextArea rows={2} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'报错信息'}> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="add-row"> |
| | | 确定 |
| | | </Button> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={'结果'}> |
| | | {getFieldDecorator('result', { |
| | | initialValue: 'true', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '结果!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select> |
| | | <Select.Option value="true"> 存在 </Select.Option> |
| | | <Select.Option value="false"> 不存在 </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={'提示信息'}> |
| | | {getFieldDecorator('errmsg', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '报错信息!' |
| | | message: this.props.dict['form.required.input'] + '提示信息!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Col span={7}> |
| | | <Form.Item label={'报错编码'}> |
| | | {getFieldDecorator('errorCode', { |
| | | initialValue: 'E', |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={2} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="add-row"> |
| | | 确定 |
| | | </Button> |
| | | </Col> |
| | | |
| | | </Row> |
| | | </Form> |
| | | ) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Tabs, Row, Col, Radio, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber } from 'antd' |
| | | import moment from 'moment' |
| | | import Utils from '@/utils/utils.js' |
| | | import UniqueForm from './uniqueform' |
| | | import CustomForm from './customform' |
| | | import BillcodeForm from './billcodeform' |
| | | import VoucherForm from './voucherform' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | |
| | | |
| | | state = { |
| | | verify: {}, |
| | | fields: [] |
| | | fields: [], |
| | | orderModular: [], |
| | | orderModularDetail: [], |
| | | voucher: [], |
| | | voucherDetail: [], |
| | | uniqueColumns: [ |
| | | { |
| | | title: '字段名', |
| | | dataIndex: 'field', |
| | | width: '50%' |
| | | }, |
| | | { |
| | | title: '提示信息', |
| | | dataIndex: 'errmsg', |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: 'ErrorCode', |
| | | dataIndex: 'errorCode', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '15%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(record, 'unique')}> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | </div>) |
| | | } |
| | | ], |
| | | customColumns: [ |
| | | { |
| | | title: 'SQL', |
| | | dataIndex: 'sql', |
| | | width: '40%' |
| | | }, |
| | | { |
| | | title: '结果', |
| | | dataIndex: 'resultName', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '提示信息', |
| | | dataIndex: 'errmsg', |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: 'ErrorCode', |
| | | dataIndex: 'errorCode', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '15%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(record, 'customverify')}> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | </div>) |
| | | } |
| | | ], |
| | | orderColumns: [ |
| | | { |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | width: '15%' |
| | | }, |
| | | { |
| | | title: '类型', |
| | | dataIndex: 'billType', |
| | | width: '10%', |
| | | }, |
| | | { |
| | | title: '凭证类型', |
| | | dataIndex: 'ModularCodeName', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '凭证标识', |
| | | dataIndex: 'ModularDetailCode', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '流水号位数', |
| | | dataIndex: 'Type', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '提示信息', |
| | | dataIndex: 'errmsg', |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: 'ErrorCode', |
| | | dataIndex: 'errorCode', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '15%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(record, 'ordercode')}> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'ordercode', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | </div>) |
| | | } |
| | | ] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | uniques: _verify.uniques || [], |
| | | accountdate: _verify.accountdate || 'false', |
| | | customverifys: _verify.customverifys || [], |
| | | billCode: _verify.billCode || {} |
| | | billcodes: _verify.billcodes || [], |
| | | voucher: _verify.voucher || {enabled: false}, |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | componentDidMount() { |
| | | // 获取生成单号一级菜单 |
| | | let defer1 = new Promise(resolve => { |
| | | let _orderSql = 'select ID,ModularCode+ModularName+ModularNo as NameNO from sModular where deleted=0 order by ID asc' |
| | | _orderSql = Utils.formatOptions(_orderSql) |
| | | |
| | | let orderParam = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: _orderSql, |
| | | obj_name: 'data', |
| | | arr_field: 'ID,NameNO' |
| | | } |
| | | |
| | | orderParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | orderParam.secretkey = Utils.encrypt(orderParam.LText, orderParam.timestamp) |
| | | |
| | | Api.getSystemConfig(orderParam).then(res => { |
| | | if (res.status) { |
| | | resolve(res) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | // 获取生成单号二级菜单 |
| | | let defer2 = new Promise(resolve => { |
| | | let _orderDetailSql = 'select ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,BID,Type from sModularDetail where Deleted=0' |
| | | _orderDetailSql = Utils.formatOptions(_orderDetailSql) |
| | | |
| | | let orderDetailParam = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: _orderDetailSql, |
| | | obj_name: 'data', |
| | | arr_field: 'ModularDetailCode,CodeName,BID,Type' |
| | | } |
| | | |
| | | orderDetailParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | orderDetailParam.secretkey = Utils.encrypt(orderDetailParam.LText, orderDetailParam.timestamp) |
| | | |
| | | Api.getSystemConfig(orderDetailParam).then(res => { |
| | | if (res.status) { |
| | | resolve(res) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | Promise.all([defer1, defer2]).then(result => { |
| | | this.setState({ |
| | | orderModular: result[0].data, |
| | | orderModularDetail: result[1].data |
| | | }) |
| | | }) |
| | | |
| | | // 获取凭证二级菜单 |
| | | let defer3 = new Promise(resolve => { |
| | | let _voucherSql = 'select ID,ModularCode+ModularName+ModularNo as NameNO,TypeCharOne from sModular where deleted=0' |
| | | _voucherSql = Utils.formatOptions(_voucherSql) |
| | | |
| | | let voucherParam = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: _voucherSql, |
| | | obj_name: 'data', |
| | | arr_field: 'ID,NameNO,TypeCharOne' |
| | | } |
| | | |
| | | voucherParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | voucherParam.secretkey = Utils.encrypt(voucherParam.LText, voucherParam.timestamp) |
| | | |
| | | Api.getSystemConfig(voucherParam).then(res => { |
| | | if (res.status) { |
| | | resolve(res) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | // 获取凭证三级菜单 |
| | | let defer4 = new Promise(resolve => { |
| | | let _voucherDetailSql = 'select ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,BID, VoucherTypeTwo, IDefine1 from sModularDetail where Deleted=0 and VoucherTypeTwo!=\'\'' |
| | | _voucherDetailSql = Utils.formatOptions(_voucherDetailSql) |
| | | |
| | | let voucherDetailParam = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: _voucherDetailSql, |
| | | obj_name: 'data', |
| | | arr_field: 'ModularDetailCode,CodeName,BID,VoucherTypeTwo,IDefine1' |
| | | } |
| | | |
| | | voucherDetailParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | voucherDetailParam.secretkey = Utils.encrypt(voucherDetailParam.LText, voucherDetailParam.timestamp) |
| | | |
| | | Api.getSystemConfig(voucherDetailParam).then(res => { |
| | | if (res.status) { |
| | | resolve(res) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | Promise.all([defer3, defer4]).then(result => { |
| | | this.setState({ |
| | | voucher: result[0].data, |
| | | voucherDetail: result[1].data |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | uniqueChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | orderChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | | if (values.uuid) { |
| | | verify.billcodes = verify.billcodes.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | values.uuid = Utils.getuuid() |
| | | verify.billcodes.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | orderCheck = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let valid = true |
| | | verify.billcodes.forEach(item => { |
| | | if (item.uuid !== values.uuid && item.field === values.field) { |
| | | valid = false |
| | | } |
| | | }) |
| | | return valid |
| | | } |
| | | |
| | | onOptionChange = (e, key) => { |
| | | const { verify } = this.state |
| | | let value = e.target.value |
| | |
| | | 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) |
| | | } |
| | | |
| | | this.setState({ verify: verify }) |
| | |
| | | this.customForm.edit(record) |
| | | } else if (type === 'unique') { |
| | | this.uniqueForm.edit(record) |
| | | } else if (type === 'ordercode') { |
| | | this.orderForm.edit(record) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } else if (type === 'ordercode') { |
| | | verify.billcodes = verify.billcodes.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.billcodes.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.billcodes.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.billcodes.splice(index + 1, 0, record) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | } |
| | | |
| | | voucherChange = (voucher) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: { |
| | | ...verify, |
| | | voucher: voucher |
| | | } |
| | | }) |
| | | } |
| | | |
| | | showError = (errorType) => { |
| | |
| | | |
| | | render() { |
| | | // const { getFieldDecorator } = this.props.form |
| | | const { verify, fields } = this.state |
| | | const { verify, fields, uniqueColumns, customColumns, orderColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | let uniqueColumns = [ |
| | | { |
| | | title: '字段名', |
| | | dataIndex: 'field', |
| | | width: '50%' |
| | | }, |
| | | { |
| | | title: 'ErrorMessage', |
| | | dataIndex: 'errmsg', |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: 'ErrorCode', |
| | | dataIndex: 'errorCode', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '15%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(record, 'unique')}> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | </div>) |
| | | } |
| | | ] |
| | | |
| | | let columns = [ |
| | | { |
| | | title: 'SQL', |
| | | dataIndex: 'sql', |
| | | width: '50%' |
| | | }, |
| | | { |
| | | title: 'ErrorMessage', |
| | | dataIndex: 'errmsg', |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: 'ErrorCode', |
| | | dataIndex: 'errorCode', |
| | | width: '10%' |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '15%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(record, 'customverify')}> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | </div>) |
| | | } |
| | | ] |
| | | |
| | | return ( |
| | | <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}> |
| | |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.customverifys} |
| | | columns={columns} |
| | | columns={customColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="单号生成" key="4"> |
| | | {verify.billCode ? <BillcodeForm dict={this.props.dict} billCode={verify.billCode} /> : null} |
| | | <BillcodeForm |
| | | dict={this.props.dict} |
| | | modular={orderModular} |
| | | modularDetail={orderModularDetail} |
| | | orderChange={this.orderChange} |
| | | orderCheck={this.orderCheck} |
| | | wrappedComponentRef={(inst) => this.orderForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.billcodes} |
| | | columns={orderColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="信息提示" key="5"> |
| | | <TabPane tab="创建凭证" key="5"> |
| | | <VoucherForm |
| | | dict={this.props.dict} |
| | | voucher={voucher} |
| | | voucherobj={verify.voucher} |
| | | voucherDetail={voucherDetail} |
| | | voucherChange={this.voucherChange} |
| | | wrappedComponentRef={(inst) => this.voucherForm = inst} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="信息提示" key="6"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | |
| | | .ant-tabs-content { |
| | | min-height: 40vh; |
| | | } |
| | | .custom-verify-form { |
| | | .verify-form { |
| | | .sql { |
| | | .ant-col-sm-8 { |
| | | width: 25%; |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-sm-16 { |
| | | width: 75%; |
| | | width: 89.5%; |
| | | padding-top: 4px; |
| | | } |
| | | } |
| | |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | field: [], |
| | | errmsg: '', |
| | | errorCode: 'E' |
| | | errmsg: '' |
| | | }) |
| | | } |
| | | }) |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="custom-verify-form" id="verifycard1"> |
| | | <Form {...formItemLayout} className="verify-form" id="verifycard1"> |
| | | <Row gutter={24}> |
| | | <Col span={10}> |
| | | <Form.Item label={'字段名'}> |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'报错信息'}> |
| | | <Form.Item label={'提示信息'}> |
| | | {getFieldDecorator('errmsg', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '报错信息!' |
| | | message: this.props.dict['form.required.input'] + '提示信息!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Switch } from 'antd' |
| | | import './index.scss' |
| | | |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | voucherobj: PropTypes.object, // 凭证信息 |
| | | voucher: PropTypes.array, // 表单 |
| | | voucherDetail: PropTypes.array, // 表单 |
| | | voucherChange: PropTypes.func // 表单 |
| | | } |
| | | |
| | | state = { |
| | | voucher: [], |
| | | voucherDetail: [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (this.props.voucherobj.BVoucherType && this.props.voucher.length > 0) { |
| | | let _voucher = this.props.voucher.filter(item => item.TypeCharOne === this.props.voucherobj.BVoucherType) |
| | | let _voucherDetail = this.props.voucherDetail.filter(item => item.BID === this.props.voucherobj.VoucherType) |
| | | |
| | | this.setState({ |
| | | voucher: _voucher, |
| | | voucherDetail: _voucherDetail |
| | | }) |
| | | } else if (this.props.voucher.length > 0) { |
| | | let _voucher = this.props.voucher.filter(item => item.TypeCharOne === 'MES') |
| | | let _voucherDetail = this.props.voucherDetail.filter(item => _voucher[0] && item.BID === _voucher[0].ID) |
| | | |
| | | this.setState({ |
| | | voucher: _voucher, |
| | | voucherDetail: _voucherDetail |
| | | }) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.voucher), fromJS(nextProps.voucher)) && nextProps.voucher.length > 0) { |
| | | if (this.props.voucherobj.BVoucherType) { |
| | | let _voucher = nextProps.voucher.filter(item => item.TypeCharOne === this.props.voucherobj.BVoucherType) |
| | | let _voucherDetail = nextProps.voucherDetail.filter(item => item.BID === this.props.voucherobj.VoucherType) |
| | | |
| | | this.setState({ |
| | | voucher: _voucher, |
| | | voucherDetail: _voucherDetail |
| | | }) |
| | | } else { |
| | | let _voucher = nextProps.voucher.filter(item => item.TypeCharOne === 'MES') |
| | | let _voucherDetail = nextProps.voucherDetail.filter(item => _voucher[0] && item.BID === _voucher[0].ID) |
| | | |
| | | this.setState({ |
| | | voucher: _voucher, |
| | | voucherDetail: _voucherDetail |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | VoucherType: _voucher[0] ? _voucher[0].ID : '', |
| | | VoucherTypeOne: _voucherDetail[0] ? _voucherDetail[0].ModularDetailCode : '' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | voucherTypeChange = (value) => { |
| | | const { voucherobj } = this.props |
| | | |
| | | let _voucher = this.props.voucher.filter(item => item.TypeCharOne === value) |
| | | let _voucherDetail = this.props.voucherDetail.filter(item => _voucher[0] && item.BID === _voucher[0].ID) |
| | | |
| | | this.setState({ |
| | | voucher: _voucher, |
| | | voucherDetail: _voucherDetail |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | VoucherType: _voucher[0] ? _voucher[0].ID : '', |
| | | VoucherTypeOne: _voucherDetail[0] ? _voucherDetail[0].ModularDetailCode : '' |
| | | }) |
| | | |
| | | if (voucherobj.enabled) { |
| | | this.props.voucherChange({...voucherobj, enabled: false}) |
| | | } |
| | | } |
| | | |
| | | voucherSChange = (value) => { |
| | | const { voucherobj } = this.props |
| | | let _detail = this.props.voucherDetail.filter(item => item.BID === value) |
| | | |
| | | this.setState({ |
| | | voucherDetail: _detail |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | VoucherTypeOne: _detail[0] ? _detail[0].ModularDetailCode : '' |
| | | }) |
| | | |
| | | if (voucherobj.enabled) { |
| | | this.props.voucherChange({...voucherobj, enabled: false}) |
| | | } |
| | | } |
| | | |
| | | contentChange = () => { |
| | | const { voucherobj } = this.props |
| | | |
| | | if (voucherobj.enabled) { |
| | | this.props.voucherChange({...voucherobj, enabled: false}) |
| | | } |
| | | } |
| | | |
| | | onEnabledChange = () => { |
| | | const { voucherobj } = this.props |
| | | |
| | | if (voucherobj.enabled) { |
| | | this.props.voucherChange({...voucherobj, enabled: false}) |
| | | } else { |
| | | this.handleConfirm() |
| | | } |
| | | } |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.enabled = true |
| | | let _detail = this.state.voucherDetail.filter(item => item.ModularDetailCode === values.VoucherTypeOne)[0] |
| | | values.VoucherTypeTwo = _detail.VoucherTypeTwo |
| | | values.Type = _detail.IDefine1 |
| | | |
| | | this.props.voucherChange(values) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { voucherobj } = this.props |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 10 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 14 } |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="verify-form"> |
| | | <Row gutter={24}> |
| | | <Col span={6}> |
| | | <Form.Item label={'主类型'}> |
| | | {getFieldDecorator('BVoucherType', { |
| | | initialValue: voucherobj.BVoucherType || 'MES', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '主类型!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select onChange={(value) => {this.voucherTypeChange(value)}}> |
| | | <Select.Option value="MES"> 业务类凭证 </Select.Option> |
| | | <Select.Option value="FCC"> 财务类凭证 </Select.Option> |
| | | <Select.Option value="WMS"> 物流类凭证 </Select.Option> |
| | | <Select.Option value="Z"> 自定义 </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'凭证类型'}> |
| | | {getFieldDecorator('VoucherType', { |
| | | initialValue: voucherobj.VoucherType || (this.state.voucher[0] && this.state.voucher[0].ID) || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '凭证类型!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.voucherSChange(value)}} |
| | | > |
| | | {this.state.voucher.map(option => |
| | | <Select.Option id={option.ID} key={option.ID} value={option.ID}> |
| | | {option.NameNO} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'凭证标识'}> |
| | | {getFieldDecorator('VoucherTypeOne', { |
| | | initialValue: voucherobj.VoucherTypeOne || (this.state.voucherDetail[0] && this.state.voucherDetail[0].ModularDetailCode) || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '凭证标识!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={this.contentChange} |
| | | > |
| | | {this.state.voucherDetail.map(option => |
| | | <Select.Option id={option.ModularDetailCode} key={option.ModularDetailCode} value={option.ModularDetailCode}> |
| | | {option.CodeName} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'提示信息'}> |
| | | {getFieldDecorator('errmsg', { |
| | | initialValue: voucherobj.errmsg ||'', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '提示信息!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" onChange={this.contentChange} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'报错编码'}> |
| | | {getFieldDecorator('errorCode', { |
| | | initialValue: voucherobj.errmsg || 'E', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '报错编码!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select onChange={this.contentChange}> |
| | | <Select.Option value="E"> E </Select.Option> |
| | | <Select.Option value="N"> N </Select.Option> |
| | | <Select.Option value="F"> F </Select.Option> |
| | | <Select.Option value="NM"> NM </Select.Option> |
| | | <Select.Option value="S"> S </Select.Option> |
| | | <Select.Option value="-1"> -1 </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'是否启用'}> |
| | | <Switch checkedChildren="启" unCheckedChildren="停" checked={voucherobj.enabled} onChange={this.onEnabledChange} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(UniqueForm) |
| | |
| | | * @return {String} table 表名 |
| | | */ |
| | | static getSysDefaultSql (btn, setting, formdata, primaryId) { |
| | | // let verify = btn.verify |
| | | let primaryKey = setting.primaryKey || 'id' |
| | | let _sql = '' |
| | | |
| | | // if (verify && verify.accountdate === 'true') { |
| | | // _sql += `exec s_FIBVoucherDateCheck @ErrorCode=@ErrorCode OUTPUT,@retmsg=@retmsg OUTPUT |
| | | // if @ErrorCode!='' |
| | | // GOTO aaa |
| | | // ` |
| | | // } |
| | | // if (verify && verify.invalid === 'true') { |
| | | // _sql += `Declare @tbid nvarchar(50), @ErrorCode nvarchar(50), |
| | | // @retmsg nvarchar(4000) |
| | | // Select @tbid='', @ErrorCode='',@retmsg='' |
| | | // Select @tbid=${primaryKey} from ${btn.sql} where ${primaryKey} ='${primaryId}' |
| | | // If @tbid='' |
| | | // Begin |
| | | // Setect @ErrorCode='E',@retmsg='数据已失效' |
| | | // goto aaa |
| | | // end |
| | | // ` |
| | | // } |
| | | |
| | | console.log(btn) |
| | | console.log(formdata) |
| | | console.log(primaryId) |
| | | if (btn.OpenType === 'pop' && btn.sqlType === 'insert') { |
| | | let keys = [] |
| | |
| | | keys = keys.join(',') |
| | | values = values.join(',') |
| | | |
| | | _sql = `insert into ${btn.sql} (${keys}, createuserid, BID) select ${values},@BID,@userid` |
| | | _sql += `insert into ${btn.sql} (${keys}, createuserid, BID) select ${values},@BID,@userid` |
| | | } else if (btn.OpenType === 'pop' && btn.sqlType === 'update') { |
| | | let _form = [] |
| | | formdata.forEach(item => { |
| | |
| | | } |
| | | }) |
| | | _form = _form.join(',') |
| | | _sql = `update ${btn.sql} set ${_form},modifydate=getdate(),modifyuserid=@userid where ${primaryKey}=@${primaryKey}` |
| | | _sql += `update ${btn.sql} set ${_form},modifydate=getdate(),modifyuserid=@userid where ${primaryKey}=@${primaryKey}` |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'LogicDelete') { // 逻辑删除 |
| | | _sql = `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid where ${primaryKey}=@${primaryKey}` |
| | | _sql += `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid where ${primaryKey}=@${primaryKey}` |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'delete') { |
| | | _sql = `insert into snote (remark,createuserid) select '删除表:${btn.sql} 数据: ${primaryKey}='+@${primaryKey},@userid delete ${btn.sql} where ${primaryKey}=@${primaryKey}` |
| | | _sql += `insert into snote (remark,createuserid) select '删除表:${btn.sql} 数据: ${primaryKey}='+@${primaryKey},@userid delete ${btn.sql} where ${primaryKey}=@${primaryKey}` |
| | | } |
| | | |
| | | console.log(_sql) |
| | | return _sql |
| | | } |
| | | |