Преглед изворни кода

fix: remove check view api

hi-cactus! пре 3 година
родитељ
комит
9d2d299245

+ 53 - 49
app/containers/DataManagerView/components/CatalogueModal.tsx

@@ -19,23 +19,23 @@
  */
 
 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 { ICatalogue, IViewBase } from '../types'
 
 const FormItem = Form.Item
 
 interface ICopyModalProps extends FormComponentProps<ICatalogue> {
-  visible: boolean
-  loading: boolean
-  fromView: ICatalogue
+  visible: boolean,
+  loading: boolean,
+  fromView: ICatalogue,
   onCheckUniqueName: (
     viewName: string,
     resolve: () => 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> {
@@ -77,14 +77,14 @@ export class CatalogueModal extends React.PureComponent<ICopyModalProps> {
     const { getFieldDecorator } = form
 
     const modalButtons = [
-      <Button key="back" size="large" onClick={onCancel}>
+      <Button key='back' size='large' onClick={onCancel}>
         取 消
       </Button>,
       <Button
         disabled={loading}
-        key="submit"
-        size="large"
-        type="primary"
+        key='submit'
+        size='large'
+        type='primary'
         onClick={this.save}
       >
         保 存
@@ -94,49 +94,53 @@ export class CatalogueModal extends React.PureComponent<ICopyModalProps> {
     return (
       <Modal
         title={fromView ? '编辑' : '新增'}
-        wrapClassName="ant-modal-small"
+        wrapClassName='ant-modal-small'
+        confirmLoading={loading}
         visible={visible}
         footer={modalButtons}
         onCancel={onCancel}
         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>
     )
   }

+ 1 - 2
app/containers/DataManagerView/components/CopyModal.tsx

@@ -100,8 +100,7 @@ export class CopyModal extends React.PureComponent<ICopyModalProps> {
             {getFieldDecorator<IViewBase>('name', {
               validateFirst: true,
               rules: [
-                { required: true, message: '不能为空' },
-                { validator: this.checkName }
+                { required: true, message: '不能为空' }
               ],
               initialValue: `${fromView.name}_copy`
             })(<Input />)}

+ 2 - 6
app/containers/DataManagerView/index.tsx

@@ -365,7 +365,7 @@ export class ViewList extends React.PureComponent<
       this.setState({
         copyModalVisible: false
       })
-      message.info('View 复制成功')
+      message.info('数据资产 复制成功')
     })
   }
 
@@ -428,7 +428,6 @@ export class ViewList extends React.PureComponent<
       const parentId = Number(this.state.selectedCatalogueKeys[0]) || null
       const catalogueFromView = this.state.catalogueFromView
       this.setState({ saveCatalogueLoading: true })
-      // const api = this.state.catalogueFromView ? api.updateCatalogue : api.createCatalogue
       if (catalogueFromView) {
         await request(api.updateCatalogue + `/${catalogueFromView.id}`, {
           method: 'PUT',
@@ -440,10 +439,7 @@ export class ViewList extends React.PureComponent<
           data: { ...catalogue, parentId, projectId }
         })
       }
-      this.setState({
-        saveCatalogueLoading: true,
-        catalogueModalVisible: false
-      })
+      this.setState({ catalogueModalVisible: false })
       this.getCatalogues()
     } finally {
       this.setState({