瀏覽代碼

更新2023-07-14周功能

code4eat 2 年之前
父節點
當前提交
8465faec1c
共有 34 個文件被更改,包括 1970 次插入879 次删除
  1. 13 10
      .umirc.ts
  2. 0 1
      package.json
  3. 5 4
      src/app.tsx
  4. 98 47
      src/components/BMSTable/style.less
  5. 102 7
      src/global.less
  6. 1 1
      src/pages/Home/style.less
  7. 65 62
      src/pages/budgetMana/monthlyDataCheck/index.tsx
  8. 127 95
      src/pages/budgetMana/monthlySet/index.tsx
  9. 11 1
      src/pages/budgetMana/monthlySet/service.ts
  10. 362 91
      src/pages/budgetMana/oneBatch/index.tsx
  11. 32 6
      src/pages/budgetMana/oneBatch/service.ts
  12. 32 0
      src/pages/budgetMana/oneBatch/style.less
  13. 9 1
      src/pages/budgetMana/personnelSalaryBudget/index.tsx
  14. 32 18
      src/pages/reportCheck/report/index.tsx
  15. 102 53
      src/pages/secondaryDistribute/secondaryDitriComputed/index.tsx
  16. 75 68
      src/pages/secondaryDistribute/secondaryDitriComputed/style.less
  17. 2 2
      src/pages/setting/baseSetting/jobCateBaseSet/index.tsx
  18. 2 1
      src/pages/setting/baseSetting/paramsMana/index.tsx
  19. 3 3
      src/pages/setting/baseSetting/positionLevelRateSet/index.tsx
  20. 9 2
      src/pages/setting/checkUnitSet/checkUnitEmpSet/index.tsx
  21. 4 3
      src/pages/setting/checkUnitSet/medicalGroupSet/index.tsx
  22. 0 1
      src/pages/setting/checkUnitSet/medicalGroupSet/style.less
  23. 2 2
      src/pages/setting/manaPerformanceSet/indicGroupWeightSet/index.tsx
  24. 5 4
      src/pages/setting/manaPerformanceSet/unitIndicTargetSet/index.tsx
  25. 1 1
      src/pages/setting/projectSetting/checkUnitProjectSet/style.less
  26. 2 2
      src/pages/setting/projectSetting/costIncomeProjectSet/index.tsx
  27. 12 2
      src/pages/setting/projectSetting/secondaryProjectDistribute/index.tsx
  28. 3 3
      src/pages/setting/reportSet/diySqlMana/index.tsx
  29. 4 2
      src/pages/setting/reportSet/reportListMana/index.tsx
  30. 3 1
      src/pages/setting/reportSet/reportSetting/index.tsx
  31. 61 17
      src/utils/tableToExcel.ts
  32. 277 0
      src/utils/tableToMultiHeaderExcel.ts
  33. 37 1
      src/utils/tooljs.ts
  34. 477 367
      yarn.lock

+ 13 - 10
.umirc.ts

@@ -2,31 +2,37 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-14 14:14:32
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-19 10:22:31
+ * @LastEditTime: 2023-07-11 15:45:01
  * @FilePath: /BudgetManaSystem/.umirc.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
 import { defineConfig } from '@umijs/max';
 
+
 const { REACT_APP_ENV } = process.env;
 
-export default defineConfig({
 
+export default defineConfig({
   antd: {
     configProvider: {
       prefixCls: 'bms-ant',
-      primaryColor: '#3377FF'
-      // getPopupContainer:(triggerNode:HTMLElement)=>triggerNode
     },
   },
-
   qiankun: {
     slave: {},
   },
-  mfsu: {},
+  mfsu:false,
   lessLoader: {
-    modifyVars: { '@ant-prefix': 'bms-ant'},  
+    modifyVars: { 
+      '@ant-prefix': 'bms-ant',
+      '@primary-color': '#3377FF',
+      '@border-color-base':'#dae2f2'
+    },  
+    javascriptEnabled: true,
   }, //对应修改生成的 antd 样式类名
+
+
+
   access: {},
   model: {},
 
@@ -39,9 +45,6 @@ export default defineConfig({
       theme: 'light',
     }
   },
-  theme: {
-    primaryColor: '#3377FF'
-  },
   manifest: {
     basePath: '/',
   },

+ 0 - 1
package.json

@@ -16,7 +16,6 @@
     "@ant-design/icons": "^4.7.0",
     "@ant-design/pro-components": "^2.0.1",
     "@umijs/max": "^4.0.51",
-    "antd": "^5.0.7",
     "axios": "^1.3.3",
     "file-saver": "^2.0.5",
     "json-bigint": "^1.0.0",

+ 5 - 4
src/app.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-14 14:14:32
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-16 11:12:14
+ * @LastEditTime: 2023-07-10 13:34:32
  * @FilePath: /BudgetManaSystem/src/app.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -18,9 +18,6 @@ import { AxiosResponse } from '@umijs/max';
 import { message, notification } from 'antd';
 import type { RequestConfig } from 'umi';
 
-
-
-
 import iconEnum from './menuIcons.js';
 
 import Report from './pages/reports/index';
@@ -35,6 +32,8 @@ import { useState } from 'react';
 
 
 import './utils/zhongtaiC'
+import { RuntimeAntdConfig } from '@umijs/max';
+
 
 const IconFont = createFromIconfontCN({
   scriptUrl: '',
@@ -231,6 +230,8 @@ export const request: RequestConfig = {
 };
 
 
+
+
 export function patchClientRoutes({ routes }: { routes: any }) {
 
   // const paths = [...new Array(10).keys()].map((a, index) => ({

+ 98 - 47
src/components/BMSTable/style.less

@@ -19,10 +19,10 @@
     border-radius: 4px !important;
 }
 
-.bms-ant-table-wrapper .bms-ant-table-tbody>tr>td {
-    //padding: 8px 8px !important;
-    border-top: 1px solid rgb(218 226 242) !important;
-}
+// .bms-ant-table-wrapper .bms-ant-table-tbody>tr>td {
+//     //padding: 8px 8px !important;
+//     border-top: 1px solid rgb(218 226 242) !important;
+// }
 
 .bms-ant-table-wrapper .bms-ant-table-pagination.bms-ant-pagination {
 
@@ -34,14 +34,14 @@
     border-inline-end: 1px solid #dae2f2 !important;
 }
 
-.bms-ant-table-wrapper .bms-ant-table.bms-ant-table-bordered>.bms-ant-table-container>.bms-ant-table-header>table>thead>tr {
+// .bms-ant-table-wrapper .bms-ant-table.bms-ant-table-bordered>.bms-ant-table-container>.bms-ant-table-header>table>thead>tr {
 
-    &:last-child {
-        &>th {
-            border-top: 1px solid #dae2f2 !important;
-        }
-    }
-}
+//     &:last-child {
+//         &>th {
+//             border-top: 1px solid #dae2f2 !important;
+//         }
+//     }
+// }
 
 .BMSTable {
     .bms-ant-table {
@@ -57,14 +57,16 @@
                 background: rgb(238 243 250 / 100%) !important;
                 //border-right: 1px solid  #dae2f2 !important;
 
+                a {
+                    color: #3376FE;
+                }
+
                 .bms-ant-table-selection {
                     .bms-ant-table-selection-extra {
                         top: 5px;
                     }
                 }
 
-
-
                 &::before {
                     display: none;
                 }
@@ -87,35 +89,51 @@
 
         .bms-ant-table-tbody {
             &>tr {
-                .bms-ant-table-cell {
-                    // display: inline-flex;
-                    // flex-direction: row;
-                    // justify-content: flex-start;
-                    // align-items: center;
-                    // height: 40px;
-                    // line-height: 40px;
-                    font-size: 14px;
-                    font-family: SourceHanSansCN-Medium, SourceHanSansCN;
-                    // font-weight: 500;
-
-                    color: #17181A;
-                    padding: 8px 8px !important; 
-                    border-bottom: none !important;
-
-                    &>.bms-ant-typography {
-                        line-height:unset;
+                &.bms-ant-table-measure-row {
+                    border: none !important;
+                    &>td {
+                        border-inline-end:none !important;
                     }
+                }
 
-                    &.bms-ant-table-cell-with-append {
-                        .bms-ant-table-row-expand-icon {
-                             
+                &.bms-ant-table-row {
+                    .bms-ant-table-cell {
+                    
+                        font-size: 14px;
+                        font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+                        
+                        color: #17181A;
+                        padding: 8px 8px !important; 
+                        border-bottom: none !important;
+                        border-top: 1px solid rgb(218 226 242) !important;
+
+                        &.bms-ant-table-cell-with-append {
+                            .bms-ant-table-row-expand-icon {
+                                  border-radius: 4px !important;
+                                  border: 1px solid #DAE2F2 !important;
+
+                                  &:hover {
+                                    color: #3377ff;
+                                    border: 1px solid #3377ff !important;
+                                  }
+                            }
+                        }
+    
+                        &>.bms-ant-typography {
+                            line-height:unset;
+                        }
+    
+                        &.bms-ant-table-cell-with-append {
+                            .bms-ant-table-row-expand-icon {
+                                 
+                            }
+                        }
+    
+                        &:hover {
+                            border-radius: 0 !important;
+                            background: #FAFBFC !important;
+    
                         }
-                    }
-
-                    &:hover {
-                        border-radius: 0 !important;
-                        background: #FAFBFC !important;
-
                     }
                 }
 
@@ -129,6 +147,14 @@
                     }
                 }
 
+               
+
+                // &:nth-child(2) {
+                //     .bms-ant-table-cell {
+                //         border-top: none !important;
+                //     }
+                // }
+
                 &:last-child>td {
                     border-bottom: none !important;
                 }
@@ -147,19 +173,44 @@
 
         &.bms-ant-table-bordered {
             .bms-ant-table-container {
-                .bms-ant-table-thead {
-                    &>tr {
-                        &>th {
-                            border-right: 1px solid #dae2f2 !important;
-                        }
-
-                        &:last-child {
+                border-left: none !important;
+                .bms-ant-table-header {
+                    table {
+                        border-top: none !important;
+                    }
+                    .bms-ant-table-thead {
+                        &>tr {
                             &>th {
-                                border-top: 1px solid #dae2f2 !important;
+                                border-right: 1px solid #dae2f2 !important;
+                                border-bottom: 1px solid #dae2f2 !important;
+                                border-top: none !important;
+    
+                                &.bms-ant-table-cell-scrollbar {
+                                    border: none !important;
+                                }
+
+                                &::after {
+                                    border: none !important;
+                                }
+                            }
+    
+                            &:last-child {
+                                &>th {
+                                    border-top:none !important;
+                                }
                             }
                         }
                     }
                 }
+                .bms-ant-table-body {
+                    table > tbody > tr > td {
+                        border-right: 1px solid #dae2f2 !important;
+                        &::after {
+                            border: none !important;
+                        }
+                    }
+                }
+                
             }
         }
     }

+ 102 - 7
src/global.less

@@ -25,22 +25,69 @@ body {
 
 
 
+
 .bms-ant-space-item {
     &>a {
-        color: #3376FE !important;
+        color: #3377FF !important;
     }
 }
 
+
+
 textarea {
+    border-radius: 4px !important;
     border: 1px solid #CFD7E6 !important;
 }
 
+.bms-ant-btn-primary {
+    background: #3377FF;
+}
+.bms-ant-btn-primary[disabled]{
+    background:#f5f5f5 ;
+}
+
+.bms-ant-checkbox {
+    &.bms-ant-checkbox-checked {
+          .bms-ant-checkbox-inner {
+            background-color:#3377FF;
+            background: #3377FF;
+          }
+    }
+    // &.bms-ant-checkbox-indeterminate {
+    //     &.bms-ant-checkbox-inner {
+    //         &::after {
+    //             background-color:#3377FF !important;
+    //         }
+    //     }
+    // }
+}
+
+.bms-ant-checkbox-indeterminate .bms-ant-checkbox-inner::after {
+    background-color:#3377FF;
+}
+
+.bms-ant-input-affix-wrapper {
+    border-radius: 4px !important;
+}
+
 .bms-ant-input {
+    border-radius: 4px;
+    // border: 1px solid #CFD7E6 !important;
     &::placeholder {
         color: #99A6BF !important;
     }
 }
 
+.bms-ant-table-cell {
+    a {
+        color: #3376FE !important;
+    }
+}
+
+.bms-ant-input-number {
+    border-radius: 4px !important;
+}
+
 
 
 
@@ -51,11 +98,16 @@ textarea {
 .bms-ant-modal {
     .bms-ant-modal-content {
         padding: 16px !important;
-
+        border-radius: 4px !important;
+        .bms-ant-modal-header {
+             padding: 0 ;
+             margin-bottom: 16px;
+             border-bottom: none;
+        }
         .bms-ant-modal-body {
-            max-height: 600px;
-            overflow-y: scroll;
-            overflow-x: hidden;
+            max-height: 570px;
+            // overflow-y: scroll;
+            // overflow-x: hidden;
             padding: 0;
 
             .bms-ant-modal-confirm-body-wrapper {
@@ -185,6 +237,16 @@ textarea {
                 }
             }
         }
+        .bms-ant-modal-footer {
+            border-top: none;
+            padding: 0;
+            margin-top: 16px;
+            .bms-ant-btn {
+                 border-radius: 4px !important;
+                 height: 24px !important;
+                 padding: 0 14px !important;
+            }
+        }
     }
 
     .bms-ant-modal-footer {
@@ -301,6 +363,12 @@ textarea {
 //      line-height: 17px !important;
 // }
 
+.bms-ant-page-header {
+    .bms-ant-page-header-heading-title {
+         font-size: 16px !important;
+    }
+}
+
 .bms-ant-page-header .bms-ant-page-header-heading-left {
     margin-block: 0 !important;
 }
@@ -319,6 +387,9 @@ textarea {
 }
 
 
+.bms-ant-pro-base-menu .bms-ant-pro-base-menu-submenu-has-icon >.bms-ant-menu-sub {
+    padding-inline-start:0 !important;
+}
 
 .bms-ant-menu-item-selected {
     background-color:#F2F6FF !important;
@@ -598,6 +669,7 @@ textarea {
 
 
 .bms-ant-input-number-input {
+    border-radius: 4px;
     &::placeholder {
         color: #99A6BF !important;
     }
@@ -622,8 +694,9 @@ textarea {
 
 .bms-ant-input-number {
     border: 1px solid #CFD7E6 !important;
-    color: #99A6BF !important;
-
+    // color: #99A6BF !important;
+    border-radius: 4px;
+    box-shadow: none !important;
     .bms-ant-input-number-input {
         height: 24px !important;
         line-height: 24px !important;
@@ -644,7 +717,29 @@ textarea {
 }
 
 .bms-ant-picker {
+    border-radius: 4px !important;
     border: 1px solid #CFD7E6 !important;
+    height: 26px;
+}
+
+.bms-ant-picker-panel-container {
+    .bms-ant-picker-panel {
+        .bms-ant-picker-month-panel {
+            .bms-ant-picker-body {
+                .bms-ant-picker-content {
+                    tr {
+                        td {
+                            &.bms-ant-picker-cell-selected {
+                                .bms-ant-picker-cell-inner {
+                                    background:#3377FF;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
 }
 
 .bms-ant-picker-input>input[disabled] {

+ 1 - 1
src/pages/Home/style.less

@@ -3,7 +3,7 @@
   height: 100%;
   padding-bottom: 36px;
   background: #fff;
-
+  overflow-y: scroll;
   .tabWrap {
     display: flex;
     flex-direction: row;

+ 65 - 62
src/pages/budgetMana/monthlyDataCheck/index.tsx

@@ -4,7 +4,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-16 09:42:52
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-07-06 15:32:34
+ * @LastEditTime: 2023-07-10 10:10:50
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -83,7 +83,7 @@ const MonthlyDataCheck: React.FC = () => {
 
     const [currentEditRecord, set_currentEditRecord] = useState<undefined | any>(undefined);
 
-    const [inputSalaryNum, set_inputSalaryNum] = useState<undefined|number>(undefined);  //固定工资金额
+    const [inputSalaryNum, set_inputSalaryNum] = useState<undefined | number>(undefined);  //固定工资金额
 
     const [checkItemvalNum, set_checkItemvalNum] = useState(0); //考核项目数值
 
@@ -95,7 +95,7 @@ const MonthlyDataCheck: React.FC = () => {
 
     const [computeMethod, set_computeMethod] = useState('1'); //1按考核分级 2按总分
 
-    const [unitCostComputeData,set_unitCostComputeData] = useState({unitCostTotal:0,unitCostCtrlTotal:0})
+    const [unitCostComputeData, set_unitCostComputeData] = useState({ unitCostTotal: 0, unitCostCtrlTotal: 0 })
 
     const [manaIndexGroups, set_manaIndexGroups] = useState<{
         depiction: any; id: number, groupCode: string, groupName: string, hospId: number
@@ -289,16 +289,16 @@ const MonthlyDataCheck: React.FC = () => {
             dataIndex: 'amount',
             width: 200,
             render: (text: any, record: any) => {
-            
+
                 return (
                     <div style={{ display: 'flex', flexDirection: 'row', width: '100%', justifyContent: 'flex-start', alignItems: 'center' }}>
 
                         <div style={{ width: '80px', height: 16, display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center' }}>
                             {
-                                (currentEditRecord ? currentEditRecord.id : -1) == record.id ? <InputNumber size='small' defaultValue={record.amount} placeholder='请输入' onChange={(value) => { console.log({value}); set_currentEditRecord({...currentEditRecord,amount:value})}} style={{ width: '80px' }} /> : <span>{formatMoneyNumber(text)}</span>
+                                (currentEditRecord ? currentEditRecord.id : -1) == record.id ? <InputNumber size='small' defaultValue={record.amount} placeholder='请输入' onChange={(value) => {set_currentEditRecord({ ...currentEditRecord, amount: value }) }} style={{ width: '80px' }} /> : <span>{formatMoneyNumber(text)}</span>
                             }
                         </div>
-                        {(auditType == '0'&&record.summaryFlag == 0) && <img onClick={() => editHandle(record, '7')} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={(currentEditRecord ? currentEditRecord.id : -1) == record.id ? conformIcon : editIcon} alt="" />}
+                        {(auditType == '0' && record.summaryFlag == 0) && <img onClick={() => editHandleTwo(record)} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={(currentEditRecord ? currentEditRecord.id : -1) == record.id ? conformIcon : editIcon} alt="" />}
                     </div>
                 )
             }
@@ -307,21 +307,21 @@ const MonthlyDataCheck: React.FC = () => {
             title: '汇总',
             dataIndex: 'summaryFlag',
             render: (num: any, record: any) => {
-                return record.summaryFlag == 0 ?'否':'是'
+                return record.summaryFlag == 0 ? '否' : '是'
             }
         },
         {
             title: '统计',
             dataIndex: 'statFlag',
             render: (num: any, record: any) => {
-                return num == 0 ?'否':'是'
+                return num == 0 ? '否' : '是'
             }
         },
         {
             title: '可控',
             dataIndex: 'ctrlFlag',
             render: (num: any, record: any) => {
-                  return num == 0 ?'否':'是'
+                return num == 0 ? '否' : '是'
             }
         }
     ]
@@ -336,7 +336,7 @@ const MonthlyDataCheck: React.FC = () => {
     const onSelectHandle: TreeProps['onSelect'] = (selectedKeys, info) => {
 
         const { node } = info;
-        if(!node.children){
+        if (!node.children) {
             set_currentSelectedTreeNode(node);
         }
     };
@@ -347,6 +347,23 @@ const MonthlyDataCheck: React.FC = () => {
         setAutoExpandParent(false);
     };
 
+    //编辑单元成本金额
+    const editHandleTwo = async (record: any) => {
+        const { id, deptCode, salaryType, unitCode, userId } = record;
+        if (currentEditRecord&&id == currentEditRecord.id) {
+            const resp = await editUnitCostTableData({
+                amount: currentEditRecord.amount,
+                id
+
+            });
+            if (resp) {
+                tableRef.current?.reload();
+            }
+            set_currentEditRecord(undefined);
+        }else{
+            set_currentEditRecord(record);
+        }
+    }
 
     //固定金额编辑金额
     const editHandle = async (record: any, curTabKey: string) => {
@@ -354,7 +371,7 @@ const MonthlyDataCheck: React.FC = () => {
         if (id == editTableCellId) {
             //保存
             //console.log({currentEditRecord,curTabKey });
-            
+
             if (inputSalaryNum != undefined) {
 
                 if (curTabKey == '1') {
@@ -372,24 +389,10 @@ const MonthlyDataCheck: React.FC = () => {
                     }
                 }
             }
-
-            if (curTabKey == '7') {
-                const resp = await editUnitCostTableData({
-                    amount: currentEditRecord.amount,
-                    id
-
-                });
-                if (resp) {
-                    tableRef.current?.reload();
-                }
-            }
-
             set_editTableCellId(undefined);
-            set_currentEditRecord(undefined);
         } else {
             //编辑
             set_editTableCellId(id);
-            set_currentEditRecord(record);
         }
 
     }
@@ -727,7 +730,7 @@ const MonthlyDataCheck: React.FC = () => {
                     }
                 }
             }
-            if (type == '7'&&currentSelectedTreeNode) {
+            if (type == '7' && currentSelectedTreeNode) {
                 const resp = await getUnitCostTableData({
                     unitCode: currentSelectedTreeNode.code,
                     ...params
@@ -736,30 +739,30 @@ const MonthlyDataCheck: React.FC = () => {
                 let unitCostTotal = 0;
                 let unitCostCtrlTotal = 0;
 
-                const traverseTree = (node:any) => {
-                    if(node == null) return;
+                const traverseTree = (node: any) => {
+                    if (node == null) return;
 
-                    if(!node.summaryFlag){
+                    if (!node.summaryFlag) {
                         //summaryFlag 汇总
                         unitCostTotal = unitCostTotal + node.amount
-                        if(node.ctrlFlag){
+                        if (node.ctrlFlag) {
                             unitCostCtrlTotal = unitCostCtrlTotal + node.amount
                         }
                     }
-                     
-                    if(node.children) {
-                      node.children.forEach(traverseTree);
+
+                    if (node.children) {
+                        node.children.forEach(traverseTree);
                     }
                 }
 
-                
-                
-                resp.forEach((a:any) => {
+
+
+                resp.forEach((a: any) => {
                     traverseTree(a);
                 });
 
                 set_unitCostComputeData({
-                    unitCostTotal,unitCostCtrlTotal
+                    unitCostTotal, unitCostCtrlTotal
                 })
 
                 if (resp) {
@@ -767,9 +770,9 @@ const MonthlyDataCheck: React.FC = () => {
                     return {
                         data: resp,
                         success: true,
-                        total:0,
-                        pageSize:10,
-                        totalPage:0,
+                        total: 0,
+                        pageSize: 10,
+                        totalPage: 0,
                     }
                 }
             }
@@ -891,13 +894,13 @@ const MonthlyDataCheck: React.FC = () => {
          * index 获取的表格类型下标
          */
 
-        if ((index == 3||index == 7) && !loading) {
+        if ((index == 3 || index == 7) && !loading) {
             Modal.confirm({
                 title: '注意',
                 cancelText: '',
                 okText: '确定',
                 closable: true,
-                content: others ? '获取单个操作会覆盖上次获取的该核算单元的数据,确定要继续操作?' : `${index == 7?'获取':'获取所有'}操作会覆盖所有已获取的数据,确定要继续操作?`,
+                content: others ? '获取单个操作会覆盖上次获取的该核算单元的数据,确定要继续操作?' : `${index == 7 ? '获取' : '获取所有'}操作会覆盖所有已获取的数据,确定要继续操作?`,
                 onOk: () => { set_loading(true); confirmGenerateHandle(index, others) }
             })
         }
@@ -1066,12 +1069,12 @@ const MonthlyDataCheck: React.FC = () => {
                         formData.append('file', fileList[0].originFileObj);
                         formData.append('computeDate', currentComputeDate as string);
                         formData.append('unitCode', currentSelectedTreeNode.code);
-                    }else{
+                    } else {
                         formData.append('file', fileList[0].originFileObj);
                         formData.append('computeDate', currentComputeDate as string);
                         formData.append('groupId', currentSelectedManaGroup?.id as any);
                     }
-                    
+
 
                     const resp = await importMonthlyperformanceRelaFiles(index, formData);
 
@@ -1212,15 +1215,15 @@ const MonthlyDataCheck: React.FC = () => {
 
     }, [currentSelectedTabKey]);
 
-    useEffect(()=>{
+    useEffect(() => {
         if (currentSelectedTabKey == '7') {
-            if (currentComputeDate) {
-                getCheckUnitTreeDataFunc(currentComputeDate as string);
-            }
+            // if (currentComputeDate) {
+            //     getCheckUnitTreeDataFunc(currentComputeDate as string);
+            // }
             set_tableColumn(tableColumnSeven as ProColumns[]);
         }
 
-    },[currentEditRecord,auditType])
+    }, [currentEditRecord, auditType])
 
 
 
@@ -2018,22 +2021,22 @@ const MonthlyDataCheck: React.FC = () => {
                                                             </div>
                                                         </div>
                                                         <>
-                                                        {/* <span className='compelted'>已分配总额: <i>{pageData.completedTotal}</i></span>
+                                                            {/* <span className='compelted'>已分配总额: <i>{pageData.completedTotal}</i></span>
                                 <span className='left'>剩余分配总额: <i>{pageData.leftTotal}</i></span> */}
-                                                        <div className='count'><span className='compelted' style={{display:'inline-block',marginRight:20}}>总成本:<i>{formatMoneyNumber(Number(unitCostComputeData.unitCostTotal.toFixed(2)))}</i></span><span className='left'>可控成本:<i>{formatMoneyNumber(Number(unitCostComputeData.unitCostCtrlTotal.toFixed(2)))}</i></span></div>
-                                                        <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} >
-                                                            <div className={auditType == '1' || loading ? 'btnGroup disabled' : 'btnGroup'}
-                                                                onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
-                                                                onMouseLeave={() => set_ifShowTip(false)}
-                                                            >
-                                                                <span key="1" onClick={auditType == '0' ? () => generateFunc(7,false) : () => { }}>获取</span>
-                                                                <>{importData(7, '成本')}</>
-                                                            </div>
-                                                        </Popover>
+                                                            <div className='count'><span className='compelted' style={{ display: 'inline-block', marginRight: 20 }}>总成本:<i>{formatMoneyNumber(Number(unitCostComputeData.unitCostTotal.toFixed(2)))}</i></span><span className='left'>可控成本:<i>{formatMoneyNumber(Number(unitCostComputeData.unitCostCtrlTotal.toFixed(2)))}</i></span></div>
+                                                            <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} >
+                                                                <div className={auditType == '1' || loading ? 'btnGroup disabled' : 'btnGroup'}
+                                                                    onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
+                                                                    onMouseLeave={() => set_ifShowTip(false)}
+                                                                >
+                                                                    <span key="1" onClick={auditType == '0' ? () => generateFunc(7, false) : () => { }}>获取</span>
+                                                                    <>{importData(7, '成本')}</>
+                                                                </div>
+                                                            </Popover>
                                                         </>
-                                                        
+
                                                     </div>
-                                                    {currentComputeDate && <BMSTable actionRef={tableRef} loading={{ spinning: loading, tip: '正在获取数据...' }} rowKey='id' params={tableDataFilterParams} columns={[...tableColumn]} pagination={false} request={(params, sort, filter) => getTableData('7', params, sort, filter)} />}
+                                                    {currentComputeDate && <BMSTable actionRef={tableRef} scroll={{ y: 666 }} loading={{ spinning: loading, tip: '正在获取数据...' }} rowKey='id' params={tableDataFilterParams} columns={[...tableColumn]} pagination={false} request={(params, sort, filter) => getTableData('7', params, sort, filter)} />}
                                                 </div>
 
                                             </div>

+ 127 - 95
src/pages/budgetMana/monthlySet/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-16 09:42:52
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-12 16:09:20
+ * @LastEditTime: 2023-07-14 10:59:06
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -23,10 +23,12 @@ import {
     getMonthlyData,
     getMonthlyDataRespType,
     jiezhuanGoBack,
-    jiezhuanRequest
+    jiezhuanRequest,
+    kaizhnagRequest
 } from './service';
 import { Divider, message, Modal } from 'antd';
 import { getComputeDate } from '@/pages/Home/service';
+import moment from 'moment';
 
 
 
@@ -37,65 +39,69 @@ const MonthlySet: React.FC = () => {
     const [data, set_data] = useState<getMonthlyDataRespType>();
     const [currentComputeDate, set_currentComputeDate] = useState('');
     const [ifEdit, set_ifEdit] = useState(false);
-    const [isSettlementting,set_isSettlementting] = useState(false);
+    const [isSettlementting, set_isSettlementting] = useState(false);
+
+    const [topform] = ProForm.useForm();
+    const [midform] = ProForm.useForm();
+    const [bottomform] = ProForm.useForm();
 
     const formRef = useRef<ProFormInstance>();
-    
-    const getCurrentComputeDate =async () => {
+
+    const getCurrentComputeDate = async () => {
         const resp = await getComputeDate();
-        set_currentComputeDate(resp);    
+        set_currentComputeDate(resp);
     }
 
     const getMonthlyDataFunc = async (dateString: string) => {
 
         const resp = await getMonthlyData(dateString);
-        if(isSettlementting){
-            setTimeout(()=>{
+        if (isSettlementting) {
+            setTimeout(() => {
                 set_isSettlementting(false);
                 set_data(resp);
-            },1000)
-        }else{
+            }, 1000)
+        } else {
             set_data(resp);
-        } 
+        }
     }
 
-    const editClickHandle = ()=>{
+    const editClickHandle = () => {
         set_ifEdit(true);
     }
-    
-    const saveHandle = async (prevData:any) => {
-          const f = formRef.current?.getFieldFormatValueObject;
-          const value = f?f():undefined;
-          const {dateRange,personalRate,seniority} = value;
-          
-          const resp = await editSave({
-               computeDate:currentComputeDate,
-               ...prevData,
-               beginDate:dateRange&&dateRange.length>0?dateRange[0]:'',
-               endDate:dateRange&&dateRange.length>0?dateRange[1]:'',
-               personalRate,
-               seniority
-          });
-
-          if(resp){
-               set_ifEdit(false);  //获取最新数据
-          }     
+
+    const saveHandle = async (prevData: any) => {
+        const f = formRef.current?.getFieldFormatValueObject;
+        const value = f ? f() : undefined;
+        const { dateRange, personalRate, seniority } = value;
+
+        const resp = await editSave({
+            computeDate: currentComputeDate,
+            ...prevData,
+            beginDate: dateRange && dateRange.length > 0 ? dateRange[0] : '',
+            endDate: dateRange && dateRange.length > 0 ? dateRange[1] : '',
+            personalRate,
+            seniority
+        });
+
+        if (resp) {
+            set_ifEdit(false);  //获取最新数据
+        }
     }
 
-    const jiezhuanHandle = (data:any) => {
+    const jiezhuanHandle = (data: any) => {
 
         Modal.confirm({
-            title:'将对当前核算月份进行结转,结转后将进入下一个核算月份,请确认本月工作已经核算完成后进行结转',
+            title: '将对当前核算月份进行结转,结转后将进入下一个核算月份,请确认本月工作已经核算完成后进行结转',
             okText: '确定',
             cancelText: '取消',
-            onOk:async (...args)=>{
-                if(!isSettlementting){
+            onOk: async (...args) => {
+                if (!isSettlementting) {
                     //非结转中才可以再次操作
                     // set_isSettlementting(true);
-                   
+
                     const resp = await jiezhuanRequest(data.computeDate);
-                    
-                    if(resp){
+
+                    if (resp) {
                         message.success('结转成功!');
                         getCurrentComputeDate();
                     }
@@ -108,48 +114,71 @@ const MonthlySet: React.FC = () => {
     const goBackHandle = () => {
 
         Modal.confirm({
-            title:'当前核算月份未结账,回退后所有已操作数据会作废,请确认是否要进行回退操作',
+            title: '当前核算月份未结账,回退后所有已操作数据会作废,请确认是否要进行回退操作',
             okText: '确定',
             cancelText: '取消',
-            onOk:async (...args)=>{
+            onOk: async (...args) => {
                 const resp = await jiezhuanGoBack(currentComputeDate);
-                if(resp){
+                if (resp) {
                     message.success('回退成功!');
                     getCurrentComputeDate();
                 }
             },
         });
-        
-    } 
 
-    const getStatus = (num:number|undefined)=>{
+    }
+
+    const getStatus = (num: number | undefined) => {
 
-        if(num||num == 0){
-             //状态0未结算 1结算中 2已结算
-          if(num == 0)return '未结算';
-          if(num == 1)return '结算中';
-          if(num == 2)return '已结算';
+        if (num || num == 0) {
+            //状态0未结算 1结算中 2已结算
+            if (num == 0) return '未结算';
+            if (num == 1) return '结算中';
+            if (num == 2) return '已结算';
 
-        }else{
+        } else {
             return '无效status'
         }
-        
+
     }
 
-    const kaizhangHandle = ()=>{
-          
+    const kaizhangHandle = async () => {
+        const resp = await kaizhnagRequest(currentComputeDate);
+        if (resp) {
+            getMonthlyDataFunc(currentComputeDate);
+        }
     }
 
-    useEffect(()=>{
-         if(!ifEdit){
-              //取消编辑时刷新数据
-              getCurrentComputeDate();
-         }
-    },[ifEdit]);
+    useEffect(() => {
+        if (!ifEdit) {
+            //取消编辑时刷新数据
+            getCurrentComputeDate();
+        }
+    }, [ifEdit]);
+
+    useEffect(() => {
+        if(data){
+            topform.setFieldsValue({
+                personalRate: data.lastCarry.personalRate,
+                seniority: data.lastCarry.seniority,
+                dateRange: [dayjs(data.lastCarry.beginDate ? data.lastCarry.beginDate : '1997-01-01', dateFormat), dayjs(data.lastCarry.endDate ? data.lastCarry.endDate : '1997-01-01', dateFormat)],
+            });
+            midform.setFieldsValue({
+                personalRate: data.currentCarry.personalRate,
+                seniority: data.currentCarry.seniority,
+                dateRange: [dayjs(data.currentCarry.beginDate ? data.currentCarry.beginDate : '1997-01-01', dateFormat), dayjs(data.currentCarry.endDate ? data.currentCarry.endDate : '1997-01-01', dateFormat)],
+            });
+            bottomform.setFieldsValue({
+                personalRate: data.preCarry.personalRate,
+                seniority: data.preCarry.seniority,
+                dateRange: [dayjs(data.preCarry.beginDate ? data.preCarry.beginDate : '1997-01-01', dateFormat), dayjs(data.preCarry.endDate ? data.preCarry.endDate : '1997-01-01', dateFormat)],
+            });
+        }
+    }, [data])
 
     useEffect(() => {
         //改变计算月份触发刷新数据
-        if(currentComputeDate){
+        if (currentComputeDate) {
             getMonthlyDataFunc(currentComputeDate);
         }
     }, [currentComputeDate]);
@@ -159,33 +188,34 @@ const MonthlySet: React.FC = () => {
         getCurrentComputeDate();
     }, []);
 
-    
+
 
     return (
         <BMSPagecontainer className='MonthlySet' title={`月度结转 ${currentComputeDate}`} ghost>
-            <div style={{height:16}}> </div>
+            <div style={{ height: 16 }}> </div>
             <div className='card'>
                 <div className='mark'>{getStatus(data?.lastCarry.status)}</div>
                 <div className='cardTitle'>{data?.lastCarry.computeDate}月<span>下一个核算月份</span></div>
                 <div className='formWrap'>
                     {data && (
                         <ProForm submitter={false} layout='vertical' grid={true}
-                            initialValues={{
-                                personalRate: data.lastCarry.personalRate,
-                                seniority: data.lastCarry.seniority,
-                                dateRange:[dayjs(data.lastCarry.beginDate?data.lastCarry.beginDate:'1997-01-01', dateFormat), dayjs(data.lastCarry.endDate?data.lastCarry.endDate:'1997-01-01', dateFormat)],
-                            }}
+                            form={topform}
+                            // initialValues={{
+                            //     personalRate: data.lastCarry.personalRate,
+                            //     seniority: data.lastCarry.seniority,
+                            //     dateRange: [dayjs(data.lastCarry.beginDate ? data.lastCarry.beginDate : '1997-01-01', dateFormat), dayjs(data.lastCarry.endDate ? data.lastCarry.endDate : '1997-01-01', dateFormat)],
+                            // }}
                             rowProps={{
                                 gutter: [24, 0],
                             }} >
                             <ProForm.Group >
-                                <ProFormDateRangePicker disabled name="dateRange" width={'lg'} fieldProps={{ locale: locale }} label="日期区间:" colProps={{span:8}} />
+                                <ProFormDateRangePicker disabled name="dateRange" width={'lg'} fieldProps={{ locale: locale }} label="日期区间:" colProps={{ span: 8 }} />
 
                                 <ProFormDigit
                                     disabled
                                     label="人事成本比例系数:"
                                     name="personalRate"
-                                    colProps={{span:8}}
+                                    colProps={{ span: 8 }}
                                     width='lg'
                                     placeholder='请输入'
                                     fieldProps={{ precision: 2 }}
@@ -193,7 +223,7 @@ const MonthlySet: React.FC = () => {
 
                                 <ProFormDigit
                                     disabled
-                                    colProps={{span:8}}
+                                    colProps={{ span: 8 }}
                                     label="年资系数:"
                                     name="seniority"
                                     placeholder='请输入'
@@ -206,49 +236,50 @@ const MonthlySet: React.FC = () => {
 
                 </div>
             </div>
-            <div className='colorBtn' onClick={()=>jiezhuanHandle(data?.currentCarry)}>{isSettlementting?'结转中...':'结转'}</div>
+            <div className='colorBtn' onClick={() => jiezhuanHandle(data?.currentCarry)}>{isSettlementting ? '结转中...' : '结转'}</div>
             <div className='card on'>
                 <div className='mark caculating'>{getStatus(data?.currentCarry.status)}</div>
                 <div className='cardTitle'>
                     {data?.currentCarry.computeDate}<span>当前核算月份</span>
-                    {(!ifEdit&&data?.currentCarry.status != 2)&&<a onClick={()=>editClickHandle()}>编辑</a>}
-                    {(!ifEdit&&data?.currentCarry.status == 2)&&<a onClick={()=>kaizhangHandle()}>开帐</a>}
+                    {(!ifEdit && data?.currentCarry.status != 2) && <a onClick={() => editClickHandle()}>编辑</a>}
+                    {(!ifEdit && data?.currentCarry.status == 2) && <a onClick={() => kaizhangHandle()}>开帐</a>}
 
                     {
                         ifEdit && (
                             <div className='editActBtnGroup'>
-                                <a onClick={()=>set_ifEdit(false)}>取消</a>
-                                <Divider type="vertical" style={{position:'relative',top:2}} />
-                                <a onClick={()=>saveHandle(data?.currentCarry)}>保存</a>
+                                <a onClick={() => set_ifEdit(false)}>取消</a>
+                                <Divider type="vertical" style={{ position: 'relative', top: 2 }} />
+                                <a onClick={() => saveHandle(data?.currentCarry)}>保存</a>
                             </div>
                         )
                     }
-                    
+
                 </div>
                 <div className='formWrap'>
 
                     {
                         data && (
                             <ProForm submitter={false} layout='vertical' grid={true}
-                                initialValues={{
-                                    personalRate: data.currentCarry.personalRate,
-                                    seniority: data.currentCarry.seniority,
-                                    dateRange:[dayjs(data.currentCarry.beginDate?data.currentCarry.beginDate:'1997-01-01', dateFormat), dayjs(data.currentCarry.endDate?data.currentCarry.endDate:'1997-01-01', dateFormat)],
-                                }}
+                                form={midform}
+                                // initialValues={{
+                                //     personalRate: data.currentCarry.personalRate,
+                                //     seniority: data.currentCarry.seniority,
+                                //     dateRange: [moment(data.currentCarry.beginDate ? data.currentCarry.beginDate : '1997-01-01', dateFormat), moment(data.currentCarry.endDate ? data.currentCarry.endDate : '1997-01-01', dateFormat)],
+                                // }}
                                 rowProps={{
                                     gutter: [16, 0],
-                                }} 
+                                }}
                                 formRef={formRef}
-                                >
+                            >
                                 <ProForm.Group>
-                                    <ProFormDateRangePicker name="dateRange" disabled={!ifEdit} fieldProps={{ locale: locale }} label="日期区间:" colProps={{span:8}} width='lg' />
+                                    <ProFormDateRangePicker name="dateRange" disabled={!ifEdit} fieldProps={{ locale: locale }} label="日期区间:" colProps={{ span: 8 }} width='lg' />
 
                                     <ProFormDigit
                                         disabled={!ifEdit}
                                         label="人事成本比例系数:"
                                         name="personalRate"
                                         min={0}
-                                        colProps={{span:8}}
+                                        colProps={{ span: 8 }}
                                         width='lg'
                                         placeholder='请输入'
                                         fieldProps={{ precision: 2 }}
@@ -256,7 +287,7 @@ const MonthlySet: React.FC = () => {
 
                                     <ProFormDigit
                                         disabled={!ifEdit}
-                                        colProps={{span:8}}
+                                        colProps={{ span: 8 }}
                                         width='lg'
                                         label="年资系数:"
                                         name="seniority"
@@ -271,7 +302,7 @@ const MonthlySet: React.FC = () => {
 
                 </div>
             </div>
-            <div className='grayBtn' onClick={()=>goBackHandle()}>回退</div>
+            <div className='grayBtn' onClick={() => goBackHandle()}>回退</div>
             <div className='card'>
                 <div className='mark compeleted'>{getStatus(data?.preCarry.status)}</div>
                 <div className='cardTitle'>{data?.preCarry.computeDate}<span>上一个核算月份</span></div>
@@ -279,23 +310,24 @@ const MonthlySet: React.FC = () => {
                     {
                         data && (
                             <ProForm submitter={false} layout='vertical' grid={true}
-                                initialValues={{
-                                    personalRate: data.preCarry.personalRate,
-                                    seniority: data.preCarry.seniority,
-                                    dateRange:[dayjs(data.preCarry.beginDate?data.preCarry.beginDate:'1997-01-01', dateFormat), dayjs(data.preCarry.endDate?data.preCarry.endDate:'1997-01-01', dateFormat)],
-                                }}
+                                form={bottomform}
+                                // initialValues={{
+                                //     personalRate: data.preCarry.personalRate,
+                                //     seniority: data.preCarry.seniority,
+                                //     dateRange: [moment(data.preCarry.beginDate ? data.preCarry.beginDate : '1997-01-01', dateFormat), moment(data.preCarry.endDate ? data.preCarry.endDate : '1997-01-01', dateFormat)],
+                                // }}
                                 rowProps={{
                                     gutter: [16, 0],
                                 }} >
                                 <ProForm.Group>
-                                    <ProFormDateRangePicker disabled name="dateRange" fieldProps={{ locale: locale }} label="日期区间:" colProps={{span:8}} width='lg' />
+                                    <ProFormDateRangePicker disabled name="dateRange" fieldProps={{ locale: locale }} label="日期区间:" colProps={{ span: 8 }} width='lg' />
 
                                     <ProFormDigit
                                         disabled
                                         label="人事成本比例系数:"
                                         name="personalRate"
                                         min={0}
-                                        colProps={{span:8}}
+                                        colProps={{ span: 8 }}
                                         width='lg'
                                         placeholder='请输入'
                                         fieldProps={{ precision: 2 }}
@@ -303,7 +335,7 @@ const MonthlySet: React.FC = () => {
 
                                     <ProFormDigit
                                         disabled
-                                        colProps={{span:8}}
+                                        colProps={{ span: 8 }}
                                         width='lg'
                                         label="年资系数:"
                                         name="seniority"

+ 11 - 1
src/pages/budgetMana/monthlySet/service.ts

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-15 15:14:12
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-01-12 11:31:41
+ * @LastEditTime: 2023-07-06 20:06:08
  * @FilePath: /BudgetManaSystem/src/pages/Home/service.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -61,6 +61,16 @@ export const jiezhuanRequest = (computeDate:string)=>{
     })
 }
 
+//开帐请求
+
+export const kaizhnagRequest = (computeDate:string)=>{
+
+    return request('/performance/carry/openBill', {
+         method:'POST',
+         params:{computeDate},
+    })
+}
+
 //当前结转年月编辑
 
 export type EditSaveRequestBodyType = {

+ 362 - 91
src/pages/budgetMana/oneBatch/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-01-04 14:12:31
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-07-06 13:54:58
+ * @LastEditTime: 2023-07-14 18:17:36
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/oneBatch/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -12,16 +12,21 @@ import BMSPagecontainer from '@/components/BMSPageContainer'
 import { BMSTable } from '@/components/BMSTable';
 import { getComputeDate } from '@/pages/Home/service';
 import { ActionType, ProColumns } from '@ant-design/pro-components';
-import { message, Modal, Popover, Table, Tabs } from 'antd';
+import { message, Modal, Popover, Table, Tabs, Button } from 'antd';
 import { useEffect, useRef, useState } from 'react';
-import { caculate, checkRequest, getCurrentCheckStatus, getData, getZhileiList } from './service';
+import { caculate, checkRequest, getCheckType, getCurrentCheckStatus, getCurrentZhileiCheckStatus, getData, getZhileiList } from './service';
 
 
 import './style.less';
 
 
-import { create, all } from 'mathjs'
+import { create, all, number } from 'mathjs'
 import exportTableToExcel from '@/utils/tableToExcel';
+import { convertToColumns } from '@/utils/tooljs';
+
+import * as XLSX from 'xlsx';
+import exportTableToMultiExcel from '@/utils/tableToMultiHeaderExcel';
+
 
 const config = {
   number: 'number',
@@ -30,22 +35,188 @@ const config = {
 const math = create(all, config as any);
 
 
+type JsonStructure = {
+  code: string;
+  name: string;
+  expand?: number;
+  childTitle?: JsonStructure[];
+};
+
+type Column = {
+  title: string | JSX.Element;
+  dataIndex: string;
+  key: string;
+  ellipsis: boolean;
+  width: number;
+  children?: Column[];
+};
+
+const mockData = [
+  {
+    "code": "1",
+    "name": "单元绩效点值1",
+    "sort": 1,
+    "redirect": false,
+    "expand": 1,
+    "childTitle": [
+      {
+        "code": "2-1",
+        "name": "单元绩效点值2",
+        "sort": 1,
+        "redirect": false,
+        "expand": 0,
+        "childTitle": [
+          {
+            "code": "3",
+            "name": "单元绩效点值3",
+            "sort": 1,
+            "redirect": false,
+            "expand": 1,
+            "childTitle": []
+          }
+        ]
+      },
+      {
+        "code": "2-2",
+        "name": "单元绩效点值2",
+        "sort": 1,
+        "redirect": false,
+        "expand": 1,
+        "childTitle": [
+          {
+            "code": "3-1",
+            "name": "单元绩效点值3-1",
+            "sort": 1,
+            "redirect": false,
+            "expand": 1,
+            "childTitle": []
+          },
+          {
+            "code": "3-2",
+            "name": "单元绩效点值3-2",
+            "sort": 1,
+            "redirect": false,
+            "expand": 1,
+            "childTitle": []
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code": "4",
+    "name": "单元管理绩效",
+    "sort": 2,
+    "redirect": false
+  },
+]
+
+const mockColumns = [
+  {
+    dataIndex: "unitName",
+    ellipsis: true,
+    fixed: "left",
+    key: "unitName",
+    title: "核算单元",
+    width: 140
+  },
+  {
+    dataIndex: "key-23",
+    ellipsis: true,
+    key: "key-23",
+    title: "单元管理绩效",
+    width: 200
+  },
+  {
+    dataIndex: "key-1646350087779131392",
+    ellipsis: true,
+    key: "key-1646350087779131392",
+    title: "核算年月",
+    width: 200
+  },
+  {
+    dataIndex: "key-1679019958216040448",
+    ellipsis: true,
+    key: "key-1679019958216040448",
+    title: "临床诊察积分奖金",
+    width: 200,
+    children: [
+      {
+        dataIndex: "key-6",
+        ellipsis: true,
+        key: "key-6",
+        title: "临床诊察积分-节假日奖金",
+        width: 200,
+        children: [
+          {
+            dataIndex: "key-4",
+            ellipsis: true,
+            key: "key-4",
+            title: "临床诊察积分-节假日",
+            width: 200
+          },
+          {
+            dataIndex: "key-5",
+            ellipsis: true,
+            key: "key-5",
+            title: "临床诊察积分-节假日点值",
+            width: 200
+          }
+        ]
+      },
+      {
+        dataIndex: "key-3",
+        ellipsis: true,
+        key: "key-3",
+        title: "临床诊察积分-工作日奖金",
+        width: 200,
+        children: [
+          {
+            dataIndex: "key-1",
+            ellipsis: true,
+            key: "key-1",
+            title: "临床诊察积分-工作日",
+            width: 200
+          },
+          {
+            dataIndex: "key-2",
+            ellipsis: true,
+            key: "key-2",
+            title: "临床诊察积分-工作日点值",
+            width: 200
+          }
+        ]
+      }
+    ]
+  },
+  {
+    dataIndex: "totalScore",
+    ellipsis: true,
+    fixed: "right",
+    key: "totalScore",
+    title: "总奖金",
+    width: 140
+  }
+]
 
+let checkStatusArr:number[] = []
 
 const OneBatch = () => {
 
 
   const [tableColumn, set_tableColumn] = useState<ProColumns[] | any[]>([]);
 
+  const [columnsForExcel, set_columnsForExcel] = useState<ProColumns[] | any[]>([]);
+
   const [tableData, set_tableData] = useState<any[]>([]);
 
   const [currentComputeDate, set_currentComputeDate] = useState<string | undefined>();
 
   const [currentTabKey, set_currentTabKey] = useState('1');
 
-  const [tabs,set_Tabs] = useState<{
-    name: any;value:string
-}[]>([]);
+  const [tabs, set_Tabs] = useState<{
+    name: any; value: string
+  }[]>([]);
 
   const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>({ reportCode: undefined });
 
@@ -56,7 +227,12 @@ const OneBatch = () => {
   const tableRef = useRef<ActionType>();
 
   const [tableH, set_tableH] = useState(0);
-  const [reportTitle,set_reportTitle] = useState('');
+  const [reportTitle, set_reportTitle] = useState('');
+  const [checkType, set_checkType] = useState<string | undefined>(undefined); // 一次分配审核模式,1职类一起审核 2职类分开审核
+
+  const [disAccount,set_disAccount] = useState(false);
+
+  //const [checkStatusArr,set_checkStatusArr] = useState<number[]>([]);
 
 
   const onTabChange = (activeKey: string) => {
@@ -64,9 +240,57 @@ const OneBatch = () => {
     set_tableDataFilterParams({
       ...tableDataFilterParams,
       reportCode: activeKey
-    })
+    });
+  }
+
+  const [expandedkeys, set_expandedkeys] = useState<string[]>([]);
+
+  const convertToColumnsFunc = (json: JsonStructure[], ifRender?: boolean, level: number = 1): Column[] => {
+    return json.map((item) => {
+      let column: Column = {
+        title: item.name,
+        dataIndex: `key-${item.code}`,
+        key: `key-${item.code}`,
+        ellipsis: true,
+        width: 200,
+      };
+
+      const isExpanded = expandedkeys.includes(item.code);
+
+      if (item.expand === 1 && item.childTitle && item.childTitle.length > 0) {
+
+        column.title = ifRender ? (
+          <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'center', alignContent: 'center' }}>
+            <span style={{ display: 'inline-block', maxWidth: '80%', minWidth: 140, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{item.name}</span>
+            <div className='expandIcon' onClick={() => {
+              if (isExpanded) {
+                let _expandedkeys = [...expandedkeys];
+                _expandedkeys.splice(expandedkeys.findIndex(a => a == item.code), 1);
+                set_expandedkeys([..._expandedkeys]);
+              } else {
+                set_expandedkeys([...expandedkeys, item.code]);
+              }
+            }}>
+              {isExpanded ? '-' : '+'}
+            </div>
+          </div>
+        ) : item.name;
+
+        if (isExpanded) {
+          column.children = convertToColumnsFunc(item.childTitle, ifRender, level + 1);
+        }
+      }
+
+      return column;
+    });
   }
 
+
+  useEffect(() => {
+    tableRef.current?.reload();
+  }, [expandedkeys])
+
+
   const getTableData = async (params: any, sort: any, filter: any) => {
 
     const { reportCode = 1 } = params;
@@ -78,22 +302,19 @@ const OneBatch = () => {
 
     if (resp) {
 
-      const { title, assignmentData,reportName } = resp;
-      const columns = title.map((item: any) => {
-        return {
-          title: item.name,
-          dataIndex: `key-${item.code}`,
-          key: `key-${item.code}`,
-          width: 140,
+      const { title, assignmentData, reportName } = resp;
+      const columns = convertToColumnsFunc(title, true);
+      const columnsForExcel = convertToColumnsFunc(title, false);
+
+
 
-        }
-      });
       set_tableColumn([{
         title: '核算单元',
         dataIndex: 'unitName',
         key: 'unitName',
         width: 140,
         fixed: 'left',
+        ellipsis: true
 
       }, ...columns, {
         title: '总奖金',
@@ -101,9 +322,33 @@ const OneBatch = () => {
         key: 'totalScore',
         width: 140,
         fixed: 'right',
+        ellipsis: true
+
+      }]);
+
+
+      set_columnsForExcel([{
+        title: '核算单元',
+        dataIndex: 'unitName',
+        key: 'unitName',
+        width: 140,
+        fixed: 'left',
+        ellipsis: true
+
+      }, ...columnsForExcel, {
+        title: '总奖金',
+        dataIndex: 'totalScore',
+        key: 'totalScore',
+        width: 140,
+        fixed: 'right',
+        ellipsis: true
 
       }]);
 
+      // set_tableColumn([...mockColumns]);
+      // set_columnsForExcel([...mockColumns]);
+
+
       const data = assignmentData.map((item: any) => {
 
         let rowData: { [key: string]: any } = {};
@@ -136,10 +381,13 @@ const OneBatch = () => {
 
   const checkHandle = async (type: string) => {
 
+    if (!checkType) return;
+
     const resp = await checkRequest({
       computeDate: currentComputeDate as string,
       auditType: type == '0' ? '1' : '0',   //审核类型  1审核 0取消审核
-    });
+      reportCode: checkType == '2' ? currentTabKey : undefined
+    }, checkType);
 
     if (resp) {
       if (type == '0') {
@@ -151,18 +399,19 @@ const OneBatch = () => {
         set_auditType('0');
       }
     }
+    return resp;
   }
 
   const getCurrentComputeDate = async () => {
     const resp = await getComputeDate();
     set_currentComputeDate(resp);
   }
-  
-  const getTabList =async () => {
-       const resp = await getZhileiList();
-       if(resp){
-        set_Tabs(resp.list);
-       }
+
+  const getTabList = async () => {
+    const resp = await getZhileiList();
+    if (resp) {
+      set_Tabs(resp.list);
+    }
   }
 
 
@@ -174,11 +423,25 @@ const OneBatch = () => {
   }
 
 
-  const getCheckStatus = async (computeDate: string) => {
-    const resp = await getCurrentCheckStatus(computeDate);
-    if (resp) {
-      set_auditType(`${resp}`);  //0 未审核 1 已审核
+  const getCheckStatus = async (computeDate: string,code?:string) => {
+
+    if (checkType == '1') {
+      const resp = await getCurrentCheckStatus(computeDate);
+      if (resp) {
+        set_auditType('1');  //0 未审核 1 已审核
+      } else {
+        set_auditType('0');
+      }
     }
+    if (checkType == '2') {
+      const resp = await getCurrentZhileiCheckStatus(computeDate,code?code:currentTabKey);
+      if (resp) {
+        set_auditType('1');  //0 未审核 1 已审核
+      } else {
+        set_auditType('0');
+      }
+    }
+
   }
 
   const generateFunc = () => {
@@ -194,47 +457,9 @@ const OneBatch = () => {
   }
 
   const exportHandle = () => {
-    let headers: { [key: string]: any } = {};
-    let data: any[] = [];
-    let summary: { [key: string]: any } = {};
-    
-    tableColumn.forEach(a => {
-      if(a.hideInTable != 1){
-        headers[`${a.dataIndex}`] = a.title;
-      }
-    });
 
-    tableData.forEach(b => {
-      let _temp: { [key: string]: any } = {};
-      Object.keys(headers).forEach(key => {
-        _temp[`${key}`] = b[`${key}`]
-      });
-      data.push(_temp);
-    });
-
-    tableColumn.forEach(a => {
-      if(a.dataIndex == 'unitName'){
-        summary[`unitName`] = '合计';
-      }else{
-        const calArr = tableData.map(b=>b[`${a.dataIndex}`]);
-        const total = calArr.reduce((prev, cur) => {
-          //return prev + cur[`${dataIndex}`]
-          if (typeof cur == 'number') {
-            return math.add(prev, cur);
-          }
-        }, 0);
-        summary[`${a.dataIndex}`] = total;
-      }
-    });
+    exportTableToMultiExcel(tableData, columnsForExcel as any, reportTitle, true);
 
-    //console.log({headers,tableData,data,summary});
-    
-    const excelTableData = [
-      ...data,
-      summary
-    ];
-
-    exportTableToExcel(excelTableData,headers,reportTitle);
   }
 
   const handleResize = (e: any) => {
@@ -243,6 +468,13 @@ const OneBatch = () => {
     set_tableH(tableHeight);
   }
 
+  const getCheckTypeHandle = async () => {
+    const resp = await getCheckType();
+    if (resp && resp.list.length > 0) {
+      set_checkType(resp.list[0].value);
+    }
+  }
+
   function doResize() {
     setTimeout(() => {
       const ev: any = new Event('resize');
@@ -250,18 +482,45 @@ const OneBatch = () => {
     }, 0)
   }
 
-  useEffect(()=>{
-    if(tabs.length>0){
+  useEffect(() => {
+    if (tabs.length > 0) {
       set_currentTabKey(tabs[0].value);
     }
-  },[tabs])
+  }, [tabs]);
+
+  useEffect(() => {
+    if (currentComputeDate && checkType == '2') {
+      getCheckStatus(currentComputeDate as string);
+    }
+  }, [currentTabKey]);
+
+
+  useEffect(()=>{
+    if(checkType == '2'){
+      checkStatusArr = [];
+      tabs.forEach(async (item)=>{
+             const resp = await getCurrentZhileiCheckStatus(currentComputeDate as string,item.value);
+
+            checkStatusArr.push(resp);
+
+            if(checkStatusArr.length == tabs.length){
+              const total = [...checkStatusArr].reduce((prev,cur)=>prev+cur,0);
+              total>0?set_disAccount(true):set_disAccount(false)
+            }
+             
+      })
+    }
+  },[auditType]);
+
+
+
 
 
   useEffect(() => {
-    if (currentComputeDate) {
+    if (currentComputeDate && checkType) {
       getCheckStatus(currentComputeDate);
     }
-  }, [currentComputeDate]);
+  }, [currentComputeDate, checkType]);
 
 
   useEffect(() => {
@@ -269,6 +528,7 @@ const OneBatch = () => {
     window.addEventListener('resize', (e) => handleResize(e)) //监听窗口大小改变
     doResize();
     getTabList();
+    getCheckTypeHandle();
 
     return () => {
       window.removeEventListener('resize', (e) => handleResize(e))
@@ -280,11 +540,11 @@ const OneBatch = () => {
     <BMSPagecontainer className='OneBatch' title={`核算年月:${currentComputeDate}`}>
       <div className='btnGroup'>
         <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} >
-          <div style={{display:'flex',flexDirection:'row',alignItems:'center'}}>
-            <div className={auditType == '0' ? 'caculateBtn' : 'caculateBtn disabled'}
+          <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+            <div className={(auditType == '0'&&!disAccount) ? 'caculateBtn' : 'caculateBtn disabled'}
               onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
               onMouseLeave={() => set_ifShowTip(false)}
-              onClick={() => auditType == '0' ? generateFunc() : () => { }}>计算</div>
+              onClick={() => (auditType == '0'&&!disAccount) ? generateFunc() : () => { }}>计算</div>
             <div className={auditType == '0' ? 'caculateBtn' : 'caculateBtn disabled'}
               onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
               onMouseLeave={() => set_ifShowTip(false)}
@@ -298,19 +558,25 @@ const OneBatch = () => {
           defaultActiveKey='1'
           onChange={onTabChange}
           items={[
-            ...tabs.map(a=>({label:a.name,key:a.value}))
+            ...tabs.map(a => ({ label: a.name, key: a.value }))
           ]}
         />
         <div className='tabContent'>
-          {currentComputeDate && <BMSTable actionRef={tableRef} rowKey='unitCode' pagination={false} columns={tableColumn as ProColumns[]}
+          {currentComputeDate && <BMSTable actionRef={tableRef} rowKey='unitCode' bordered pagination={false} columns={tableColumn as ProColumns[]}
             params={tableDataFilterParams}
-            scroll={{ x: 140 * 10, y: tableH }}
+            scroll={{ x: 140 * tableColumn.length, y: tableH }}
             request={(params, sort, filter) => getTableData(params, sort, filter)}
 
             summary={(pageData) => {
               const Caculate = ({ colData }: { colData: any }) => {
 
-                const { dataIndex } = colData;
+                const { dataIndex, children } = colData;
+
+                if (children) {
+                  return children.map((child: any, index: number) => (
+                    <Caculate key={index} colData={child} />
+                  ));
+                }
 
                 const total = pageData.reduce((prev, cur) => {
                   //return prev + cur[`${dataIndex}`]
@@ -319,25 +585,30 @@ const OneBatch = () => {
                   }
                 }, 0);
 
-                return dataIndex == "unitName" ? <div style={{textAlign:'left'}}>合计</div>:(
+                return dataIndex == "unitName" ? <div style={{ textAlign: 'left' }}>合计</div> : (
                   //<span>{typeof total == 'number'?math.format(total, {precision: 14}) : '合计'}</span>
-                  <span style={{textAlign:'left'}}>{typeof total == 'number' ? Number(total.toFixed(4)) : '-'}</span>
+                  <span style={{ textAlign: 'left' }}>{typeof total == 'number' ? Number(total.toFixed(4)) : '-'}</span>
                 )
               }
 
+              const renderSummaryRow = (columns: any[]): React.ReactNode[] => {
+                return columns.map((colData, index) => {
+                  if (colData.children) {
+                    return renderSummaryRow(colData.children);
+                  } else {
+                    return (
+                      <Table.Summary.Cell key={index} index={index} align='center' rowSpan={1}>
+                        <Caculate colData={colData} />
+                      </Table.Summary.Cell>
+                    );
+                  }
+                });
+              };
 
               return (
                 <Table.Summary fixed>
                   <Table.Summary.Row>
-                    {
-                      tableColumn.map((item, index) => {
-                        return (
-                          <Table.Summary.Cell key={index} index={index} align='center' rowSpan={1} >
-                            <Caculate colData={item} />
-                          </Table.Summary.Cell >
-                        )
-                      })
-                    }
+                    {renderSummaryRow(tableColumn)}
                   </Table.Summary.Row>
                 </Table.Summary>
               );

+ 32 - 6
src/pages/budgetMana/oneBatch/service.ts

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-01-04 13:59:26
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-07-06 13:48:41
+ * @LastEditTime: 2023-07-12 17:44:22
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/personnelSalaryBudget/service.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -54,6 +54,15 @@ export const getCurrentCheckStatus = (computeDate:string)=>{
    })
 }
 
+//获取当前职类审核状态
+export const getCurrentZhileiCheckStatus = (computeDate:string,reportCode:string)=>{
+    return request('/performance/first/getUnitTypeAuditStatus', {
+        method:'GET',
+        params:{computeDate,reportCode}
+   })
+}
+
+
 //获取职类列表
 export const getZhileiList = ()=>{
     return request('/performance/dict/getDictDataList?current=1&pageSize=500&typeCode=1', {
@@ -62,11 +71,21 @@ export const getZhileiList = ()=>{
 }
 
 //审核
-export const checkRequest = (data:{computeDate:string,auditType:string})=>{
-    return request('/performance/first/audit', {
-        method:'POST',
-        params:data
-   })
+export const checkRequest = (data:{computeDate:string,auditType:string,reportCode?:string},checkType:string)=>{
+
+    if(checkType == '1'){
+        return request('/performance/first/audit', {
+            method:'POST',
+            params:data
+       })
+    }
+    if(checkType == '2'){
+        return request('/performance/first/auditUnitType', {
+            method:'POST',
+            params:data
+       })
+    }
+    
 }
 
 
@@ -79,5 +98,12 @@ export const caculate = (computeDate:string)=>{
    })
 }
 
+//获取审核方式
+export const getCheckType = ()=>{
+    return request(`/performance/parameter/getList?current=1&pageSize=10&parameterName=${'一次分配审核模式'}`, {
+        method:'GET',
+   })
+}
+
 
 

+ 32 - 0
src/pages/budgetMana/oneBatch/style.less

@@ -1,3 +1,24 @@
+
+.expandIcon {
+    position: relative;
+    top:2px;
+    display: inline-block;
+    width: 16px;
+    height: 16px;
+    text-align: center;
+    line-height: 12px;
+    border-radius: 4px;
+    margin-left: 4px;
+    cursor: pointer;
+    font-size: 14px;
+    border: 1px solid #DAE2F2;
+    transition: all 0.3 linear;
+    background: #fff;
+    &:hover {
+        border: 1px solid #3377ff;
+        color: #3377ff;
+    }
+}
 .OneBatch {
     position: relative;
     padding: 16px;
@@ -66,5 +87,16 @@
                 border-bottom: none !important;
             }
         }
+
+        .bms-ant-table-body {
+            &::-webkit-scrollbar {
+                transition: all 0.5s ease-in;
+            }
+            &:hover {
+                &::-webkit-scrollbar {
+                    height: 5px;
+                }
+            }
+        }
     }
 }

+ 9 - 1
src/pages/budgetMana/personnelSalaryBudget/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-01-03 14:20:22
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-12 16:10:13
+ * @LastEditTime: 2023-07-06 17:45:44
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/personnelSalaryBudget/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -78,6 +78,14 @@ const PersonnelSalaryBudget = () => {
                 return formatMoneyNumber(num)
             },
         },
+        {
+            title: '基金',
+            dataIndex: 'fundBonus',
+            key: 'fundBonus',
+            renderText(num, record, index, action) {
+                return formatMoneyNumber(num)
+            },
+        },
         {
             title: '固定工资',
             dataIndex: 'salary',

+ 32 - 18
src/pages/reportCheck/report/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-01-04 14:12:31
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-02 10:17:39
+ * @LastEditTime: 2023-07-12 16:25:52
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/oneBatch/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -12,7 +12,7 @@ import BMSPagecontainer from '@/components/BMSPageContainer'
 import { BMSTable } from '@/components/BMSTable';
 import { getComputeDate } from '@/pages/Home/service';
 import { ActionType, ProColumns } from '@ant-design/pro-components';
-import { Space, Dropdown, MenuProps } from 'antd';
+import { Space, Dropdown, MenuProps,DatePicker } from 'antd';
 import { useEffect, useRef, useState } from 'react';
 import { getData, getRedirReportData } from './service';
 
@@ -25,6 +25,10 @@ import { useLocation } from '@umijs/max';
 import exportTableToExcel from '@/utils/tableToExcel';
 
 
+import 'moment/locale/zh-cn';
+import locale from 'antd/es/date-picker/locale/zh_CN';
+import moment from 'moment';
+
 
 
 // const {search} = locatio
@@ -35,15 +39,13 @@ const ReportTemplate = () => {
 
   const { reportCode: urlReportCode } = useParams();
 
-  console.log({ urlReportCode });
-
   // const location = useLocation();
   // console.log({location});
   // const menuName = location.pathname.replace('/', '');
 
   const [tableColumn, set_tableColumn] = useState<ProColumns[] | any[]>([]);
 
-  const [tableData,set_tableData] = useState<any[]>([]);
+  const [tableData, set_tableData] = useState<any[]>([]);
 
   const [currentComputeDate, set_currentComputeDate] = useState<string | undefined>();
 
@@ -57,7 +59,7 @@ const ReportTemplate = () => {
 
   const [step, set_step] = useState(0);
 
-  const [reportName,set_reportName] = useState('')
+  const [reportName, set_reportName] = useState('')
 
 
   const reportJumphandle = (reportData: any) => {
@@ -123,7 +125,7 @@ const ReportTemplate = () => {
 
     if (resp) {
 
-      const { title, data: assignmentData,reportName } = resp;
+      const { title, data: assignmentData, reportName } = resp;
       set_reportName(reportName);
       const columns = title.map((item: any, index: number) => {
         return {
@@ -216,17 +218,17 @@ const ReportTemplate = () => {
   const exportHandle = () => {
 
     //const headers = { name: '姓名', age: '年龄', city: '城市' };
-    let headers:{[key:string]:any} = {};
-    let data:any[]= [];
-    tableColumn.forEach(a=>{
-        console.log({a});
-        if(a.hideInTable != 1){
-          headers[`${a.dataIndex}`] = a.title;
-        }
+    let headers: { [key: string]: any } = {};
+    let data: any[] = [];
+    tableColumn.forEach(a => {
+      console.log({ a });
+      if (a.hideInTable != 1) {
+        headers[`${a.dataIndex}`] = a.title;
+      }
     });
 
-    tableData.forEach(b=>{
-      let _temp:{[key:string]:any} = {};
+    tableData.forEach(b => {
+      let _temp: { [key: string]: any } = {};
       Object.keys(headers).forEach(key => {
         _temp[`${key}`] = b[`${key}`]
       });
@@ -238,7 +240,7 @@ const ReportTemplate = () => {
       ...data
     ];
 
-    exportTableToExcel(excelTableData,headers,reportName);
+    exportTableToExcel(excelTableData, headers, reportName);
   }
 
 
@@ -275,7 +277,19 @@ const ReportTemplate = () => {
 
 
   return (
-    <BMSPagecontainer className='ReportTemplate' title={`核算年月:${currentComputeDate}`}>
+    <BMSPagecontainer className='ReportTemplate' title={false}>
+      {currentComputeDate && (<div className='search'>
+        <span>核算年月:</span>
+        <DatePicker
+          onChange={(data, dateString) => {
+            set_tableDataFilterParams({ ...tableDataFilterParams, parameter: { ...tableDataFilterParams.parameter, compute_date: dateString } });
+          }}
+          allowClear={false}
+          picker='month'
+          locale={locale}
+          defaultValue={moment(currentComputeDate, 'YYYY-MM')}
+          format='YYYY-MM' placeholder="请选择核算年月" />
+      </div>)}
       <div className='export' onClick={() => exportHandle()}>导出</div>
       <div className='breadcrumb'>
         {

+ 102 - 53
src/pages/secondaryDistribute/secondaryDitriComputed/index.tsx

@@ -4,7 +4,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-16 09:42:52
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-25 10:19:04
+ * @LastEditTime: 2023-07-10 16:47:40
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -16,32 +16,66 @@ import BMSPagecontainer from '@/components/BMSPageContainer';
 import { useEffect, useRef, useState } from 'react';
 import './style.less';
 
-import { TreeProps, Input, Modal, message, Popover, Table, Switch, Tooltip } from 'antd';
+import { TreeProps, Input, Modal, message, Popover, Table, Switch, Tooltip, DatePicker, ConfigProvider } from 'antd';
 import { DataNode } from 'antd/es/tree';
 
 import expandedIcon from '../../../../static/treenode_open.png';
 import closeIcon from '../../../../static/treenode_collapse.png';
 import { BMSTable } from '@/components/BMSTable';
-import { ActionType, ProColumns, ProFormDigit, ProFormInstance } from '@ant-design/pro-components';
+import { ActionType, ProColumns, ProFormDatePicker, ProFormDigit, ProFormInstance, ProFormSelect } from '@ant-design/pro-components';
 import { createFromIconfontCN } from '@ant-design/icons';
 import { checkCurrentRequest, checkRequest, commitRequest, getCurrentCheckStatusReq, getCurrentCommitStatusReq, getCurrentUnitCheckStatusReq, getSecondaryDistriComputeTableData, getTreeData, getTreeDataRespType, save } from './service';
 
-import { getComputeDate } from '@/pages/Home/service';
 
+import { getComputeDate } from '@/pages/Home/service';
 
-import 'dayjs/locale/zh-cn';
 import React from 'react';
 import DirectoryTree from 'antd/es/tree/DirectoryTree';
 import { getDeepestTreeData } from '@/utils/tooljs';
 
 import { getCurrentCheckStatus } from '@/services/auth';
-import math, { sparse } from 'mathjs';
-import { useParams } from '@umijs/max';
+
 import { useLocation } from '@umijs/max';
 import { useAccess } from '@umijs/max';
-import { getParamsData } from '@/pages/setting/baseSetting/paramsMana/service';
 
+import { getParamsData } from '@/pages/setting/baseSetting/paramsMana/service';
 
+import 'moment/locale/zh-cn';
+import locale from 'antd/es/date-picker/locale/zh_CN';
+import moment from 'moment';
+
+
+const DatePickerLocale = {
+    lang: {
+      placeholder: '请选择日期',
+      rangePlaceholder: ['开始日期', '结束日期'],
+      today: '今天',
+      now: '此刻',
+      backToToday: '回到今天',
+      ok: '确定',
+      clear: '清除',
+      month: '月',
+      year: '年',
+      timeSelect: '选择时间',
+      dateSelect: '选择日期',
+      weekSelect: '选择周',
+      monthSelect: '选择月份',
+      yearSelect: '选择年份',
+      decadeSelect: '选择十年',
+      yearFormat: 'YYYY',
+      dateFormat: 'M/D/YYYY',
+      dayFormat: 'D',
+      dateTimeFormat: 'M/D/YYYY HH:mm:ss',
+      monthFormat: 'MMMM',
+      weekFormat: 'wo',
+      quarterFormat: '[Q]Q-YYYY',
+      // 其他翻译...
+    },
+    timePickerLocale: {
+      placeholder: '请选择时间',
+      // 其他翻译...
+    },
+  };
 
 
 const SearchIcon = createFromIconfontCN({
@@ -49,7 +83,6 @@ const SearchIcon = createFromIconfontCN({
 });
 
 
-
 export type TableListItem = {
     key: number;
     name: string;
@@ -82,7 +115,7 @@ const SecondaryDitriComputed: React.FC = () => {
 
     const [auditType, set_auditType] = useState('0');  //审核状态
 
-    const [currentUnitAuditType,set_currentUnitAuditType] = useState('0'); //当前单元审核状态
+    const [currentUnitAuditType, set_currentUnitAuditType] = useState('0'); //当前单元审核状态
 
     const tableRef = useRef<ActionType>();
 
@@ -130,8 +163,10 @@ const SecondaryDitriComputed: React.FC = () => {
                 set_currentSelectedTreeNode(node);
             }
         } else {
-            Modal.confirm({ title: '提示', content: '当前存在编辑未保存,请先保存!',okText: '确定',
-            cancelText: '取消', })
+            Modal.confirm({
+                title: '提示', content: '当前存在编辑未保存,请先保存!', okText: '确定',
+                cancelText: '取消',
+            })
         }
 
 
@@ -151,8 +186,8 @@ const SecondaryDitriComputed: React.FC = () => {
     }
 
     const getCurrentUnitCheckStatus = async () => {
-        if(currentSelectedTreeNode){
-            const resp = await getCurrentUnitCheckStatusReq(currentComputeDate as string,currentSelectedTreeNode.code);
+        if (currentSelectedTreeNode) {
+            const resp = await getCurrentUnitCheckStatusReq(currentComputeDate as string, currentSelectedTreeNode.code);
             set_currentUnitAuditType(`${resp}`);  //0 未审核 1 已审核
         }
     }
@@ -304,7 +339,7 @@ const SecondaryDitriComputed: React.FC = () => {
 
         const compeltedTotal = data.reduce((prev: any, cur: any) => prev + cur.totalScore, 0);
         const leftTotal = resp.totalBonus - compeltedTotal;
-        set_pageData({ ...pageData, total: resp.totalBonus.toFixed(2), completedTotal: compeltedTotal.toFixed(2), leftTotal: Number(leftTotal.toFixed(2)) });
+        set_pageData({ ...pageData, total: resp.totalBonus?resp.totalBonus.toFixed(2):0, completedTotal: compeltedTotal.toFixed(2), leftTotal: Number(leftTotal.toFixed(2)) });
 
         set_dataSource(data)
     }
@@ -313,21 +348,21 @@ const SecondaryDitriComputed: React.FC = () => {
         // type 1 当前 2 全部
         //检查当前单元是否提交
         if (type == 1) {
-             //currentUnitAuditType == 1 时是取消操作无需校验
-            return currentUnitAuditType == '1'?true:currentSelectedTreeNode.map
+            //currentUnitAuditType == 1 时是取消操作无需校验
+            return currentUnitAuditType == '1' ? true : currentSelectedTreeNode.map
         }
-        if (type == 2&&auditType == '0') {
+        if (type == 2 && auditType == '0') {
             //auditType == 1 时是取消操作无需校验
             interface Node {
                 map: boolean;
                 child?: Node[];
             }
-    
+
             function filterNodes(node: Node): Node | null {
                 if (node.map === false && (!node.child || node.child.length === 0)) {
                     return node; // 如果节点map为false并且是叶子节点,返回该节点
                 }
-    
+
                 if (Array.isArray(node.child)) {
                     // 对每个子节点递归执行此过程
                     let child = node.child.map(filterNodes).filter((n): n is Node => n !== null);
@@ -336,7 +371,7 @@ const SecondaryDitriComputed: React.FC = () => {
                         return { ...node, child: child };
                     }
                 }
-    
+
                 // 如果节点map为true,或者所有子节点的map都为true,返回null
                 return null;
             }
@@ -344,10 +379,10 @@ const SecondaryDitriComputed: React.FC = () => {
             const result = treeData.map(a => {
                 return filterNodes(a);
             });
-            
+
             return result.length == 0
-           
-        }else{
+
+        } else {
             return true
         }
     }
@@ -359,18 +394,18 @@ const SecondaryDitriComputed: React.FC = () => {
          * 提交界面不需要type
          */
 
-        const handle = async (ifCheckCommit:string) => {
+        const handle = async (ifCheckCommit: string) => {
             if (type == 1) {
                 //审核单个
                 const resp = await checkCurrentRequest({
                     computeDate: currentComputeDate as string,
                     auditType: currentUnitAuditType == '1' ? '0' : '1',  //1 审核 0 取消审核
                     unitCode: currentSelectedTreeNode.code,
-                    type:ifCheckCommit
+                    type: ifCheckCommit
                 });
                 if (resp) {
                     message.success('操作成功!');
-                    getTreeReqFunc(currentComputeDate as string,ifCheckPage?'1':'0');
+                    getTreeReqFunc(currentComputeDate as string, ifCheckPage ? '1' : '0');
                     getCurrentUnitCheckStatus();
                 }
             }
@@ -379,11 +414,11 @@ const SecondaryDitriComputed: React.FC = () => {
                 const resp = await checkRequest({
                     computeDate: currentComputeDate as string,
                     auditType: auditType == '1' ? '0' : '1',  //1 审核 0 取消审核
-                    type:ifCheckCommit
+                    type: ifCheckCommit
                 });
                 if (resp) {
                     message.success('操作成功!');
-                    getTreeReqFunc(currentComputeDate as string,ifCheckPage?'1':'0');
+                    getTreeReqFunc(currentComputeDate as string, ifCheckPage ? '1' : '0');
                     getCheckStatus(currentComputeDate as string);
                 }
             }
@@ -440,7 +475,7 @@ const SecondaryDitriComputed: React.FC = () => {
                         });
                         if (resp) {
                             message.success('提交成功!');
-                            getTreeReqFunc(currentComputeDate as string,ifCheckPage?'1':'0');
+                            getTreeReqFunc(currentComputeDate as string, ifCheckPage ? '1' : '0');
                             getCurrentCommitStatus();
                         }
                     }
@@ -556,8 +591,8 @@ const SecondaryDitriComputed: React.FC = () => {
     generateList(treeData as any);
 
 
-    const getTreeReqFunc = async (computeDate: string,type:string) => {
-        const resp = await getTreeData(computeDate,type);
+    const getTreeReqFunc = async (computeDate: string, type: string) => {
+        const resp = await getTreeData(computeDate, type);
         set_treeData(resp);
         set_treeDataDefault(resp);
     }
@@ -576,10 +611,10 @@ const SecondaryDitriComputed: React.FC = () => {
         }, 0)
     }
 
-    const computeHandle = ()=>{
+    const computeHandle = () => {
         Modal.confirm({
-            title:'注意',
-            content:'重新计算会覆盖原有数据,确定要继续计算操作?'
+            title: '注意',
+            content: '重新计算会覆盖原有数据,确定要继续计算操作?'
         })
     }
 
@@ -595,9 +630,9 @@ const SecondaryDitriComputed: React.FC = () => {
     useEffect(() => {
 
         if (currentComputeDate) {
-            getTreeReqFunc(currentComputeDate,ifCheckPage?'1':'0');
+            getTreeReqFunc(currentComputeDate, ifCheckPage ? '1' : '0');
             getCheckStatus(currentComputeDate);
-            
+
         }
     }, [currentComputeDate]);
 
@@ -609,7 +644,7 @@ const SecondaryDitriComputed: React.FC = () => {
             if (!ifCheckPage) {
                 getCurrentCommitStatus();
             }
-            if(ifCheckPage){
+            if (ifCheckPage) {
                 getCurrentUnitCheckStatus();
             }
 
@@ -717,13 +752,14 @@ const SecondaryDitriComputed: React.FC = () => {
 
 
     return (
+        
         <div className='SecondaryDitriComputed'>
             {
                 treeFilterVisible && (
                     <div className='selecterList'>
                         <div onClick={() => changeTreeDataFilter({ name: '全部单元', code: 0 })} className={currentTreeDataFilter.code == 0 ? 'list on' : 'list'}>全部单元</div>
-                        <div onClick={() => changeTreeDataFilter({ name: ifCheckPage?'未审核':'未提交', code: 1 })} className={currentTreeDataFilter.code == 1 ? 'list on' : 'list'}>{ifCheckPage?'未审核':'未提交'}</div>
-                        <div onClick={() => changeTreeDataFilter({ name: ifCheckPage?'已审核':'已提交', code: 2 })} className={currentTreeDataFilter.code == 2 ? 'list on' : 'list'}>{ifCheckPage?'已审核':'已提交'}</div>
+                        <div onClick={() => changeTreeDataFilter({ name: ifCheckPage ? '未审核' : '未提交', code: 1 })} className={currentTreeDataFilter.code == 1 ? 'list on' : 'list'}>{ifCheckPage ? '未审核' : '未提交'}</div>
+                        <div onClick={() => changeTreeDataFilter({ name: ifCheckPage ? '已审核' : '已提交', code: 2 })} className={currentTreeDataFilter.code == 2 ? 'list on' : 'list'}>{ifCheckPage ? '已审核' : '已提交'}</div>
                     </div>
                 )
             }
@@ -804,14 +840,21 @@ const SecondaryDitriComputed: React.FC = () => {
             </div>
             {/* <div style={{width:16,height:'92vh',background:'#F5F7FA'}}></div> */}
             <div className='rightContent'>
-                <BMSPagecontainer title={`核算年月:${currentComputeDate}`} ghost>
+                <BMSPagecontainer title={false} ghost>
                     <div className='tabContent'>
                         <div className='tableToolbar'>
-                            <div className='search'>
-                                <span className='total'>可分配总额: <i>{pageData.total}</i></span>
-                                <span className='compelted'>已分配总额: <i>{pageData.completedTotal}</i></span>
-                                <span className='left'>剩余分配总额: <i>{pageData.leftTotal}</i></span>
-                            </div>
+                            {currentComputeDate && (<div className='search'>
+                                <span>核算年月:</span>
+                                    <DatePicker
+                                        onChange={(data, dateString) => {
+                                            set_currentComputeDate(dateString);
+                                        }}
+                                        allowClear={false}
+                                        picker='month'
+                                        locale={locale}
+                                        defaultValue={moment(currentComputeDate,'YYYY-MM')} 
+                                        format='YYYY-MM' placeholder="请选择核算年月" />
+                            </div>)}
 
                             <div className='btnGroupWrap'>
                                 {
@@ -827,10 +870,10 @@ const SecondaryDitriComputed: React.FC = () => {
                                                     onMouseEnter={() => auditType == '0' ? commitStatus == '1' ? set_ifShowTip(true) : set_ifShowTip(false) : set_ifShowTip(true)}
                                                     onMouseLeave={() => set_ifShowTip(false)}
                                                 >
-                                                    {!ifEditMode && <span  className='compute cancel' onClick={commitStatus == '0' && auditType != '1' ? () => computeHandle() : () => { }}>计算</span>}
-                                                    {!ifEditMode && <span  className='cancel' onClick={commitStatus == '0' && auditType != '1' ? () => set_ifEditMode(true) : () => { }}>编辑</span>}
-                                                    {ifEditMode && <span  className='cancel' onClick={commitStatus == '0' ? () => set_ifEditMode(false) : () => { }}>取消</span>}
-                                                    {ifEditMode && <span  className='editBtn' onClick={commitStatus == '0' && auditType != '1' ? () => saveHandle() : () => { }}>保存</span>}
+                                                    {!ifEditMode && <span className='compute cancel' onClick={commitStatus == '0' && auditType != '1' ? () => computeHandle() : () => { }}>计算</span>}
+                                                    {!ifEditMode && <span className='cancel' onClick={commitStatus == '0' && auditType != '1' ? () => set_ifEditMode(true) : () => { }}>编辑</span>}
+                                                    {ifEditMode && <span className='cancel' onClick={commitStatus == '0' ? () => set_ifEditMode(false) : () => { }}>取消</span>}
+                                                    {ifEditMode && <span className='editBtn' onClick={commitStatus == '0' && auditType != '1' ? () => saveHandle() : () => { }}>保存</span>}
 
                                                 </div>
                                             </Popover>
@@ -841,8 +884,8 @@ const SecondaryDitriComputed: React.FC = () => {
                                 {
                                     ifCheckPage && userFunctionInThispage && (userFunctionInThispage.findIndex((a: { code: string, name: string }) => a.code == 'audit') != -1) && (
                                         <>
-                                            <div  className={'commit gray'} onClick={() => commitBtnhandle(1)}>{currentUnitAuditType == '1' ? '取消审核单个' : '审核单个'}</div>
-                                            <div  className={'commit'} onClick={() => commitBtnhandle(2)}>{auditType == '1' ? '取消审核全部' : '审核全部'}</div>
+                                            <div className={'commit gray'} onClick={() => commitBtnhandle(1)}>{currentUnitAuditType == '1' ? '取消审核单个' : '审核单个'}</div>
+                                            <div className={'commit'} onClick={() => commitBtnhandle(2)}>{auditType == '1' ? '取消审核全部' : '审核全部'}</div>
                                         </>
                                     )
                                 }
@@ -850,7 +893,12 @@ const SecondaryDitriComputed: React.FC = () => {
                             </div>
 
                         </div>
-                        {currentSelectedTreeNode && <BMSTable params={empFilterParams} pagination={false} actionRef={tableRef} rowKey='id'
+                        <div className='info'>
+                            <span className='total'>可分配总额: <i>{pageData.total}</i></span>
+                            <span className='compelted'>已分配总额: <i>{pageData.completedTotal}</i></span>
+                            <span className='left'>剩余分配总额: <i>{pageData.leftTotal}</i></span>
+                        </div>
+                        {currentSelectedTreeNode && <BMSTable pagination={false} actionRef={tableRef} rowKey='id'
                             scroll={{ x: 120 * tableColumn.length, y: tableH }}
                             columns={[...tableColumn]} dataSource={dataSource}
                             summary={(pageData) => {
@@ -896,6 +944,7 @@ const SecondaryDitriComputed: React.FC = () => {
                 </BMSPagecontainer>
             </div >
         </div >
+        
     );
 
 };

+ 75 - 68
src/pages/secondaryDistribute/secondaryDitriComputed/style.less

@@ -211,7 +211,7 @@
                 flex-direction: row;
                 justify-content: space-between;
                 align-items: center;
-                margin-top: 16px;
+                margin-top: 0px;
                 margin-bottom: 16px;
 
                 .search {
@@ -220,75 +220,11 @@
                     justify-content: flex-start;
                     align-items: center;
 
-                    span {
-                        font-size: 14px;
-                        font-family: SourceHanSansCN-Normal, SourceHanSansCN;
-                        font-weight: 400;
-                        color: #17181A;
-                        margin-right: 24px;
-
-                        &.total {
-                            i {
-                                font-style: normal;
-                                font-size: 14px;
-                                font-family: SourceHanSansCN-Medium, SourceHanSansCN;
-                                font-weight: 500;
-                                color: #17181A;
-                            }
-                        }
-
-                        &.compelted {
-                            i {
-                                font-style: normal;
-                                font-size: 14px;
-                                font-family: SourceHanSansCN-Medium, SourceHanSansCN;
-                                font-weight: 500;
-                                color: #2E6BE6;
-                            }
-
-                            &::before {
-                                position: relative;
-                                top: 2px;
-                                display: inline-block;
-                                content: '';
-                                width: 12px;
-                                height: 12px;
-                                margin-right: 4px;
-                                background: url('../../../../static//bingzhuantu.png');
-                                background-size: cover;
-
-                            }
-                        }
-
-                        &.left {
-                            i {
-                                font-style: normal;
-                                font-size: 14px;
-                                font-family: SourceHanSansCN-Medium, SourceHanSansCN;
-                                font-weight: 500;
-                                color: #14CC8F;
-                            }
-
-                            &::before {
-                                position: relative;
-                                top: 2px;
-                                display: inline-block;
-                                content: '';
-                                width: 12px;
-                                height: 12px;
-                                margin-right: 4px;
-                                background: url('../../../../static/bingzhuantu_green.png');
-                                background-size: cover;
-
-                            }
-                        }
-
-                        &:last-child {
-                            margin-right: 0;
-                        }
-                    }
+                    
                 }
 
+                
+
                 .btnGroupWrap {
                     display: flex;
                     flex-direction: row;
@@ -369,6 +305,77 @@
                 }
 
             }
+
+            .info {
+                margin-bottom: 16px;
+                span {
+                    font-size: 14px;
+                    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+                    font-weight: 400;
+                    color: #17181A;
+                    margin-right: 24px;
+
+                    &.total {
+                        i {
+                            font-style: normal;
+                            font-size: 14px;
+                            font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+                            font-weight: 500;
+                            color: #17181A;
+                        }
+                    }
+
+                    &.compelted {
+                        i {
+                            font-style: normal;
+                            font-size: 14px;
+                            font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+                            font-weight: 500;
+                            color: #2E6BE6;
+                        }
+
+                        &::before {
+                            position: relative;
+                            top: 2px;
+                            display: inline-block;
+                            content: '';
+                            width: 12px;
+                            height: 12px;
+                            margin-right: 4px;
+                            background: url('../../../../static//bingzhuantu.png');
+                            background-size: cover;
+
+                        }
+                    }
+
+                    &.left {
+                        i {
+                            font-style: normal;
+                            font-size: 14px;
+                            font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+                            font-weight: 500;
+                            color: #14CC8F;
+                        }
+
+                        &::before {
+                            position: relative;
+                            top: 2px;
+                            display: inline-block;
+                            content: '';
+                            width: 12px;
+                            height: 12px;
+                            margin-right: 4px;
+                            background: url('../../../../static/bingzhuantu_green.png');
+                            background-size: cover;
+
+                        }
+                    }
+
+                    &:last-child {
+                        margin-right: 0;
+                    }
+                }
+            }
         }
     }
 }

+ 2 - 2
src/pages/setting/baseSetting/jobCateBaseSet/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-07-06 17:23:30
+ * @LastEditTime: 2023-07-14 14:13:58
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -100,7 +100,7 @@ export default function JobCateBaseSet() {
             //render: (_: any, record: any) => <EditableCell _={_} record={record} keyStr='workPercent' />
         },
         {
-            title: '岗值系数',
+            title: '岗位系数奖金',
             dataIndex: 'defaultPositionRate',
             valueType:'digit'
             //render: (_: any, record: any) => <EditableCell _={_} record={record} keyStr='workPercent' />

+ 2 - 1
src/pages/setting/baseSetting/paramsMana/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-06 09:29:08
+ * @LastEditTime: 2023-07-12 16:59:31
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -58,6 +58,7 @@ export default function ParamsMana() {
         {
             title: '启用',
             dataIndex: 'status', 
+            width:80,
             render: (_: any, record: any) => {
                   return _ == 1?'是':'否'
             } 

+ 3 - 3
src/pages/setting/baseSetting/positionLevelRateSet/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-15 18:28:33
+ * @LastEditTime: 2023-07-19 09:33:25
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -145,8 +145,8 @@ export default function PositionLevelRateSet() {
             const resp = await getPositionDicData();
             if (resp) {
 
-                const defaultSelctedkeys = record.position.map((item: any) => item.code);
-                set_datasource([...resp,...record.position]);
+                const defaultSelctedkeys = record.position?record.position.map((item: any) => item.code):[];
+                set_datasource([...resp,...(record.position?record.position:[])]);
                 setTargetKeys(defaultSelctedkeys);
 
             }

+ 9 - 2
src/pages/setting/checkUnitSet/checkUnitEmpSet/index.tsx

@@ -4,7 +4,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2022-12-16 09:42:52
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-15 17:48:12
+ * @LastEditTime: 2023-07-19 10:30:59
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -231,7 +231,14 @@ const CheckUnitDepMap: React.FC = () => {
             const resp = await getMapEmpList();
             if (resp) {
                 
-                const defaultSelctedkeys = tableData.map((item: any) => item.userId);
+                let defaultSelctedkeys:string[] = [];
+
+                const resp2:any = await getTableData('CHARGE',{pageSize:500,current:1},{},{});
+
+                if(resp2){
+                    defaultSelctedkeys = resp2.data.map((item: any) => item.userId);
+                    console.log({defaultSelctedkeys,resp2});
+                }
         
                 set_datasource([...resp,...tableData]);
 

+ 4 - 3
src/pages/setting/checkUnitSet/medicalGroupSet/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-05-30 11:04:19
+ * @LastEditTime: 2023-07-07 14:26:29
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -324,6 +324,7 @@ const MedicalGroupSet = () => {
                         },
                     }}
                     rowKey='userId'
+                  
                     tableAlertRender={false}
                     rowSelection={{
                         // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
@@ -331,9 +332,9 @@ const MedicalGroupSet = () => {
                         selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
                         onChange: onSelectChange,
                     }}
-                    pagination={{ showSizeChanger: false, pageSize: 10, simple: true, showTitle: false }}
+                    pagination={{ showSizeChanger: false, pageSize:10, simple: true, showTitle: false }}
                     dataSource={showList}
-                />
+                />                
                 <div className='footer'>
                     <span className='cancel' onClick={() => set_ifShowModal(false)}>取消</span>
                     <span className='ok' onClick={() => save()}>{`确认(${selectedKeys.length > 0 && selectedKeys.length})`}</span>

+ 0 - 1
src/pages/setting/checkUnitSet/medicalGroupSet/style.less

@@ -10,7 +10,6 @@
             display: flex;
             flex-direction:row;
             justify-content: flex-end;
-            margin-bottom:-10px;
             margin-top: 15px;
             span {
                 display: inline-block;

+ 2 - 2
src/pages/setting/manaPerformanceSet/indicGroupWeightSet/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-07-06 14:37:54
+ * @LastEditTime: 2023-07-07 14:42:01
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -485,7 +485,7 @@ export default function IndicGroupWeightSet() {
 
             <ModalForm
                 title={title()}
-                width={352}
+                width={356}
                 className='IndicGroupWeightSet-ModalForm'
                 initialValues={type == 'EDIT'? { ...record } :type == 'INDICATOR'?{...indicatorIniData}:{}}
                 formRef={formRef}

+ 5 - 4
src/pages/setting/manaPerformanceSet/unitIndicTargetSet/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-13 10:17:51
+ * @LastEditTime: 2023-07-06 19:56:49
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -53,7 +53,6 @@ const UnitIndicTargetSet = () => {
 
     const getTableData = async (params: any) => {
         const { groupId } = params;
-        console.log({ params });
         if (groupId) {
             const resp = await getUnitIndicTargetTableData(params);
             if (resp) {
@@ -75,11 +74,13 @@ const UnitIndicTargetSet = () => {
                 set_tableColumn([{
                     title: '核算单元',
                     dataIndex: 'unitName',
+                    fixed:'left'
 
                 }, ...columns, {
                     title: '操作',
                     key: 'option',
                     width: 120,
+                    fixed:'right',
                     valueType: 'option',
                     render: (_: any, record: any) => {
                         return [
@@ -105,7 +106,7 @@ const UnitIndicTargetSet = () => {
 
                     return { ...item, ...rowData, columns }
                 });
-                console.log({data});
+    
                 return {
                     data,
                     success: true
@@ -477,7 +478,7 @@ const UnitIndicTargetSet = () => {
                     </div>
                 </div>
                 <div style={{ marginTop: 16 }}>
-                    {currentSelectedType && <BMSTable actionRef={tableRef} columns={tableColumn} rowKey='unitCode' params={tableDataFilterParams} request={(params) => getTableData(params)} />}
+                    {currentSelectedType && <BMSTable scroll={{x:872}} actionRef={tableRef} columns={tableColumn} rowKey='unitCode' params={tableDataFilterParams} request={(params) => getTableData(params)} />}
                 </div>
             </div>
         </BMSPagecontainer>

+ 1 - 1
src/pages/setting/projectSetting/checkUnitProjectSet/style.less

@@ -4,7 +4,7 @@
          display: flex;
          flex-direction:row;
          justify-content: flex-end;
-         margin-bottom:-10px;
+        //  margin-bottom:-10px;
          margin-top: 15px;
          span {
              display: inline-block;

+ 2 - 2
src/pages/setting/projectSetting/costIncomeProjectSet/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-07-06 14:32:51
+ * @LastEditTime: 2023-07-06 19:58:46
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -355,7 +355,7 @@ export default function CostIncomeProjectSet() {
                                 rules={[{ required: true, message: '类型不能为空!' }]}
                             />
                             {
-                                ((record&&!record.children && type == 'EDIT') || !record)&& (
+                                ((record&&!record.children && type == 'EDIT') || type == 'ADD')&& (
                                     <ProFormRadio.Group
                                         name="summaryFlag"
                                         label="汇总:"

+ 12 - 2
src/pages/setting/projectSetting/secondaryProjectDistribute/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-05-30 11:10:59
+ * @LastEditTime: 2023-07-19 10:52:42
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -16,7 +16,7 @@ import { getComputeDate } from '@/pages/Home/service';
 import { getDataByKeyFromDic, getPubDicData } from '@/services/getDic';
 import { createFromIconfontCN } from '@ant-design/icons';
 
-import { ActionType, ProFormRadio } from '@ant-design/pro-components';
+import { ActionType, ProForm, ProFormRadio } from '@ant-design/pro-components';
 import { ModalForm, ProFormCascader, ProFormDependency, ProFormDigit, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-form'
 import { ProColumns } from '@ant-design/pro-table';
 import { Input, message, Popconfirm } from 'antd';
@@ -201,6 +201,16 @@ export default function BilingProjectMana() {
                     ]}
                     rules={[{ required: true, message: '评价方式不能为空!' }]}
                 />
+                <ProFormDependency name={['evaluation']}>
+                     {
+                        ({evaluation})=> evaluation == 1&&(
+                            <div style={{display:'flex',flexDirection:'row',justifyContent:'space-between'}}>
+                                  <ProFormDigit name="count" label="评分下限:" colProps={{span:12}} rules={[{ required: true, message: '评价下限不能为空!' }]} />
+                                  <ProFormDigit name="count" label="评分上限:" colProps={{span:12}} rules={[{ required: true, message: '评价上限不能为空!' }]}/>
+                            </div>
+                        )
+                     }
+                </ProFormDependency>
                 <ProFormRadio.Group
                     name="dataType"
                     label="数据格式:"

+ 3 - 3
src/pages/setting/reportSet/diySqlMana/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-05-30 11:28:36
+ * @LastEditTime: 2023-07-13 15:06:40
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -115,7 +115,7 @@ export default function DiySqlMana() {
                 sqlCode: formVal.sqlCode,
                 sql: formVal.sql,
                 sqlDefinition: formVal.sqlDefinition,
-                sqlType: formVal.sqlType.value,
+                sqlType: formVal.sqlType,
                 sort: formVal.sort
             });
             if (resp) {
@@ -188,7 +188,7 @@ export default function DiySqlMana() {
                         }
                     }}
                     fieldProps={{
-                        labelInValue: true
+                        // labelInValue: true
                     }}
                     rules={[{ required: true, message: '类型不能为空!' }]}
                 />

+ 4 - 2
src/pages/setting/reportSet/reportListMana/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-07-06 14:36:01
+ * @LastEditTime: 2023-07-14 10:40:37
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -114,11 +114,13 @@ export default function ReportListMana() {
         {
             title: '列名称',
             dataIndex: 'name',
+            ellipsis:true
             // render:(_:any)=>_ == 1?'指标':'自定义SQL'
         },
         {
             title: '列标题',
             dataIndex: 'headerText',
+            ellipsis:true
             // render:(_:any)=>_ == 1?'指标':'自定义SQL'
         },
     ]
@@ -526,7 +528,7 @@ export default function ReportListMana() {
                     style={{ marginBottom: 8 }}
                     onChange={(e) => {
                         if (e.target.value.length != 0) {
-                            const result = datasource.filter(item => item.name.indexOf(e.target.value) != -1);
+                            const result = datasource.filter(item => item.headerText.indexOf(e.target.value) != -1);
                             set_showList(result);
                         } else {
                             set_showList(datasource);

+ 3 - 1
src/pages/setting/reportSet/reportSetting/index.tsx

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-03-03 11:30:33
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-15 18:04:31
+ * @LastEditTime: 2023-07-07 13:46:13
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -419,6 +419,7 @@ const ReportSetting = () => {
                             dataSource={filteredItems}
                             size="small"
                             rowKey={'code'}
+                            scroll={{y:830}}
                             tableAlertRender={false}
                             pagination={{simple:true,pageSize:9,showTotal:()=>false}}
                             style={{ pointerEvents: listDisabled ? 'none' : undefined }}
@@ -653,6 +654,7 @@ const ReportSetting = () => {
                 </div>
                 <div style={{ marginTop: 16 }}>
                     {currentSelectedType && <BMSTable actionRef={tableRef} columns={tableColumn}
+                        scroll={{y:500}}
                         rowKey='id' dataSource={dataSource}
                         pagination={false}
                         components={{

+ 61 - 17
src/utils/tableToExcel.ts

@@ -2,34 +2,78 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-05-31 11:18:30
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-06-06 15:40:21
+ * @LastEditTime: 2023-07-12 15:45:33
  * @FilePath: /BudgetManaSystem/src/utils/tableToExcel.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
-
 import * as XLSX from 'xlsx';
 import { saveAs } from 'file-saver';
+
 type DataType = { [key: string]: string | number | null };
 
-function exportTableToExcel(tableData: DataType[], headers: DataType, fileName = 'data') {
-    const headerValues = Object.values(headers);
-    const dataValues = tableData.map(row => Object.values(row));
+type Column = {
+  title: string;
+  dataIndex: string;
+  key: string;
+  children?: Column[];
+};
+
+type Merge = {
+  s: { r: number; c: number };
+  e: { r: number; c: number };
+};
+
+function getMerges(columns: Column[], startRow = 0, startCol = 0): Merge[] {
+  let merges: Merge[] = [];
+  let colIndex = startCol;
+
+  for (const column of columns) {
+    let endRow = startRow;
+    let endCol = colIndex;
+
+    if (column.children) {
+      // 如果有子列,递归处理子列
+      const childMerges = getMerges(column.children, startRow + 1, colIndex);
+      merges = merges.concat(childMerges);
+
+      // 计算结束列的位置
+      endCol += column.children.length - 1;
+    }
+
+    // 添加合并项
+    merges.push({ s: { r: startRow, c: colIndex }, e: { r: endRow, c: endCol } });
+
+    // 更新列索引
+    colIndex = endCol + 1;
+  }
+
+  return merges;
+}
+
+function exportTableToExcel(tableData: DataType[], columns: Column[], fileName = 'data') {
+  const dataValues = tableData.map(row => Object.values(row));
+
+  // 获取合并项
+  const merges = getMerges(columns);
+
+  // 创建一个新的工作簿
+  const wb = XLSX.utils.book_new();
 
-    // 创建一个新的工作簿
-    const wb = XLSX.utils.book_new();
+  // 将数据转化为工作表
+  const ws = XLSX.utils.aoa_to_sheet(dataValues);
 
-    // 将数据转化为工作表
-    const ws = XLSX.utils.aoa_to_sheet([headerValues, ...dataValues]);
+  // 设置合并项
+  ws['!merges'] = merges;
 
-    // 将工作表添加到工作簿中
-    XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
+  // 将工作表添加到工作簿中
+  XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
 
-    // 将工作簿转化为blob
-    const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
-    const blob = new Blob([wbout], { type: 'application/octet-stream' });
+  // 将工作簿转化为blob
+  const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
+  const blob = new Blob([wbout], { type: 'application/octet-stream' });
 
-    // 使用file-saver保存文件
-    saveAs(blob, `${fileName}.xls`);
+  // 使用file-saver保存文件
+  saveAs(blob, `${fileName}.xlsx`);
 }
 
-export default exportTableToExcel
+export default exportTableToExcel;

+ 277 - 0
src/utils/tableToMultiHeaderExcel.ts

@@ -0,0 +1,277 @@
+//exportTableToMultiExcel
+
+import * as XLSX from 'xlsx';
+import { saveAs } from 'file-saver';
+
+
+type DataType = { [key: string]: string | number | null };
+
+type Column = {
+    title: string;
+    dataIndex: string;
+    key: string;
+    children?: Column[];
+};
+
+type Merge = {
+    s: { r: number; c: number };
+    e: { r: number; c: number };
+};
+
+
+function getMaxDepth(columns: Column[]): number {
+    let maxDepth = 0;
+    for (const column of columns) {
+        if (column.children) {
+            // 如果有子列,递归计算子列的深度
+            const depth = 1 + getMaxDepth(column.children);
+            maxDepth = Math.max(maxDepth, depth);
+        } else {
+            // 如果没有子列,深度为1
+            maxDepth = Math.max(maxDepth, 1);
+        }
+    }
+    return maxDepth;
+}
+
+
+
+
+function processColumns(columns: Column[], startRow = 0, startCol = 0, maxDepth = 0): { headers: any[][], merges: Merge[] } {
+
+    console.log({ columns });
+
+    let headers: any[][] = Array.from({ length: maxDepth }, () => Array(columns.length).fill(''));
+    let merges: Merge[] = [];
+    let colIndex = startCol;
+
+    for (const column of columns) {
+        let endRow = startRow;
+        let endCol = colIndex;
+
+        if (column.children) {
+            const result = processColumns(column.children, startRow + 1, colIndex, maxDepth);
+
+            console.log({colIndex,result});
+            console.log({headers,column});
+            headers = headers.map((row, i) => {
+                if (i === startRow) {
+                    return [...row.slice(0, colIndex), ...result.headers[i], ...row.slice(colIndex + result.headers[i].length)];
+                } else {
+                    return [...row.slice(0, colIndex), ...result.headers[i].slice(colIndex, result.headers[i].length), ...row.slice(colIndex + result.headers[i].length)];
+                }
+            });
+            merges = [...merges, ...result.merges];
+            endCol += getAllColumns(column.children).length - 1;  // 根据所有子列的总数来更新 endCol
+            endRow = startRow;  // 父列的标题应该在子列标题的上一行
+        } else {
+            endRow = maxDepth - 1;
+        }
+
+        for (let i = startRow; i <= endRow; i++) {
+            headers[i][colIndex] = i === startRow ? column.title : '';
+        }
+
+        merges.push({ s: { r: startRow, c: colIndex }, e: { r: endRow, c: endCol } });
+        colIndex = endCol + 1;
+    }
+   
+    return { headers, merges };
+}
+
+
+function exportTableToMultiExcel(tableData: DataType[], columns: Column[], fileName = 'data', needSummary = false) {
+    const allColumns = getAllColumns(columns);  // 获取所有列(包括子列)
+
+    // 计算总结信息
+    const summary: DataType = {};
+    if (needSummary) {
+        allColumns.forEach(column => {
+            summary[column.dataIndex] = tableData.reduce((total, row) => {
+                if (typeof row[column.dataIndex] === 'number') {
+                    return total + (row[column.dataIndex] as number);
+                }
+                return total;
+            }, 0);
+        });
+        summary[allColumns[0].dataIndex] = '总计';  // 设置第一列的值为'总计'
+    }
+
+    const dataValues = [...tableData.map(row => {
+        const rowData = [];
+        for (const column of allColumns) {
+            rowData.push(row[column.dataIndex]);
+        }
+        return rowData;
+    }), needSummary ? Object.values(summary) : []];  // 如果需要汇总,那么在数据数组的末尾添加总结信息
+
+    const maxDepth = getMaxDepth(columns);
+    const { headers, merges } = processColumns(columns, 0, 0, maxDepth);
+    const wb = XLSX.utils.book_new();
+    const ws = XLSX.utils.aoa_to_sheet([...headers, ...dataValues]);
+
+    // 计算每一列的最大字符长度
+    const colWidths = allColumns.map((column, i) => {
+        let maxLength = column.title.length * 2; // 初始值设为列标题的长度的两倍
+        dataValues.forEach(row => {
+            const cellValue = row[i];
+            if (cellValue) {
+                const cellLength = cellValue.toString().length;
+                // 对于宽字符,使用较大的系数;对于窄字符,使用较小的系数
+                const cellWidth = /[\u4e00-\u9fa5]/.test(cellValue.toString()) ? cellLength * 2 : cellLength;
+                maxLength = Math.max(maxLength, cellWidth);
+            }
+        });
+        return { wch: maxLength };
+    });
+
+    // 设置每一列的宽度
+    ws['!cols'] = colWidths;
+
+    // 设置单元格样式为水平和垂直居中
+    const range = XLSX.utils.decode_range(ws['!ref'] as string);
+    for (let R = range.s.r; R <= range.e.r; ++R) {
+        for (let C = range.s.c; C <= range.e.c; ++C) {
+            const cell_address = { c: C, r: R };
+            const cell_ref = XLSX.utils.encode_cell(cell_address);
+            if (!ws[cell_ref]) ws[cell_ref] = {};
+            ws[cell_ref].s = {
+                alignment: {
+                    horizontal: 'center',
+                    vertical: 'center'
+                }
+            };
+        }
+    }
+
+    // 设置表头的背景色
+    for (let r = 0; r < maxDepth; r++) {
+        for (let c = 0; c < headers[r].length; c++) {
+            if (!ws[XLSX.utils.encode_cell({ r, c })]) {
+                ws[XLSX.utils.encode_cell({ r, c })] = {};
+            }
+            ws[XLSX.utils.encode_cell({ r, c })].s = {
+                fill: {
+                    fgColor: { rgb: "FFFF00" }  // 设置为黄色
+                },
+                alignment: {
+                    horizontal: 'center',
+                    vertical: 'center'
+                }
+            };
+        }
+    }
+
+    ws['!merges'] = merges;
+    XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
+    const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
+    const blob = new Blob([wbout], { type: 'application/octet-stream' });
+    saveAs(blob, `${fileName}.xlsx`);
+}
+
+
+
+
+function getAllColumns(columns: Column[]): Column[] {
+    let allColumns: Column[] = [];
+    for (const column of columns) {
+        if (column.children) {
+            allColumns = [...allColumns, ...getAllColumns(column.children)];
+        } else {
+            allColumns.push(column);
+        }
+    }
+    return allColumns;
+}
+
+export default exportTableToMultiExcel;
+
+
+
+const columns = [
+    {
+        dataIndex: "unitName",
+        ellipsis: true,
+        fixed: "left",
+        key: "unitName",
+        title: "核算单元",
+        width: 140
+    },
+    {
+        dataIndex: "key-23",
+        ellipsis: true,
+        key: "key-23",
+        title: "单元管理绩效",
+        width: 200
+    },
+    {
+        dataIndex: "key-1679019958216040448",
+        ellipsis: true,
+        key: "key-1679019958216040448",
+        title: "临床诊察积分奖金",
+        width: 200,
+        children: [
+            {
+                dataIndex: "key-6",
+                ellipsis: true,
+                key: "key-6",
+                title: "临床诊察积分-节假日奖金",
+                width: 200,
+                children: [
+                    {
+                        dataIndex: "key-4",
+                        ellipsis: true,
+                        key: "key-4",
+                        title: "临床诊察积分-节假日",
+                        width: 200
+                    },
+                    {
+                        dataIndex: "key-5",
+                        ellipsis: true,
+                        key: "key-5",
+                        title: "临床诊察积分-节假日点值",
+                        width: 200
+                    }
+                ]
+            },
+            {
+                dataIndex: "key-3",
+                ellipsis: true,
+                key: "key-3",
+                title: "临床诊察积分-工作日奖金",
+                width: 200,
+                children: [
+                    {
+                        dataIndex: "key-1",
+                        ellipsis: true,
+                        key: "key-1",
+                        title: "临床诊察积分-工作日",
+                        width: 200
+                    },
+                    {
+                        dataIndex: "key-2",
+                        ellipsis: true,
+                        key: "key-2",
+                        title: "临床诊察积分-工作日点值",
+                        width: 200
+                    }
+                ]
+            }
+        ]
+    },
+    {
+        dataIndex: "totalScore",
+        ellipsis: true,
+        fixed: "right",
+        key: "totalScore",
+        title: "总奖金",
+        width: 140
+    }
+]
+
+
+
+
+
+
+

+ 37 - 1
src/utils/tooljs.ts

@@ -2,7 +2,7 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-02-20 14:31:06
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-07-06 15:10:14
+ * @LastEditTime: 2023-07-11 13:50:30
  * @FilePath: /BudgetManaSystem/src/utils/tooljs.js
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -138,4 +138,40 @@ export const  findParentCodes = (node: TreeNode, parentCodes: string[] = []): st
 
 
 
+//将动态表头转换
+
+type JsonStructure = {
+  code: string;
+  name: string;
+  expand?: number;
+  childTitle?: JsonStructure[];
+};
+
+type Column = {
+  title: string;
+  dataIndex: string;
+  key: string;
+  children?: Column[];
+};
+ 
+export const  convertToColumns = (json: JsonStructure[]): Column[] => {
+  return json.map((item) => {
+    let column: Column = {
+      title: item.name,
+      dataIndex: item.code,
+      key: item.code,
+    };
+
+    if (item.expand === 1 && item.childTitle && item.childTitle.length > 0) {
+      column.children = convertToColumns(item.childTitle);
+    }
+
+    return column;
+  });
+}
+
+
+
+
+
 

文件差異過大導致無法顯示
+ 477 - 367
yarn.lock


部分文件因文件數量過多而無法顯示