|
@@ -19,23 +19,23 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
import React from 'react'
|
|
import React from 'react'
|
|
-import { Modal, Form, Button, Input } from 'antd'
|
|
|
|
|
|
+import { Modal, Form, Button, Input, Spin } from 'antd'
|
|
import { FormComponentProps } from 'antd/lib/form'
|
|
import { FormComponentProps } from 'antd/lib/form'
|
|
import { ICatalogue, IViewBase } from '../types'
|
|
import { ICatalogue, IViewBase } from '../types'
|
|
|
|
|
|
const FormItem = Form.Item
|
|
const FormItem = Form.Item
|
|
|
|
|
|
interface ICopyModalProps extends FormComponentProps<ICatalogue> {
|
|
interface ICopyModalProps extends FormComponentProps<ICatalogue> {
|
|
- visible: boolean
|
|
|
|
- loading: boolean
|
|
|
|
- fromView: ICatalogue
|
|
|
|
|
|
+ visible: boolean,
|
|
|
|
+ loading: boolean,
|
|
|
|
+ fromView: ICatalogue,
|
|
onCheckUniqueName: (
|
|
onCheckUniqueName: (
|
|
viewName: string,
|
|
viewName: string,
|
|
resolve: () => void,
|
|
resolve: () => void,
|
|
reject: (err: string) => void
|
|
reject: (err: string) => void
|
|
- ) => void
|
|
|
|
- onSave: (view: ICatalogue) => void
|
|
|
|
- onCancel: () => void
|
|
|
|
|
|
+ ) => void,
|
|
|
|
+ onSave: (view: ICatalogue) => void,
|
|
|
|
+ onCancel: () => void,
|
|
}
|
|
}
|
|
|
|
|
|
export class CatalogueModal extends React.PureComponent<ICopyModalProps> {
|
|
export class CatalogueModal extends React.PureComponent<ICopyModalProps> {
|
|
@@ -77,14 +77,14 @@ export class CatalogueModal extends React.PureComponent<ICopyModalProps> {
|
|
const { getFieldDecorator } = form
|
|
const { getFieldDecorator } = form
|
|
|
|
|
|
const modalButtons = [
|
|
const modalButtons = [
|
|
- <Button key="back" size="large" onClick={onCancel}>
|
|
|
|
|
|
+ <Button key='back' size='large' onClick={onCancel}>
|
|
取 消
|
|
取 消
|
|
</Button>,
|
|
</Button>,
|
|
<Button
|
|
<Button
|
|
disabled={loading}
|
|
disabled={loading}
|
|
- key="submit"
|
|
|
|
- size="large"
|
|
|
|
- type="primary"
|
|
|
|
|
|
+ key='submit'
|
|
|
|
+ size='large'
|
|
|
|
+ type='primary'
|
|
onClick={this.save}
|
|
onClick={this.save}
|
|
>
|
|
>
|
|
保 存
|
|
保 存
|
|
@@ -94,49 +94,53 @@ export class CatalogueModal extends React.PureComponent<ICopyModalProps> {
|
|
return (
|
|
return (
|
|
<Modal
|
|
<Modal
|
|
title={fromView ? '编辑' : '新增'}
|
|
title={fromView ? '编辑' : '新增'}
|
|
- wrapClassName="ant-modal-small"
|
|
|
|
|
|
+ wrapClassName='ant-modal-small'
|
|
|
|
+ confirmLoading={loading}
|
|
visible={visible}
|
|
visible={visible}
|
|
footer={modalButtons}
|
|
footer={modalButtons}
|
|
onCancel={onCancel}
|
|
onCancel={onCancel}
|
|
afterClose={this.clearFieldsValue}
|
|
afterClose={this.clearFieldsValue}
|
|
>
|
|
>
|
|
- <Form>
|
|
|
|
- <FormItem label="资源名称" {...this.formItemStyle}>
|
|
|
|
- {getFieldDecorator<ICatalogue>('name', {
|
|
|
|
- validateFirst: true,
|
|
|
|
- rules: [
|
|
|
|
- { required: true, message: '不能为空' },
|
|
|
|
- { validator: this.checkName }
|
|
|
|
- ],
|
|
|
|
- initialValue: fromView?.name
|
|
|
|
- })(<Input autoComplete={'off'} />)}
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem label="行业分类" {...this.formItemStyle}>
|
|
|
|
- {getFieldDecorator<ICatalogue>('industry', {
|
|
|
|
- initialValue: fromView?.industry
|
|
|
|
- })(<Input />)}
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem label="来源部门" {...this.formItemStyle}>
|
|
|
|
- {getFieldDecorator<ICatalogue>('originDept', {
|
|
|
|
- initialValue: fromView?.originDept
|
|
|
|
- })(<Input />)}
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem label="来源系统" {...this.formItemStyle}>
|
|
|
|
- {getFieldDecorator<ICatalogue>('originSystem', {
|
|
|
|
- initialValue: fromView?.originSystem
|
|
|
|
- })(<Input />)}
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem label="扩展json" {...this.formItemStyle}>
|
|
|
|
- {getFieldDecorator<ICatalogue>('extConfig', {
|
|
|
|
- initialValue: fromView?.extConfig
|
|
|
|
- })(<Input />)}
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem label="描述" {...this.formItemStyle}>
|
|
|
|
- {getFieldDecorator<ICatalogue>('description', {
|
|
|
|
- initialValue: fromView?.description
|
|
|
|
- })(<Input />)}
|
|
|
|
- </FormItem>
|
|
|
|
- </Form>
|
|
|
|
|
|
+ <Spin spinning={loading}>
|
|
|
|
+ <Form>
|
|
|
|
+ <FormItem label='资源名称' {...this.formItemStyle}>
|
|
|
|
+ {getFieldDecorator<ICatalogue>('name', {
|
|
|
|
+ validateFirst: true,
|
|
|
|
+ rules: [
|
|
|
|
+ { required: true, message: '不能为空' },
|
|
|
|
+ { validator: this.checkName }
|
|
|
|
+ ],
|
|
|
|
+ initialValue: fromView?.name
|
|
|
|
+ })(<Input autoComplete={'off'} />)}
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem label='行业分类' {...this.formItemStyle}>
|
|
|
|
+ {getFieldDecorator<ICatalogue>('industry', {
|
|
|
|
+ initialValue: fromView?.industry
|
|
|
|
+ })(<Input />)}
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem label='来源部门' {...this.formItemStyle}>
|
|
|
|
+ {getFieldDecorator<ICatalogue>('originDept', {
|
|
|
|
+ initialValue: fromView?.originDept
|
|
|
|
+ })(<Input />)}
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem label='来源系统' {...this.formItemStyle}>
|
|
|
|
+ {getFieldDecorator<ICatalogue>('originSystem', {
|
|
|
|
+ initialValue: fromView?.originSystem
|
|
|
|
+ })(<Input />)}
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem label='扩展json' {...this.formItemStyle}>
|
|
|
|
+ {getFieldDecorator<ICatalogue>('extConfig', {
|
|
|
|
+ initialValue: fromView?.extConfig
|
|
|
|
+ })(<Input />)}
|
|
|
|
+ </FormItem>
|
|
|
|
+ <FormItem label='描述' {...this.formItemStyle}>
|
|
|
|
+ {getFieldDecorator<ICatalogue>('description', {
|
|
|
|
+ initialValue: fromView?.description
|
|
|
|
+ })(<Input />)}
|
|
|
|
+ </FormItem>
|
|
|
|
+ </Form>
|
|
|
|
+ </Spin>
|
|
|
|
+
|
|
</Modal>
|
|
</Modal>
|
|
)
|
|
)
|
|
}
|
|
}
|