code4eat 2 anni fa
parent
commit
ef94670591

+ 2 - 2
src/pages/secondaryDistribute/employeeInfoCheck/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-05-26 11:03:15
+ * @LastEditTime: 2023-05-26 13:12:21
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -567,7 +567,7 @@ const EmployeeInfoCheck: React.FC = () => {
                                         index > -1 ? (
                                             <span>
                                                 {beforeStr}
-                                                <span className="site-tree-search-value" style={{ color: 'red', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{searchValue}</span>
+                                                <span className="site-tree-search-value" style={{ color: '#3377ff', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{searchValue}</span>
                                                 {afterStr}
                                             </span>
                                         ) : (

+ 4 - 4
src/pages/secondaryDistribute/nonCheckProjectApprove/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-05-26 11:12:26
+ * @LastEditTime: 2023-05-26 13:30:29
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -480,7 +480,6 @@ const NonCheckProjectApprove: React.FC = () => {
 
     useEffect(() => {
         //初始化左侧树结构数据后
-
         if (treeData?.length > 0) {
             if (!currentSelectedTreeNode) {
                 if (treeData[0].child && treeData[0].child.length > 0) {
@@ -492,6 +491,7 @@ const NonCheckProjectApprove: React.FC = () => {
                 }
             }
         }
+
     }, [treeData]);
 
 
@@ -548,7 +548,7 @@ const NonCheckProjectApprove: React.FC = () => {
                                         index > -1 ? (
                                             <span>
                                                 {beforeStr}
-                                                <span className="site-tree-search-value" style={{ color: 'red', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{searchValue}</span>
+                                                <span className="site-tree-search-value" style={{ color: '#3377ff', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{searchValue}</span>
                                                 {afterStr}
                                             </span>
                                         ) : (
@@ -619,7 +619,7 @@ const NonCheckProjectApprove: React.FC = () => {
                             </div>
 
                         </div>
-                        {currentSelectedTreeNode && <BMSTable params={empFilterParams} pagination={false} actionRef={tableRef} rowKey='id' columns={commitStatus == '0' ? [...tableColumn, {
+                        {currentSelectedTreeNode && <BMSTable params={empFilterParams} actionRef={tableRef} rowKey='id' columns={commitStatus == '0' ? [...tableColumn, {
                             title: '操作',
                             key: 'option',
                             width:120,

+ 54 - 38
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-05-26 11:19:35
+ * @LastEditTime: 2023-05-26 13:28:53
  * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -39,6 +39,7 @@ import math, { sparse } from 'mathjs';
 import { useParams } from '@umijs/max';
 import { useLocation } from '@umijs/max';
 import { useAccess } from '@umijs/max';
+import { values } from 'lodash';
 
 
 
@@ -114,18 +115,18 @@ const SecondaryDitriComputed: React.FC = () => {
     ];
 
 
-    const onSelect: TreeProps['onSelect'] = (selectedKeys, info:any) => {
+    const onSelect: TreeProps['onSelect'] = (selectedKeys, info: any) => {
         // console.log('selected', selectedKeys, info);
-        if(!ifEditMode){
-             //编辑时,需要先保存后切换
-             const { node } = info;
-             if(!node.child){
-                 set_currentSelectedTreeNode(node);
-             }
-        }else{
-            Modal.confirm({title:'提示',content:'当前存在编辑未保存,请先保存!'})
+        if (!ifEditMode) {
+            //编辑时,需要先保存后切换
+            const { node } = info;
+            if (!node.child) {
+                set_currentSelectedTreeNode(node);
+            }
+        } else {
+            Modal.confirm({ title: '提示', content: '当前存在编辑未保存,请先保存!' })
         }
-        
+
 
     };
 
@@ -161,14 +162,45 @@ const SecondaryDitriComputed: React.FC = () => {
                 width: 120,
                 renderText: (_: any, record: any) => {
                     if (ifEditMode) {
+
+                        let _val = 0;
+
+                        const calcuFunc = (value:number)=>{
+                            const updatedUserList = needSaveData.userList.map((a: any) => {
+                                if (a.account == record.account) {
+                                    const arr = a.itemValue.map((b: any) => {
+                                        if (b.code == item.code) {
+                                            return { ...b, value: value ? value : 0 } //value有为undefined的可能
+                                        } else {
+                                            return b
+                                        }
+                                    });
+                                    return { ...a, itemValue: arr }
+                                } else {
+                                    return a
+                                }
+                            });
+
+                            set_needSaveData({ ...needSaveData, userList: updatedUserList })
+                        }
+
                         return <ProFormDigit noStyle min={-1000000000} fieldProps={{
                             ref: ref => {
                                 inputsRef.current[`${record.account}-${item.code}`] = ref;
                                 //console.log({ref});
                             },
-                            onPressEnter: (event) => {
+                            onBlur: () => {
+                                calcuFunc(_val);
+                            },
+                            onChange(value) {
+                                _val = value ? value : 0;
+                            },
+                            onPressEnter: (event: any) => {
                                 if (event.code === 'Enter') {
                                     event.preventDefault();
+
+                                    const value = event.target.value ? Number(event.target.value) : 0;
+                                    calcuFunc(value);
                                     const index = inputsRefKeys ? inputsRefKeys.findIndex(a => a == `${record.account}-${item.code}`) : -1;
                                     //console.log({index,input:inputsRef.current,inputsRefKeys});
                                     const nextInput = inputsRefKeys ? inputsRef.current[inputsRefKeys[index + 1]] : null;
@@ -179,26 +211,8 @@ const SecondaryDitriComputed: React.FC = () => {
                                 }
                             },
                             onFocus: () => set_currentInputRefKeys(`${record.account}-${item.code}`),
-                            defaultValue: _, onChange(value) {
-                                //if(!value)return;
-                                const updatedUserList = needSaveData.userList.map((a: any) => {
-                                    if (a.account == record.account) {
-                                        const arr = a.itemValue.map((b: any) => {
-                                            if (b.code == item.code) {
-                                                return { ...b, value: value ? value : 0 } //value有为undefined的可能
-                                            } else {
-                                                return b
-                                            }
-                                        });
-                                        return { ...a, itemValue: arr }
-                                    } else {
-                                        return a
-                                    }
-                                });
-
-                                set_needSaveData({ ...needSaveData, userList: updatedUserList })
+                            defaultValue: _,
 
-                            },
                         }} width={80} />
                     } else {
                         return <span style={{ display: 'inline-block', width: 80 }}>{_}</span>
@@ -328,14 +342,16 @@ const SecondaryDitriComputed: React.FC = () => {
                             getCurrentCommitStatus();
                         }
                     }
-    
+
                 })
             } else {
                 Modal.confirm({
-                    title: '提交时需有单元的剩余分配金额必须是0'
+                    title: '提交时需有单元的剩余分配金额必须是0',
+                    okText: '确定',
+                    cancelText: '取消',
                 })
             }
-            
+
         }
 
     }
@@ -588,7 +604,7 @@ const SecondaryDitriComputed: React.FC = () => {
                                         index > -1 ? (
                                             <span>
                                                 {beforeStr}
-                                                <span className="site-tree-search-value" style={{ color: 'red', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{searchValue}</span>
+                                                <span className="site-tree-search-value" style={{ color: '#3377ff', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{searchValue}</span>
                                                 {afterStr}
                                             </span>
                                         ) : (
@@ -646,12 +662,12 @@ const SecondaryDitriComputed: React.FC = () => {
                                                     onMouseEnter={() => auditType == '0' ? commitStatus == '1' ? set_ifShowTip(true) : set_ifShowTip(false) : set_ifShowTip(true)}
                                                     onMouseLeave={() => set_ifShowTip(false)}
                                                 >
-                                                    {!ifEditMode && <span key="1" className='editBtn' onClick={commitStatus == '0'&&auditType != '1' ? () => set_ifEditMode(true) : () => { }}>编辑</span>}
-                                                    {ifEditMode && <span key="2" className='editBtn' onClick={commitStatus == '0'&&auditType != '1' ? () => saveHandle() : () => { }}>保存</span>}
+                                                    {!ifEditMode && <span key="1" className='editBtn' onClick={commitStatus == '0' && auditType != '1' ? () => set_ifEditMode(true) : () => { }}>编辑</span>}
+                                                    {ifEditMode && <span key="2" className='editBtn' onClick={commitStatus == '0' && auditType != '1' ? () => saveHandle() : () => { }}>保存</span>}
                                                     {ifEditMode && <span key="3" className='cancel' onClick={commitStatus == '0' ? () => set_ifEditMode(false) : () => { }}>取消</span>}
                                                 </div>
                                             </Popover>
-                                            {!ifEditMode&&<div key="4" className={auditType == '1' ? 'commit disabled' : 'commit'} onClick={() => auditType == '0' ? commitBtnhandle() : () => { }}>{commitStatus == '1' ? '取消提交' : '提交'}</div>}
+                                            {!ifEditMode && <div key="4" className={auditType == '1' ? 'commit disabled' : 'commit'} onClick={() => auditType == '0' ? commitBtnhandle() : () => { }}>{commitStatus == '1' ? '取消提交' : '提交'}</div>}
                                         </>
                                     )
                                 }