Bladeren bron

ver v0.1.0

code4eat 4 jaren geleden
bovenliggende
commit
0843d8d488
39 gewijzigde bestanden met toevoegingen van 1568 en 475 verwijderingen
  1. 4 3
      config/config.js
  2. 4 1
      config/defaultSettings.js
  3. 2 2
      config/proxy.js
  4. 37 37
      config/routes.js
  5. 3 3
      package.json
  6. 115 15
      src/app.jsx
  7. 35 20
      src/components/CAUpload/index.jsx
  8. 12 0
      src/components/Footer/index.jsx
  9. 9 9
      src/pages/DepartmentMana/index.jsx
  10. 1 1
      src/pages/DepartmentMana/service.js
  11. 36 10
      src/pages/UserMana/index.js
  12. 12 1
      src/pages/UserMana/service.js
  13. 6 5
      src/pages/UserMana/updateForm.jsx
  14. 28 92
      src/pages/accountingSubject/index.jsx
  15. 1 1
      src/pages/accountingSubject/service.js
  16. 17 6
      src/pages/accountingSubjectConnect/index.jsx
  17. 1 1
      src/pages/accountingSubjectConnect/service.js
  18. 14 7
      src/pages/apportionmentLevel/index.jsx
  19. 4 2
      src/pages/apportionmentLevel/service.js
  20. 321 23
      src/pages/costAllocationParamsConnect/index.jsx
  21. 43 1
      src/pages/costAllocationParamsConnect/service.js
  22. 81 25
      src/pages/costAllocationParamsConnect/updateForm.jsx
  23. 120 0
      src/pages/costAllocationParamsConnect/updateForm_drawer.js
  24. 299 25
      src/pages/costAllocationParamsSetting/index.jsx
  25. 11 1
      src/pages/costAllocationParamsSetting/service.js
  26. 120 0
      src/pages/costAllocationParamsSetting/updateForm_drawer.js
  27. 1 1
      src/pages/costProjectMana/service.js
  28. 31 18
      src/pages/districtMana/index.jsx
  29. 1 1
      src/pages/districtMana/service.js
  30. 43 25
      src/pages/districtMana/updateForm.jsx
  31. 10 12
      src/pages/document.ejs
  32. 44 52
      src/pages/responsibilityCenter/index.jsx
  33. 1 1
      src/pages/responsibilityCenter/service.js
  34. 75 62
      src/pages/responsibilityCenter/updateForm.jsx
  35. 15 4
      src/pages/responsibilityCenterConnect/index.jsx
  36. 1 1
      src/pages/responsibilityCenterConnect/service.js
  37. 9 6
      src/pages/user/Login/index.jsx
  38. 1 1
      src/services/user.js
  39. BIN
      成本核算_build0801.zip

+ 4 - 3
config/config.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-22 15:04:09
- * @LastEditTime: 2021-07-23 16:12:44
+ * @LastEditTime: 2021-08-02 11:50:09
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/config/config.js
@@ -29,9 +29,9 @@ export default defineConfig({
   locale: {
     // default zh-CN
     default: 'zh-CN',
-    antd: true,
+    antd: false,
     // default true, when it is true, will use `navigator.language` overwrite default
-    baseNavigator: true,
+    baseNavigator: false,
   },
   dynamicImport: {
     loading: '@ant-design/pro-layout/es/PageLoading',
@@ -45,6 +45,7 @@ export default defineConfig({
   theme: {
     'primary-color':defaultSettings.primaryColor,
   },
+ 
   // esbuild is father build tools
   // https://umijs.org/plugins/plugin-esbuild
   esbuild: {},

+ 4 - 1
config/defaultSettings.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-22 15:04:09
- * @LastEditTime: 2021-07-29 08:44:10
+ * @LastEditTime: 2021-08-02 11:51:42
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/config/defaultSettings.js
@@ -19,6 +19,9 @@ const Settings = {
   colorWeak: false,
   title: '全成本核算管理系统',
   pwa: false,
+  menu:{
+    locale:false
+  },
   logo:'https://i.postimg.cc/WzYX2nfQ/KC-white.png',
   iconfontUrl: '',
 };

+ 2 - 2
config/proxy.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-22 15:04:09
- * @LastEditTime: 2021-07-28 17:11:31
+ * @LastEditTime: 2021-07-29 23:15:16
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/config/proxy.js
@@ -16,7 +16,7 @@
  */
 export default {
   mock: {
-    '/api/': {
+    '/': {
       target: 'http://localhost',
       changeOrigin: true,
       pathRewrite: {

+ 37 - 37
config/routes.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-22 15:04:09
- * @LastEditTime: 2021-07-29 19:47:41
+ * @LastEditTime: 2021-08-02 09:00:55
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/config/routes.js
@@ -23,76 +23,76 @@ export default [
       },
     ],
   },
-  {
-    path: '/welcome',
-    name: 'welcome',
-    icon: 'smile',
-    component: './Welcome',
-  },
+  // {
+  //   path: '/welcome',
+  //   name: 'welcome',
+  //   icon: 'smile',
+  //   component: './Welcome',
+  // },
   {
     path: '/UserMana',
     name: '用户管理',
     icon: 'tool',
     component: './UserMana/index',
   },
+  // {
+  //   path: '/districtMana',
+  //   name: '院区管理',
+  //   icon: 'InsertRowLeftOutlined',
+  //   component: './districtMana/index',
+  // },
   {
-    path: '/districtMana',
-    name: '院区管理',
-    icon: 'InsertRowLeftOutlined',
-    component: './districtMana/index',
+    path: '/apportionmentLevel',
+    name: '分摊层级设置',
+    icon: 'NodeExpandOutlined',
+    component: './apportionmentLevel/index',
   },
   {
     path: '/DepartmentMana',
     name: '科室管理',
-    icon: 'smile',
+    icon: 'BorderOuterOutlined',
     component: './DepartmentMana/index',
   },
   {
     path: '/responsibilityCenter',
     name: '责任中心管理',
-    icon: 'smile',
+    icon: 'CopyrightOutlined',
     component: './responsibilityCenter/index',
   },
   {
     path: '/responsibilityCenterConnect',
     name: '责任中心对应',
-    icon: 'smile',
+    icon: 'CopyrightOutlined',
     component: './responsibilityCenterConnect/index',
   },
-  {
-    path: '/apportionmentLevel',
-    name: '分摊层级设置',
-    icon: 'smile',
-    component: './apportionmentLevel/index',
-  },
   {
     path: '/accountingSubject',
     name: '会计科目管理',
-    icon: 'smile',
+    icon: 'ProfileOutlined',
     component: './accountingSubject/index',
   },
-  {
-    path: '/accountingSubjectConnect',
-    name: '会计科目对应',
-    icon: 'smile',
-    component: './accountingSubjectConnect/index',
-  },
   {
     path: '/costProjectMana',
     name: '成本收入项目管理',
-    icon: 'smile',
+    icon: 'AccountBookOutlined',
     component: './costProjectMana/index',
   },
+  {
+    path: '/accountingSubjectConnect',
+    name: '会计科目对应',
+    icon: 'ProfileOutlined',
+    component: './accountingSubjectConnect/index',
+  },
   {
     path: '/costAllocationParamsSetting',
     name: '成本分摊参数设置',
-    icon: 'smile',
+    icon: 'ControlOutlined',
     component: './costAllocationParamsSetting/index',
   },
   {
     path: '/costAllocationParamsConnect',
     name: '成本分摊参数对应',
-    icon: 'smile',
+    icon: 'ClusterOutlined',
     component: './costAllocationParamsConnect/index',
   },
   {
@@ -110,15 +110,15 @@ export default [
       },
     ],
   },
-  {
-    name: 'list.table-list',
-    icon: 'table',
-    path: '/list',
-    component: './TableList',
-  },
+  // {
+  //   name: 'list.table-list',
+  //   icon: 'table',
+  //   path: '/list',
+  //   component: './TableList',
+  // },
   {
     path: '/',
-    redirect: '/welcome',
+    redirect: '/UserMana',
   },
   {
     component: './404',

+ 3 - 3
package.json

@@ -1,8 +1,8 @@
-{
+ {
   "name": "CostAccountManaSys",
-  "version": "0.0.1",
+  "version": "0.1.0",
   "private": true,
-  "description": "An out-of-box UI solution for enterprise applications",
+  "description": "全成本核算管理系统",
   "scripts": {
     "analyze": "cross-env ANALYZE=1 umi build",
     "build": "umi build",

+ 115 - 15
src/app.jsx

@@ -1,16 +1,49 @@
 import { PageLoading } from '@ant-design/pro-layout';
-import { notification } from 'antd';
-import { history, Link } from 'umi';
+import { notification,Modal,message } from 'antd';
+import { history, Link ,useModel} from 'umi';
 import RightContent from '@/components/RightContent';
 import Footer from '@/components/Footer';
-import { currentUser as queryCurrentUser } from './services/ant-design-pro/api';
+import { currentUser as queryCurrentUser,outLogin } from './services/ant-design-pro/api';
 import { BookOutlined, LinkOutlined } from '@ant-design/icons';
 import {getQueryString} from './utils';
+import { stringify } from 'querystring';
 import {getSubHosp} from './services/user';
 
+
+const defaultMenus = [
+  {
+    path: '/',
+    name: 'welcome',
+    icon: 'smile',
+    children: [
+      {
+        path: '/welcome',
+        name: 'one',
+        icon: 'smile',
+        children: [
+          {
+            path: '/welcome/welcome',
+            name: 'two',
+            icon: 'smile',
+            exact: true,
+          },
+        ],
+      },
+    ],
+  },
+  {
+    path: '/responsibilityCenter',
+    name: 'demo',
+    icon: 'heart',
+  },
+];
+
+
 const isDev = process.env.NODE_ENV === 'development';
 const loginPath = '/user/login';
 
+let requestMethod = 'get';
+
 /** 获取用户信息比较慢的时候会展示一个 loading */
 
 export const initialStateConfig = {
@@ -33,11 +66,11 @@ export async function getInitialState() {
   const sign = getQueryString('hospSign');
 
   const fetchSubHosp = async ()=>{
-    try {
-      const msg = await getSubHosp(sign);
-    } catch (error) {
+    // try {
+    //   const msg = await getSubHosp(sign);
+    // } catch (error) {
       
-    }
+    // }
   }
 
   if (history.location.pathname !== loginPath) {
@@ -46,6 +79,7 @@ export async function getInitialState() {
       fetchUserInfo,
       currentUser,
       settings: {},
+      isExpired:false,
       fetchSubHosp,
       sign
     };
@@ -58,6 +92,35 @@ export async function getInitialState() {
     sign
   };
 }
+
+
+/**
+ * 退出登录,并且将当前的 url 保存
+ */
+ const loginOut = async () => {
+  // await outLogin();
+  const { query = {}, pathname } = history.location;
+  const { redirect,hospSign } = query; // Note: There may be security issues, please note
+  const loginParams = localStorage.getItem('loginParams');
+
+  let sign;
+  if(loginParams){
+      const {hospSign,hospId} = JSON.parse(loginParams);
+      sign = hospSign;
+  }
+  // &hospSign=${sign}
+  // console.log({redirect,hospSign})
+  if (window.location.pathname !== `/user/login` && !redirect) {
+    history.replace({
+      pathname: `/user/login`,
+      search: stringify({
+        redirect: pathname,
+        hospSign:sign
+      }),
+    });
+  }
+};
+
 /**
  * 异常处理程序
     200: '服务器成功返回请求的数据。',
@@ -99,6 +162,13 @@ export async function getInitialState() {
 
 //请求拦截器
 const authHeaderInterceptor = (url, options) => {
+  console.log({options});
+  const {method} = options;
+  if(method == 'post'){
+    requestMethod='post'
+  }else{
+    requestMethod='get'
+  }
   const userData = localStorage.getItem('userData');
   let authHeader = {};
   if(userData){
@@ -118,6 +188,8 @@ const authHeaderInterceptor = (url, options) => {
 //响应拦截器
 const demoResponseInterceptors = async (response, options) => {
   // response.headers.append('interceptors', 'yes yo');
+  // console.log({response});
+
   const {status} = response;
 
   if(status != 200){
@@ -131,27 +203,43 @@ const demoResponseInterceptors = async (response, options) => {
             message: '抱歉,服务器未找到请求!'
           });
         }
+
+        return {};
   }
 
   const _response = await response.clone().json();
-  const {status:dataStatus,msg,errorMessage} = _response;
+  const {status:dataStatus,msg,errorMessage,errorCode} = _response;
   
+  //success返回
   if(dataStatus == 200){
-    // notification.error({
-    //   message:errorMessage
-    // });
+    if(requestMethod=='post'&&history.location.pathname != loginPath){
+      message.success('操作成功!');
+    }
     return response;
   }else{
-    notification.error({
-      message:errorMessage
-    });
+
+    if(errorCode==499){
+      // setInitialState((s) => ({ ...s, isExpired:true}));
+      Modal.confirm({
+        title:'抱歉,登录已过期请重新登录!',
+        onOk:()=>{
+          loginOut();
+        }
+      });
+    }else{
+      notification.error({
+        message:errorMessage,
+        duration: 5,
+      });
+    }
+    return {}
   }
 }
 
 
 export const request = {
   errorHandler: (error) => {
-    // console.log({error});
+    console.log({error});
     const { response } = error;
     if (!response) {
       notification.error({
@@ -184,6 +272,18 @@ export const layout = ({ initialState }) => {
         history.push(loginPath);
       }
     },
+    menu: {
+      // 每当 initialState?.currentUser?.userid 发生修改时重新执行 request
+      // params: {
+      //   userId: initialState?.currentUser?.userid,
+      // },
+      request: async (params, defaultMenuData) => {
+        // initialState.currentUser 中包含了所有用户信息
+        // const menuData = await fetchMenuData();
+        // return menuData;
+        return defaultMenus;
+      },
+    },
     links: isDev
       ? [
           <Link to="/umi/plugin/openapi" target="_blank">

+ 35 - 20
src/components/CAUpload/index.jsx

@@ -18,6 +18,8 @@ class CAUpload extends Component {
         this.exportExcel = this.exportExcel.bind(this);
         // 表格上传事件
         this.uploadProps.onChange = this.uploadProps.onChange.bind(this);
+
+        this.customRequestCallback = props.customRequestCallback?props.customRequestCallback.bind(this):()=>{}
     }
     // 模板下载
     jumpTo() {
@@ -25,32 +27,43 @@ class CAUpload extends Component {
     }
     // 上传参数
     uploadProps = {
-        // 发到后台的文件参数名
-        name: 'file',
-        // 接受的文件类型
-        accept: '.xls,.xlsx',
-        // 上传的地址
-        action: Host + this.props.url,
-        // 是否展示上传的文件
-        showUploadList:false,
-        // 上传的参数
-        data: {
+        // // 发到后台的文件参数名
+        // name: 'file',
+        // // 接受的文件类型
+        // accept: '.xls,.xlsx',
+        // // 上传的地址
+        // action: Host + this.props.url,
+        // // 是否展示上传的文件
+        // showUploadList:false,
+        // // 上传的参数
+        // data: {
             
-            // uid: Cookies.get('uid')
-        },
-        // 设置上传的请求头部,IE10 以上有效
-        headers: {
-            // authorization: 'authorization-text',
-            'Content-Type':'multipart/form-data',
-            'token':this.props.token,
-        },
+        //     // uid: Cookies.get('uid')
+        // },
+        // // 设置上传的请求头部,IE10 以上有效
+        // headers: {
+        //     // authorization: 'authorization-text',
+        //     'Content-Type':'multipart/form-data',
+        //     'token':this.props.token,
+        // },
         // 上传文件前的钩子函数
+        showUploadList:false,
         beforeUpload() {
             message.loading('正在导入中...');
             return true;
         },
+        customRequest:({
+            file,data,action,onSuccess
+        })=>{
+               console.log({file,data,action,onSuccess});
+               const formData = new FormData();
+               formData.set('file',file);
+               this.customRequestCallback(formData);
+
+        },
         // 上传文件改变时的状态
         onChange(info) {
+            console.log({info});
             if (info.file.status !== 'uploading') {
                 console.log(info.file, info.fileList);
             }
@@ -85,7 +98,7 @@ class CAUpload extends Component {
     render() {
         const uploadProps = this.uploadProps;
         return [
-            <Button style={{marginLeft: 10}} key='exportExcel' onClick={this.exportExcel}>导出</Button>,
+            // <Button style={{marginLeft: 10}} key='exportExcel' onClick={this.exportExcel}>导出</Button>,
             <Upload style={{marginLeft: 10}} key='importExcel' {...uploadProps} >
                 <Button type="primary">导入</Button>
             </Upload>,
@@ -101,7 +114,9 @@ CAUpload.propTypes = {
     // 上传地址
     url: PropTypes.string.isRequired,
     // 导入成功后的回调
-    importSuccessCallback: PropTypes.func
+    importSuccessCallback: PropTypes.func,
+
+    customRequestCallback: PropTypes.func,
 };
 
 

+ 12 - 0
src/components/Footer/index.jsx

@@ -1,10 +1,22 @@
 
 import { DefaultFooter } from '@ant-design/pro-layout';
+
+import {version} from '../../../package.json';
+
+
 export default () => {
 
   return (
     <DefaultFooter
       copyright={`2021 康程智医技术出品`}
+      links={[
+        {
+          key: 'version',
+          title: `V${version}`,
+          href: 'https://kcim-hz.yuque.com/kczy/zvxdyc',
+          blankTarget: true,
+        },
+      ]}
     />
   );
 };

+ 9 - 9
src/pages/DepartmentMana/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-28 14:33:10
+ * @LastEditTime: 2021-08-02 08:57:44
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -39,15 +39,15 @@ const DepartmentMana = () => {
       key: 'departmentCode',
       hideInSearch: false,
     },
-    {
-      title: '医院Id',
-      dataIndex: 'hospId',
-      key: 'hospId',
-      hideInSearch: true,
-    },
+    // {
+    //   title: '医院Id',
+    //   dataIndex: 'hospId',
+    //   key: 'hospId',
+    //   hideInSearch: true,
+    // },
     {
       title: '创建时间',
-      dataIndex: 'createTime',
+      dataIndex: 'createDateTime',
       key: 'createTime',
       hideInSearch: true,
     },
@@ -97,7 +97,7 @@ const DepartmentMana = () => {
   //获取科室列表
   const getList = async (params = {}, sort, filter) => {
     const res = await getDepartmentList(params);
-    console.log({res});
+    // console.log({res});
     return {
       data: res.data.list,
       total: res.data.totalCount,

+ 1 - 1
src/pages/DepartmentMana/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-28 14:32:20
+ * @LastEditTime: 2021-07-29 23:13:14
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js

+ 36 - 10
src/pages/UserMana/index.js

@@ -1,14 +1,14 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-29 17:14:18
+ * @LastEditTime: 2021-07-31 19:22:20
  * @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, message, Input, Drawer } from 'antd';
+import { Button, Popconfirm, message, Input, Modal } from 'antd';
 import React, { useState, useRef, useEffect } from 'react';
 import { useIntl, FormattedMessage,useModel } from 'umi';
 import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
@@ -16,7 +16,7 @@ import ProTable from '@ant-design/pro-table';
 import { ModalForm, ProFormText, ProFormSelect } from '@ant-design/pro-form';
 import UpdateForm from './updateForm';
 import CAUpload from '@/components/CAUpload';
-import { getUserList, addUser, editUser, delUser } from './service';
+import { getUserList, addUser, editUser, delUser,importExcel } from './service';
 
 const UserMana = () => {
   const columns = [
@@ -40,10 +40,11 @@ const UserMana = () => {
       hideInSearch: true,
     },
     {
-      title: '在状态',
+      title: '在状态',
       dataIndex: 'hospitalStatus',
       key: 'hospitalStatus',
       hideInSearch: true,
+      render: (text) => <a>{text == 1 ? '在职' : '离职'}</a>,
     },
     {
       title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="Operating" />,
@@ -80,6 +81,7 @@ const UserMana = () => {
   const [currentRow, setCurrentRow] = useState({});
   const { initialState, setInitialState } = useModel('@@initialState');
   const {currentUser:{token}} = initialState;
+  // const [shareParamsSetting,setShareParamsSetting] = useState(false);  //是否分摊参数设置
 
   console.log({initialState});
   
@@ -114,6 +116,26 @@ const UserMana = () => {
       }
     }
   };
+  //自定义上传回调
+  const customRequestCallback = async (formData)=>{
+    const resp = await importExcel({formData},{
+      // 'content-type': 'application/json'
+      'content-type':'multipart/form-data',
+    })
+    console.log({resp});
+
+    const {status} = resp;
+    if(status==200){
+      Modal.success({
+         title:'导入成功!',
+         onOk:()=>{
+          if (actionRef.current) {
+            actionRef.current.reload();
+          }
+         }
+      })
+    }
+  }
 
   return (
     <PageContainer>
@@ -138,6 +160,7 @@ const UserMana = () => {
                 url='/costAccount/excel/importUser'
                 importSuccessCallback={() =>{}}
                 token={token}
+                customRequestCallback={customRequestCallback}
           />
         ]}
         pagination={{
@@ -195,12 +218,12 @@ const UserMana = () => {
           name="account"
         />
         <ProFormText
-          label="密码"
+          label="密码不修改留空"
           rules={[
             {
-              required: true,
+              required: false,
               message: (
-                <FormattedMessage id="pages.searchTable.ruleName" defaultMessage="密码是必填项" />
+                <FormattedMessage id="pages.searchTable.password" defaultMessage="" />
               ),
             },
           ]}
@@ -211,19 +234,20 @@ const UserMana = () => {
           options={[
             {
               value: 0,
-              label: '不在院',
+              label: '离职',
             },
             {
               value: 1,
-              label: '在',
+              label: '在',
             },
           ]}
           width="sm"
           name="hospitalStatus"
-          label="在状态"
+          label="在状态"
         />
       </ModalForm>
 
+    
       {/* 更新 */}
       <UpdateForm
         onSubmit={async (value) => {
@@ -247,6 +271,8 @@ const UserMana = () => {
         updateModalVisibleChange={updateModalVisibleChange}
         values={currentRow || {}}
       />
+
+
     </PageContainer>
   );
 };

+ 12 - 1
src/pages/UserMana/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:31
- * @LastEditTime: 2021-07-28 10:45:53
+ * @LastEditTime: 2021-07-31 15:06:17
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/service.js
@@ -46,4 +46,15 @@ export async function delUser(params, options) {
     method: 'POST',
     ...(options || {}),
   });
+}
+
+
+//导入excel
+export async function importExcel(body, options) {
+  const {formData} = body;
+  return request('/api/costAccount/excel/importUser', {
+    method: 'POST',
+    data:formData,
+    ...(options || {}),
+  });
 }

+ 6 - 5
src/pages/UserMana/updateForm.jsx

@@ -54,12 +54,13 @@ const UpdateForm = (props) => {
                  label="密码"
                  rules={[
                    {
-                     required: true,
+                     required: false,
                      message: (
-                       <FormattedMessage id="pages.searchTable.ruleName" defaultMessage="密码是必填项" />
+                       <FormattedMessage id="pages.searchTable.password" defaultMessage="" />
                      ),
                    },
                  ]}
+                 placeholder="密码不修改时留空"
                  width="sm"
                  name="password"
                />
@@ -67,16 +68,16 @@ const UpdateForm = (props) => {
                  options={[
                    {
                      value: 0,
-                     label: '不在院',
+                     label: '离职',
                    },
                    {
                      value: 1,
-                     label: '在',
+                     label: '在',
                    },
                  ]}
                  width="sm"
                  name="hospitalStatus"
-                 label="在状态"
+                 label="在状态"
                />
              </ModalForm>
            }

+ 28 - 92
src/pages/accountingSubject/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-29 17:00:03
+ * @LastEditTime: 2021-08-02 09:14:31
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -22,70 +22,6 @@ import { idText } from 'typescript';
 
 
 
-const dataSource = [
-  {
-    key: 1,
-    accountingName: 'John Brown sr.',
-    accountingCode: 60,
-    isBaseCost:1,
-    children: [
-      {
-        key: 11,
-        name: 'John Brown',
-        age: 42,
-        address: 'New York No. 2 Lake Park',
-      },
-      {
-        key: 12,
-        name: 'John Brown jr.',
-        age: 30,
-        address: 'New York No. 3 Lake Park',
-        children: [
-          {
-            key: 121,
-            name: 'Jimmy Brown',
-            age: 16,
-            address: 'New York No. 3 Lake Park',
-          },
-        ],
-      },
-      {
-        key: 13,
-        name: 'Jim Green sr.',
-        age: 72,
-        address: 'London No. 1 Lake Park',
-        children: [
-          {
-            key: 131,
-            name: 'Jim Green',
-            age: 42,
-            address: 'London No. 2 Lake Park',
-            children: [
-              {
-                key: 1311,
-                name: 'Jim Green jr.',
-                age: 25,
-                address: 'London No. 3 Lake Park',
-              },
-              {
-                key: 1312,
-                name: 'Jimmy Green sr.',
-                age: 18,
-                address: 'London No. 4 Lake Park',
-              },
-            ],
-          },
-        ],
-      },
-    ],
-  },
-  {
-    key: 2,
-    name: 'Joe Black',
-    age: 32,
-    address: 'Sidney No. 1 Lake Park',
-  },
-];
 
 const AccountingSubject = () => {
   const columns = [
@@ -155,7 +91,7 @@ const AccountingSubject = () => {
   const actionRef = useRef();  //表格
   const ref = useRef();   //新增表单
   const [currentRow, setCurrentRow] = useState({});
-  const [selectedLevelList, setSelectedLevelList] = useState(null); //可选的分摊层级列表
+  const [selectedLevelList, setSelectedLevelList] = useState(null); //类型
   const [selectedLevel, setSelectedLevel] = useState(null);
   const [accountType, setAccountType] = useState(1);
   const [options, setOptions] = useState([]);
@@ -309,7 +245,14 @@ const AccountingSubject = () => {
     )
     
   };
-
+   
+  const onTabChange = (key)=>{
+    console.log({key});
+    setAccountType(Number(key));
+    if (actionRef.current) {
+      actionRef.current.reload();
+    }
+  }
 
   useEffect(async () => {
     const respForSelecter = await getAccountingSubjectForSelecter();
@@ -319,7 +262,19 @@ const AccountingSubject = () => {
   }, [])
 
   return (
-    <PageContainer>
+    <PageContainer
+    tabList={[
+      {
+        tab: '收益',
+        key: 1,
+      },
+      {
+        tab: '支出',
+        key: 2,
+      },
+    ]} 
+    onTabChange={onTabChange}  
+    >
 
       <ProTable
         columns={columns}
@@ -330,26 +285,7 @@ const AccountingSubject = () => {
         // expandable={{ expandedRowRender }}
         toolbar={{
           actions: [
-            <Button
-              key="button"
-              // icon={<PlusOutlined />}
-              type="primary"
-              onClick={() => {
-                setAccountType(1)
-              }}
-            >
-              收入
-            </Button>,
-            <Button
-              key="button"
-              // icon={<PlusOutlined />}
-              type="primary"
-              onClick={() => {
-                setAccountType(2)
-              }}
-            >
-              支出
-            </Button>,
+            
             <Button
               key="button"
               icon={<PlusOutlined />}
@@ -385,7 +321,7 @@ const AccountingSubject = () => {
         formRef={ref}
         onFinish={async (value) => {
           const { id } = currentRow;
-          const success = await addAccountingSubject({ ...value, id: id ? id : 0 });
+          const success = await addAccountingSubject({ ...value, id: id ? id : 0,accountingType:accountType });
           //   console.log({ success });
           if (success) {
             handleModalVisible(false);
@@ -424,7 +360,7 @@ const AccountingSubject = () => {
           width="sm"
           name="accountingName"
         />
-        <ProFormSelect
+        {/* <ProFormSelect
           rules={[
             {
               required: true,
@@ -446,7 +382,7 @@ const AccountingSubject = () => {
           width="sm"
           name="accountingType"
           label="会计科目类型"
-        />
+        /> */}
         <ProFormSelect
           rules={[
             {
@@ -476,7 +412,7 @@ const AccountingSubject = () => {
       <UpdateForm
         onSubmit={async (value) => {
           console.log({ '编辑': value });
-          const success = await editAccountingSubjectList(value);
+          const success = await editAccountingSubjectList({...value,accountType});
 
           if (success) {
             handleUpdateModalVisible(false);

+ 1 - 1
src/pages/accountingSubject/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-28 19:10:38
+ * @LastEditTime: 2021-07-29 23:11:02
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js

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

@@ -1,14 +1,14 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-29 16:56:36
+ * @LastEditTime: 2021-08-01 14:01:23
  * @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, Space, Table, Tag } from 'antd';
+import { Button, Space, Table, Tag,Tooltip } from 'antd';
 import React, { useState, useRef, useEffect } from 'react';
 import { useIntl, FormattedMessage } from 'umi';
 import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
@@ -25,7 +25,7 @@ const ResponsibilityCenterConnect = () => {
       dataIndex: 'accountingName',
       key: 'accountingName',
       hideInSearch: false,
-      width: '20%'
+      width: '20%',
     },
     {
       title: '会计科目编号',
@@ -64,7 +64,7 @@ const ResponsibilityCenterConnect = () => {
               setCurrentRow(record);
             }}
           >
-            绑定成本中心
+            设置对应
           </a>,
         ] : []
       },
@@ -92,6 +92,7 @@ const ResponsibilityCenterConnect = () => {
   const [currentRow, setCurrentRow] = useState({});
   const [drawerVisible, setDrawerVisible] = useState(false);
   const [selectedRowKeys,setSelectedRowKeys] = useState([]);
+  const [defaultExpandedRowKeys,setDefaultExpandedRowKeys] = useState([]);
 
   /**
    * 
@@ -100,7 +101,7 @@ const ResponsibilityCenterConnect = () => {
   const drawerVisibleChange = (bool) => {
     // console.log({currentRow});
     const {productVOs} = currentRow;
-    console.log({currentRow});
+  
     const selected = productVOs?productVOs.map(item=>item.id):[];
     if (bool)setSelectedRowKeys(selected==undefined?[]:selected);
     setDrawerVisible(bool);
@@ -112,6 +113,10 @@ const ResponsibilityCenterConnect = () => {
   const getList = async (params = {}, sort, filter) => {
     const res = await getAccountProductConnectList(params);
     // console.log({res});
+
+    const defaultKeys = res.data.list.map(item=>item.id);
+    setDefaultExpandedRowKeys(defaultKeys);
+
     return {
       data: res.data.list,
       total: res.data.totalCount,
@@ -133,6 +138,11 @@ const ResponsibilityCenterConnect = () => {
     }
   }
 
+  const onExpandedRowsChange = (expandedRows)=>{
+    setDefaultExpandedRowKeys([].concat(expandedRows))
+}
+
+
 
   return (
     <PageContainer>
@@ -142,7 +152,8 @@ const ResponsibilityCenterConnect = () => {
         actionRef={actionRef}
         rowKey="id"
         childrenColumnName="child"
-        expandable={{ defaultExpandedRowKeys: [] }}
+   
+        expandable={{ defaultExpandedRowKeys: [],expandedRowKeys:defaultExpandedRowKeys,onExpandedRowsChange:onExpandedRowsChange }}
         toolBarRender={() => []}
 
         pagination={{

+ 1 - 1
src/pages/accountingSubjectConnect/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-29 16:38:10
+ * @LastEditTime: 2021-07-29 23:11:23
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js

+ 14 - 7
src/pages/apportionmentLevel/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-27 19:44:56
+ * @LastEditTime: 2021-07-30 15:21:27
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -13,7 +13,7 @@ import React, { useState, useRef, useEffect } from 'react';
 import { useIntl, FormattedMessage } from 'umi';
 import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
-import { ModalForm, ProFormText, ProFormSelect, ProFormDependency } from '@ant-design/pro-form';
+import { ModalForm, ProFormText, ProFormSelect, ProFormDigit } from '@ant-design/pro-form';
 import UpdateForm from './updateForm';
 // import CAUpload from '@/components/CAUpload';
 import { getApportionmentLevelList, editApportionmentLevelList, delApportionmentLevel, addApportionmentLevel } from './service';
@@ -44,7 +44,7 @@ const ApportionmentLevel = () => {
       dataIndex: 'calcType',
       key: 'calcType',
       hideInSearch: true,
-      render: (text) => <a>{text == 0 ? '合并计算' : '分开计算'}</a>,
+      render: (text) =><>{text == 0 ? '合并计算' : '分开计算'}</>,
     },
     {
       title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="Operating" />,
@@ -105,7 +105,12 @@ const ApportionmentLevel = () => {
    */
   const delListHandler = async (value) => {
     const resp = await delApportionmentLevel(value);
-    console.log({ resp });
+    const {status} = resp;
+    if(status==200){
+      if (actionRef.current) {
+        actionRef.current.reload();
+      }
+    }
   };
 
   return (
@@ -178,7 +183,7 @@ const ApportionmentLevel = () => {
           }
         }}
       >
-        <ProFormText
+        <ProFormDigit
           label="分摊层级序号"
           rules={[
             {
@@ -190,8 +195,9 @@ const ApportionmentLevel = () => {
           ]}
           width="sm"
           name="leverSort"
+          min={1} max={100}
         />
-
+    
         <ProFormText
           label="分摊层级名"
           rules={[
@@ -205,7 +211,7 @@ const ApportionmentLevel = () => {
           width="sm"
           name="shareName"
         />
-        <ProFormText
+        <ProFormDigit
           label="目标层级"
           rules={[
             {
@@ -215,6 +221,7 @@ const ApportionmentLevel = () => {
               ),
             },
           ]}
+          min={1} max={100}
           width="sm"
           name="targetLevel"
         />

+ 4 - 2
src/pages/apportionmentLevel/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-28 15:10:14
+ * @LastEditTime: 2021-07-29 23:11:46
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
@@ -54,8 +54,10 @@ export async function addApportionmentLevel(body, options) {
 //删除分摊层级
 export async function delApportionmentLevel(params, options) {
   const {id} = params;
-  return request(`/api/costAccount/costsharelevel/delete?ids=${id}`, {
+  const ids = [id];
+  return request(`/api/costAccount/costsharelevel/delete`, {
     method: 'POST',
+    data:ids,
     ...(options || {}),
   });
 }

+ 321 - 23
src/pages/costAllocationParamsConnect/index.jsx

@@ -1,25 +1,28 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-29 20:09:57
+ * @LastEditTime: 2021-07-30 19:55:25
  * @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, Cascader } from 'antd';
+import { Button, Popconfirm, Cascader,Modal } from 'antd';
 import React, { useState, useRef, useEffect } from 'react';
 import { useIntl, FormattedMessage } from 'umi';
 import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
-import ProForm, { ModalForm, ProFormDependency, ProFormSelect, ProFormTextArea } from '@ant-design/pro-form';
+import ProForm, { ModalForm, DrawerForm, ProFormSelect, ProFormTextArea, ProFormDigit } from '@ant-design/pro-form';
 import UpdateForm from './updateForm';
+import UpdateFormDrawer from './updateForm_drawer';
 // import CAUpload from '@/components/CAUpload';
 import {
   getCostshareparamConnectList, editCostshareparamConnectList, delCostshareparamConnect,
-  addCostshareparamConnect, getResponsibilityCenterSelecterList, getAccountingSubjectForSelecter
+  addCostshareparamConnect, getResponsibilityCenterSelecterList, getAccountingSubjectForSelecter,
+  getHasSetParamsList, getParamsSelectableList, saveParamsList
 } from './service';
+import { set } from 'lodash-es';
 
 const DepartmentMana = () => {
   const columns = [
@@ -66,7 +69,17 @@ const DepartmentMana = () => {
       valueType: 'option',
       render: (_, record) => [
         <a
-          key="config"
+          key="config1"
+          onClick={() => {
+            setDrawerVisible(true);
+            setCurrentRow(record);
+            setCurrentResponsibilityRow(record);
+          }}
+        >
+          分摊参数设置
+        </a>,
+        <a
+          key="config2"
           onClick={() => {
             handleUpdateModalVisible(true);
             setCurrentRow(record);
@@ -88,13 +101,78 @@ const DepartmentMana = () => {
     },
   ];
 
+
+  const drawerTableColumns = [
+    {
+      title: '分摊参数编码',
+      dataIndex: 'shareParamCode',
+      key: 'shareParamCode',
+      hideInSearch: true,
+    },
+    {
+      title: '分摊参数名称',
+      dataIndex: 'shareParamName',
+      key: 'shareParamName',
+      hideInSearch: false,
+    },
+    {
+      title: '分摊比例',
+      dataIndex: 'shareParamPopout',
+      key: 'shareParamPopout',
+      hideInSearch: false,
+    },
+    {
+      title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="Operating" />,
+      dataIndex: 'option',
+      valueType: 'option',
+      render: (_, record) => [
+        <a
+          key="config2"
+          onClick={() => {
+            setDrawerUpdateModalVisible(true);
+            setCurrentRow(record);
+          }}
+        >
+          编辑
+        </a>,
+        <Popconfirm
+          key="subscribeAlert"
+          title="是否确定删除?"
+          onConfirm={() => {
+            setCurrentRow(record);
+            delParamsListHandler(record);
+          }}
+        >
+          <a>删除</a>
+        </Popconfirm>,
+      ],
+    },
+
+  ];
+
   const [createModalVisible, handleModalVisible] = useState(false);
   const [updateModalVisible, handleUpdateModalVisible] = useState(false);
   const [cascaderOptions, setCascaderOptions] = useState([]);
   const actionRef = useRef(); //表格
   const ref = useRef();   //新增表单
+  const [currentResponsibilityRow, setCurrentResponsibilityRow] = useState({});
   const [selectedCascader, setSelectedCascader] = useState(null);
   const [currentRow, setCurrentRow] = useState({});
+  const [ifDisable, setIfDisable] = useState(false);
+  const [selectedResponsibilityId, setSelectedResponsibilityId] = useState(null);
+
+
+  const drawerFormRef = useRef(); //DrawerForm
+  const actionDrawertableRef = useRef(); //Drawertable
+  const drawerModalRef = useRef(); //DrawerModal
+  const [drawerVisible, setDrawerVisible] = useState(false);
+  const [drawerMadalVisible, setDrawerMadalVisible] = useState(false);
+  const [hasSetParamsList, setHasSetParamsList] = useState([]);
+  const [selectedParam, setSelectedParam] = useState(null);
+  const [newAddParamList, setNewAddParamList] = useState([]);
+
+  const [drawerUpdateModalVisible,setDrawerUpdateModalVisible] = useState(false);
+
 
   /**
    *
@@ -105,6 +183,11 @@ const DepartmentMana = () => {
     if (!bool) setCurrentRow(undefined);
   };
 
+  const drawerUpdateModalVisibleChange = (bool)=>{
+    setDrawerUpdateModalVisible(bool);
+    if (!bool) setCurrentRow(undefined);
+  }
+
   //获取科室列表
   const getList = async (params = {}, sort, filter) => {
     const res = await getCostshareparamConnectList(params);
@@ -128,11 +211,43 @@ const DepartmentMana = () => {
     }
   };
 
+  const delParamsListHandler = (record)=>{
+      const {id} = record;
+      const arr = hasSetParamsList;
+      arr.splice(arr.findIndex(item => item.id === id), 1);
+      setHasSetParamsList([].concat(arr));
+      if (actionDrawertableRef.current) {
+        actionDrawertableRef.current.reload();
+      }
+  }
+
   //级联回调
   const cascaderChangeHandle = (value) => {
-    console.log({ value });
     setSelectedCascader(value[value.length - 1]);
   }
+  //分摊参数回调
+  const drawerVisibleChange = async (bool) => {
+    // console.log({currentRow});
+    if (bool) {
+      //展示
+      const { id } = currentRow;
+      const resp = await getHasSetParamsList({ id });
+      const { data, msg, status } = resp;
+      // console.log({data, msg, status});
+      if (status == 200) {
+        setHasSetParamsList(data?data:[]);
+
+        if (actionDrawertableRef.current) {
+          actionDrawertableRef.current.reload();
+        }
+      }
+    }
+    setDrawerVisible(bool);
+  }
+
+  const handleDrawerModalVisible = (bool) => {
+    setDrawerMadalVisible(bool);
+  }
 
 
   useEffect(async () => {
@@ -184,8 +299,11 @@ const DepartmentMana = () => {
           handleModalVisible(bool);
         }}
         onFinish={async (value) => {
-
+          const { costNode } = value;
           const success = await addCostshareparamConnect({
+            responsibilityId: selectedResponsibilityId,
+            accountingId: selectedCascader > 0 ? selectedCascader : 0,
+            costNode
 
           });
           //   console.log({ success });
@@ -207,6 +325,21 @@ const DepartmentMana = () => {
               ),
             },
           ]}
+          fieldProps={{//这里使用了select的onChange方法,必须使用这样的写法来进行调用onChange方法
+            onChange: async (val) => {
+              setSelectedResponsibilityId(val);
+              const resp = await getResponsibilityCenterSelecterList();
+              const { data, msg, status } = resp;
+              if (status == 200) {
+                const selected = data.filter(item => item.id == val);
+                if (selected && selected[0].calcType == 0) {
+                  setIfDisable(true);
+                } else {
+                  setIfDisable(false);
+                }
+              }
+            },
+          }}
           request={async () => {
             const resp = await getResponsibilityCenterSelecterList();
             const { data, msg, status } = resp;
@@ -221,21 +354,10 @@ const DepartmentMana = () => {
           name="responsibilityId"
           label="请选择责任中心"
         />
-        <ProFormDependency name={['responsibilityId']}>
-          {({ responsibilityId }) => {
-            // const resp = await getResponsibilityCenterSelecterList();
-            // const { data, msg, status } = resp;
-            // if (status == 200) {
-            //   // data.findIndex(item=>item.)
-            // }
-            return (
-              <ProForm.Group style={{ marginBottom: 20 }}>
-                <div style={{ marginLeft: 115 }}>请选择成本科目:</div>
-                <Cascader options={cascaderOptions} onChange={cascaderChangeHandle} placeholder="请选择成本科目" />
-              </ProForm.Group>
-            );
-          }}
-        </ProFormDependency>
+        <ProForm.Group style={{ marginBottom: 20 }}>
+          <div style={{ marginLeft: 115 }}>请选择成本科目:</div>
+          <Cascader disabled={ifDisable} options={cascaderOptions} onChange={cascaderChangeHandle} placeholder="请选择成本科目" />
+        </ProForm.Group>
 
         <ProFormTextArea
           name="costNode"
@@ -245,11 +367,184 @@ const DepartmentMana = () => {
         />
       </ModalForm>
 
+      {/* 成本分摊参数设置 */}
+      <DrawerForm
+        title="分摊参数设置"
+        formRef={drawerFormRef}
+        visible={drawerVisible}
+        onVisibleChange={(visible) => drawerVisibleChange(visible)}
+        // onFinish={(value) => onSubmit({ ...values, ...value })}
+        onFinish={async () => {
+          if(true){
+            const { id } = currentResponsibilityRow;
+      
+            const resp = await saveParamsList({
+              id,
+              shareParamProportionVOList: hasSetParamsList
+            });
+            const {status} = resp;
+            if(status == 200){
+              setDrawerVisible(false);
+              if (actionRef.current) {
+                actionRef.current.reload();
+              }
+            }
+          }
+          
+        }}
+      >
+        <ProTable
+          columns={drawerTableColumns}
+          // request={[]}
+          rowKey="id"
+          actionRef={actionDrawertableRef}
+          toolBarRender={() => [
+            <Button
+              key="button"
+              icon={<PlusOutlined />}
+              type="primary"
+              onClick={() => {
+                setDrawerMadalVisible(true);
+                setCurrentRow(undefined);
+              }}
+            >
+              新增
+            </Button>
+          ]}
+          request={async (params = {}, sort, filter) => {
+            console.log({ hasSetParamsList });
+            return {
+              data: hasSetParamsList,
+              success: true
+            };
+          }}
+          pagination={{
+            pageSize: 10,
+          }}
+          search={false}
+        />
+        <ModalForm
+          title="新增分摊参数"
+          width="800px"
+          labelCol={{ span: 5, offset: 3 }}
+          layout={'horizontal'}
+          visible={drawerMadalVisible}
+          formRef={drawerModalRef}
+          onVisibleChange={(bool) => {
+            if (ref.current) {
+              ref.current.resetFields();
+            }
+            handleDrawerModalVisible(bool);
+          }}
+
+          onFinish={async (value) => {
+            console.log({ '新增分摊参数': value, selectedParam,hasSetParamsList});
+            const { shareParamPopout } = value;
+            const { id, shareParamCode, shareParamName } = selectedParam;
+
+            setHasSetParamsList(hasSetParamsList.concat([{
+              id, shareParamCode, shareParamName, shareParamPopout
+            }]));
+
+            setNewAddParamList(newAddParamList.concat([{
+              id, shareParamCode, shareParamName, shareParamPopout
+            }]));
+
+            setDrawerMadalVisible(false);
+
+            if (actionDrawertableRef.current) {
+              actionDrawertableRef.current.reload();
+            }
+          }}
+        >
+          <ProFormSelect
+            rules={[
+              {
+                required: true,
+                message: (
+                  <FormattedMessage id="pages.searchTable.accountingType" defaultMessage="请选择责任中心" />
+                ),
+              },
+            ]}
+
+            fieldProps={{//这里使用了select的onChange方法,必须使用这样的写法来进行调用onChange方法
+              onChange: async (val) => {
+                // setSelectedParam(val);
+                const { id } = currentResponsibilityRow;
+                // console.log({currentResponsibilityRow});
+                const resp = await getParamsSelectableList({ id });
+                const { data, status } = resp;
+                console.log({resp});
+                if (status == 200) {
+                  const selected = data.list.filter(item => item.id == val);
+                  console.log({ selected });
+                  setSelectedParam(selected[0]);
+                }
+              },
+            }}
+
+            request={async () => {
+              const { id } = currentResponsibilityRow;
+              const resp = await getParamsSelectableList({ id });
+              const { data, status } = resp;
+              console.log({ resp });
+              if (status == 200) {
+                const temp = data.list.map(item => ({
+                  label: item.shareParamName,
+                  value: item.id
+                }));
+                return temp;
+              }
+
+            }}
+            width="sm"
+            name="id"
+            label="请选择分摊参数"
+          />
+
+          <ProFormDigit width={100} label="分摊比例" name="shareParamPopout" min={0} max={100} />
+
+        </ModalForm>
+
+        {/* 分摊更新 */}
+        <UpdateFormDrawer
+          onSubmit={async (value) => {
+               
+               const {id} = value;
+               const index = hasSetParamsList.findIndex(item=>item.id == id);
+               const temp = hasSetParamsList;
+               temp[index] = value;
+               console.log({value,temp});
+               setHasSetParamsList([].concat(temp));
+               setDrawerUpdateModalVisible(false);
+               if (actionDrawertableRef.current) {
+                actionDrawertableRef.current.reload();
+              }
+          }}
+          onCancel={() => {
+            drawerUpdateModalVisible(false);
+            setCurrentRow(undefined);
+          }}
+          currentResponsibilityRow={currentResponsibilityRow}
+          drawerUpdateModalVisible={drawerUpdateModalVisible}
+          drawerUpdateModalVisibleChange={drawerUpdateModalVisibleChange}
+          values={currentRow || {}}
+       
+
+        />
+      </DrawerForm>
+
+
+
       {/* 更新 */}
       <UpdateForm
         onSubmit={async (value) => {
           console.log({ '编辑': value });
-          const success = await editCostshareparamConnectList(value);
+          const { responsibilityId, ifDisable, accountingId, costNode, id } = value;
+
+          const success = await editCostshareparamConnectList(ifDisable ? {
+            responsibilityId, costNode, id
+          } : { responsibilityId, accountingId, costNode, id });
 
           if (success) {
             handleUpdateModalVisible(false);
@@ -267,6 +562,9 @@ const DepartmentMana = () => {
         updateModalVisible={updateModalVisible}
         updateModalVisibleChange={updateModalVisibleChange}
         values={currentRow || {}}
+        cascaderOptions={cascaderOptions}
+        cascaderChangeHandle={cascaderChangeHandle}
+
       />
     </PageContainer>
   );

+ 43 - 1
src/pages/costAllocationParamsConnect/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-29 19:38:36
+ * @LastEditTime: 2021-07-30 18:45:42
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
@@ -73,3 +73,45 @@ export async function getAccountingSubjectForSelecter(params, options) {
   });
 }
 
+//获取当前成本已用本的分摊参数列表
+export async function getHasSetParamsList(params, options) {
+  const {id} = params;
+  return request(`/api/costAccount/costaccountshare/getShareParamById`, {
+    method: 'GET',
+    params:{
+         id:id
+    },
+    ...(options || {}),
+  });
+
+}
+
+
+//获取添加分摊参数时可选列表
+export async function getParamsSelectableList(params, options) {
+  const {id} = params;
+  console.log({params});
+  return request(`/api/costAccount/costaccountshare/getAllShareParamStatusById`, {
+    method: 'GET',
+    params:{
+         id:id
+    },
+    ...(options || {}),
+  });
+
+}
+
+
+//保存成本分摊参数
+export async function saveParamsList(params, options) {
+  const {id,shareParamProportionVOList} = params;
+  return request(`/api/costAccount/costaccountshare/updateShareParam`, {
+    method: 'POST',
+    data:{
+         id,
+         shareParamProportionVOList
+    },
+    ...(options || {}),
+  });
+
+}

+ 81 - 25
src/pages/costAllocationParamsConnect/updateForm.jsx

@@ -1,54 +1,110 @@
-import React from 'react';
-import { Modal } from 'antd';
-import {
+import React, { useState,useEffect} from 'react';
+import { Cascader,Form } from 'antd';
+import ProForm, {
   ProFormSelect,
   ProFormText,
   ModalForm,
+  ProFormTextArea
 } from '@ant-design/pro-form';
 import { useIntl, FormattedMessage } from 'umi';
 
+import {
+  getResponsibilityCenterSelecterList
+} from './service';
+
 
 const UpdateForm = (props) => {
-  const { updateModalVisible, updateModalVisibleChange, values, onSubmit } = props;
-  // console.log({values});
+  const { cascaderOptions, cascaderChangeHandle, values: record ,updateModalVisible, updateModalVisibleChange,onSubmit} = props;
+  const { accountingId,responsibilityId } = record;
+  const [selectedCascader, setSelectedCascader] = useState(null);
+  const [ifDisable, setIfDisable] = useState(false);
+  const [selectedResponsibilityId, setSelectedResponsibilityId] = useState(null);
+
+  // console.log({record});
+   
+  useEffect(async () => {
+    const resp = await getResponsibilityCenterSelecterList();
+    const { data, msg, status } = resp;
+    if (status == 200) {
+      const selected = data.filter(item =>{
+          // console.log({item});
+          return item.responsibilityId == responsibilityId
+      });
+      // console.log({selected,data});
+      if (selected&&selected.length>0&&selected[0].calcType == 0) {
+        setIfDisable(true);
+      } else {
+        setIfDisable(false);
+      }
+    }
+  }, [record])
+
   return (
     <>
       {
-        JSON.stringify(values) !== '{}' && <ModalForm
+        JSON.stringify(record) !== '{}' && <ModalForm
           title="编辑成本分摊参数"
           width="800px"
-          initialValues={{ ...values }}
-          labelCol={{ span:5,offset: 3 }}
+          initialValues={{ ...record,cascaderIds:[accountingId] }}
+          labelCol={{ span: 5, offset: 3 }}
           layout={'horizontal'}
           visible={updateModalVisible}
           onVisibleChange={(visible) => updateModalVisibleChange(visible)}
-          onFinish={(value) => onSubmit({ ...values, ...value })}
+          onFinish={(value) => onSubmit({ ...record, ...value,ifDisable })}
         >
-          <ProFormText
-            label="成本分摊参数名"
+          <ProFormSelect
             rules={[
               {
                 required: true,
                 message: (
-                  <FormattedMessage id="pages.searchTable.shareParamName" defaultMessage="成本分摊参数名是必填项" />
+                  <FormattedMessage id="pages.searchTable.responsibilityId" defaultMessage="请选择责任中心" />
                 ),
               },
             ]}
-            width="sm"
-            name="shareParamName"
-          />
-          <ProFormText
-            label="成本分摊参数编号"
-            rules={[
-              {
-                required: true,
-                message: (
-                  <FormattedMessage id="pages.searchTable.shareParamCode" defaultMessage="成本分摊参数编号是必填项" />
-                ),
+            fieldProps={{//这里使用了select的onChange方法,必须使用这样的写法来进行调用onChange方法
+              onChange: async (val) => {
+                setSelectedResponsibilityId(val);
+                const resp = await getResponsibilityCenterSelecterList();
+                const { data, msg, status } = resp;
+                if (status == 200) {
+                  const selected = data.filter(item => item.id == val);
+                  console.log({val,selected});
+                  if (selected && selected[0].calcType == 0) {
+                    setIfDisable(true);
+                  } else {
+                    setIfDisable(false);
+                  }
+                }
               },
-            ]}
+            }}
+            request={async () => {
+              const resp = await getResponsibilityCenterSelecterList();
+              const { data, msg, status } = resp;
+              if (status == 200) {
+                return data.map(item => ({
+                  label: item.responsibilityName,
+                  value: item.id
+                }))
+              }
+            }}
             width="sm"
-            name="shareParamCode"
+            name="responsibilityId"
+            label="请选择责任中心"
+          />
+          <Form.Item name="cascaderIds" label="请选择成本科目" wrapperCol={{ offset:0, span:7 }} >
+                <Cascader disabled={ifDisable} options={cascaderOptions}    placeholder="请选择成本科目" onChange={cascaderChangeHandle} />
+
+          </Form.Item>
+          {/* <ProForm.Group style={{ marginBottom: 20 }}>
+            <div style={{ marginLeft: 115 }}>请选择成本科目:</div>
+            <Cascader defaultValue={accountingId} disabled={ifDisable} options={cascaderOptions} onChange={cascaderChangeHandle} placeholder="请选择成本科目" />
+          </ProForm.Group> */}
+
+          <ProFormTextArea
+            name="costNode"
+            label="备注"
+            width={300}
+            placeholder="请输入备注"
           />
         </ModalForm>
       }

+ 120 - 0
src/pages/costAllocationParamsConnect/updateForm_drawer.js

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

+ 299 - 25
src/pages/costAllocationParamsSetting/index.jsx

@@ -1,22 +1,24 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-28 20:54:19
+ * @LastEditTime: 2021-08-02 02:09:05
  * @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, message, Input, Drawer } from 'antd';
+import { Button, Popconfirm, message, Space, Drawer,Table } from 'antd';
 import React, { useState, useRef, useEffect } from 'react';
 import { useIntl, FormattedMessage } from 'umi';
 import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
-import { ModalForm, ProFormText, ProFormSelect } from '@ant-design/pro-form';
+import { ModalForm, ProFormText, ProFormSelect,DrawerForm,ProFormDigit} from '@ant-design/pro-form';
 import UpdateForm from './updateForm';
+import UpdateFormDrawer from './updateForm_drawer';
 // import CAUpload from '@/components/CAUpload';
-import { getCostshareparamList, editCostshareparamList, delCostshareparam, addCostshareparam } from './service';
+import { getCostshareparamList, editCostshareparamList, delCostshareparam, addCostshareparam,updateCostShareParamByAccountId } from './service';
+import { getAccountingSubjectList} from '../accountingSubject/service';
 
 const DepartmentMana = () => {
   const columns = [
@@ -38,41 +40,86 @@ const DepartmentMana = () => {
       dataIndex: 'calcType',
       key: 'calcType',
       hideInSearch: true,
-      render: (text) => <>{text == 1 ? '手动填写' : '按对应成本项目计算'}</>,
+      render: (text) => <>{text == 1 ? '手动填写' : '按对应会计科目计算'}</>,
     },
     {
       title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="Operating" />,
       dataIndex: 'option',
       valueType: 'option',
-      render: (_, record) => [
-        <a
+      render: (_, record) =>{
+        const {calcType} = record;
+        const groups = [
+          <a
+            key="config"
+            onClick={() => {
+              handleUpdateModalVisible(true);
+              setCurrentRow(record);
+            }}
+          >
+            编辑
+          </a>,
+          <Popconfirm
+            key="subscribeAlert"
+            title="是否确定删除?"
+            onConfirm={() => {
+              setCurrentRow(record);
+              delListHandler(record);
+            }}
+          >
+            <a>删除</a>
+          </Popconfirm>,
+        ]
+
+        return calcType==1?groups:[...groups,<a
           key="config"
           onClick={() => {
-            handleUpdateModalVisible(true);
-            setCurrentRow(record);
-          }}
-        >
-          编辑
-        </a>,
-        <Popconfirm
-          key="subscribeAlert"
-          title="是否确定删除?"
-          onConfirm={() => {
+            setDrawerVisible(true);
             setCurrentRow(record);
-            delListHandler(record);
+            setCurrentResponsibilityRow(record);
           }}
         >
-          <a>删除</a>
-        </Popconfirm>,
-      ],
+          设置对应会计科目
+        </a>,]
+      } 
     },
   ];
 
+  const drawerTableColumns = [
+    {
+      title: '成本科目编码',
+      dataIndex: 'accountingCode',
+      key: 'accountingCode',
+      hideInSearch: true,
+    },
+    {
+      title: '成本科目名称',
+      dataIndex: 'accountingName',
+      key: 'accountingName',
+      hideInSearch: false,
+    }
+  ];
+
   const [createModalVisible, handleModalVisible] = useState(false);
   const [updateModalVisible, handleUpdateModalVisible] = useState(false);
   const actionRef = useRef(); //表格
   const ref = useRef();   //新增表单
   const [currentRow, setCurrentRow] = useState({});
+  const [currentResponsibilityRow, setCurrentResponsibilityRow] = useState({});
+  
+  const drawerFormRef = useRef(); //DrawerForm
+  const actionDrawertableRef = useRef(); //Drawertable
+  const drawerModalRef = useRef(); //DrawerModal
+  const [drawerVisible, setDrawerVisible] = useState(false);
+  const [drawerMadalVisible, setDrawerMadalVisible] = useState(false);
+  const [hasSetParamsList, setHasSetParamsList] = useState([]);
+  const [selectedParam, setSelectedParam] = useState(null);
+  const [newAddParamList, setNewAddParamList] = useState([]);
+
+  const [accountType, setAccountType] = useState(1);
+  const [selectedRowKeys,setSelectedRowKeys] = useState([]);
+  
+
+  const [drawerUpdateModalVisible,setDrawerUpdateModalVisible] = useState(false);
 
   /**
    *
@@ -83,6 +130,11 @@ const DepartmentMana = () => {
     if (!bool) setCurrentRow(undefined);
   };
 
+  const drawerUpdateModalVisibleChange = (bool)=>{
+    setDrawerUpdateModalVisible(bool);
+    if (!bool) setCurrentRow(undefined);
+  }
+
   //获取科室列表
   const getList = async (params = {}, sort, filter) => {
     const res = await getCostshareparamList(params);
@@ -106,6 +158,29 @@ const DepartmentMana = () => {
     }
   };
 
+
+    //分摊参数回调
+    const drawerVisibleChange = async (bool) => {
+      // console.log({currentRow});
+      if (bool) {
+          if(actionDrawertableRef.current){
+            actionDrawertableRef.current.reload();
+          }
+      }
+      setDrawerVisible(bool);
+    }
+  
+    const handleDrawerModalVisible = (bool) => {
+      setDrawerMadalVisible(bool);
+    }
+
+    const onTabChange = (key)=>{
+      setAccountType(Number(key));
+      if (actionDrawertableRef.current) {
+        actionDrawertableRef.current.reload();
+      }
+    }
+
   return (
     <PageContainer>
       <ProTable
@@ -190,26 +265,225 @@ const DepartmentMana = () => {
             {
               required: true,
               message: (
-                <FormattedMessage id="pages.searchTable.accountingType" defaultMessage="请选择会计科目类型" />
+                <FormattedMessage id="pages.searchTable.accountingType" defaultMessage="请选择计算方式" />
               ),
             },
           ]}
           options={[
             {
               value: 1,
-              label: '收入',
+              label: '手动填写',
             },
             {
               value: 2,
-              label: '支出',
+              label: '按对应会计科目计算',
             },
           ]}
           width="sm"
           name="calcType"
-          label="会计科目类型"
+          label="计算方式"
         />
       </ModalForm>
 
+
+      {/* 设置对应会计科目 */}
+      <DrawerForm
+        title="设置对应会计科目"
+        formRef={drawerFormRef}
+        visible={drawerVisible}
+        onVisibleChange={(visible) => drawerVisibleChange(visible)}
+        // onFinish={(value) => onSubmit({ ...values, ...value })}
+        onFinish={async () => {
+
+          const {id} = currentResponsibilityRow;
+          console.log({selectedRowKeys,currentResponsibilityRow});
+          const resp = await updateCostShareParamByAccountId({costShareParamId:id,accountIds:selectedRowKeys});
+          const {status} = resp;
+          setDrawerVisible(false);
+          if(status==200){
+            if (actionRef.current) {
+              actionRef.current.reload();
+            }
+          }
+          
+        }}
+      >
+        <PageContainer
+             header={{
+               title:''
+             }}
+             tabList={[
+              {
+                tab: '收益',
+                key: 1,
+              },
+              {
+                tab: '支出',
+                key: 2,
+              },
+            ]} 
+            onTabChange={onTabChange}  
+        >
+        <ProTable
+          columns={drawerTableColumns}
+          // request={[]}
+          rowKey="id"
+          actionRef={actionDrawertableRef}
+          rowSelection={{
+            // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
+            // 注释该行则默认不显示下拉选项
+            selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
+            selectedRowKeys:selectedRowKeys,
+            onChange:(selectedRowKeys, selectedRows)=>{
+              setSelectedRowKeys(selectedRowKeys);
+            }
+          }}
+          tableAlertRender={({ selectedRowKeys, selectedRows, onCleanSelected }) =>{
+            setSelectedRowKeys(selectedRowKeys);
+              return (
+                <Space size={24}>
+                  <span>
+                    已选 {selectedRowKeys.length} 项
+                    <a style={{ marginLeft: 8 }} onClick={onCleanSelected}>
+                      取消选择
+                    </a>
+                  </span>
+                </Space>
+              )
+          }}
+          request={async (params = {}, sort, filter) => {
+            const {id} = currentResponsibilityRow;
+            const result = await getAccountingSubjectList({accountType,shareParamId:id});
+            const {status,data} = result;
+            if(status==200){
+              const selectedList = data.list.filter(item=>item.isSelect);
+              const temp = selectedList.map(item=>item.id);
+              setSelectedRowKeys(temp);
+              return {
+                data: data.list,
+                success: true
+              };
+            }
+          }}
+          pagination={{
+            pageSize: 10,
+          }}
+          search={false}
+        />
+        <ModalForm
+          title="新增分摊参数"
+          width="800px"
+          labelCol={{ span: 5, offset: 3 }}
+          layout={'horizontal'}
+          visible={drawerMadalVisible}
+          formRef={drawerModalRef}
+          onVisibleChange={(bool) => {
+            if (ref.current) {
+              ref.current.resetFields();
+            }
+            handleDrawerModalVisible(bool);
+          }}
+
+          onFinish={async (value) => {
+            console.log({ '新增分摊参数': value, selectedParam,hasSetParamsList});
+            const { shareParamPopout } = value;
+            const { id, shareParamCode, shareParamName } = selectedParam;
+
+            setHasSetParamsList(hasSetParamsList.concat([{
+              id, shareParamCode, shareParamName, shareParamPopout
+            }]));
+
+            setNewAddParamList(newAddParamList.concat([{
+              id, shareParamCode, shareParamName, shareParamPopout
+            }]));
+
+            setDrawerMadalVisible(false);
+
+            if (actionDrawertableRef.current) {
+              actionDrawertableRef.current.reload();
+            }
+          }}
+        >
+          <ProFormSelect
+            rules={[
+              {
+                required: true,
+                message: (
+                  <FormattedMessage id="pages.searchTable.accountingType" defaultMessage="请选择责任中心" />
+                ),
+              },
+            ]}
+
+            fieldProps={{//这里使用了select的onChange方法,必须使用这样的写法来进行调用onChange方法
+              onChange: async (val) => {
+                // setSelectedParam(val);
+                const { id } = currentResponsibilityRow;
+                // console.log({currentResponsibilityRow});
+                const resp = await getParamsSelectableList({ id });
+                const { data, status } = resp;
+                console.log({resp});
+                if (status == 200) {
+                  const selected = data.list.filter(item => item.id == val);
+                  console.log({ selected });
+                  setSelectedParam(selected[0]);
+                }
+              },
+            }}
+
+            request={async () => {
+              const { id } = currentResponsibilityRow;
+              const resp = await getParamsSelectableList({ id });
+              const { data, status } = resp;
+              console.log({ resp });
+              if (status == 200) {
+                const temp = data.list.map(item => ({
+                  label: item.shareParamName,
+                  value: item.id
+                }));
+                return temp;
+              }
+
+            }}
+            width="sm"
+            name="id"
+            label="请选择分摊参数"
+          />
+
+          <ProFormDigit width={100} label="分摊比例" name="shareParamPopout" min={0} max={100} />
+
+        </ModalForm>
+
+        {/* 科目更新 */}
+        <UpdateFormDrawer
+          onSubmit={async (value) => {
+               
+               const {id} = value;
+               const index = hasSetParamsList.findIndex(item=>item.id == id);
+               const temp = hasSetParamsList;
+               temp[index] = value;
+               console.log({value,temp});
+               setHasSetParamsList([].concat(temp));
+               setDrawerUpdateModalVisible(false);
+               if (actionDrawertableRef.current) {
+                actionDrawertableRef.current.reload();
+              }
+          }}
+          onCancel={() => {
+            drawerUpdateModalVisible(false);
+            setCurrentRow(undefined);
+          }}
+          currentResponsibilityRow={currentResponsibilityRow}
+          drawerUpdateModalVisible={drawerUpdateModalVisible}
+          drawerUpdateModalVisibleChange={drawerUpdateModalVisibleChange}
+          values={currentRow || {}}
+       
+
+        />
+        </PageContainer>
+        
+      </DrawerForm>
+
+
       {/* 更新 */}
       <UpdateForm
         onSubmit={async (value) => {

+ 11 - 1
src/pages/costAllocationParamsSetting/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-28 20:40:52
+ * @LastEditTime: 2021-08-02 00:35:02
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
@@ -53,3 +53,13 @@ export async function delCostshareparam(params, options) {
   });
 }
 
+
+//为成本分摊设置会计科目
+export async function updateCostShareParamByAccountId(body, options) {
+  return request('/api/costAccount/costshareparam/updateCostShareParamByAccountId', {
+    method: 'POST',
+    data:{...body},
+    ...(options || {}),
+  });
+}
+

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

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

+ 1 - 1
src/pages/costProjectMana/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-29 19:48:25
+ * @LastEditTime: 2021-07-29 23:12:59
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js

+ 31 - 18
src/pages/districtMana/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-28 14:15:20
+ * @LastEditTime: 2021-07-30 10:25:05
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -35,11 +35,11 @@ const DistrictMana = () => {
       hideInSearch: false,
     },
     {
-      title: '是否为院',
+      title: '是否为院',
       dataIndex: 'isHospital',
       key: 'isHospital',
       hideInSearch: true,
-      render: (text) => <a>{text == 1 ? '是' : '否'}</a>,
+      render: (text) => <a>{text == 0 ? '是' : '否'}</a>,
     },
     {
       title: '医院标识',
@@ -61,8 +61,8 @@ const DistrictMana = () => {
     },
     {
       title: '创建时间',
-      dataIndex: 'createTime',
-      key: 'createTime',
+      dataIndex: 'createDateTime',
+      key: 'createDateTime',
       hideInSearch: true,
     },
     {
@@ -96,6 +96,7 @@ const DistrictMana = () => {
   const [createModalVisible, handleModalVisible] = useState(false);
   const [updateModalVisible, handleUpdateModalVisible] = useState(false);
   const actionRef = useRef();
+  const ref = useRef();   //新增表单
   const [currentRow, setCurrentRow] = useState({});
 
   /**
@@ -124,7 +125,7 @@ const DistrictMana = () => {
    */
   const delListHandler = async (value) => {
     const resp = await delDistrict(value);
-    console.log({ resp });
+    // console.log({ resp });
     if (resp.status) {
       if (actionRef.current) {
         actionRef.current.reload();
@@ -171,10 +172,22 @@ const DistrictMana = () => {
         width="800px"
         labelCol={{ span: 3, offset: 3 }}
         layout={'horizontal'}
+        formRef={ref}
         visible={createModalVisible}
-        onVisibleChange={handleModalVisible}
+        onVisibleChange={(bool) => {
+          if (ref.current) {
+            ref.current.resetFields();
+          }
+          handleModalVisible(bool);
+        }}
         onFinish={async (value) => {
-          const success = await addDistrict(value);
+          console.log({value});
+          const {name,isHospital,id,sign} = value;
+          const success = await addDistrict(isHospital==0?{
+            name,isHospital,sign
+          }:{
+            name,isHospital,parentId:id
+          });
           //   console.log({ success });
           if (success) {
             handleModalVisible(false);
@@ -209,11 +222,11 @@ const DistrictMana = () => {
           ]}
           options={[
             {
-              value: 1,
+              value: 0,
               label: '是',
             },
             {
-              value: 0,
+              value: 1,
               label: '否',
             },
           ]}
@@ -224,29 +237,29 @@ const DistrictMana = () => {
 
         <ProFormDependency name={['isHospital']}>
           {({ isHospital }) => {
-            return isHospital == '0' ? (
+            return isHospital == 0 ? (
               <ProFormText
-                label="主医院名称"
+                label="医院标识"
                 rules={[
                   {
-                    required: false,
+                    required: true,
                     message: (
-                      <FormattedMessage id="pages.searchTable.parentName" defaultMessage="..." />
+                      <FormattedMessage id="pages.searchTable.sign" defaultMessage="..." />
                     ),
                   },
                 ]}
                 width="sm"
-                name="parentName"
+                name="sign"
               />
             ) : <></>;
           }}
         </ProFormDependency>
         <ProFormDependency name={['isHospital']}>
           {({ isHospital }) => {
-            return isHospital == '0' ? (
+            return isHospital == 1 ? (
               <ProFormSelect
-                name="parentId"
-                label="主医院Id"
+                name="id"
+                label="选择主医院"
                 request={async () =>{
                       const resp = await getMainDistrictList();
                       const {status,data,} = resp;

+ 1 - 1
src/pages/districtMana/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-28 14:11:21
+ * @LastEditTime: 2021-07-29 23:13:28
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js

+ 43 - 25
src/pages/districtMana/updateForm.jsx

@@ -1,4 +1,4 @@
-import React from 'react';
+import React,{useState} from 'react';
 import {
   ProFormSelect,
   ProFormText,
@@ -6,10 +6,12 @@ import {
   ProFormDependency
 } from '@ant-design/pro-form';
 import { useIntl, FormattedMessage } from 'umi';
+import { getMainDistrictList } from './service';
 
 
 const UpdateForm = (props) => {
   const { updateModalVisible, updateModalVisibleChange, values, onSubmit } = props;
+  const [selectedHosp,setSelectedHosp] = useState({});
   // console.log({values});
   return (
     <>
@@ -22,7 +24,7 @@ const UpdateForm = (props) => {
           layout={'horizontal'}
           visible={updateModalVisible}
           onVisibleChange={(visible) => updateModalVisibleChange(visible)}
-          onFinish={(value) => onSubmit({ ...values, ...value })}
+          onFinish={(value) => onSubmit({ ...values, ...value,parentName:selectedHosp.name})}
         >
           <ProFormText
             label="医院名"
@@ -49,11 +51,11 @@ const UpdateForm = (props) => {
             ]}
             options={[
               {
-                value: 1,
+                value: 0,
                 label: '是',
               },
               {
-                value: 0,
+                value: 1,
                 label: '否',
               },
             ]}
@@ -64,9 +66,9 @@ const UpdateForm = (props) => {
 
           <ProFormDependency name={['isHospital']}>
             {({ isHospital }) => {
-              return isHospital == '1' ? (
+              return isHospital == 0 ? (
                 <ProFormText
-                  label="主医院名称"
+                  label="医院标识"
                   rules={[
                     {
                       required: false,
@@ -76,30 +78,46 @@ const UpdateForm = (props) => {
                     },
                   ]}
                   width="sm"
-                  name="parentName"
+                  name="sign"
                 />
               ) : <></>;
             }}
           </ProFormDependency>
           <ProFormDependency name={['isHospital']}>
-            {({ isHospital }) => {
-              return isHospital == '1' ? (
-                <ProFormText
-                  label="主医院Id"
-                  rules={[
-                    {
-                      required: false,
-                      message: (
-                        <FormattedMessage id="pages.searchTable.parentId" defaultMessage="" />
-                      ),
-                    },
-                  ]}
-                  width="sm"
-                  name="parentId"
-                />
-              ) : <></>
-            }}
-          </ProFormDependency>
+          {({ isHospital }) => {
+            return isHospital == 1 ? (
+              <ProFormSelect
+                name="parentId"
+                label="选择主医院"
+                request={async () =>{
+                      const resp = await getMainDistrictList();
+                      const {status,data,} = resp;
+                      
+                      if(status == 200){
+                        return data.map(item=>({
+                          label:item.name,
+                          value:item.id
+                        }))
+                      }
+                }}
+                fieldProps={{
+                  onChange: async (val) => {
+                    const resp = await getMainDistrictList();
+                    const {status,data,} = resp;
+                    if(status==200){
+                        const needItem = data.filter(item => item.id == val);
+                        needItem.length>0&&setSelectedHosp(needItem[0]);
+                    }
+                    
+                  },
+                }}
+                placeholder="请选择主医院"
+                width='sm'
+                rules={[{ required: true, message: '请选择主医院' }]}
+              />
+            ) : <></>
+          }}
+        </ProFormDependency>
         </ModalForm>
       }
     </>

+ 10 - 12
src/pages/document.ejs

@@ -5,27 +5,25 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     <meta
       name="keywords"
-      content="antd,umi,umijs,ant design,Scaffolding, layout, Ant Design, project, Pro, admin, console, homepage, out-of-the-box, middle and back office, solution, component library"
+      content=""
     />
     <meta
       name="description"
-      content="
-    An out-of-box UI solution for enterprise applications as a React boilerplate."
+      content="康程智医全成本核算管理系统使成本分析得以精确和实时完成,通过全院责任中心的设置,形成全成本管理闭环,精确掌握收支损益,提升医院运营效益。"
     />
     <meta
       name="description"
-      content="
-      Out-of-the-box mid-stage front-end/design solution."
+      content="康程智医全成本核算管理系统使成本分析得以精确和实时完成,通过全院责任中心的设置,形成全成本管理闭环,精确掌握收支损益,提升医院运营效益。"
     />
     <meta
       name="viewport"
       content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
     />
-    <title>Ant Design Pro</title>
+    <title>全成本核算管理系统</title>
     <link rel="icon" href="<%= context.config.publicPath +'KC-color-square.png'%>" type="image/x-icon" />
   </head>
   <body>
-    <noscript>Out-of-the-box mid-stage front/design solution!</noscript>
+    <noscript></noscript>
     <div id="root">
       <style>
         html,
@@ -189,7 +187,7 @@
           min-height: 420px;
         "
       >
-        <img src="<%= context.config.publicPath +'kcLogo.png'%>" alt="logo" width="150" />
+        <img src="<%= context.config.publicPath +'KC-color-square.png'%>" alt="logo" width="150" />
         <div class="page-loading-warp">
           <div class="ant-spin ant-spin-lg ant-spin-spinning">
             <span class="ant-spin-dot ant-spin-dot-spin"
@@ -198,14 +196,14 @@
             ></span>
           </div>
         </div>
-        <div style="display: flex; align-items: center; justify-content: center">
+        <!-- <div style="display: flex; align-items: center; justify-content: center">
           <img
-            src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
+            src="<%= context.config.publicPath +'KC-color-square.png'%>"
             width="32"
             style="margin-right: 8px"
           />
-          Ant Design
-        </div>
+          全成本核算管理系统
+        </div> -->
       </div>
     </div>
   </body>

+ 44 - 52
src/pages/responsibilityCenter/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-29 14:29:33
+ * @LastEditTime: 2021-08-02 00:53:52
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -28,19 +28,19 @@ const responsibilityCenter = () => {
       hideInSearch: false,
       width: '15%'
     },
-    // {
-    //   title: '责任中心编码',
-    //   dataIndex: 'responsibilityCode',
-    //   key: 'responsibilityCode',
-    //   hideInSearch: true,
-    // },
     {
-      title: '责任中心级别',
-      dataIndex: 'responsibilityLevel',
-      key: 'responsibilityLevel',
+      title: '责任中心编码',
+      dataIndex: 'responsibilityCode',
+      key: 'responsibilityCode',
       hideInSearch: true,
-      width: '10%'
     },
+    // {
+    //   title: '责任中心级别',
+    //   dataIndex: 'responsibilityLevel',
+    //   key: 'responsibilityLevel',
+    //   hideInSearch: true,
+    //   width: '10%'
+    // },
     {
       title: '是否汇总中心',
       dataIndex: 'isGatherCenter',
@@ -54,7 +54,8 @@ const responsibilityCenter = () => {
       dataIndex: 'responsibilityType',
       key: 'responsibilityType',
       hideInSearch: true,
-      width: '15%'
+      width: '15%',
+      render: (text) => <>{text == 1 ? '收益中心' : '成本(费用)中心'}</>,
     },
     {
       title: '分摊级别',
@@ -203,7 +204,12 @@ const responsibilityCenter = () => {
         }}
         formRef={ref}
         onFinish={async (value) => {
-          const success = await addResponsibilityCenter({...value,shareName:selectedLevel.shareName});
+          console.log({'新增':value,selectedLevel})
+          const {shareLevel} = value;
+          const body = {...value,shareName:selectedLevel.shareName,shareId:selectedLevel.id}
+          // console.log({body});
+          // return;
+          const success = await addResponsibilityCenter(body);
           //   console.log({ success });
           if (success) {
             handleModalVisible(false);
@@ -285,7 +291,7 @@ const responsibilityCenter = () => {
               label: '是',
             },
             {
-              value: 0,
+              value: 2,
               label: '否',
             },
           ]}
@@ -305,7 +311,7 @@ const responsibilityCenter = () => {
           options={[
             {
               value: 1,
-              label: '收中心',
+              label: '收中心',
             },
             {
               value: 2,
@@ -325,12 +331,22 @@ 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]);
+              }
+            },
+          }}
           request={ async ()=>{
                 const resp = await getApportionmentLevelListNoPage();
                 const {status,data} = resp;
                 if(status==200){
                     setSelectedLevelList(data.list);
-                    return data.list.map(item=>({label:item.leverSort,value:item.leverSort}))
+                    return data.list.map(item=>({label:`级别${item.leverSort}-${item.shareName}`,value:item.leverSort}))
                 }else{
                    return []
                 }
@@ -339,48 +355,24 @@ const responsibilityCenter = () => {
           name={['shareLevel']}
           label="选择分摊级别"
         />
-
-        <ProFormDependency name={['shareLevel']}>
-          {({shareLevel}) => {
-  
-            let name='12',render=false;
-            if(shareLevel&&selectedLevelList&&selectedLevelList.length>0){
-              const arr = selectedLevelList.filter(item=>item.leverSort == shareLevel);
-              // console.log({arr,selectedLevelList,shareLevel});
-              if(arr.length>0){
-                name = arr[0].shareName;
-                setSelectedLevel(arr[0]);
-                render=true;
-              }
-              
-            }
-            // console.log({name});
-            return shareLevel&&render ? (
-              <ProFormText
-                initialValue={name}
-                disabled
-                label="分摊层级名称"
-                rules={[
-                  {
-                    required: false,
-                    message: (
-                      <FormattedMessage id="pages.searchTable.parentName" defaultMessage="..." />
-                    ),
-                  },
-                ]}
-                placeholder={name}
-                width="sm"
-              />
-            ) : <></>;
-          }}
-        </ProFormDependency>
       </ModalForm>
 
       {/* 更新 */}
       <UpdateForm
         onSubmit={async (value) => {
           console.log({ '编辑': value });
-          const success = await editResponsibilityCenterList(value);
+         
+          const {responsibilityLevel,selectedLevel} = value;
+          const body = selectedLevel.length==0?{
+            //没有修改分摊层级
+            ...value,shareLevelId:responsibilityLevel
+          }:{
+                  //修改了分摊层级
+                  ...value,shareLevelId:selectedLevel[0].id
+          }
+          // console.log({'editBody':body});
+          // return;
+          const success = await editResponsibilityCenterList(body);
 
           if (success) {
             handleUpdateModalVisible(false);

+ 1 - 1
src/pages/responsibilityCenter/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-28 17:05:29
+ * @LastEditTime: 2021-07-29 23:13:44
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js

+ 75 - 62
src/pages/responsibilityCenter/updateForm.jsx

@@ -1,4 +1,4 @@
-import React,{useState} from 'react';
+import React, { useState, useEffect } from 'react';
 import {
   ProFormSelect,
   ProFormText,
@@ -8,13 +8,22 @@ import {
 import { useIntl, FormattedMessage } from 'umi';
 
 import { getApportionmentLevelListNoPage } from '../apportionmentLevel/service';
+import { getResponsibilityCenterList, editResponsibilityCenterList, delResponsibilityCenter, addResponsibilityCenter } from './service';
 
 
 const UpdateForm = (props) => {
   const { updateModalVisible, updateModalVisibleChange, values, onSubmit } = props;
-  const [selectedLevelList,setSelectedLevelList] = useState(null); //可选的分摊层级列表
-  const [selectedLevel,setSelectedLevel] = useState(null);
-  // console.log({values});
+  const { responsibilityLevel, parentId } = values;
+  const [selectedLevelList, setSelectedLevelList] = useState([]); //可选的分摊层级列表
+  const [selectedLevel, setSelectedLevel] = useState(null);
+  console.log({ values });
+
+
+  useEffect(() => {
+    const temp = selectedLevelList.filter(item => item.leverSort == responsibilityLevel);
+    setSelectedLevel(temp);
+  }, [values])
+
   return (
     <>
       {
@@ -26,8 +35,39 @@ const UpdateForm = (props) => {
           layout={'horizontal'}
           visible={updateModalVisible}
           onVisibleChange={(visible) => updateModalVisibleChange(visible)}
-          onFinish={(value) => onSubmit({ ...values, ...value })}
+          onFinish={(value) => onSubmit({ ...values, ...value, selectedLevel })}
         >
+          {
+            parentId != 0 &&<ProFormSelect
+              name="parentId"
+              label="责任管理中心"
+              showSearch
+              request={async ({ keyWords }) => {
+                const res = await getResponsibilityCenterList();
+                if (res.status == 200) {
+                  // console.log({res});
+                  const filter_arr = res.data.list.filter(item => {
+                    //  console.log({item});
+                    if (keyWords) {
+                      return item.responsibilityName.indexOf(keyWords) != -1
+                    } else {
+                      return item
+                    }
+
+                  });
+                  const arr = filter_arr.map(item => ({ label: item.responsibilityName, value: item.id }));
+                  return arr;
+                } else {
+                  return [];
+                }
+
+              }}
+              width='md'
+              placeholder="选择需要新增在哪个责任中心下,默认新增最外层"
+              rules={[{ required: false, message: '' }]}
+            />
+          }
+
           <ProFormText
             label="责任中心名"
             rules={[
@@ -56,7 +96,7 @@ const UpdateForm = (props) => {
                 label: '是',
               },
               {
-                value: 0,
+                value: 2,
                 label: '否',
               },
             ]}
@@ -76,7 +116,7 @@ const UpdateForm = (props) => {
             options={[
               {
                 value: 1,
-                label: '收中心',
+                label: '收中心',
               },
               {
                 value: 2,
@@ -88,63 +128,36 @@ const UpdateForm = (props) => {
             label="选择责任类型"
           />
           <ProFormSelect
-          rules={[
-            {
-              required: true,
-              message: (
-                <FormattedMessage id="pages.searchTable.shareLevel" defaultMessage="请选择分摊级别" />
-              ),
-            },
-          ]}
-          request={ async ()=>{
-                const resp = await getApportionmentLevelListNoPage();
-                const {status,data} = resp;
-                if(status==200){
-                    setSelectedLevelList(data.list);
-                    return data.list.map(item=>({label:item.leverSort,value:item.leverSort}))
-                }else{
-                   return []
-                }
-          }}
-          width="sm"
-          name={['shareLevel']}
-          label="选择分摊级别"
-        />
+            rules={[
+              {
+                required: true,
+                message: (
+                  <FormattedMessage id="pages.searchTable.shareLevel" defaultMessage="请选择分摊级别" />
+                ),
+              },
+            ]}
+            fieldProps={{
+              onChange: async (val) => {
+
+                const needItem = selectedLevelList.filter(item => item.leverSort == val);
+                setSelectedLevel(needItem);
+              },
+            }}
 
-        <ProFormDependency name={['shareLevel']}>
-          {({shareLevel}) => {
-  
-            let name='12',render=false;
-            if(shareLevel&&selectedLevelList&&selectedLevelList.length>0){
-              const arr = selectedLevelList.filter(item=>item.leverSort == shareLevel);
-              // console.log({arr,selectedLevelList,shareLevel});
-              if(arr.length>0){
-                name = arr[0].shareName;
-                setSelectedLevel(arr[0]);
-                render=true;
+            request={async () => {
+              const resp = await getApportionmentLevelListNoPage();
+              const { status, data } = resp;
+              if (status == 200) {
+                setSelectedLevelList(data.list);
+                return data.list.map(item => ({ label: `级别${item.leverSort}-${item.shareName}`, value: item.leverSort }))
+              } else {
+                return []
               }
-              
-            }
-            // console.log({name});
-            return shareLevel&&render ? (
-              <ProFormText
-                initialValue={name}
-                disabled
-                label="分摊层级名称"
-                rules={[
-                  {
-                    required: false,
-                    message: (
-                      <FormattedMessage id="pages.searchTable.parentName" defaultMessage="..." />
-                    ),
-                  },
-                ]}
-                placeholder={name}
-                width="sm"
-              />
-            ) : <></>;
-          }}
-        </ProFormDependency>
+            }}
+            width="sm"
+            name='responsibilityLevel'
+            label="选择分摊级别"
+          />
         </ModalForm>
       }
     </>

+ 15 - 4
src/pages/responsibilityCenterConnect/index.jsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 10:13:13
- * @LastEditTime: 2021-07-29 16:16:50
+ * @LastEditTime: 2021-08-01 13:58:05
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
@@ -55,8 +55,9 @@ const ResponsibilityCenterConnect = () => {
       valueType: 'option',
       width: '15%',
       render: (_, record) => {
-        const { isParent } = record;
-        return !isParent ? [
+        const { isParent,isGatherCenter } = record;
+        // console.log({record});
+        return isGatherCenter==2 ? [
           <a
             key="config"
             onClick={() => {
@@ -98,6 +99,7 @@ const ResponsibilityCenterConnect = () => {
   const [currentRow, setCurrentRow] = useState({});
   const [drawerVisible, setDrawerVisible] = useState(false);
   const [selectedRowKeys,setSelectedRowKeys] = useState([]);
+  const [defaultExpandedRowKeys,setDefaultExpandedRowKeys] = useState([]);
 
   /**
    * 
@@ -117,6 +119,10 @@ const ResponsibilityCenterConnect = () => {
   const getList = async (params = {}, sort, filter) => {
     const res = await getResponsibilityCenterConnectList(params);
     // console.log({res});
+    const defaultKeys = res.data.list.map(item=>item.responsibilityId);
+    setDefaultExpandedRowKeys(defaultKeys);
+
+
     return {
       data: res.data.list,
       total: res.data.totalCount,
@@ -138,6 +144,11 @@ const ResponsibilityCenterConnect = () => {
     }
   }
 
+  const onExpandedRowsChange = (expandedRows)=>{
+      console.log({expandedRows});
+      setDefaultExpandedRowKeys([].concat(expandedRows))
+  }
+
 
   return (
     <PageContainer>
@@ -147,7 +158,7 @@ const ResponsibilityCenterConnect = () => {
         actionRef={actionRef}
         rowKey="responsibilityId"
         childrenColumnName="child"
-        expandable={{ defaultExpandedRowKeys: [] }}
+        expandable={{ defaultExpandedRowKeys: [],expandedRowKeys:defaultExpandedRowKeys,onExpandedRowsChange:onExpandedRowsChange }}
         toolBarRender={() => []}
 
         pagination={{

+ 1 - 1
src/pages/responsibilityCenterConnect/service.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-26 08:54:08
- * @LastEditTime: 2021-07-29 16:11:07
+ * @LastEditTime: 2021-07-29 23:13:56
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js

+ 9 - 6
src/pages/user/Login/index.jsx

@@ -17,6 +17,7 @@ import styles from './index.less';
 import CustomDialog from '@/components/Dialog';
 import { getQueryString } from '../../../utils.js';
 
+
 const LoginMessage = ({ content }) => (
   <Alert
     style={{
@@ -33,6 +34,8 @@ const Login = () => {
   const [userLoginState, setUserLoginState] = useState({});
   const [type, setType] = useState('account');
   const [subHospList, setSubHospList] = useState([]);
+  const { query = {} } = history.location;
+  const { redirect,hospSign } = query;
   const { initialState, setInitialState } = useModel('@@initialState');
   const intl = useIntl();
 
@@ -44,7 +47,7 @@ const Login = () => {
   //   }
   // };
 
-  const { fetchSubHosp, sign } = initialState;
+  const { fetchSubHosp,sign } = initialState;
 
   const handleSubmit = async (values) => {
     setSubmitting(true);
@@ -52,7 +55,7 @@ const Login = () => {
     try {
 
       // 登录
-      const loginResp = await login({ ...values, hospSign: sign });
+      const loginResp = await login({ ...values, hospSign:hospSign});
       const {status,msg,data} = loginResp;
       // console.log({status,msg,data});
       if (status == 200) {
@@ -67,8 +70,8 @@ const Login = () => {
         if (localStorage.getItem('loginParams') == null || localStorage.getItem('loginParams') == undefined) {
           localStorage.setItem('loginParams',null);
         }
-        localStorage.setItem('loginParams',JSON.stringify({hospSign:sign}));
-        localStorage.setItem('userData',JSON.stringify(data));
+        localStorage.setItem('loginParams',JSON.stringify({hospSign:hospSign}));
+        localStorage.setItem('userData',JSON.stringify({...data,avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',}));
 
         message.success(defaultloginSuccessMessage);
         await setInitialState((s) => ({ ...s, currentUser:data }));
@@ -203,7 +206,7 @@ const Login = () => {
               </>
             )}
 
-            <ProFormDependency name={['name', ['name2', 'text']]}>
+            {/* <ProFormDependency name={['name', ['name2', 'text']]}>
               {({ name, name2 }) => {
                 return (
                   <ProFormSelect
@@ -216,7 +219,7 @@ const Login = () => {
                   />
                 );
               }}
-            </ProFormDependency>
+            </ProFormDependency> */}
 
             <div
               style={{

+ 1 - 1
src/services/user.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-07-23 14:26:44
- * @LastEditTime: 2021-07-26 14:19:50
+ * @LastEditTime: 2021-07-29 23:14:28
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /TracerMethodology_PC/src/services/user.js

BIN
成本核算_build0801.zip