Explorar o código

完成第四周相关功能

code4eat %!s(int64=4) %!d(string=hai) anos
pai
achega
e624af2051
Modificáronse 47 ficheiros con 1885 adicións e 438 borrados
  1. 2 2
      config/defaultSettings.js
  2. 2 2
      config/proxy.js
  3. 46 15
      config/routes.js
  4. 18 11
      src/app.jsx
  5. 126 117
      src/pages/accountingSubject/index.jsx
  6. 35 5
      src/pages/accountingSubject/updateForm.jsx
  7. 6 7
      src/pages/accountingSubjectConnect/index.jsx
  8. 3 3
      src/pages/apportionmentLevel/index.jsx
  9. 1 1
      src/pages/apportionmentLevel/updateForm.jsx
  10. 30 27
      src/pages/baseSetting/reportProjectSetting/component/drawerContent.jsx
  11. 52 27
      src/pages/baseSetting/reportProjectSetting/index.js
  12. 1 1
      src/pages/baseSetting/reportProjectSetting/service.js
  13. 2 2
      src/pages/baseSetting/visitsAndBedDayCostSetting/index.jsx
  14. 3 3
      src/pages/costAccounting/afterCollectionSearch/index.jsx
  15. 107 0
      src/pages/costAccounting/afterCostShareSearch/components/DrawerContent.jsx
  16. 295 0
      src/pages/costAccounting/afterCostShareSearch/index.jsx
  17. 17 0
      src/pages/costAccounting/afterCostShareSearch/index.less
  18. 36 0
      src/pages/costAccounting/afterCostShareSearch/service.js
  19. 6 5
      src/pages/costAccounting/beforeCollectionSearch/index.jsx
  20. 161 0
      src/pages/costAccounting/costShare/index.jsx
  21. 43 0
      src/pages/costAccounting/costShare/service.js
  22. 2 2
      src/pages/costAccounting/costShareParamsHandle/index.js
  23. 194 0
      src/pages/costAccounting/costShareReportTable/index.jsx
  24. 25 0
      src/pages/costAccounting/costShareReportTable/service.js
  25. 193 0
      src/pages/costAccounting/departmentCostCalculate/index.jsx
  26. 36 0
      src/pages/costAccounting/departmentCostCalculate/service.js
  27. 168 0
      src/pages/costAccounting/wholeHospCostCalculate/index.jsx
  28. 35 0
      src/pages/costAccounting/wholeHospCostCalculate/service.js
  29. 2 2
      src/pages/costAccounting/wholeHospIncomeAndCost/index.jsx
  30. 17 12
      src/pages/costAllocationParamsConnect/index.jsx
  31. 28 27
      src/pages/costAllocationParamsConnect/selectCopyDrawer.jsx
  32. 1 1
      src/pages/costAllocationParamsConnect/updateForm.jsx
  33. 3 3
      src/pages/costAllocationParamsConnect/updateForm_drawer.js
  34. 6 5
      src/pages/costAllocationParamsSetting/index.jsx
  35. 3 28
      src/pages/costAllocationParamsSetting/selectCopyDrawer.jsx
  36. 2 2
      src/pages/platformMana/districtMana/index.jsx
  37. 0 0
      src/pages/platformMana/districtMana/service.js
  38. 1 1
      src/pages/platformMana/districtMana/updateForm.jsx
  39. 52 54
      src/pages/platformMana/menuManage/index.js
  40. 36 25
      src/pages/platformMana/roleManage/component/drawer.jsx
  41. 4 4
      src/pages/platformMana/roleManage/index.js
  42. 24 19
      src/pages/responsibilityCenter/index.jsx
  43. 10 12
      src/pages/responsibilityCenter/updateForm.jsx
  44. 3 3
      src/pages/responsibilityCenterConnect/index.jsx
  45. 1 1
      src/pages/user/Login/index.jsx
  46. 34 0
      src/projectConstant.js
  47. 13 9
      src/utils.js

+ 2 - 2
config/defaultSettings.js

@@ -1,13 +1,13 @@
 /*
  * @Author: your name
  * @Date: 2021-07-22 15:04:09
- * @LastEditTime: 2021-08-23 11:41:59
+ * @LastEditTime: 2021-08-23 13:55:21
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/config/defaultSettings.js
  */
 
-console.log('process.env.NODE_ENV',process.env.NODE_ENV);
+
 
 export const Settings = {
   navTheme: 'light',

+ 2 - 2
config/proxy.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-22 15:04:09
- * @LastEditTime: 2021-08-17 09:16:58
+ * @LastEditTime: 2021-08-28 19:28:16
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/config/proxy.js
@@ -26,7 +26,7 @@ export default {
   },
   dev: {
     '/api/': {
-      target: 'http://112.124.59.133:8082',    //开发本地:192.168.51.76 ,dev:112.124.59.133:8082
+      target: 'http://112.124.59.133:8082',    //开发本地:192.168.51.76 ,dev:112.124.59.133:8082  hr:192.168.51.80
       changeOrigin: true,
       pathRewrite: {
         '^/api': '',

+ 46 - 15
config/routes.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-22 15:04:09
- * @LastEditTime: 2021-08-23 10:56:02
+ * @LastEditTime: 2021-08-28 14:25:11
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/config/routes.js
@@ -27,7 +27,7 @@ export default [
     path: '/platformMana',
     name: '平台系统管理',
     icon: 'smile',
-    routes:[
+    routes: [
       {
         name: '角色管理',
         path: '/platformMana/roleManage',
@@ -37,14 +37,20 @@ export default [
         name: '菜单管理',
         path: '/platformMana/menuManage',
         component: './platformMana/menuManage/index',
-      }
-    ]
+      },
+      {
+        path: '/platformMana/districtMana',
+        name: '院区管理',
+        icon: 'InsertRowLeftOutlined',
+        component: './platformMana/districtMana/index',
+      },
+    ],
   },
   {
     path: '/baseSetting',
     name: '基础设置',
     icon: 'tool',
-    routes:[
+    routes: [
       {
         path: '/baseSetting/incomeCollectionSetting',
         name: '收入归集设置',
@@ -69,13 +75,13 @@ export default [
         icon: 'tool',
         component: './baseSetting/wholeHospCostAndIncomeSet/index',
       },
-    ]
+    ],
   },
   {
     path: '/costAccounting',
     name: '成本核算',
     icon: 'tool',
-    routes:[
+    routes: [
       {
         path: '/costAccounting/incomeCostDataImport',
         name: '收入成本数据导入',
@@ -110,8 +116,33 @@ export default [
         path: '/costAccounting/beforeCostShareSearch',
         name: '成本分摊前查询',
         component: './costAccounting/beforeCostShareSearch/index',
-      }
-    ]
+      },
+      {
+        path: '/costAccounting/costShare',
+        name: '成本分摊',
+        component: './costAccounting/costShare/index',
+      },
+      {
+        path: '/costAccounting/afterCostShareSearch',
+        name: '成本分摊后查询',
+        component: './costAccounting/afterCostShareSearch/index',
+      },
+      {
+        path: '/costAccounting/costShareReportTable',
+        name: '成本分摊报表',
+        component: './costAccounting/costShareReportTable/index',
+      },
+      {
+        path: '/costAccounting/wholeHospCostCalculate',
+        name: '全院损益计算',
+        component: './costAccounting/wholeHospCostCalculate/index',
+      },
+      {
+        path: '/costAccounting/departmentCostCalculate',
+        name: '科室损益计算',
+        component: './costAccounting/departmentCostCalculate/index',
+      },
+    ],
   },
   {
     path: '/UserMana',
@@ -119,12 +150,12 @@ export default [
     icon: 'tool',
     component: './UserMana/index',
   },
-  {
-    path: '/districtMana',
-    name: '院区管理',
-    icon: 'InsertRowLeftOutlined',
-    component: './districtMana/index',
-  },
+  // {
+  //   path: '/districtMana',
+  //   name: '院区管理',
+  //   icon: 'InsertRowLeftOutlined',
+  //   component: './districtMana/index',
+  // },
   {
     path: '/apportionmentLevel',
     name: '分摊层级设置',

+ 18 - 11
src/app.jsx

@@ -9,6 +9,7 @@ import { stringify } from 'querystring';
 import { getSubHosp, getMenus } from './services/user';
 import iconEnum from './menuIcons';
 import { createRef } from 'react';
+import { reject } from 'lodash';
 
 const layoutActionRef = createRef();
 
@@ -116,6 +117,7 @@ export async function getInitialState() {
       isExpired: false,
       fetchSubHosp,
       sign,
+      isDev:process.env.NODE_ENV == 'development',
       menu: menu
     };
   }
@@ -200,7 +202,7 @@ const demoResponseInterceptors = async (response, options) => {
     }
 
     const _response = await response.clone().json();
-    const { status: dataStatus, msg, errorMessage, errorCode } = _response;
+    const { status: dataStatus, errorMessage, errorCode } = _response;
     const { url } = options;
 
     //success返回
@@ -229,6 +231,13 @@ const demoResponseInterceptors = async (response, options) => {
       }
 
     }
+ 
+    return {
+      success:true,
+      errorMessage:{
+        info:errorMessage
+      }
+    }
 
   } catch (err) {
     console.log('catch error:', err)
@@ -237,6 +246,8 @@ const demoResponseInterceptors = async (response, options) => {
 }
 
 
+
+
 export const request = {
   errorHandler: (error) => {
     console.log({ error });
@@ -265,9 +276,6 @@ const mappingIcon = menuData => {
 
 export const layout = async ({ initialState }) => {
 
-
-
-
   return {
     rightContentRender: () => <RightContent />,
     disableContentMargin: false,
@@ -283,19 +291,18 @@ export const layout = async ({ initialState }) => {
       }
     },
     menu: {
-      // request: async (params, defaultMenuData) => {
-      //   // initialState.currentUser 中包含了所有用户信息
-      //   const menuData = await getMenus();
-      //   return menuData;
-      // },
+
 
       params: {
         userId: initialState?.currentUser?.userid,
       },
       request: async (params, defaultMenuData) => {
         // initialState.currentUser 中包含了所有用户信息
-        const { currentUser} = initialState;
-
+        const { currentUser,isDev} = initialState;
+        if(isDev||currentUser.userid == 96){
+          //开发环境或超级账号
+          return []
+        }
         if (currentUser) {
           const resp = await getMenus();
           const { data: menu } = resp;

+ 126 - 117
src/pages/accountingSubject/index.jsx

@@ -1,19 +1,19 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-13 17:10:45
+ * @LastEditTime: 2021-08-28 10:28:33
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
  */
 
 import { PlusOutlined } from '@ant-design/icons';
-import { Button, Popconfirm} from 'antd';
+import { Button, Popconfirm } from 'antd';
 import React, { useState, useRef, useEffect } from 'react';
 
-import { PageContainer} from '@ant-design/pro-layout';
+import { PageContainer } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
-import { ModalForm, ProFormText, ProFormSelect} from '@ant-design/pro-form';
+import { ModalForm, ProFormText, ProFormDependency,ProFormSelect } from '@ant-design/pro-form';
 import UpdateForm from './updateForm';
 import { getAccountingSubjectList, editAccountingSubjectList, delAccountingSubject, addAccountingSubject, getAccountingSubjectForSelecter } from './service';
 
@@ -46,7 +46,7 @@ const AccountingSubject = () => {
     //   width: '20%'
     // },
     {
-      title:'操作',
+      title: '操作',
       dataIndex: 'option',
       valueType: 'option',
       key: 'option',
@@ -95,7 +95,7 @@ const AccountingSubject = () => {
   const [options, setOptions] = useState([]);
 
   const [ifChild, setIfChild] = useState(false);
-  const [expanedRowIds,setExpanedRowIds] = useState([]);
+  const [expanedRowIds, setExpanedRowIds] = useState([]);
 
 
   /**
@@ -134,33 +134,33 @@ const AccountingSubject = () => {
     }
   };
 
-  const expandHandle = id=>{
-   
-    if(expanedRowIds.includes(id)){
+  const expandHandle = id => {
+
+    if (expanedRowIds.includes(id)) {
       const temp = expanedRowIds;
       temp.splice(temp.findIndex(item => item == id), 1);
       setExpanedRowIds([...temp])
-    }else{
-      setExpanedRowIds([...expanedRowIds,id])
+    } else {
+      setExpanedRowIds([...expanedRowIds, id])
     }
   }
-  
+
 
   /**
    * 
    * @param {Object} record  record对象
    * @param {String} type  可选值[del,edit,‘add’]
    */
-  const customRowUpdata = (record,type)=>{
-      //  console.log({record});
-       const {accountingCode,accountingName,id} = record;
-       const needRowData = {accountingCode,accountingName,id};
-       setIfChild(true);
-       setCurrentRow(needRowData);
-    
-       if(type == 'add')handleModalVisible(true);
-       if(type == 'edit')handleUpdateModalVisible(true);
-       if(type == 'del')delListHandler(needRowData);
+  const customRowUpdata = (record, type) => {
+    //  console.log({record});
+    const { accountingCode, accountingName, id } = record;
+    const needRowData = { accountingCode, accountingName, id };
+    setIfChild(true);
+    setCurrentRow(needRowData);
+
+    if (type == 'add') handleModalVisible(true);
+    if (type == 'edit') handleUpdateModalVisible(true);
+    if (type == 'del') delListHandler(needRowData);
   }
 
   //展开table
@@ -172,67 +172,67 @@ const AccountingSubject = () => {
     return (<table>
       <tbody>
         {
-          child&&child.map((item, index) => {
+          child && child.map((item, index) => {
             const { accountingCode, accountingName, id, child } = item;
             console.log({ accountingCode, accountingName, id, child });
             return (
-              <React.Fragment  key={index}>
+              <React.Fragment key={index}>
                 <tr key={id} style={{ position: 'relative' }}>
                   <td>
                     <table>
                       <tbody>
-                      <tr>
-                        <td style={{ position: 'absolute', width: 0 }}>
-                          {
-                            child&&child.length > 0 &&(
-                              <button onClick={()=>expandHandle(id)} style={{top:12}} className={
-                                expanedRowIds.includes(id)?'ant-table-row-expand-icon ant-table-row-expand-icon-expanded':'ant-table-row-expand-icon ant-table-row-expand-icon-collapsed'
-                              }></button>
-                            ) 
-                          }
-                          {/* <button className="ant-table-row-expand-icon ant-table-row-expand-icon-expanded customExpandIcon"></button> */}
-                        </td>
-                        <td width="30%" style={{ paddingLeft: '0.8%',paddingTop:10,paddingBottom:10 }}><span style={{transform:'rotateY(180deg)'}}>↵</span>会计科目名称:{accountingName}</td>
-                        <td width="30%" style={{ paddingLeft: '0.3%' }}>会计科目编码:{accountingCode}</td>
-                        <td width="20%" style={{ paddingLeft: '0.7%' }}>否</td>
-                        <td width="15%" style={{ paddingLeft: '0.9%' }}>
-                          <a onClick={()=>customRowUpdata(item,'add')}>添加</a>
-                          <a onClick={()=>customRowUpdata(item,'edit')}>编辑</a>
-                          <a onClick={()=>customRowUpdata(item,'del')}>删除</a>
-                        </td>
-                      </tr>
+                        <tr>
+                          <td style={{ position: 'absolute', width: 0 }}>
+                            {
+                              child && child.length > 0 && (
+                                <button onClick={() => expandHandle(id)} style={{ top: 12 }} className={
+                                  expanedRowIds.includes(id) ? 'ant-table-row-expand-icon ant-table-row-expand-icon-expanded' : 'ant-table-row-expand-icon ant-table-row-expand-icon-collapsed'
+                                }></button>
+                              )
+                            }
+                            {/* <button className="ant-table-row-expand-icon ant-table-row-expand-icon-expanded customExpandIcon"></button> */}
+                          </td>
+                          <td width="30%" style={{ paddingLeft: '0.8%', paddingTop: 10, paddingBottom: 10 }}><span style={{ transform: 'rotateY(180deg)' }}>↵</span>会计科目名称:{accountingName}</td>
+                          <td width="30%" style={{ paddingLeft: '0.3%' }}>会计科目编码:{accountingCode}</td>
+                          <td width="20%" style={{ paddingLeft: '0.7%' }}>否</td>
+                          <td width="15%" style={{ paddingLeft: '0.9%' }}>
+                            <a onClick={() => customRowUpdata(item, 'add')}>添加</a>
+                            <a onClick={() => customRowUpdata(item, 'edit')}>编辑</a>
+                            <a onClick={() => customRowUpdata(item, 'del')}>删除</a>
+                          </td>
+                        </tr>
                       </tbody>
                     </table>
                   </td>
                 </tr>
                 {
-                  expanedRowIds.includes(id)&&<tr key={`expand${id}`}>
-                  <td width="100%">
-                    <table>
-                      <tbody>
-                        {
-                          child.map((data, index) => {
-                    
-                            const { accountingCode, accountingName, id, child } = data;
-                            return (
-                              <tr key={id} style={{ position: 'relative' }}>
-                                <td style={{ position: 'absolute', width: 0 }}>
-                                  {
-                                   child&&child.length > 0 && <button  class="ant-table-row-expand-icon ant-table-row-expand-icon-collapsed"></button>
-                                 }
-                                </td>
-                                <td width="30%" style={{ paddingLeft: '2.5%',paddingTop:10,paddingBottom:10 }}>↵会计科目名称:{accountingName}</td>
-                                <td width="30%" style={{ paddingLeft: '0.3%' }}>会计科目编码:{accountingCode}</td>
-                                <td width="20%" style={{ paddingLeft: '0.7%' }}>否</td>
-                                <td width="15%" style={{ paddingLeft: '0.9%' }}><a >编辑</a></td>
-                              </tr>
-                            )
-                          })
-                        }
-                      </tbody>
-                    </table>
-                  </td>
-                </tr>
+                  expanedRowIds.includes(id) && <tr key={`expand${id}`}>
+                    <td width="100%">
+                      <table>
+                        <tbody>
+                          {
+                            child&&child.map((data, index) => {
+
+                              const { accountingCode, accountingName, id, child } = data;
+                              return (
+                                <tr key={id} style={{ position: 'relative' }}>
+                                  <td style={{ position: 'absolute', width: 0 }}>
+                                    {
+                                      child && child.length > 0 && <button class="ant-table-row-expand-icon ant-table-row-expand-icon-collapsed"></button>
+                                    }
+                                  </td>
+                                  <td width="30%" style={{ paddingLeft: '2.5%', paddingTop: 10, paddingBottom: 10 }}>↵会计科目名称:{accountingName}</td>
+                                  <td width="30%" style={{ paddingLeft: '0.3%' }}>会计科目编码:{accountingCode}</td>
+                                  <td width="20%" style={{ paddingLeft: '0.7%' }}>否</td>
+                                  <td width="15%" style={{ paddingLeft: '0.9%' }}><a >编辑</a></td>
+                                </tr>
+                              )
+                            })
+                          }
+                        </tbody>
+                      </table>
+                    </td>
+                  </tr>
                 }
               </React.Fragment>
             )
@@ -241,10 +241,10 @@ const AccountingSubject = () => {
       </tbody>
     </table>
     )
-    
+
   };
-   
-  const onTabChange = (key)=>{
+
+  const onTabChange = (key) => {
 
     setAccountType(Number(key));
     if (actionRef.current) {
@@ -261,17 +261,17 @@ const AccountingSubject = () => {
 
   return (
     <PageContainer
-    tabList={[
-      {
-        tab: '收益',
-        key: 1,
-      },
-      {
-        tab: '支出',
-        key: 2,
-      },
-    ]} 
-    onTabChange={onTabChange}  
+      tabList={[
+        {
+          tab: '收入',
+          key: 1,
+        },
+        {
+          tab: '支出',
+          key: 2,
+        },
+      ]}
+      onTabChange={onTabChange}
     >
 
       <ProTable
@@ -279,11 +279,11 @@ const AccountingSubject = () => {
         request={getList}
         actionRef={actionRef}
         rowKey="id"
-        expandable={{defaultExpandedRowKeys:[]}}
+        expandable={{ defaultExpandedRowKeys: [] }}
         // expandable={{ expandedRowRender }}
         toolbar={{
           actions: [
-            
+
             <Button
               key="button"
               icon={<PlusOutlined />}
@@ -309,7 +309,7 @@ const AccountingSubject = () => {
         layout={'horizontal'}
         visible={createModalVisible}
         onVisibleChange={(bool) => {
-        
+
           if (ref.current) {
             ref.current.resetFields();
           }
@@ -318,9 +318,9 @@ const AccountingSubject = () => {
         }}
         formRef={ref}
         onFinish={async (value) => {
-          let id=0;
-          currentRow&&(id=currentRow.id)
-          const success = await addAccountingSubject({ ...value, id:id,accountingType:accountType });
+          let id = 0;
+          currentRow && (id = currentRow.id)
+          const success = await addAccountingSubject({ ...value, id: id, accountingType: accountType });
           //   console.log({ success });
           if (success) {
             handleModalVisible(false);
@@ -332,14 +332,14 @@ const AccountingSubject = () => {
           setCurrentRow(undefined);
         }}
       >
-       
+
 
         <ProFormText
           label="会计科目编码"
           rules={[
             {
               required: true,
-              message:'会计科目编码是必填项',
+              message: '会计科目编码是必填项',
             },
           ]}
           width="sm"
@@ -350,41 +350,49 @@ const AccountingSubject = () => {
           rules={[
             {
               required: true,
-              message:'会计科目名是必填项',
+              message: '会计科目名是必填项',
             },
           ]}
           width="sm"
           name="accountingName"
         />
-        {/* <ProFormSelect
-          rules={[
-            {
-              required: false,
-              message:'',
-            },
-          ]}
-          options={[
-            {
-              value: 0,
-              label: '不是',
-            },
-            {
-              value: 1,
-              label: '是',
-            },
-          ]}
-          width="sm"
-          name="isBaseCode"
-          label="是否固定成本"
-        /> */}
+        <ProFormDependency name={['accountingCode']}>
+          {
+            ({accountingCode}) => {
+              return accountType == 2 ?(
+                <ProFormSelect
+                  rules={[
+                    {
+                      required: true,
+                      message: '',
+                    },
+                  ]}
+                  options={[
+                    {
+                      value: 0,
+                      label: '不是',
+                    },
+                    {
+                      value: 1,
+                      label: '是',
+                    },
+                  ]}
+                  width="sm"
+                  name="isBaseCode"
+                  label="是否固定成本"
+                />
+              ):<></>
+            }
+          }
+        </ProFormDependency>
       </ModalForm>
 
       {/* 更新 */}
       <UpdateForm
         onSubmit={async (value) => {
           // console.log({ '编辑': value });
-          console.log({currentRow});
-          const success = await editAccountingSubjectList({...value,accountType});
+          // console.log({ currentRow });
+          const success = await editAccountingSubjectList({ ...value, accountType });
 
           if (success) {
             handleUpdateModalVisible(false);
@@ -399,6 +407,7 @@ const AccountingSubject = () => {
           handleUpdateModalVisible(false);
           setCurrentRow(undefined);
         }}
+        accountType={accountType}
         updateModalVisible={updateModalVisible}
         updateModalVisibleChange={updateModalVisibleChange}
         values={currentRow || {}}

+ 35 - 5
src/pages/accountingSubject/updateForm.jsx

@@ -1,13 +1,15 @@
 import React from 'react';
 import {
   ProFormText,
-  ModalForm
+  ModalForm,
+  ProFormDependency,
+  ProFormSelect
 } from '@ant-design/pro-form';
 
 
 
 const UpdateForm = (props) => {
-  const { updateModalVisible, updateModalVisibleChange, values, onSubmit } = props;
+  const { updateModalVisible, updateModalVisibleChange, values, onSubmit,accountType } = props;
   // console.log({values});
   return (
     <>
@@ -15,12 +17,12 @@ const UpdateForm = (props) => {
         JSON.stringify(values) !== '{}' && <ModalForm
           title="编辑医院"
           width="800px"
-          initialValues={{ ...values }}
+          initialValues={{ ...values,isBaseCode:values.isBaseCost  }}
           labelCol={{ span: 5, offset: 3 }}
           layout={'horizontal'}
           visible={updateModalVisible}
           onVisibleChange={(visible) => updateModalVisibleChange(visible)}
-          onFinish={(value) => onSubmit({ ...values, ...value })}
+          onFinish={(value) => onSubmit({ ...values, ...value})}
         >
           <ProFormText
             label="会计科目编码"
@@ -45,7 +47,35 @@ const UpdateForm = (props) => {
             width="sm"
             name="accountingName"
           />
-          
+          <ProFormDependency name={['accountingCode']}>
+          {
+            ({accountingCode}) => {
+              return accountType == 2 ?(
+                <ProFormSelect
+                  rules={[
+                    {
+                      required: true,
+                      message: '',
+                    },
+                  ]}
+                  options={[
+                    {
+                      value: 0,
+                      label: '不是',
+                    },
+                    {
+                      value: 1,
+                      label: '是',
+                    },
+                  ]}
+                  width="sm"
+                  name="isBaseCode"
+                  label="是否固定成本"
+                />
+              ):<></>
+            }
+          }
+        </ProFormDependency>
         </ModalForm>
       }
     </>

+ 6 - 7
src/pages/accountingSubjectConnect/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-13 19:06:24
+ * @LastEditTime: 2021-08-28 10:32:49
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -111,15 +111,14 @@ const ResponsibilityCenterConnect = () => {
   //获取责任中心对应列表
   const getList = async (params = {}, sort, filter) => {
     const res = await getAccountProductConnectList({...params,accountType});
-    // console.log({res});
-
-    const defaultKeys = res.data.list.map(item=>item.id);
+    const {data:{list=[],totalCount},success} = res;
+    const defaultKeys = list&&list.map(item=>item.id);
     setDefaultExpandedRowKeys(defaultKeys);
 
     return {
-      data: res.data.list,
-      total: res.data.totalCount,
-      success: res.success,
+      data: list,
+      total:totalCount,
+      success:success,
     };
   };
 

+ 3 - 3
src/pages/apportionmentLevel/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-19 17:47:41
+ * @LastEditTime: 2021-08-28 10:34:23
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -93,8 +93,8 @@ const ApportionmentLevel = () => {
   const getList = async (params = {}, sort, filter) => {
 
     const res = await getApportionmentLevelList(params);
-    const { status, data: { list } } = res;
-    const tempArr = list.map(item => ({ label: item.shareName, value: item.leverSort }))
+    const { status, data: { list=[] } } = res;
+    const tempArr = list&&list.map(item => ({ label: item.shareName, value: item.leverSort }))
     setSelectableLevelList(tempArr);
     return {
       data: res.data.list,

+ 1 - 1
src/pages/apportionmentLevel/updateForm.jsx

@@ -8,7 +8,7 @@ import { Form,Select} from 'antd';
 
 
 const UpdateForm = (props) => {
-  const { updateModalVisible, updateModalVisibleChange, values, onSubmit,selectableLevelList } = props;
+  const { updateModalVisible, updateModalVisibleChange, values, onSubmit,selectableLevelList=[] } = props;
   
   const {targetLevel} = values;
 

+ 30 - 27
src/pages/baseSetting/reportProjectSetting/component/drawerContent.jsx

@@ -7,7 +7,7 @@ import { PageContainer } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
 import {Table } from 'antd';
 import { DrawerForm } from '@ant-design/pro-form';
-import {deepGetVal,unique} from '@/utils';
+import {deepGetVal,deepGetAllParents,unique} from '@/utils';
 
 
 
@@ -83,7 +83,9 @@ export default function DrawerContent(props) {
                         setIfSearch(true);
                     }}
                     onReset={()=>{setIfSearch(false);}}
-                    expandable={{...expandable}}
+                    expandable={{
+                        ...expandable,
+                    }}
                     rowSelection={{
                         // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
                         // 注释该行则默认不显示下拉选项
@@ -91,39 +93,40 @@ export default function DrawerContent(props) {
                         checkStrictly:true,
                         selectedRowKeys:selectedKeys,
                         renderCell:(checked, record, index, originNode)=>{
-                               if(!record.children||record.children.length==0)return originNode
+                               if(!record[expandable['childrenColumnName']]||record[expandable['childrenColumnName']].length==0)return originNode
                         },
                         onChange:(selectedRowKeys, selectedRows)=>{
                             // console.log({selectedRowKeys,selectedRows});
                             setSelectedRows(selectedRows);
                             setSelectedKeys(selectedRowKeys);
+                            setDefaultSelectedKeys([].concat(selectedRowKeys));
                         },
                         onSelect:(record, selected, selectedRows, nativeEvent)=>{
-                            // console.log({record, selected, selectedRows, nativeEvent,ifSearch});
-                            let _defaultSelectedKeys = defaultSelectedKeys;
-                            let {children} = record;
-                            let arr=[];
-                            if(children&&children.length>0){
-                                arr = deepGetVal(children,rowKeys,'children');
-                            }
-                            arr.push(record[rowKeys]);
+                            // // console.log({record, selected, selectedRows, nativeEvent,ifSearch});
+                            // let _defaultSelectedKeys = defaultSelectedKeys;
+                            // let children = record[expandable['childrenColumnName']];
+                            // let arr=[];
+                            // if(children&&children.length>0){
+                            //     arr = deepGetVal(children,rowKeys,expandable['childrenColumnName']);
+                            // }
+                            // arr.push(record[rowKeys]);
                             
-                            if(!selected){
-                                arr.forEach(val=>{
-                                    const index =  defaultSelectedKeys.findIndex(item=>item == val);
-                                // console.log(index,record[rowKeys],defaultSelectedKeys)
-                                    if(index != -1){
-                                        _defaultSelectedKeys.splice(index,1);
-                                    }
-                                });
-                                _defaultSelectedKeys = unique(_defaultSelectedKeys);
-                                setDefaultSelectedKeys(_defaultSelectedKeys);
-
-                            }else{
-                                let tempArr = _defaultSelectedKeys.concat(arr);
-                                tempArr = unique(tempArr);
-                                setDefaultSelectedKeys([].concat(tempArr));
-                            }
+                            // if(!selected){
+                            //     arr.forEach(val=>{
+                            //         const index =  defaultSelectedKeys.findIndex(item=>item == val);
+                            //     // console.log(index,record[rowKeys],defaultSelectedKeys)
+                            //         if(index != -1){
+                            //             _defaultSelectedKeys.splice(index,1);
+                            //         }
+                            //     });
+                            //     _defaultSelectedKeys = unique(_defaultSelectedKeys);
+                            //     setDefaultSelectedKeys(_defaultSelectedKeys);
+
+                            // }else{
+                            //     let tempArr = _defaultSelectedKeys.concat(arr);
+                            //     tempArr = unique(tempArr);
+                            //     setDefaultSelectedKeys([].concat(tempArr));
+                            // }
 
                         }
                     }}

+ 52 - 27
src/pages/baseSetting/reportProjectSetting/index.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-19 17:26:06
+ * @LastEditTime: 2021-08-28 16:28:25
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -35,8 +35,14 @@ import { getAccountingSubjectList } from '@/pages/accountingSubject/service';
 
 import { getApportionmentLevelList } from '@/pages/apportionmentLevel/service';
 
+import {getResponsibilityCenterList} from '@/pages/responsibilityCenter/service';
+
 import DrawerContent from './component/drawerContent';
 
+import {reportTypes} from '@/projectConstant';
+
+import {deepGetAllParents} from '@/utils';
+
 const IncomeCollectionSetting = () => {
   const columns = [
     {
@@ -131,6 +137,7 @@ const IncomeCollectionSetting = () => {
             onClick={() => {
               setIfAddZeroLevelMenu(false);
               handleModalVisible(true);
+              setModalFormType(1);
               setCurrentRow(record);
             }}
           >
@@ -164,7 +171,7 @@ const IncomeCollectionSetting = () => {
                   setRelationInit(showAddRelation, record);
                 }}
               >
-                {showAddRelation == 1 ? '对应会计科目设置' : showAddRelation == 2 && '对应分摊层级'}
+                {showAddRelation == 1 ? '对应会计科目设置' : showAddRelation == 2 ? '对应分摊层级设置':showAddRelation==3&&'对应责任中心设置'}
               </a>,
               ...btnGroup,
             ]
@@ -202,28 +209,24 @@ const IncomeCollectionSetting = () => {
     },
   ];
 
-
-  const tabList = [
-    {
-      tab: '损益表',
-      key: 0,
-    },
-    {
-      tab: '完全成本法表',
-      key: 1,
-    },
+  const responsibilityColumn = [
     {
-      tab: '变动成本表',
-      key: 2,
-    },
-    {
-      tab: '全院损益表',
-      key: 3,
+      title: '责任中心编码',
+      dataIndex: 'responsibilityCode',
+      key: 'responsibilityCode',
+      hideInSearch: false,
     },
     {
-      tab: '全成本报表',
-      key: 4,
+      title: '责任中心名',
+      dataIndex: 'responsibilityName',
+      key: 'responsibilityName',
+      hideInSearch: false,
     },
+  ];
+
+
+  const tabList = [
+    ...reportTypes
   ]
 
   const [createModalVisible, handleModalVisible] = useState(false);
@@ -244,6 +247,8 @@ const IncomeCollectionSetting = () => {
 
   const [selectedKeys, setSelectedKeys] = useState([]);
 
+  const [defaultExpandedKeys,setDefaultExpandedKeys] = useState([]);
+
   /**
    *
    * @param {Boolean} bool 弹窗展示状态
@@ -267,6 +272,9 @@ const IncomeCollectionSetting = () => {
   const getTableList = async (params = {}, sort, filter) => {
     if (settingType == 1) {
       const res = await getAccountingSubjectList({ ...params, accountType });
+      const opendedArr = deepGetAllParents(res.data.list,'children');
+      opendedArr&&setDefaultExpandedKeys(opendedArr.map(item=>item.accountingCode));
+      
       return {
         data: res.data.list,
         total: res.data.totalCount,
@@ -281,6 +289,16 @@ const IncomeCollectionSetting = () => {
         success: res.success,
       };
     }
+    if (settingType == 3) {
+      const res = await getResponsibilityCenterList({ ...params });
+      const opendedArr = deepGetAllParents(res.data.list,'child');
+      opendedArr&&setDefaultExpandedKeys(opendedArr.map(item=>item.responsibilityCode));
+      return {
+        data: res.data.list,
+        total: res.data.totalCount,
+        success: res.success,
+      };
+    }
   };
 
   //tab切换
@@ -316,7 +334,7 @@ const IncomeCollectionSetting = () => {
     setCurrentRow(record);
 
     const resp = await getHasSetReportRelation({ reportId, relation: showAddRelation });
-    const { status, data } = resp;
+    const { status, data=[] } = resp;
     if (status == 200) {
       if (showAddRelation == 1) {
         const tempArr = data.map((item) => item.code);
@@ -324,7 +342,10 @@ const IncomeCollectionSetting = () => {
       }
       if (showAddRelation == 2) {
         const tempArr = data.map((item) => Number(item.code));
-        console.log({ tempArr, showAddRelation });
+        setSelectedKeys(tempArr);
+      }
+      if (showAddRelation == 3) {
+        const tempArr = data.map((item) =>item.code);
         setSelectedKeys(tempArr);
       }
     }
@@ -494,12 +515,16 @@ const IncomeCollectionSetting = () => {
 
       {/* 对应设置抽屉 */}
       <DrawerContent
-        title={settingType == 1 ? '对应会计科目设置' : '对应分摊层级'}
-        columns={settingType == 1 ? accountingSubjectColumn : shareParamsColumn} //shareParamsColumn
+        title={settingType == 1 ? '对应会计科目设置' : settingType==2?'对应分摊层级设置':'对应责任中心设置'}
+        columns={settingType == 1 ? accountingSubjectColumn : settingType==2?shareParamsColumn:responsibilityColumn} //shareParamsColumn
         visible={drawerVisible}
         currentRow={currentRow}
         // tableRef = {drawerTableRef}
         defaultSelected={selectedKeys}
+        expandable={{
+          childrenColumnName:settingType==1?'children':'child',
+          expandedRowKeys:defaultExpandedKeys
+        }}
         pageContainerConfig={(tableRef) => {
           return {
             header: {
@@ -530,18 +555,18 @@ const IncomeCollectionSetting = () => {
         }}
         onVisibleChange={(bool) => setDrawerVisible(bool)}
         renderListFunc={getTableList}
-        config={{ tableSearch: false, rowKeys: settingType == 1 ? 'accountingCode' : 'id' }}
+        config={{ tableSearch: false, rowKeys: settingType == 1 ? 'accountingCode' :settingType==2?'id':'responsibilityCode' }}
         onFinishFunc={async (value, selectedRowKeys) => {
           // console.log({value,selectedRowKeys});
           let selectedRowKeysToStr = [];
           if (settingType == 2) {
-            selectedRowKeys.map((item) => selectedRowKeysToStr.push(`${item}`));
+            selectedRowKeys?selectedRowKeys.map((item) => selectedRowKeysToStr.push(`${item}`)):[];
           }
           const { id: reportId } = currentRow;
           const resp = await saveReportRelation({
             reportId,
             relation: settingType,
-            relationCodes: settingType == 1 ? selectedRowKeys : selectedRowKeysToStr,
+            relationCodes: settingType != 2 ? selectedRowKeys : selectedRowKeysToStr,
           });
           const { status } = resp;
           if (status == 200) {

+ 1 - 1
src/pages/baseSetting/reportProjectSetting/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-08-03 14:38:54
- * @LastEditTime: 2021-08-17 15:10:20
+ * @LastEditTime: 2021-08-26 10:00:57
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /CostAccountManaSys/src/pages/platformMana/menuManage/service.js

+ 2 - 2
src/pages/baseSetting/visitsAndBedDayCostSetting/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-13 20:18:17
+ * @LastEditTime: 2021-08-28 10:41:01
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -174,7 +174,7 @@ const DistrictMana = () => {
     if (type == 2) {
       const res = await getReportProjectSettingList({ ...params, reportType: activeKey });
 
-      const arr = res.data.list.map(item=>item.num);
+      const arr = res.data.list?res.data.list.map(item=>item.num):[];
       setExpandedRowKeys(arr);
 
       return {

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

@@ -2,7 +2,7 @@
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
 
- * @LastEditTime: 2021-08-20 16:26:15
+ * @LastEditTime: 2021-08-28 10:42:58
 
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
@@ -98,7 +98,7 @@ const AfterCollectionSearch = () => {
             <ProFormSelect
               request={async () => {
                 const resp = await getCostProjecttList({ pageSize: 100 });
-                const { status, data: { list } } = resp;
+                const { status, data: { list=[] } } = resp;
                 if (status == 200) {
                 
                   const arr = list.map(item => ({
@@ -228,7 +228,7 @@ const AfterCollectionSearch = () => {
   const getReportData = async (params = {}, sort, filter)=>{
 
     const resp = await getAfterIncomeCollectionTableData({...params,date:currentTime,responsibilityCode:selectedResponsibilityCode,accountingCode:selectedAccountingCode});
-    const { status, data: { titleMap, realData, totalMap } } = resp;
+    const { status, data: { titleMap=[], realData, totalMap=[] } } = resp;
     if (status == 200) {
       const titleMapToArr = Object.entries(titleMap);
       const totalMapToArr = Object.entries(totalMap);

+ 107 - 0
src/pages/costAccounting/afterCostShareSearch/components/DrawerContent.jsx

@@ -0,0 +1,107 @@
+
+
+
+
+import React,{useState,useEffect,useRef} from 'react'
+// import { PageContainer } from '@ant-design/pro-layout';
+import ProTable from '@ant-design/pro-table';
+import {Table } from 'antd';
+import { DrawerForm } from '@ant-design/pro-form';
+import { PageContainer } from '@ant-design/pro-layout';
+
+
+
+
+
+
+export default function DrawerContent(props) {
+
+    const { 
+        visible=false,
+        onVisibleChange=()=>{},
+        currentRow={},
+        renderListFunc=()=>{},
+        onFinishFunc=()=>{console.log('init onFinishFunc')},
+        columns=[],
+        defaultSelected=[],
+        config={},
+        title,
+        type,
+        tabList,
+        onTabChange,
+        renderCell,
+        tabActiveKey,
+        expandable
+    } = props;
+    
+    const {rowKeys='id',tableSearch=false,} = config;
+    const drawerRef = useRef();
+    const drawerTableRef = useRef();
+    const [selectedKeys,setSelectedKeys] = useState([]);
+    const [defaultSelectedKeys,setDefaultSelectedKeys] = useState([]);
+    const [ifSearch,setIfSearch] = useState(false);
+    const [selectedRows,setSelectedRows] = useState([]);
+
+    const renderDefault = ()=>{
+        // console.log({defaultSelected});
+        const defaultSelects = defaultSelected;
+        setDefaultSelectedKeys(defaultSelected);
+        setSelectedKeys(defaultSelects);
+    }
+
+
+    useEffect(()=>{
+        // console.log({tabActiveKey});
+        renderDefault();
+    },[props]);
+
+
+    return visible&&currentRow&&columns.length>0 ? (
+        <>
+            <DrawerForm
+                title={title}
+                visible={visible}
+                width={'90%'}
+                onVisibleChange={onVisibleChange}
+                formRef={drawerRef}
+                drawerProps={{
+                    forceRender: true,
+                    destroyOnClose: true,
+                    footer:null
+                }}
+
+                onFinish={async (values) => {
+                      onFinishFunc(values,defaultSelectedKeys,selectedRows);
+                }}
+            
+            >
+                <PageContainer  
+                    header={{
+                         title:'',
+                         breadcrumb:''
+                    }}
+                    tabActiveKey={tabActiveKey}
+                    tabList={tabList}
+                    onTabChange={(key)=>onTabChange(key,drawerTableRef)}
+                >
+                <ProTable
+                    columns={columns}
+                    rowKey={rowKeys}
+                    tableClassName="drawerContent"
+                    request={renderListFunc}
+                    search={tableSearch}
+                    actionRef={drawerTableRef}
+                    pagination={false}
+                    onSubmit={(u)=>{
+                        //  console.log({u});
+                        setIfSearch(true);
+                    }}
+                    onReset={()=>{setIfSearch(false);}}
+                    expandable={expandable}
+                    
+                />
+                </PageContainer>
+            </DrawerForm>
+        </>
+    ) : <></>
+}

+ 295 - 0
src/pages/costAccounting/afterCostShareSearch/index.jsx

@@ -0,0 +1,295 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 10:13:13
+
+ * @LastEditTime: 2021-08-28 19:08:04
+
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
+ */
+
+// import { PlusOutlined } from '@ant-design/icons';
+import { Cascader, Form, Button, Drawer, Table } from 'antd';
+import React, { useRef, useState, useEffect } from 'react';
+import { PageContainer } from '@ant-design/pro-layout';
+import ProTable from '@ant-design/pro-table';
+import {
+  ProFormDatePicker,
+  ProFormSelect,
+} from '@ant-design/pro-form';
+import { getAfterCostShareSearchList, getAfterCostShareSearchTableData } from './service';
+import { getResponsibilityCenterList } from '@/pages/responsibilityCenter/service';
+import {getAccountingSubjectList} from '@/pages/accountingSubject/service';
+import moment from 'moment';
+import 'moment/locale/zh-cn';
+import locale from 'antd/es/date-picker/locale/zh_CN';
+import './index.less';
+
+const AfterCollectionSearch = () => {
+
+  const [currentTime, setCurrentTime] = useState(moment(new Date()).subtract(1,'months').format('YYYY-MM'));
+  const [selectableResponsibilityList, setSelectableResponsibilityList] = useState([]);
+  const [selectedResponsibilityCode,setSelectedResponsibilityCode] = useState(null);
+
+  const [selectableAccountingSubjectList,setSelectableAccountingSubjectList] = useState([]);
+  
+  // const [selectableCostProjectList, setSelectableCostProjectList] = useState([])
+
+  const columns = [
+    {
+      title: '选择时间',
+      key: 'dateTime',
+      hideInTable: true,
+      dataIndex: 'dateTime',
+      renderFormItem: (item, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
+
+        if (type === 'form') {
+          return null;
+        }
+        return (
+          <Form.Item >
+            <ProFormDatePicker initialValue={currentTime} fieldProps={{ picker: 'month', format: (value) => { return value.format('YYYY-MM') }, locale: locale,onChange:(moment)=>{setCurrentTime(moment.format('YYYYMM'))} }} name="dateTime" />
+          </Form.Item>
+        )
+      },
+    },
+    {
+      title: '执行责任中心',
+      key: 'responsibilityCode',
+      hideInTable: true,
+      fieldProps: (form, config) => {
+        // console.log({ form, config });
+      },
+      dataIndex: 'responsibilityName',
+      renderFormItem: (item, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
+        // console.log({item,type, defaultRender,formItemProps, fieldProps,rest,form })
+        if (type === 'form') {
+          return null;
+        }
+
+        return (
+          <Form.Item name="responsibilityCode">
+            <Cascader options={selectableResponsibilityList}
+              fieldNames={{
+                label: 'responsibilityName',
+                value: 'responsibilityCode',
+                children: 'child',
+              }}
+              onChange={(val)=>{setSelectedResponsibilityCode(val)}}
+              {...fieldProps}
+            />
+          </Form.Item>
+        )
+      },
+    },
+    {
+      title: '年份',
+      dataIndex: 'dateYear',
+      key: 'dateYear',
+      hideInSearch: true,
+    },
+    {
+      title: '月份',
+      dataIndex: 'dateMonth',
+      key: 'dateMonth',
+      hideInSearch: true,
+    },
+    {
+      title: '分摊层级',
+      dataIndex: 'levelSort',
+      key: 'levelSort',
+      hideInSearch: true,
+    },
+    {
+      title: '分摊层级名',
+      dataIndex: 'levelName',
+      key: 'levelName',
+      hideInSearch: true,
+    },
+    {
+      title: '责任中心编码',
+      dataIndex: 'responsibilityCode',
+      key: 'responsibilityCode',
+      hideInSearch: true,
+    },
+    {
+      title: '责任中心名',
+      dataIndex: 'responsibilityName',
+      key: 'responsibilityName',
+      hideInSearch: true,
+    },
+    {
+      title: '会计科目编码',
+      dataIndex: 'accountingCode',
+      key: 'accountingCode',
+      hideInSearch: true,
+    },
+    {
+      title: '会计科目名',
+      dataIndex: 'accountingName',
+      key: 'accountingName',
+      hideInSearch: true,
+    },
+    {
+      title: '金额',
+      dataIndex: 'amount',
+      key: 'amount',
+      hideInSearch: true,
+    }
+  ];
+
+
+
+
+  const actionRef = useRef();
+  const [totalCount, setTotalCount] = useState(0);
+  const [drawerVisible, setDrawerVisible] = useState(false);
+  const [reportTableColumns, setReportTableColumns] = useState([]);
+  const [totalData,setTotalData] = useState([]);
+
+  //获取列表
+  const getList = async (params = {}, sort, filter) => {
+
+    const { dateTime,responsibilityCode=[],pageSize,current} = params;
+   
+    const res = await getAfterCostShareSearchList({
+       responsibilityCode:responsibilityCode[responsibilityCode.length-1],
+       year: moment(dateTime).format('yyyy-MM-DD'),pageSize,current });
+
+    if (res && res.status) {
+      const { data: { totalAmount=0 } } = res;
+      setTotalCount(totalAmount);
+      return {
+        data: res.data.list,
+        total: res.data.totalCount,
+        success: res.success,
+      };
+    }
+
+  };
+
+
+  const renderDrawerHandle = () => {
+   
+      setDrawerVisible(true);
+
+    
+  }
+
+  const getReportData = async (params = {}, sort, filter)=>{
+
+    const resp = await getAfterCostShareSearchTableData(
+      {...params,year:moment(currentTime).format('YYYY-MM-DD'),responsibilityCode:selectedResponsibilityCode}
+    );
+    const { status, data: { titleMap={}, realData=[], totalMap={} } } = resp;
+    if (status == 200) {
+      const titleMapToArr = Object.entries(titleMap);
+      const totalMapToArr = Object.entries(totalMap);
+      const columns = [...titleMapToArr].map((item, index) => {
+        if (index == 0 || index == [...titleMapToArr].length - 1) {
+          return {
+            title: item[1],
+            dataIndex: item[0],
+            key: item[0],
+            fixed:index == 0?'left':'right',
+            hideInSearch: true,
+            width: 100,
+          }
+        }
+        return {
+          title: item[1],
+          dataIndex: item[0],
+          key: item[0],
+          hideInSearch: true,
+          width: 500,
+        }
+      });
+      
+      setReportTableColumns(columns);
+      setTotalData(totalMapToArr);
+
+      return Promise.resolve({
+        data: realData,
+        success: true,
+      });
+    }
+  }
+
+  const getAllAccountingSubjectForSearch = async ()=>{
+    const resp = await getAccountingSubjectList({pageSize:200,current:1,accountType:2});
+    const {data:{list=[]}} = resp;
+    setSelectableAccountingSubjectList(list);
+  }
+
+
+  useEffect(async () => {
+    const responsibilityList = await getResponsibilityCenterList({ pageSize: 500 });
+    const { data: { list } } = responsibilityList;
+    setSelectableResponsibilityList(list);
+    await getAllAccountingSubjectForSearch();
+  }, []);
+
+  return (
+    <PageContainer>
+      <ProTable
+        columns={columns}
+        request={getList}
+        actionRef={actionRef}
+        rowKey="id"
+        toolBarRender={() => [
+          <Button key='reportBtn' type='primary' onClick={() => renderDrawerHandle()}>报表数据</Button>
+        ]}
+        pagination={{
+          pageSize: 10,
+        }}
+        search={{
+          defaultCollapsed: false,
+          labelWidth: 'auto',
+        }}
+        footer={() => <a>{`合计:${totalCount}`}</a>}
+
+      />
+
+      <Drawer
+        title="报表数据"
+        placement="right"
+        width={'90%'}
+        destroyOnClose={true}
+        closable={true}
+        onClose={() => setDrawerVisible(false)}
+        visible={drawerVisible}
+      >
+        <ProTable
+          columns={reportTableColumns}
+          request={getReportData}
+          actionRef={actionRef}
+          rowKey="id"
+          bordered
+          pagination={false}
+          search={false}
+          scroll={{ x: 1500, y: 300 }}
+          summary={() => (
+            <Table.Summary fixed >
+              <Table.Summary.Row className="rowCell">
+                {/* <Table.Summary.Cell className="firstCell" index={0}>合计</Table.Summary.Cell> */}
+                {
+                  totalData.map((item, index) => {
+                    return (
+                      <Table.Summary.Cell key={index}  className={index == totalData.length-1 ? 'ant-table-cell ant-table-cell-fix-right ant-table-cell-fix-right-last' : 'cell'} index={index}>{item[1]}</Table.Summary.Cell>
+                    )
+                  })
+                }
+              </Table.Summary.Row>
+            </Table.Summary>
+          )}
+        // footer={() => <a>{`合计:${totalCount}`}</a>}
+
+        />
+      </Drawer>
+
+    </PageContainer>
+  );
+};
+
+export default AfterCollectionSearch;

+ 17 - 0
src/pages/costAccounting/afterCostShareSearch/index.less

@@ -0,0 +1,17 @@
+
+
+.rowCell {
+    position: relative;
+}
+.firstCell {
+      z-index: 99 !important;
+}
+
+.lastCell {
+     position: sticky;
+     right: 0 !important;
+}
+
+.cell {
+    padding: 5px 8px !important;
+}

+ 36 - 0
src/pages/costAccounting/afterCostShareSearch/service.js

@@ -0,0 +1,36 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 08:54:08
+ * @LastEditTime: 2021-08-28 18:47:38
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
+ */
+
+import { request } from 'umi';
+
+
+//获取分摊后查询列表
+export async function getAfterCostShareSearchList(params, options) {
+    return request('/api/costAccount/costcostinggroup/queryAfterAllocation', {
+      method: 'GET',
+      params:{...params},
+      ...(options || {}),
+    });
+}
+
+
+
+
+
+
+//获取报表数据列表
+export async function getAfterCostShareSearchTableData(params, options) {
+  return request('/api/costAccount/costcostinggroup/queryAfterAllocationForm', {
+    method: 'GET',
+    params:{...params},
+    ...(options || {}),
+  });
+}
+
+

+ 6 - 5
src/pages/costAccounting/beforeCollectionSearch/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-20 16:13:29
+ * @LastEditTime: 2021-08-28 15:01:12
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -91,9 +91,9 @@ const IncomeCostDataImport = () => {
               <ProFormSelect
                 request={async ()=>{
                      const resp = await getCostProjecttList({pageSize:500});
-                     const {status,data:{list}} = resp;
+                     const {status,data:{list=[]}} = resp;
                      if(status==200){
-                      console.log({resp,list});
+                      // console.log({resp,list});
                           const arr = list.map(item=>({
                                'label':item.productName,
                                'value':item.productCode
@@ -178,9 +178,10 @@ const IncomeCostDataImport = () => {
 
   //获取列表
   const getList = async (params = {}, sort, filter) => {
-    const {dateTime}  = params;
+    const {dateTime,responsibilityCode=[]}  = params;
     // console.log(moment(dateTime).format('YYYY-MM'));
-    const res = await getBeforeIncomeCollectionList({ ...params,dateTime:moment(dateTime).format('YYYY-MM')});
+    console.log({responsibilityCode});
+    const res = await getBeforeIncomeCollectionList({ ...params,dateTime:moment(dateTime).format('YYYY-MM'),responsibilityCode:responsibilityCode[responsibilityCode.length-1]});
     if(res&&res.status){
       const { data: { totalAmount } } = res;
       setTotalCount(totalAmount);

+ 161 - 0
src/pages/costAccounting/costShare/index.jsx

@@ -0,0 +1,161 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 10:13:13
+ * @LastEditTime: 2021-08-28 19:31:21
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
+ */
+
+// import { PlusOutlined } from '@ant-design/icons';
+import {Form,Button} from 'antd';
+import React, { useRef, useState, useEffect } from 'react';
+import { PageContainer } from '@ant-design/pro-layout';
+import ProTable from '@ant-design/pro-table';
+import {
+  ProFormDatePicker,
+} from '@ant-design/pro-form';
+import { getCostShareList,startAllocation,cancelAllocation } from './service';
+
+import moment from 'moment';
+import 'moment/locale/zh-cn';
+import locale from 'antd/es/date-picker/locale/zh_CN';
+
+const CostShare = () => {
+
+  const [currentTime, setCurrentTime] = useState(moment(new Date()).subtract(1,'months').format('YYYY-MM'));
+
+  const columns = [
+    {
+      title: '选择年月',
+      key: 'date',
+      hideInTable: true,
+      dataIndex: 'date',
+      renderFormItem: (item, {type, defaultRender,formItemProps, fieldProps, ...rest }, form) => {
+       
+        if (type === 'form') {
+          return null;
+        }
+        return (
+          <Form.Item >
+             <ProFormDatePicker initialValue={currentTime} 
+             fieldProps={{
+               picker:'month',format:(value)=>{return value.format('YYYY-MM')},locale:locale,
+               onChange:(val)=>{console.log({val});setCurrentTime(val)}
+             }}  
+             name="date" />
+          </Form.Item>
+        )
+      },
+    },
+    {
+      title: '年份',
+      dataIndex: 'year',
+      key: 'year',
+      hideInSearch: true,
+    },
+    {
+      title: '月份',
+      dataIndex: 'month',
+      key: 'month',
+      hideInSearch: true,
+    },
+    {
+      title: '金额',
+      dataIndex: 'amount',
+      key: 'amount',
+      hideInSearch: true,
+    },
+    {
+      title: '是否分摊',
+      dataIndex: 'isAllocation',
+      key: 'isAllocation',
+      hideInSearch: true,
+      render:bool=>bool?'已分摊':'未分摊'
+    },
+    {
+      title:'操作',
+      dataIndex: 'option',
+      valueType: 'option',
+      key: 'option',
+      width: '15%',
+      render: (_, record) =>{
+          const {isAllocation} = record;
+          return [
+            <Button
+              key="config"
+              size='small'
+              // disabled={isAllocation}
+              type={isAllocation?'default':'primary'}
+              onClick={() => {
+                setCurrentRow(record);
+                optionBtnGroupshandle(isAllocation,record);
+              }}
+            >
+                <span style={{fontSize:12}}>{isAllocation?'撤销分摊':'开始分摊'}</span>
+            </Button>
+          ]
+      },
+    },
+  ];
+
+
+  const actionRef = useRef();
+  const [currentRow,setCurrentRow] = useState(undefined);
+  
+  //获取列表
+  const getList = async (params = {}, sort, filter) => {
+    const {date,pageSize,current}  = params;
+ 
+    const res = await getCostShareList({pageSize,current,date:moment(date).format('YYYY-MM-DD')});
+    if(res&&res.status){
+     
+      return {
+        data: res.data.list,
+        total: res.data.totalCount,
+        success: res.success,
+      };
+    }
+    
+  };
+
+
+  const optionBtnGroupshandle = async (isAllocation,record)=>{
+      if(!isAllocation){
+        //开始分摊
+        await startAllocation({year:currentTime.format('YYYY'),month:currentTime.format('MM')});
+      }
+      if(isAllocation){
+        //撤销分摊
+        await cancelAllocation({year:currentTime.format('YYYY'),month:currentTime.format('MM')});
+      }
+      
+      actionRef?.current?.reload();
+  }
+
+
+
+
+  return (
+    <PageContainer>
+      <ProTable
+        columns={columns}
+        request={getList}
+        actionRef={actionRef}
+        rowKey="id"
+        toolBarRender={() => [
+        ]}
+
+        pagination={{
+          pageSize: 10,
+        }}
+        search={{
+          defaultCollapsed: false,
+          labelWidth: 'auto',
+        }}
+      />
+    </PageContainer>
+  );
+};
+
+export default CostShare;

+ 43 - 0
src/pages/costAccounting/costShare/service.js

@@ -0,0 +1,43 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 08:54:08
+ * @LastEditTime: 2021-08-28 20:19:52
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
+ */
+
+import { request } from 'umi';
+
+
+//获取 成本分摊列表
+export async function getCostShareList(params, options) {
+    return request('/api/costAccount/costcostinggroup/allocationList', {
+      method: 'GET',
+      params:{...params},
+      ...(options || {}),
+    });
+}
+
+
+//开始分摊
+export async function startAllocation(body, options) {
+
+  return request('/api/costAccount/costcostinggroup/startAllocation', {
+    method: 'POST',
+    data:body,
+    ...(options || {}),
+  });
+}
+
+//撤销分摊
+export async function cancelAllocation(body, options) {
+
+  return request('/api/costAccount/costcostinggroup/cancelAllocation', {
+    method: 'POST',
+    params:body,
+    ...(options || {}),
+  });
+}
+
+

+ 2 - 2
src/pages/costAccounting/costShareParamsHandle/index.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-20 17:12:49
+ * @LastEditTime: 2021-08-28 10:49:29
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -675,7 +675,7 @@ const CostShareParamsHandle = () => {
                 const resp = await getCostshareparamList({ ...params, pageSize: 500 });
                 const {
                   status,
-                  data: { list },
+                  data: { list=[] },
                 } = resp;
                 if (status == 200) {
                   return (

+ 194 - 0
src/pages/costAccounting/costShareReportTable/index.jsx

@@ -0,0 +1,194 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 10:13:13
+ * @LastEditTime: 2021-08-28 20:58:27
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
+ */
+
+// import { PlusOutlined } from '@ant-design/icons';
+import { Form, Button } from 'antd';
+import React, { useRef, useState, useEffect } from 'react';
+import { PageContainer } from '@ant-design/pro-layout';
+import ProTable from '@ant-design/pro-table';
+import {
+  ProFormDatePicker,
+} from '@ant-design/pro-form';
+import { getCostShareReportList } from './service';
+
+import moment from 'moment';
+import 'moment/locale/zh-cn';
+import locale from 'antd/es/date-picker/locale/zh_CN';
+
+
+import {envConfig} from '../../../../config/defaultSettings';
+
+const {host} = envConfig;
+const Host = host;
+
+
+const CostShare = () => {
+
+  const [currentTime, setCurrentTime] = useState(moment(new Date()).subtract(1, 'months').format('YYYY-MM'));
+
+  const columns = [
+    {
+      title: '选择年月',
+      key: 'date',
+      hideInTable: true,
+      dataIndex: 'date',
+      renderFormItem: (item, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
+
+        if (type === 'form') {
+          return null;
+        }
+        return (
+          <Form.Item >
+            <ProFormDatePicker 
+              // initialValue={currentTime}
+              fieldProps={{
+                picker: 'month', format: (value) => { return value.format('YYYY-MM') }, locale: locale,
+                onChange: (val) => { console.log({ val }); setCurrentTime(val) }
+              }}
+              name="date" />
+          </Form.Item>
+        )
+      },
+    },
+    {
+      title: '年份',
+      dataIndex: 'year',
+      key: 'year',
+      hideInSearch: true,
+    },
+    {
+      title: '月份',
+      dataIndex: 'month',
+      key: 'month',
+      hideInSearch: true,
+    },
+    {
+      title: '分摊报表名称',
+      dataIndex: 'shareReportName',
+      key: 'shareReportName',
+      hideInSearch: true,
+    },
+    {
+      title: '分摊层级',
+      dataIndex: 'shareLevel',
+      key: 'shareLevel',
+      hideInSearch: true,
+    },
+    {
+      title: '分摊时间',
+      dataIndex: 'shareTime',
+      key: 'shareTime',
+      hideInSearch: true,
+    },
+    
+    {
+      title: '操作',
+      dataIndex: 'option',
+      valueType: 'option',
+      key: 'option',
+      width: '15%',
+      render: (_, record) => {
+        return [
+          <Button
+            key="review"
+            size='small'
+            onClick={() => {
+              setCurrentRow(record);
+              optionBtnGroupshandle('preview',record);
+            }}
+          >
+            预览
+          </Button>,
+          <Button
+            key="download"
+            size='small'
+            onClick={() => {
+              setCurrentRow(record);
+              optionBtnGroupshandle('download',record);
+            }}
+          >
+            下载
+          </Button>
+        ]
+      },
+    },
+  ];
+
+
+  const actionRef = useRef();
+  const [currentRow, setCurrentRow] = useState(undefined);
+
+  //获取列表
+  const getList = async (params = {}, sort, filter) => {
+    const { date, pageSize, current } = params;
+
+    const res = await getCostShareReportList({ pageSize, current, date: moment(date).format('YYYY-MM-DD') });
+    if (res && res.status) {
+
+      return {
+        data: res.data.list,
+        total: res.data.totalCount,
+        success: res.success,
+      };
+    }
+
+  };
+
+  /**
+   * 
+   * @param {String} type 操作类型
+   * @param {Object} record 
+   */
+  const optionBtnGroupshandle = async (type, record) => {
+    const userData = localStorage.getItem('userData');
+    const {shareLevel,shareLevelId} = record;
+    let tokenVal='';
+    if (userData) {
+      const { token } = JSON.parse(userData);
+      tokenVal = token
+    }
+    const url = `${Host}/costAccount/excel/getShareReportTemplate?token=${tokenVal}&year=${currentTime.format('YYYY')}&month=${currentTime.format('MM')}&levelSort=${shareLevel}&shareLevelId=${shareLevelId}`;
+    if(type=='download'){
+      // const resp = await getExcelDownloadLink({ year: currentTime.format('YYYY'), month: currentTime.format('MM'),token:tokenVal,levelSort:shareLevel });
+      window.open(url);
+    }
+    if(type=='preview'){
+      // const resp = await getExcelDownloadLink({ year: currentTime.format('YYYY'), month: currentTime.format('MM'),token:tokenVal,levelSort:shareLevel });
+      window.open(`http://view.xdocin.com/xdoc?_xdoc=${url}`);
+    }
+  }
+
+
+
+
+
+  return (
+    <PageContainer>
+      <ProTable
+        columns={columns}
+        request={getList}
+        actionRef={actionRef}
+        rowKey="id"
+        toolBarRender={() => [
+        ]}
+
+        pagination={{
+          pageSize: 10,
+        }}
+        search={{
+          defaultCollapsed: false,
+          labelWidth: 'auto',
+          searchText:'生成报表'
+        }}
+      />
+    </PageContainer>
+  );
+};
+
+export default CostShare;

+ 25 - 0
src/pages/costAccounting/costShareReportTable/service.js

@@ -0,0 +1,25 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 08:54:08
+ * @LastEditTime: 2021-08-27 18:17:47
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
+ */
+
+import { request } from 'umi';
+
+
+//获取 成本分摊报表列表
+export async function getCostShareReportList(params, options) {
+    return request('/api/costAccount/costcostinggroup/afterAllocationFormList', {
+      method: 'GET',
+      params:{...params},
+      ...(options || {}),
+    });
+}
+
+
+
+
+

+ 193 - 0
src/pages/costAccounting/departmentCostCalculate/index.jsx

@@ -0,0 +1,193 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 10:13:13
+ * @LastEditTime: 2021-08-28 14:55:58
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
+ */
+
+// import { PlusOutlined } from '@ant-design/icons';
+import { Form, Button,Cascader } from 'antd';
+import React, { useRef, useState, useEffect } from 'react';
+import { PageContainer } from '@ant-design/pro-layout';
+import ProTable from '@ant-design/pro-table';
+import {
+  ProFormDatePicker,
+} from '@ant-design/pro-form';
+import { getDepartmentCostList,calculateData } from './service';
+
+import { getResponsibilityCenterList } from '@/pages/responsibilityCenter/service';
+
+import moment from 'moment';
+import 'moment/locale/zh-cn';
+import locale from 'antd/es/date-picker/locale/zh_CN';
+
+
+
+const CostShare = () => {
+
+  const [currentTime, setCurrentTime] = useState(moment(new Date()).subtract(1, 'months').format('YYYY-MM'));
+  const [selectableResponsibilityList, setSelectableResponsibilityList] = useState([]);
+  const [selectedResponsibilityCode,setSelectedResponsibilityCode] = useState(null);
+
+  const columns = [
+    {
+      title: '选择年月',
+      key: 'date',
+      hideInTable: true,
+      dataIndex: 'date',
+      renderFormItem: (item, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
+
+        if (type === 'form') {
+          return null;
+        }
+        return (
+          <Form.Item >
+            <ProFormDatePicker 
+              initialValue={currentTime}
+              fieldProps={{
+                picker: 'month', format: (value) => { return value.format('YYYY-MM') }, locale: locale,
+                onChange: (val) => { console.log({ val }); setCurrentTime(val) }
+              }}
+              name="date" />
+          </Form.Item>
+        )
+      },
+    },
+    {
+      title: '选择责任中心',
+      key: 'responsibilityCode',
+      hideInTable: true,
+      fieldProps: (form, config) => {
+        // console.log({ form, config });
+      },
+      dataIndex: 'responsibilityName',
+      renderFormItem: (item, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
+        // console.log({item,type, defaultRender,formItemProps, fieldProps,rest,form })
+        if (type === 'form') {
+          return null;
+        }
+
+        return (
+          <Form.Item name="responsibilityCode">
+            <Cascader options={selectableResponsibilityList}
+              fieldNames={{
+                label: 'responsibilityName',
+                value: 'responsibilityCode',
+                children: 'child',
+              }}
+              onChange={(val)=>{setSelectedResponsibilityCode(val[val.length-1])}}
+              {...fieldProps}
+            />
+          </Form.Item>
+        )
+      },
+    },
+    {
+      title: '年份',
+      dataIndex: 'year',
+      key: 'year',
+      hideInSearch: true,
+    },
+    {
+      title: '月份',
+      dataIndex: 'month',
+      key: 'month',
+      hideInSearch: true,
+    },
+    {
+      title: '报表项目编码',
+      dataIndex: 'reportNum',
+      key: 'reportNum',
+      hideInSearch: true,
+    },
+    {
+      title: '报表项目名',
+      dataIndex: 'reportName',
+      key: 'reportName',
+      hideInSearch: true,
+    },
+    {
+      title: '责任中心编码',
+      dataIndex: 'responsibilityCode',
+      key: 'responsibilityCode',
+      hideInSearch: true,
+    },
+    {
+      title: '责任中心名',
+      dataIndex: 'responsibilityName',
+      key: 'responsibilityName',
+      hideInSearch: true,
+    },
+    {
+      title: '金额',
+      dataIndex: 'amount',
+      key: 'amount',
+      hideInSearch: true,
+    },
+    
+  ];
+
+
+  const actionRef = useRef();
+
+
+  //获取列表
+  const getList = async (params = {}, sort, filter) => {
+    const { date, pageSize, current } = params;
+    const res = await getDepartmentCostList({ pageSize, current, date: moment(date).format('YYYY-MM-DD'),responsibilityCode:selectedResponsibilityCode});
+    if (res && res.status) {
+
+      return {
+        data: res.data.list,
+        total: res.data.totalCount,
+        success: res.success,
+      };
+    }
+
+  };
+
+
+
+
+  const calculateDatahandle = async ()=>{
+        await calculateData({date:moment(currentTime).format('YYYY-MM-DD')});
+        actionRef?.current?.reload();
+  }
+
+
+
+  useEffect(async () => {
+    const responsibilityList = await getResponsibilityCenterList({ pageSize: 500 });
+    const { data: { list=[] } } = responsibilityList;
+    setSelectableResponsibilityList(list);
+  }, []);
+
+
+
+
+  return (
+    <PageContainer>
+      <ProTable
+        columns={columns}
+        request={getList}
+        actionRef={actionRef}
+        rowKey="id"
+        toolBarRender={() => [
+             <Button type='primary' onClick={()=>calculateDatahandle()}>计算数据</Button>
+        ]}
+
+        pagination={{
+          pageSize: 10,
+        }}
+        search={{
+          defaultCollapsed: false,
+          labelWidth: 'auto'
+        }}
+      />
+    </PageContainer>
+  );
+};
+
+export default CostShare;

+ 36 - 0
src/pages/costAccounting/departmentCostCalculate/service.js

@@ -0,0 +1,36 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 08:54:08
+ * @LastEditTime: 2021-08-28 14:52:33
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
+ */
+
+import { request } from 'umi';
+
+
+//获取 科室损益列表
+export async function getDepartmentCostList(params, options) {
+    return request('/api/costAccount/costdepartmentprofit/list', {
+      method: 'GET',
+      params:{...params},
+      ...(options || {}),
+    });
+}
+
+
+//计算数据
+export async function calculateData(data, options) {
+  console.log({data});
+  return request('/api/costAccount/costdepartmentprofit/setDepartmentProfit', {
+    method: 'POST',
+    params:{...data},
+    ...(options || {}),
+  });
+}
+
+
+
+
+

+ 168 - 0
src/pages/costAccounting/wholeHospCostCalculate/index.jsx

@@ -0,0 +1,168 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 10:13:13
+ * @LastEditTime: 2021-08-28 14:21:39
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
+ */
+
+// import { PlusOutlined } from '@ant-design/icons';
+import { Form, Button } from 'antd';
+import React, { useRef, useState, useEffect } from 'react';
+import { PageContainer } from '@ant-design/pro-layout';
+import ProTable from '@ant-design/pro-table';
+import {
+  ProFormDatePicker,
+} from '@ant-design/pro-form';
+import { getWholeHospCostList,calculateData } from './service';
+
+import moment from 'moment';
+import 'moment/locale/zh-cn';
+import locale from 'antd/es/date-picker/locale/zh_CN';
+
+
+import {envConfig} from '../../../../config/defaultSettings';
+
+const {host} = envConfig;
+const Host = host;
+
+
+const CostShare = () => {
+
+  const [currentTime, setCurrentTime] = useState(moment(new Date()).subtract(1, 'months').format('YYYY-MM'));
+
+  const columns = [
+    {
+      title: '选择年月',
+      key: 'date',
+      hideInTable: true,
+      dataIndex: 'date',
+      renderFormItem: (item, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
+
+        if (type === 'form') {
+          return null;
+        }
+        return (
+          <Form.Item >
+            <ProFormDatePicker 
+              initialValue={currentTime}
+              fieldProps={{
+                picker: 'month', format: (value) => { return value.format('YYYY-MM') }, locale: locale,
+                onChange: (val) => { console.log({ val }); setCurrentTime(val) }
+              }}
+              name="date" />
+          </Form.Item>
+        )
+      },
+    },
+    {
+      title: '年份',
+      dataIndex: 'dateYear',
+      key: 'dateYear',
+      hideInSearch: true,
+    },
+    {
+      title: '月份',
+      dataIndex: 'dateMonth',
+      key: 'dateMonth',
+      hideInSearch: true,
+    },
+    {
+      title: '报表项目编码',
+      dataIndex: 'reportNum',
+      key: 'reportNum',
+      hideInSearch: true,
+    },
+    {
+      title: '报表项目名',
+      dataIndex: 'reportName',
+      key: 'reportName',
+      hideInSearch: true,
+    },
+    {
+      title: '金额',
+      dataIndex: 'amount',
+      key: 'amount',
+      hideInSearch: true,
+    },
+    
+  ];
+
+
+  const actionRef = useRef();
+
+
+  //获取列表
+  const getList = async (params = {}, sort, filter) => {
+    const { date, pageSize, current } = params;
+
+    const res = await getWholeHospCostList({ pageSize, current, date: moment(date).format('YYYY-MM-DD') });
+    if (res && res.status) {
+
+      return {
+        data: res.data.list,
+        total: res.data.totalCount,
+        success: res.success,
+      };
+    }
+
+  };
+
+  /**
+   * 
+   * @param {String} type 操作类型
+   * @param {Object} record 
+   */
+  const optionBtnGroupshandle = async (type, record) => {
+    const userData = localStorage.getItem('userData');
+    const {shareLevel} = record;
+    let tokenVal='';
+    if (userData) {
+      const { token } = JSON.parse(userData);
+      tokenVal = token
+    }
+    const url = `${Host}/costAccount/excel/getShareReportTemplate?token=${tokenVal}&year=${currentTime.format('YYYY')}&month=${currentTime.format('MM')}&levelSort=${shareLevel}`;
+    if(type=='download'){
+      // const resp = await getExcelDownloadLink({ year: currentTime.format('YYYY'), month: currentTime.format('MM'),token:tokenVal,levelSort:shareLevel });
+      window.open(url);
+    }
+    if(type=='preview'){
+      // const resp = await getExcelDownloadLink({ year: currentTime.format('YYYY'), month: currentTime.format('MM'),token:tokenVal,levelSort:shareLevel });
+      window.open(`http://view.xdocin.com/xdoc?_xdoc=${url}`);
+    }
+  }
+
+
+  const calculateDatahandle = async ()=>{
+        await calculateData({date:moment(currentTime).format('YYYY-MM-DD')});
+        actionRef?.current?.reload();
+  }
+
+
+
+
+  return (
+    <PageContainer>
+      <ProTable
+        columns={columns}
+        request={getList}
+        actionRef={actionRef}
+        rowKey="id"
+        toolBarRender={() => [
+             <Button type='primary' onClick={()=>calculateDatahandle()}>计算数据</Button>
+        ]}
+
+        pagination={{
+          pageSize: 10,
+        }}
+        search={{
+          defaultCollapsed: false,
+          labelWidth: 'auto'
+        }}
+      />
+    </PageContainer>
+  );
+};
+
+export default CostShare;

+ 35 - 0
src/pages/costAccounting/wholeHospCostCalculate/service.js

@@ -0,0 +1,35 @@
+/*
+ * @Author: your name
+ * @Date: 2021-07-26 08:54:08
+ * @LastEditTime: 2021-08-28 14:22:11
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
+ */
+
+import { request } from 'umi';
+
+
+//获取 全院损益列表
+export async function getWholeHospCostList(params, options) {
+    return request('/api/costAccount/hospProfitAndLoss/getHospProfits', {
+      method: 'GET',
+      params:{...params},
+      ...(options || {}),
+    });
+}
+
+
+//计算数据
+export async function calculateData(data, options) {
+  return request('/api/costAccount/hospProfitAndLoss/calc', {
+    method: 'POST',
+    params:{...data},
+    ...(options || {}),
+  });
+}
+
+
+
+
+

+ 2 - 2
src/pages/costAccounting/wholeHospIncomeAndCost/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-20 11:42:55
+ * @LastEditTime: 2021-08-28 10:51:11
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -268,7 +268,7 @@ const WholeHospIncomeAndCost = () => {
           }}
           request={async () => {
             const resp = await getWholeHospCostSetList({ pageSize: 200, current: 1 });
-            const {data: { list } } = resp;
+            const {data: { list=[] } } = resp;
       
             return list.map(item => ({
               label: item.paymentsName,

+ 17 - 12
src/pages/costAllocationParamsConnect/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-20 11:05:55
+ * @LastEditTime: 2021-08-28 12:20:03
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -27,7 +27,7 @@ import {
 import {deepGetAllParents} from '@/utils';
 
 
-const DepartmentMana = () => {
+const CostAllocationParamsConnect = () => {
   const columns = [
 
     {
@@ -57,12 +57,14 @@ const DepartmentMana = () => {
       dataIndex: 'accountingNames',
       key: 'accountingName',
       hideInSearch: true,
+      ellipsis: true,
     },
     {
       title: '会计科目编码',
       dataIndex: 'accountingCodes',
       key: 'accountingCode',
       hideInSearch: true,
+      ellipsis: true,
     },
     {
       title: '别名',
@@ -80,6 +82,7 @@ const DepartmentMana = () => {
       title: '操作',
       dataIndex: 'option',
       valueType: 'option',
+      width:'18%',
       render: (_, record) => [
         <a
           key="config1"
@@ -353,7 +356,7 @@ const DepartmentMana = () => {
     // console.log({defaultSelected});
     setSelectedAccountSubjects(defaultSelected);
     const allParents = deepGetAllParents(list,'children');
-    const ids = allParents.map(item=>item.id);
+    const ids = allParents?allParents.map(item=>item.id):[];
     setexpandedRowKeys(ids);
     if (status == 200) {
       return {
@@ -421,6 +424,7 @@ const DepartmentMana = () => {
         }}
         onFinish={async (value) => {
           // console.log({value});
+          // console.log(ref.current.getFieldsValue(true));
           const { costNode,isShareCost=1,alias} = value;
           const { accountingIds } = ref.current.getFieldsValue(true);
           const { responsibilityCode, responsibilityId, responsibilityName, shareLevel } = selectedResponsibility;
@@ -465,7 +469,7 @@ const DepartmentMana = () => {
           }}
           request={async () => {
             const resp = await getResponsibilityCenterSelecterList();
-            const { data, msg, status } = resp;
+            const { data=[], msg, status } = resp;
             if (status == 200) {
               return data.map(item => ({
                 label: item.responsibilityName,
@@ -582,8 +586,8 @@ const DepartmentMana = () => {
           visible={drawerMadalVisible}
           formRef={drawerModalRef}
           onVisibleChange={(bool) => {
-            if (ref.current) {
-              ref.current.resetFields();
+            if (drawerModalRef.current) {
+              drawerModalRef.current.resetFields();
             }
             handleDrawerModalVisible(bool);
           }}
@@ -622,10 +626,10 @@ const DepartmentMana = () => {
                 const { id } = currentResponsibilityRow;
                 // console.log({currentResponsibilityRow});
                 const resp = await getParamsSelectableList({ id });
-                const { data, status } = resp;
+                const { data:{list=[]}, status } = resp;
                 // console.log({resp});
                 if (status == 200) {
-                  const selected = data.list.filter(item => item.id == val);
+                  const selected = list.filter(item => item.id == val);
                   console.log({ selected });
                   setSelectedParam(selected[0]);
                 }
@@ -635,10 +639,10 @@ const DepartmentMana = () => {
             request={async () => {
               const { id } = currentResponsibilityRow;
               const resp = await getParamsSelectableList({ id });
-              const { data, status } = resp;
+              const { data:{list=[]}, status } = resp;
               // console.log({ resp });
               if (status == 200) {
-                const temp = data.list.map(item => ({
+                const temp = list.map(item => ({
                   label: item.shareParamName,
                   value: item.id
                 }));
@@ -769,10 +773,11 @@ const DepartmentMana = () => {
           // console.log(updateFormRef.current.getFieldsValue(true));
           const { accountingIds } = updateFormRef.current.getFieldsValue(true);
           const { responsibilityId,responsibilityName,responsibilityCode,shareLevel,ifDisable, costNode,alias, id,isShareCost=1 } = value;
+          console.log({alias});
 
           const success = await editCostshareparamConnectList(ifDisable ? {
             responsibilityId, costNode, id,responsibilityName,responsibilityCode,shareLevel,isShareCost,alias
-          } : { responsibilityId,accountingIds, costNode, id,responsibilityName,responsibilityCode,shareLevel,isShareCost });
+          } : { responsibilityId,accountingIds, costNode,alias,id,responsibilityName,responsibilityCode,shareLevel,isShareCost });
 
           if (success) {
             handleUpdateModalVisible(false);
@@ -799,4 +804,4 @@ const DepartmentMana = () => {
   );
 };
 
-export default DepartmentMana;
+export default CostAllocationParamsConnect;

+ 28 - 27
src/pages/costAllocationParamsConnect/selectCopyDrawer.jsx

@@ -95,38 +95,39 @@ export default function DrawerContent(props) {
                                if(!record.children||record.children.length==0)return originNode
                         },
                         onChange:(selectedRowKeys, selectedRows)=>{
-                            console.log({selectedRowKeys,selectedRows});
+                            // console.log({selectedRowKeys,selectedRows});
                             setSelectedRows(selectedRows);
                             setSelectedKeys([].concat(selectedRowKeys));
+                            setDefaultSelectedKeys([].concat(selectedRowKeys));
                         },
                         onSelect:(record, selected, selectedRows, nativeEvent)=>{
-                            // console.log({record, selected, selectedRows, nativeEvent,ifSearch});
-                            let _defaultSelectedKeys = defaultSelectedKeys.length>0?defaultSelectedKeys:[];
-                            let {children} = record;
-                            let arr=[];
-                            if(children&&children.length>0){
-                                arr = deepGetVal(children,rowKeys,'children');
-                            }
-                            arr.push(record[rowKeys]);
-
-                            if(!selected){
-                                arr.forEach(val=>{
-                                    const index =  defaultSelectedKeys.findIndex(item=>item == val);
-                                // console.log(index,record[rowKeys],defaultSelectedKeys)
-                                    if(index != -1){
-                                        _defaultSelectedKeys.splice(index,1);
-                                    }
-                                });
-                                _defaultSelectedKeys = unique(_defaultSelectedKeys);
-                                setDefaultSelectedKeys(_defaultSelectedKeys);
-
-                            }else{
-                                let tempArr = arr.length>0?_defaultSelectedKeys.concat(arr):_defaultSelectedKeys;
-                                // console.log({tempArr,_defaultSelectedKeys});
-                                tempArr = unique(tempArr);
+                            // // console.log({record, selected, selectedRows, nativeEvent,ifSearch});
+                            // let _defaultSelectedKeys = defaultSelectedKeys.length>0?defaultSelectedKeys:[];
+                            // let {children} = record;
+                            // let arr=[];
+                            // if(children&&children.length>0){
+                            //     arr = deepGetVal(children,rowKeys,'children');
+                            // }
+                            // arr.push(record[rowKeys]);
+
+                            // if(!selected){
+                            //     arr.forEach(val=>{
+                            //         const index =  defaultSelectedKeys.findIndex(item=>item == val);
+                            //     // console.log(index,record[rowKeys],defaultSelectedKeys)
+                            //         if(index != -1){
+                            //             _defaultSelectedKeys.splice(index,1);
+                            //         }
+                            //     });
+                            //     _defaultSelectedKeys = unique(_defaultSelectedKeys);
+                            //     setDefaultSelectedKeys(_defaultSelectedKeys);
+
+                            // }else{
+                            //     let tempArr = arr.length>0?_defaultSelectedKeys.concat(arr):_defaultSelectedKeys;
+                            //     // console.log({tempArr,_defaultSelectedKeys});
+                            //     tempArr = unique(tempArr);
                                 
-                                setDefaultSelectedKeys(tempArr);
-                            }
+                            //     setDefaultSelectedKeys(tempArr);
+                            // }
 
                         }
                     }}

+ 1 - 1
src/pages/costAllocationParamsConnect/updateForm.jsx

@@ -78,7 +78,7 @@ const UpdateForm = (props) => {
             }}
             request={async () => {
               const resp = await getResponsibilityCenterSelecterList();
-              const { data, status } = resp;
+              const { data=[], status } = resp;
               if (status == 200) {
                 return data.map(item => ({
                   label: item.responsibilityName,

+ 3 - 3
src/pages/costAllocationParamsConnect/updateForm_drawer.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-30 18:09:25
- * @LastEditTime: 2021-08-19 14:02:29
+ * @LastEditTime: 2021-08-28 10:53:55
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/costAllocationParamsConnect/updateForm_drawer.js
@@ -68,10 +68,10 @@ const UpdateFormDrawer = (props) => {
               
               const { id } = currentResponsibilityRow;
               const resp = await getParamsSelectableList({ id });
-              const { data, status } = resp;
+              const { data:{list=[]}, status } = resp;
         
               if (status == 200) {
-                const temp = data.list.map((item) => ({
+                const temp = list.map((item) => ({
                   label: item.shareParamName,
                   value: item.id,
                 }));

+ 6 - 5
src/pages/costAllocationParamsSetting/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-20 15:30:20
+ * @LastEditTime: 2021-08-28 10:54:43
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -171,10 +171,11 @@ const DepartmentMana = () => {
       const {status,data:{list}} = result;
       if(status==200){
         const allparents= deepGetAllParents(list,'children');
-        const allparentsIds = allparents.map(item=>item.id);
-        setExpandedRowKeys(allparentsIds);
-       
-        const temp = accountingIds.map(item=>Number(item));
+        const allparentsIds = allparents?allparents.map(item=>item.id):[];
+  
+        setExpandedRowKeys(allparentsIds);  
+        const temp = accountingIds&&accountingIds.length>0?accountingIds.map(item=>Number(item)):[];
+    
         setSelectedRowKeys(temp);
         return {
           data: list,

+ 3 - 28
src/pages/costAllocationParamsSetting/selectCopyDrawer.jsx

@@ -95,38 +95,13 @@ export default function DrawerContent(props) {
                                if(!record.children||record.children.length==0)return originNode
                         },
                         onChange:(selectedRowKeys, selectedRows)=>{
-                            console.log({selectedRowKeys,selectedRows});
+                            // console.log({selectedRowKeys,selectedRows});
                             setSelectedRows(selectedRows);
                             setSelectedKeys([].concat(selectedRowKeys));
+                            setDefaultSelectedKeys([].concat(selectedRowKeys));
                         },
                         onSelect:(record, selected, selectedRows, nativeEvent)=>{
-                            // console.log({record, selected, selectedRows, nativeEvent,ifSearch});
-                            let _defaultSelectedKeys = defaultSelectedKeys.length>0?defaultSelectedKeys:[];
-                            let {children} = record;
-                            let arr=[];
-                            if(children&&children.length>0){
-                                arr = deepGetVal(children,rowKeys,'children');
-                            }
-                            arr.push(record[rowKeys]);
-
-                            if(!selected){
-                                arr.forEach(val=>{
-                                    const index =  defaultSelectedKeys.findIndex(item=>item == val);
-                                // console.log(index,record[rowKeys],defaultSelectedKeys)
-                                    if(index != -1){
-                                        _defaultSelectedKeys.splice(index,1);
-                                    }
-                                });
-                                _defaultSelectedKeys = unique(_defaultSelectedKeys);
-                                setDefaultSelectedKeys(_defaultSelectedKeys);
-
-                            }else{
-                                let tempArr = arr.length>0?_defaultSelectedKeys.concat(arr):_defaultSelectedKeys;
-                                // console.log({tempArr,_defaultSelectedKeys});
-                                tempArr = unique(tempArr);
-                                
-                                setDefaultSelectedKeys(tempArr);
-                            }
+                            
 
                         }
                     }}

+ 2 - 2
src/pages/districtMana/index.jsx → src/pages/platformMana/districtMana/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-03 17:28:08
+ * @LastEditTime: 2021-08-28 10:55:45
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -253,7 +253,7 @@ const DistrictMana = () => {
                 label="选择主医院"
                 request={async () =>{
                       const resp = await getMainDistrictList();
-                      const {status,data,} = resp;
+                      const {status,data=[],} = resp;
                       
                       if(status == 200){
                         return data.map(item=>({

+ 0 - 0
src/pages/districtMana/service.js → src/pages/platformMana/districtMana/service.js


+ 1 - 1
src/pages/districtMana/updateForm.jsx → src/pages/platformMana/districtMana/updateForm.jsx

@@ -85,7 +85,7 @@ const UpdateForm = (props) => {
                 label="选择主医院"
                 request={async () =>{
                       const resp = await getMainDistrictList();
-                      const {status,data,} = resp;
+                      const {status,data=[],} = resp;
                       
                       if(status == 200){
                         return data.map(item=>({

+ 52 - 54
src/pages/platformMana/menuManage/index.js

@@ -1,21 +1,21 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-23 11:17:44
+ * @LastEditTime: 2021-08-27 11:48:00
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
  */
 
 import { PlusOutlined } from '@ant-design/icons';
-import { Button, Popconfirm} from 'antd';
+import { Button, Popconfirm } from 'antd';
 import React, { useState, useRef } from 'react';
 
 import { PageContainer } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
-import { ModalForm, ProFormText, ProFormSelect,ProFormDigit } from '@ant-design/pro-form';
+import { ModalForm, ProFormText, ProFormSelect, ProFormDigit } from '@ant-design/pro-form';
 import UpdateForm from './updateForm';
-import {addList, editList, delList } from './service';
+import { addList, editList, delList } from './service';
 import { getMenuList } from '@/pages/platformMana/menuManage/service';
 
 const UserMana = () => {
@@ -60,36 +60,44 @@ const UserMana = () => {
       title: '操作',
       dataIndex: 'option',
       valueType: 'option',
-      render: (_, record) => [
-        <a
-          key="config"
-          onClick={() => {
-            setIfAddZeroLevelMenu(false);
-            handleModalVisible(true);
-            setCurrentRow(record);
-          }}
-        >
-          添加
-        </a>,
-        <a
-          key="config"
-          onClick={() => {
-            handleUpdateModalVisible(true);
-            setCurrentRow(record);
-          }}
-        >
-          编辑
-        </a>,
-        <Popconfirm
-          key="subscribeAlert"
-          title="是否确定删除?"
-          onConfirm={() => {
-            delUserHandler(record);
-          }}
-        >
-          <a>删除</a>
-        </Popconfirm>,
-      ],
+      render: (_, record) => {
+        const { type } = record;
+        const btnGroups = [
+          <a
+            key="config"
+            onClick={() => {
+              handleUpdateModalVisible(true);
+              setCurrentRow(record);
+            }}
+          >
+            编辑
+          </a>,
+          <Popconfirm
+            key="subscribeAlert"
+            title="是否确定删除?"
+            onConfirm={() => {
+              delUserHandler(record);
+            }}
+          >
+            <a>删除</a>
+          </Popconfirm>,
+        ];
+        return type != 0
+          ? [...btnGroups]
+          : [
+              <a
+                key="config"
+                onClick={() => {
+                  setIfAddZeroLevelMenu(false);
+                  handleModalVisible(true);
+                  setCurrentRow(record);
+                }}
+              >
+                添加
+              </a>,
+              ...btnGroups,
+            ];
+      },
     },
   ];
 
@@ -166,19 +174,17 @@ const UserMana = () => {
         labelCol={{ span: 5, offset: 3 }}
         layout={'horizontal'}
         modalProps={{
-          destroyOnClose:true
+          destroyOnClose: true,
         }}
         visible={createModalVisible}
         onVisibleChange={handleModalVisible}
         onFinish={async (value) => {
-        
-          let id=0;
-          currentRow&&(id=currentRow.menuId);
-          console.log({id});
-          const resp = await addList({ ...value, parentId:id });
+          let id = 0;
+          currentRow && (id = currentRow.menuId);
+          // console.log({id});
+          const resp = await addList({ ...value, parentId: id });
           const { status } = resp;
           if (status == 200) {
-      
             if (actionRef.current) {
               actionRef.current.reload();
             }
@@ -265,18 +271,10 @@ const UserMana = () => {
       {/* 更新 */}
       <UpdateForm
         onSubmit={async (value) => {
-          const {menuId,parentId=0} = currentRow;
+          const { menuId, parentId = 0 } = currentRow;
           // console.log({currentRow});
           // console.log({'编辑':value});
-          const {
-            name,
-            path,
-            url,
-            perms,
-            type,
-            icon='ww',
-            orderNum
-          } = value;
+          const { name, path, url, perms, type, icon = 'ww', orderNum } = value;
 
           const resp = await editList({
             parentId,
@@ -287,10 +285,10 @@ const UserMana = () => {
             type,
             icon,
             orderNum,
-            id:menuId
+            id: menuId,
           });
-          const {status} = resp;
-          if (status==200) {
+          const { status } = resp;
+          if (status == 200) {
             handleUpdateModalVisible(false);
             setCurrentRow(undefined);
 

+ 36 - 25
src/pages/platformMana/roleManage/component/drawer.jsx

@@ -78,40 +78,51 @@ export default function DrawerContent(props) {
                     rowSelection={{
                         // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
                         // 注释该行则默认不显示下拉选项
+                        hideSelectAll:true,
                         selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
                         checkStrictly:false,
                         selectedRowKeys:selectedKeys,
                         onChange:(selectedRowKeys, selectedRows)=>{
                             // console.log({selectedRowKeys,selectedRows});
                             setSelectedKeys(selectedRowKeys);
+                            
                         },
                         onSelect:(record, selected, selectedRows, nativeEvent)=>{
-                            // console.log({record, selected, selectedRows, nativeEvent,ifSearch});
-                            let _defaultSelectedKeys = defaultSelectedKeys;
-                            let {children} = record;
-                            let arr=[]
-                            if(children&&children.length>0){
-                               arr = deepGetVal(children,rowKeys,'children');
-                            }
-                            arr.push(record[rowKeys]);
-
-                            if(!selected){
-                                arr.forEach(val=>{
-                                    const index =  defaultSelectedKeys.findIndex(item=>item == val);
-                                // console.log(index,record[rowKeys],defaultSelectedKeys)
-                                    if(index != -1){
-                                        _defaultSelectedKeys.splice(index,1);
-                                    }
-                                });
-                                _defaultSelectedKeys = unique(_defaultSelectedKeys);
-                                setDefaultSelectedKeys(_defaultSelectedKeys);
-
-                            }else{
-                                let tempArr = _defaultSelectedKeys.concat(arr);
-                                tempArr = unique(tempArr);
-                                setDefaultSelectedKeys([].concat(tempArr));
-                            }
+                            console.log({record, selected, selectedRows, nativeEvent,ifSearch});
+                            if(tableSearch){
 
+                                let _defaultSelectedKeys = defaultSelectedKeys;
+                                let {children} = record;
+                                let arr=[]
+    
+                                if(children&&children.length>0){
+                                   arr = deepGetVal(children,rowKeys,'children');
+                                }
+                                arr.push(record[rowKeys]);
+    
+                                console.log({arr,children});
+    
+                                if(!selected){
+                                    arr.forEach(val=>{
+                                        const index =  defaultSelectedKeys.findIndex(item=>item == val);
+                                    // console.log(index,record[rowKeys],defaultSelectedKeys)
+                                        if(index != -1){
+                                            _defaultSelectedKeys.splice(index,1);
+                                        }
+                                    });
+                                    _defaultSelectedKeys = unique(_defaultSelectedKeys);
+                                    setDefaultSelectedKeys(_defaultSelectedKeys);
+    
+                                }else{
+                                    let tempArr = _defaultSelectedKeys.concat(arr);
+                                    tempArr = unique(tempArr);
+                                    setDefaultSelectedKeys([].concat(tempArr));
+                                }
+
+                            }else {
+                                const keys = selectedRows.map(item=>item[rowKeys]);
+                                setDefaultSelectedKeys([].concat(keys));
+                            }
                         }
                     }}
                 />

+ 4 - 4
src/pages/platformMana/roleManage/index.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-13 18:30:28
+ * @LastEditTime: 2021-08-28 10:56:39
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -216,7 +216,7 @@ const UserMana = () => {
     const {roleId} = record;
     if(type == 'user'){
       const resp = await roleHasBindUsers({roleId});
-      const {status,data} = resp;
+      const {status,data=[]} = resp;
       if(status == 200){
         const tempArr = data.map(item=>item.id);
         setSelectedUsers(tempArr);
@@ -225,7 +225,7 @@ const UserMana = () => {
     }
     if(type == 'menu'){
       const resp = await roleHasBindMenus({roleId});
-      const {status,data} = resp;
+      const {status,data=[]} = resp;
       if(status == 200){
         const tempArr = data.map(item=>item.id);
         setSelectedMenus(tempArr);
@@ -375,7 +375,7 @@ const UserMana = () => {
           config={{rowKeys:'menuId',tableSearch:false}}
           tableSearch={false}
           onFinishFunc={async (value, selectedRowKeys) => {
-            // console.log({value,selectedRowKeys});
+            console.log({value,selectedRowKeys});
             // return ;
             const { roleId } = currentRow;
             const resp = await roleBindMenu({ roleId, menuIds: selectedRowKeys });

+ 24 - 19
src/pages/responsibilityCenter/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-19 16:53:22
+ * @LastEditTime: 2021-08-28 10:57:18
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -118,9 +118,10 @@ const responsibilityCenter = () => {
   const actionRef = useRef();  //表格
   const ref = useRef();   //新增表单
   const [currentRow, setCurrentRow] = useState(undefined);
-  const [selectedLevelList, setSelectedLevelList] = useState(null); //可选的分摊层级列表
+
   const [selectedLevel, setSelectedLevel] = useState(null);
   const [ifAddChild, setIfAddChild] = useState(false);
+  const [selectableLevelList,setSelectableLevelList] = useState([]);//可选的分摊层级列表
 
   /**
    *
@@ -203,12 +204,17 @@ const responsibilityCenter = () => {
         }}
         formRef={ref}
         onFinish={async (value) => {
-          // console.log({'新增':value,selectedLevel})
+          
           let id = 0;
-          currentRow && (id = currentRow.id);
+
+          (currentRow&&ifAddChild) && (id = currentRow.id);
           const { isDefault = 0 } = value;
-          const body = { ...value, shareName: selectedLevel?selectedLevel.shareName:'', shareId: selectedLevel?selectedLevel.id:0, isDefault, id };
-          console.log({body});
+          const {selectedSharelevel} = ref?.current?.getFieldsValue(true);
+          
+          // console.log({'新增':value,selectedSharelevel})
+
+          const body = { ...value, shareName: selectedSharelevel?selectedSharelevel.shareName:'', shareId: selectedSharelevel?selectedSharelevel.id:0,shareLevel:selectedSharelevel?selectedSharelevel.leverSort:0, isDefault,id};
+     
           const success = await addResponsibilityCenter(body);
           if (success) {
             handleModalVisible(false);
@@ -329,21 +335,20 @@ const responsibilityCenter = () => {
                     },
                   ]}
                   fieldProps={{
-                    onChange: async (val) => {
-                      const resp = await getApportionmentLevelListNoPage();
-                      const { status, data } = resp;
-                      if (status == 200) {
-                        const needItem = data.list.filter(item => item.leverSort == val);
-                        setSelectedLevel(needItem[0]);
+                    onChange: (val) => {
+                      // console.log({val});
+                      const needItem = selectableLevelList.filter(item => item.id == val);
+                      if(ref.current){
+                        ref.current.setFieldsValue({selectedSharelevel:needItem[0]})
                       }
                     },
                   }}
                   request={async () => {
                     const resp = await getApportionmentLevelListNoPage();
-                    const { status, data } = resp;
+                    const { status, data:{list=[]} } = resp;
                     if (status == 200) {
-                      setSelectedLevelList(data.list);
-                      return data.list.map(item => ({ label: `级别${item.leverSort}-${item.shareName}`, value: item.leverSort }))
+                      setSelectableLevelList(list);
+                      return list.map(item => ({ label: `级别${item.leverSort}-${item.shareName}`, value: item.id }))
                     } else {
                       return []
                     }
@@ -361,20 +366,20 @@ const responsibilityCenter = () => {
       {/* 更新 */}
       <UpdateForm
         onSubmit={async (value) => {
-          // console.log({ '编辑': value });
-
+          console.log({ '编辑': value });
+       
           const { responsibilityLevel=0, selectedLevel,shareId } = value;
           // console.log({responsibilityLevel, selectedLevel});
           let body = {};
           if(selectedLevel.length==0){
             //没有修改分摊层级
-            body={...value, shareLevelId: shareId}
+            body={...value}
           }
 
           if(Object.prototype.toString.call(selectedLevel)=='[object Object]'){
              //修改了分摊层级
             //  console.log('修改了分摊层级');
-             body={...value, shareLevelId: selectedLevel.id,shareName:selectedLevel.shareName}
+             body={...value, shareId: selectedLevel.id,shareName:selectedLevel.shareName,shareLevel:selectedLevel.leverSort}
           }
       
           const success = await editResponsibilityCenterList(body);

+ 10 - 12
src/pages/responsibilityCenter/updateForm.jsx

@@ -8,7 +8,7 @@ import {
 
 
 import { getApportionmentLevelListNoPage } from '../apportionmentLevel/service';
-import { getResponsibilityCenterList } from './service';
+// import { getResponsibilityCenterList } from './service';
 
 
 const UpdateForm = (props) => {
@@ -20,6 +20,7 @@ const UpdateForm = (props) => {
   useEffect(() => {
     const temp = selectedLevelList.filter(item => item.leverSort == responsibilityLevel);
     setSelectedLevel(temp);
+    console.log({values});
   }, [values])
 
   return (
@@ -32,6 +33,7 @@ const UpdateForm = (props) => {
           labelCol={{ span: 5, offset: 3 }}
           layout={'horizontal'}
           visible={updateModalVisible}
+          // formRef={restFormRef}
           onVisibleChange={(visible) => updateModalVisibleChange(visible)}
           onFinish={(value) => onSubmit({ ...values, ...value, selectedLevel })}
         >
@@ -133,27 +135,23 @@ const UpdateForm = (props) => {
                     },
                   ]}
                   fieldProps={{
-                    onChange: async (val) => {
-                      const resp = await getApportionmentLevelListNoPage();
-                      const { status, data } = resp;
-                      if (status == 200) {
-                        const needItem = data.list.filter(item => item.leverSort == val);
-                        setSelectedLevel(needItem[0]);
-                      }
+                    onChange:(val) => {
+                      const needItem = selectedLevelList.filter(item => item.id == val);
+                      setSelectedLevel(needItem[0]);
                     },
                   }}
                   request={async () => {
                     const resp = await getApportionmentLevelListNoPage();
-                    const { status, data } = resp;
+                    const { status, data:{list=[]} } = resp;
                     if (status == 200) {
-                      setSelectedLevelList(data.list);
-                      return data.list.map(item => ({ label: `级别${item.leverSort}-${item.shareName}`, value: item.leverSort }))
+                      setSelectedLevelList(list);
+                      return list.map(item => ({ label: `级别${item.leverSort}-${item.shareName}`, value: item.id }))
                     } else {
                       return []
                     }
                   }}
                   width="sm"
-                  name='shareLevel'
+                  name='shareId'
                   label="选择分摊级别"
                 />
               )

+ 3 - 3
src/pages/responsibilityCenterConnect/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-08-03 17:37:58
+ * @LastEditTime: 2021-08-28 10:58:53
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -106,7 +106,7 @@ const ResponsibilityCenterConnect = () => {
    */
   const drawerVisibleChange = (bool) => {
     // console.log({currentRow});
-    const {departments} = currentRow;
+    const {departments=[]} = currentRow;
     const selected = departments.map(item=>item.departmentId);
     if (bool)setSelectedRowKeys(selected==undefined?[]:selected);
     setDrawerVisible(bool);
@@ -117,7 +117,7 @@ const ResponsibilityCenterConnect = () => {
   //获取责任中心对应列表
   const getList = async (params = {}, sort, filter) => {
     const res = await getResponsibilityCenterConnectList(params);
-    const defaultKeys = res.data.list.map(item=>item.responsibilityId);
+    const defaultKeys = res.data.list?res.data.list.map(item=>item.responsibilityId):[];
     setDefaultExpandedRowKeys(defaultKeys);
 
 

+ 1 - 1
src/pages/user/Login/index.jsx

@@ -44,7 +44,7 @@ const Login = () => {
 
       // 登录
       const loginResp = await login({ ...values, hospSign:hospSign});
-      const {status,msg,data} = loginResp;
+      const {status,msg,data={}} = loginResp;
       // console.log({status,msg,data});
       if (status == 200) {
         const defaultloginSuccessMessage = '登录成功!';

+ 34 - 0
src/projectConstant.js

@@ -0,0 +1,34 @@
+/*
+ * @Author: your name
+ * @Date: 2021-08-25 10:48:32
+ * @LastEditTime: 2021-08-25 10:51:13
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /CostAccountManaSys/config/projectConstant.js
+ */
+
+
+//报表类型
+
+export const reportTypes = [
+  {
+    tab: '损益表',
+    key: 0,
+  },
+  {
+    tab: '完全成本法表',
+    key: 1,
+  },
+  {
+    tab: '变动成本表',
+    key: 2,
+  },
+  {
+    tab: '全院损益表',
+    key: 3,
+  },
+  {
+    tab: '全成本报表',
+    key: 4,
+  },
+];

+ 13 - 9
src/utils.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 13:50:44
- * @LastEditTime: 2021-08-19 14:34:13
+ * @LastEditTime: 2021-08-27 14:31:46
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/utils.js
@@ -49,14 +49,18 @@ const CARequest = (url)=>{
 const deepGetVal = (dataToDeep,key,subArr)=>{
     // console.log({dataToDeep,key,subArr});
     let resultArr = [];
-
-    dataToDeep.forEach(item=>{
-        if(item[subArr]&&item[subArr].length>0){
-            deepGetVal(item[subArr],key,subArr);
-        }else {
-            resultArr.push(item[key]);
-        }
-    });
+    
+    function looper(dataToDeep,key,subArr){
+        dataToDeep.forEach(item=>{
+            if(item[subArr]&&item[subArr].length>0){
+                resultArr.push(item[key]);
+                looper(item[subArr],key,subArr);
+            }else {
+                resultArr.push(item[key]);
+            }
+        });
+    }
+    looper(dataToDeep,key,subArr);
 
     return resultArr
 }