| | |
| | | } |
| | | |
| | | render() { |
| | | const { groups, setting } = this.props |
| | | const { setting } = this.props |
| | | const { groups } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | let _width = (setting && setting.width) || 100 |
| | | |
| | | let keys = groups.map(group => group.uuid) |
| | | |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="form-tab-form-field"> |
| | | <Collapse |
| | |
| | | verifySubmit = () => { |
| | | const { card } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } else if (card.execMode) { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } else { |
| | | let _verify = this.verifyRef.state.verify |
| | | let _loading = this.verifyRef.state.updateloading |
| | | |
| | | if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (card.OpenType === 'excelOut') { |
| | | let _cols = _verify.columns.map(col => col.Column) |
| | | let _vcols = Array.from(new Set(_cols)) |
| | | if (_cols.length > _vcols.length) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'Excel列字段名,不可重复!', |
| | | duration: 10 |
| | | }) |
| | | |
| | | return |
| | | } |
| | | } |
| | | |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = _verify |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | if (_loading) { |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | } |
| | | } |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '' |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | </div> |
| | | {type === 'action' ? <Icon className="edit" title="编辑" type="edit" onClick={edit} /> : null} |
| | | {type === 'action' && card.btnType === 'confirm' && card.intertype === 'inner' && !card.innerFunc ? |
| | | {type === 'action' && card.btnType !== 'cancel' ? |
| | | <Icon className="edit profile" title="校验规则" type="profile" onClick={profile} /> : null |
| | | } |
| | | {type === 'action' && card.btnType !== 'confirm' && card.btnType !== 'cancel' && <Icon className="edit close" title="删除" type="close" onClick={del} />} |
| | |
| | | verifySubmit = () => { |
| | | const { card } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | let _verify = this.verifyRef.state.verify |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = _verify |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '' |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | import GridBtnForm from '@/templates/zshare/gridbtnform' |
| | | import EditCard from '@/templates/zshare/editcard' |
| | | import VerifyCard from '@/templates/zshare/verifycard' |
| | | import VerifyCardPrint from '@/templates/zshare/verifycardprint' |
| | | import VerifyCardExcelIn from '@/templates/zshare/verifycardexcelin' |
| | | import VerifyCardExcelOut from '@/templates/zshare/verifycardexcelout' |
| | | import MenuForm from '@/templates/zshare/menuform' |
| | |
| | | const { card } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '' |
| | | }) |
| | | }) |
| | | } else if (card.execMode) { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } else { |
| | | let _verify = this.verifyRef.state.verify |
| | | |
| | | if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (card.OpenType === 'excelOut') { |
| | | let _cols = _verify.columns.map(col => col.Column) |
| | | let _vcols = Array.from(new Set(_cols)) |
| | | if (_cols.length > _vcols.length) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'Excel列字段名,不可重复!', |
| | | duration: 10 |
| | | }) |
| | | |
| | | return |
| | | } |
| | | } |
| | | |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = _verify |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | |
| | | config: config, |
| | | card: '' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | onCancel={() => { this.setState({ profileVisible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | {this.state.card && this.state.card.OpenType !== 'excelIn' ? |
| | | {this.state.card && !this.state.card.execMode && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ? |
| | | <VerifyCard |
| | | floor="subtable" |
| | | card={this.state.card} |
| | |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.card && this.state.card.execMode ? |
| | | <VerifyCardPrint |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | columns={config.columns} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.card && this.state.card.OpenType === 'excelIn' ? |
| | | <VerifyCardExcelIn |
| | | card={this.state.card} |
| | |
| | | values.linkFieldName = _billField ? _billField.label : '' |
| | | } |
| | | |
| | | this.props.orderChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | }, () => { |
| | | |
| | | this.props.orderChange(values) |
| | | let _usedfields = this.props.billcodes.map(item => item.field) |
| | | |
| | | this.setState({ |
| | |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | |
| | | this.props.contrastChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | }, () => { |
| | | this.props.contrastChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | frontfield: '', |
| | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | if (res.status) { |
| | | this.props.customChange(values) |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | | }, () => { |
| | | this.props.customChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | sql: '', |
| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | if (res.status) { |
| | | this.props.scriptsChange(values) |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | | }, () => { |
| | | this.props.scriptsChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | sql: '' |
| | |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | state = { |
| | | updateloading: false, // 修改中 |
| | | initsql: '', // sql验证时变量声明及赋值 |
| | | verify: {}, |
| | | fields: [], |
| | |
| | | }) |
| | | } |
| | | |
| | | updateChange = () => { |
| | | 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 |
| | | } |
| | | |
| | | this.setState({ |
| | | updateloading: _loading |
| | | }) |
| | | } |
| | | |
| | | uniqueChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | }, 10) |
| | | } |
| | | |
| | | this.setState({ |
| | | updateloading: true |
| | | }) |
| | | } |
| | | |
| | | handleStatus = (record, type) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | if (verify.default === 'false' && verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | 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 |
| | | } |
| | | |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { |
| | | _loading = true |
| | | } else if (this.customForm && this.customForm.props.form.getFieldValue('sql')) { |
| | | _loading = true |
| | | } |
| | | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['header.confirm'], |
| | | cancelText: this.props.dict['header.cancel'], |
| | | onOk() { |
| | | resolve(verify) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | resolve(verify) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | values.fieldlabel = values.fieldlabel.join(',') |
| | | values.field = values.field.join(',') |
| | | |
| | | this.props.uniqueChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | }, () => { |
| | | this.props.uniqueChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | field: [], |
| | |
| | | this.setState({loading: true}) |
| | | Api.getLocalConfig(param).then(res => { |
| | | if (res.status) { |
| | | this.props.scriptsChange(values) |
| | | this.setState({ |
| | | loading: false, |
| | | editItem: null |
| | | }, () => { |
| | | this.props.scriptsChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | sql: '' |
| | |
| | | } |
| | | |
| | | state = { |
| | | updateloading: false, // 修改中 |
| | | verify: {}, |
| | | excelColumns: [ |
| | | { |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | | updateChange = () => { |
| | | let _loading = false |
| | | if (this.columnForm && this.columnForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.uniqueForm && this.uniqueForm.state.editItem) { |
| | | _loading = true |
| | | } |
| | | |
| | | this.setState({ |
| | | updateloading: _loading |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | }, 10) |
| | | } |
| | | |
| | | this.setState({ |
| | | updateloading: true |
| | | }) |
| | | } |
| | | |
| | | handleStatus = (record, type) => { |
| | |
| | | } |
| | | } |
| | | |
| | | if (this.state.updateloading) { |
| | | let _loading = false |
| | | if (this.columnForm && this.columnForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.uniqueForm && this.uniqueForm.state.editItem) { |
| | | _loading = true |
| | | } |
| | | |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { |
| | | _loading = true |
| | | } |
| | | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['header.confirm'], |
| | |
| | | values.fieldlabel = values.fieldlabel.join(',') |
| | | values.field = values.field.join(',') |
| | | |
| | | this.props.uniqueChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | }, () => { |
| | | this.props.uniqueChange(values) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | field: [], |
| | |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | let _cols = verify.columns.map(col => col.Column) |
| | | let _vcols = Array.from(new Set(_cols)) |
| | | |
| | | if (_cols.length > _vcols.length) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'Excel列字段名,不可重复!', |
| | | duration: 10 |
| | | }) |
| | | |
| | | return |
| | | } |
| | | |
| | | resolve(verify) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { verify, excelColumns } = this.state |
| | | const formItemLayout = { |