Ver Fonte

del useInl

code4eat há 4 anos atrás
pai
commit
e66af3fce3

+ 3 - 3
src/app.jsx

@@ -260,9 +260,7 @@ const demoResponseInterceptors = async (response, options) => {
           duration: 5,
         });
       }
-      return {
-        success: false
-      }
+      
     }
 
   } catch (err) {
@@ -335,6 +333,8 @@ export const layout = async ({ initialState }) => {
       //   const menuData = await getMenus();
       //   return menuData;
       // },
+
+
       // params: {
       //   userId: initialState?.currentUser?.userid,
       // },

+ 2 - 2
src/components/CAUpload/index.jsx

@@ -1,11 +1,11 @@
 
 
-import { request } from 'umi';
+
 import {ImportOutlined} from '@ant-design/icons';
 import React, { Component } from 'react';
 import PropTypes from 'prop-types';
 import {Button,Upload,message,Modal,Divider} from 'antd';
-import Cookies from 'js-cookie';
+// import Cookies from 'js-cookie';
 // 服务器地址,此处为了做演示,没有全局引入,直接写了
 const Host = 'http://112.124.59.133:8082';
 

+ 2 - 2
src/components/Footer/index.jsx

@@ -1,9 +1,9 @@
 
 import { DefaultFooter } from '@ant-design/pro-layout';
 
-import {version} from '../../../package.json';
-
+import packageInfo from '../../../package.json';
 
+const {version} = packageInfo;
 export default () => {
 
   return (

+ 4 - 15
src/global.jsx

@@ -1,5 +1,4 @@
 import { Button, message, notification } from 'antd';
-import { useIntl } from 'umi';
 import defaultSettings from '../config/defaultSettings';
 const { pwa } = defaultSettings;
 const isHttps = document.location.protocol === 'https:'; // if pwa is true
@@ -7,11 +6,7 @@ const isHttps = document.location.protocol === 'https:'; // if pwa is true
 if (pwa) {
   // Notify user if offline now
   window.addEventListener('sw.offline', () => {
-    message.warning(
-      useIntl().formatMessage({
-        id: 'app.pwa.offline',
-      }),
-    );
+    message.warning('');
   }); // Pop up a prompt on the page asking the user if they want to use the latest version
 
   window.addEventListener('sw.updated', (event) => {
@@ -58,18 +53,12 @@ if (pwa) {
           reloadSW();
         }}
       >
-        {useIntl().formatMessage({
-          id: 'app.pwa.serviceworker.updated.ok',
-        })}
+       app.pwa.serviceworker.updated.ok
       </Button>
     );
     notification.open({
-      message: useIntl().formatMessage({
-        id: 'app.pwa.serviceworker.updated',
-      }),
-      description: useIntl().formatMessage({
-        id: 'app.pwa.serviceworker.updated.hint',
-      }),
+      message:'app.pwa.serviceworker.updated',
+      description:'app.pwa.serviceworker.updated.hint',
       btn,
       key,
       onClose: async () => null,

+ 4 - 10
src/pages/Admin.jsx

@@ -2,22 +2,16 @@ import React from 'react';
 import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons';
 import { Card, Typography, Alert } from 'antd';
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
-import { useIntl } from 'umi';
+
 export default () => {
-  const intl = useIntl();
+
   return (
     <PageHeaderWrapper
-      content={intl.formatMessage({
-        id: 'pages.admin.subPage.title',
-        defaultMessage: 'This page can only be viewed by admin',
-      })}
+      content={'This page can only be viewed by admin'}
     >
       <Card>
         <Alert
-          message={intl.formatMessage({
-            id: 'pages.welcome.alertMessage',
-            defaultMessage: 'Faster and stronger heavy-duty components have been released.',
-          })}
+          message={'Faster and stronger heavy-duty components have been released.'}
           type="success"
           showIcon
           banner

+ 4 - 11
src/pages/UserMana/updateForm.jsx

@@ -1,11 +1,10 @@
 import React from 'react';
-import { Modal } from 'antd';
 import {
     ProFormSelect,
     ProFormText,
     ModalForm,
 } from '@ant-design/pro-form';
-import { useIntl, FormattedMessage } from 'umi';
+
 
 
 const UpdateForm = (props) => {
@@ -29,9 +28,7 @@ const UpdateForm = (props) => {
                  rules={[
                    {
                      required: true,
-                     message: (
-                       <FormattedMessage id="pages.searchTable.ruleName" defaultMessage="人员名是必填项" />
-                     ),
+                     message:'人员名是必填项',
                    },
                  ]}
                  width="sm"
@@ -42,9 +39,7 @@ const UpdateForm = (props) => {
                  rules={[
                    {
                      required: true,
-                     message: (
-                       <FormattedMessage id="pages.searchTable.ruleName" defaultMessage="账户名是必填项" />
-                     ),
+                     message:'账户名是必填项',
                    },
                  ]}
                  width="sm"
@@ -55,9 +50,7 @@ const UpdateForm = (props) => {
                  rules={[
                    {
                      required: false,
-                     message: (
-                       <FormattedMessage id="pages.searchTable.password" defaultMessage="" />
-                     ),
+                     message:'密码是必填项',
                    },
                  ]}
                  placeholder="密码不修改时留空"

+ 6 - 10
src/pages/Welcome.jsx

@@ -1,7 +1,6 @@
 import React from 'react';
 import { PageContainer } from '@ant-design/pro-layout';
 import { Card, Alert, Typography } from 'antd';
-import { useIntl, FormattedMessage } from 'umi';
 import styles from './Welcome.less';
 
 const CodePreview = ({ children }) => (
@@ -13,15 +12,12 @@ const CodePreview = ({ children }) => (
 );
 
 export default () => {
-  const intl = useIntl();
+
   return (
     <PageContainer>
       <Card>
         <Alert
-          message={intl.formatMessage({
-            id: 'pages.welcome.alertMessage',
-            defaultMessage: 'Faster and stronger heavy-duty components have been released.',
-          })}
+          message={'Faster and stronger heavy-duty components have been released.'}
           type="success"
           showIcon
           banner
@@ -31,13 +27,13 @@ export default () => {
           }}
         />
         <Typography.Text strong>
-          <FormattedMessage id="pages.welcome.advancedComponent" defaultMessage="Advanced Form" />{' '}
+          {' '}
           <a
             href="https://procomponents.ant.design/components/table"
             rel="noopener noreferrer"
             target="__blank"
           >
-            <FormattedMessage id="pages.welcome.link" defaultMessage="Welcome" />
+            'Welcome'
           </a>
         </Typography.Text>
         <CodePreview>yarn add @ant-design/pro-table</CodePreview>
@@ -47,13 +43,13 @@ export default () => {
             marginBottom: 12,
           }}
         >
-          <FormattedMessage id="pages.welcome.advancedLayout" defaultMessage="Advanced layout" />{' '}
+          Advanced layout{' '}
           <a
             href="https://procomponents.ant.design/components/layout"
             rel="noopener noreferrer"
             target="__blank"
           >
-            <FormattedMessage id="pages.welcome.link" defaultMessage="Welcome" />
+            Welcome
           </a>
         </Typography.Text>
         <CodePreview>yarn add @ant-design/pro-layout</CodePreview>

+ 3 - 3
src/pages/costAccounting/afterCollectionSearch/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-12 13:36:36
+ * @LastEditTime: 2021-08-12 15:12:35
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -43,7 +43,7 @@ const AfterCollectionSearch = () => {
         }
         return (
           <Form.Item >
-            <ProFormDatePicker initialValue={currentTime} fieldProps={{ picker: 'month', format: (value) => { return value.format('YYYY-MM') }, locale: locale }} name="dateTime" />
+            <ProFormDatePicker initialValue={currentTime} fieldProps={{ picker: 'month', format: (value) => { return value.format('YYYYMM') }, locale: locale }} name="dateTime" />
           </Form.Item>
         )
       },
@@ -271,7 +271,7 @@ const AfterCollectionSearch = () => {
   const getList = async (params = {}, sort, filter) => {
     const { dateTime } = params;
     // console.log(moment(dateTime).format('YYYY-MM'));
-    const res = await getAfterIncomeCollectionList({ ...params, dateTime: moment(dateTime).format('YYYY-MM') });
+    const res = await getAfterIncomeCollectionList({ ...params, dateTime: moment(dateTime).format('YYYYMM') });
     if (res && res.status) {
       const { data: { totalAmount } } = res;
       setTotalCount(totalAmount);

+ 1 - 26
src/pages/costAccounting/incomeCostDataImport/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-12 09:54:26
+ * @LastEditTime: 2021-08-12 14:30:35
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -13,7 +13,6 @@ import React, { useState, useRef } from 'react';
 import { PageContainer } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
 import ProForm,{ ModalForm, ProFormText, ProFormSelect,ProFormDatePicker} from '@ant-design/pro-form';
-import UpdateForm from './updateForm';
 import DrawerContent from './components/DrawerContent';
 import CAUpload from '@/components/CAUpload/index';
 import { getIncomeCostDataImport,addIncomeCostDataImport,cancelIncomeCostDataImport,getIncomeCostDataImportErrList } from './service';
@@ -378,30 +377,6 @@ const IncomeCostDataImport = () => {
           
           }}
       />
-
-
-      {/* 更新 */}
-      <UpdateForm
-        onSubmit={async (value) => {
-          // console.log({ '编辑': value });
-          const success = await editDistrictList(value);
-          if (success) {
-            handleUpdateModalVisible(false);
-            setCurrentRow(undefined);
-
-            if (actionRef.current) {
-              actionRef.current.reload();
-            }
-          }
-        }}
-        onCancel={() => {
-          handleUpdateModalVisible(false);
-          setCurrentRow(undefined);
-        }}
-        updateModalVisible={updateModalVisible}
-        updateModalVisibleChange={updateModalVisibleChange}
-        values={currentRow || {}}
-      />
     </PageContainer>
   );
 };

+ 0 - 121
src/pages/costAccounting/incomeCostDataImport/updateForm.jsx

@@ -1,121 +0,0 @@
-import React,{useState} from 'react';
-import {
-  ProFormSelect,
-  ProFormText,
-  ModalForm,
-  ProFormDependency
-} from '@ant-design/pro-form';
-
-import { getMainDistrictList } from './service';
-
-
-const UpdateForm = (props) => {
-  const { updateModalVisible, updateModalVisibleChange, values, onSubmit } = props;
-  const [selectedHosp,setSelectedHosp] = useState({});
-  // console.log({values});
-  return (
-    <>
-      {
-        JSON.stringify(values) !== '{}' && <ModalForm
-          title="编辑医院"
-          width="800px"
-          initialValues={{ ...values }}
-          labelCol={{ span: 3, offset: 3 }}
-          layout={'horizontal'}
-          visible={updateModalVisible}
-          onVisibleChange={(visible) => updateModalVisibleChange(visible)}
-          onFinish={(value) => onSubmit({ ...values, ...value,parentName:selectedHosp.name})}
-        >
-          <ProFormText
-            label="医院名"
-            rules={[
-              {
-                required: true,
-                message:'医院名是必填项',
-              },
-            ]}
-            width="sm"
-            name="name"
-          />
-          <ProFormSelect
-            // initialValue={parseInt(values.isHospital)}
-            rules={[
-              {
-                required: true,
-                message:'请选择是否为主院',
-              },
-            ]}
-            options={[
-              {
-                value: 0,
-                label: '是',
-              },
-              {
-                value: 1,
-                label: '否',
-              },
-            ]}
-            width="xs"
-            name="isHospital"
-            label="是否为主院"
-          />
-
-          <ProFormDependency name={['isHospital']}>
-            {({ isHospital }) => {
-              return isHospital == 0 ? (
-                <ProFormText
-                  label="医院标识"
-                  rules={[
-                    {
-                      required: false,
-                      message:'',
-                    },
-                  ]}
-                  width="sm"
-                  name="sign"
-                />
-              ) : <></>;
-            }}
-          </ProFormDependency>
-          <ProFormDependency name={['isHospital']}>
-          {({ isHospital }) => {
-            return isHospital == 1 ? (
-              <ProFormSelect
-                name="parentId"
-                label="选择主医院"
-                request={async () =>{
-                      const resp = await getMainDistrictList();
-                      const {status,data,} = resp;
-                      
-                      if(status == 200){
-                        return data.map(item=>({
-                          label:item.name,
-                          value:item.id
-                        }))
-                      }
-                }}
-                fieldProps={{
-                  onChange: async (val) => {
-                    const resp = await getMainDistrictList();
-                    const {status,data,} = resp;
-                    if(status==200){
-                        const needItem = data.filter(item => item.id == val);
-                        needItem.length>0&&setSelectedHosp(needItem[0]);
-                    }
-                    
-                  },
-                }}
-                placeholder="请选择主医院"
-                width='sm'
-                rules={[{ required: true, message: '请选择主医院' }]}
-              />
-            ) : <></>
-          }}
-        </ProFormDependency>
-        </ModalForm>
-      }
-    </>
-  );
-};
-
-export default UpdateForm;

+ 2 - 28
src/pages/costAllocationParamsSetting/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-09 16:16:36
+ * @LastEditTime: 2021-08-12 14:28:44
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -15,7 +15,7 @@ import { PageContainer } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
 import { ModalForm, ProFormText, ProFormSelect,DrawerForm,ProFormDigit} from '@ant-design/pro-form';
 import UpdateForm from './updateForm';
-import UpdateFormDrawer from './updateForm_drawer';
+
 
 import { getCostshareparamList, editCostshareparamList, delCostshareparam, addCostshareparam,updateCostShareParamByAccountId } from './service';
 import { getAccountingSubjectList} from '../accountingSubject/service';
@@ -449,32 +449,6 @@ const DepartmentMana = () => {
 
         </ModalForm>
 
-        {/* 科目更新 */}
-        <UpdateFormDrawer
-          onSubmit={async (value) => {
-               
-               const {id} = value;
-               const index = hasSetParamsList.findIndex(item=>item.id == id);
-               const temp = hasSetParamsList;
-               temp[index] = value;
-
-               setHasSetParamsList([].concat(temp));
-               setDrawerUpdateModalVisible(false);
-               if (actionDrawertableRef.current) {
-                actionDrawertableRef.current.reload();
-              }
-          }}
-          onCancel={() => {
-            drawerUpdateModalVisible(false);
-            setCurrentRow(undefined);
-          }}
-          currentResponsibilityRow={currentResponsibilityRow}
-          drawerUpdateModalVisible={drawerUpdateModalVisible}
-          drawerUpdateModalVisibleChange={drawerUpdateModalVisibleChange}
-          values={currentRow || {}}
-       
-
-        />
         </PageContainer>
         
       </DrawerForm>

+ 0 - 93
src/pages/costAllocationParamsSetting/updateForm_drawer.js

@@ -1,93 +0,0 @@
-/*
- * @Author: your name
- * @Date: 2021-07-30 18:09:25
- * @LastEditTime: 2021-08-03 17:18:46
- * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
- * @FilePath: /TracerMethodology_PC/src/pages/costAllocationParamsConnect/updateForm_drawer.js
- */
-
-import React, { useState } from 'react';
-import {
-  ProFormSelect,
-  ModalForm,
-  ProFormDigit,
-} from '@ant-design/pro-form';
-
-
-import {
-    getParamsSelectableList
-  } from './service';
-
-const UpdateFormDrawer = (props) => {
-  const {
-    values: record,
-    drawerUpdateModalVisible,
-    drawerUpdateModalVisibleChange,
-    currentResponsibilityRow,
-    onSubmit,
-  } = props;
-
-  const [selectedParam, setSelectedParam] = useState(null);
-
-
-  return (
-    <>
-      {JSON.stringify(record) !== '{}'&&record.shareParamPopout && (
-        <ModalForm
-          title="编辑成分摊参数"
-          width="800px"
-          initialValues={{ ...record }}
-          labelCol={{ span: 5, offset: 3 }}
-          layout={'horizontal'}
-          visible={drawerUpdateModalVisible}
-          onVisibleChange={(visible) => drawerUpdateModalVisibleChange(visible)}
-          onFinish={(value) => onSubmit({ ...record, ...value })}
-        >
-          <ProFormSelect
-            rules={[
-              {
-                required: true,
-                message:'',
-              },
-            ]}
-            fieldProps={{
-              //这里使用了select的onChange方法,必须使用这样的写法来进行调用onChange方法
-              onChange: async (val) => {
-                // setSelectedParam(val);
-                const { id } = currentResponsibilityRow;
-                const resp = await getParamsSelectableList({ id });
-                const { data, status } = resp;
-                if (status == 200) {
-                  const selected = data.list.filter((item) => item.id == val);
-                  setSelectedParam(selected[0]);
-                }
-              },
-            }}
-            request={async () => {
-              
-              const { id } = currentResponsibilityRow;
-              const resp = await getParamsSelectableList({ id });
-              const { data, status } = resp;
-        
-              if (status == 200) {
-                const temp = data.list.map((item) => ({
-                  label: item.shareParamName,
-                  value: item.id,
-                }));
-                return temp;
-              }
-            }}
-            width="sm"
-            name="id"
-            label="请选择分摊参数"
-          />
-
-          <ProFormDigit width={100} label="分摊比例" name="shareParamPopout" min={0} max={101} />
-        </ModalForm>
-      )}
-    </>
-  );
-};
-
-export default UpdateFormDrawer;