|
@@ -4,7 +4,7 @@
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
* @Date: 2022-12-16 09:42:52
|
|
* @Date: 2022-12-16 09:42:52
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
- * @LastEditTime: 2023-05-26 13:28:53
|
|
|
|
|
|
+ * @LastEditTime: 2023-05-26 14:46:52
|
|
* @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
|
|
* @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
*/
|
|
@@ -163,26 +163,7 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
renderText: (_: any, record: any) => {
|
|
renderText: (_: any, record: any) => {
|
|
if (ifEditMode) {
|
|
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 })
|
|
|
|
- }
|
|
|
|
|
|
+ let _val = _;
|
|
|
|
|
|
return <ProFormDigit noStyle min={-1000000000} fieldProps={{
|
|
return <ProFormDigit noStyle min={-1000000000} fieldProps={{
|
|
ref: ref => {
|
|
ref: ref => {
|
|
@@ -190,7 +171,22 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
//console.log({ref});
|
|
//console.log({ref});
|
|
},
|
|
},
|
|
onBlur: () => {
|
|
onBlur: () => {
|
|
- calcuFunc(_val);
|
|
|
|
|
|
+ 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: _val ? _val : 0 } //value有为undefined的可能
|
|
|
|
+ } else {
|
|
|
|
+ return b
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return { ...a, itemValue: arr }
|
|
|
|
+ } else {
|
|
|
|
+ return a
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ set_needSaveData({ ...needSaveData, userList: updatedUserList })
|
|
},
|
|
},
|
|
onChange(value) {
|
|
onChange(value) {
|
|
_val = value ? value : 0;
|
|
_val = value ? value : 0;
|
|
@@ -200,7 +196,22 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
|
|
|
|
const value = event.target.value ? Number(event.target.value) : 0;
|
|
const value = event.target.value ? Number(event.target.value) : 0;
|
|
- calcuFunc(value);
|
|
|
|
|
|
+ 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 })
|
|
const index = inputsRefKeys ? inputsRefKeys.findIndex(a => a == `${record.account}-${item.code}`) : -1;
|
|
const index = inputsRefKeys ? inputsRefKeys.findIndex(a => a == `${record.account}-${item.code}`) : -1;
|
|
//console.log({index,input:inputsRef.current,inputsRefKeys});
|
|
//console.log({index,input:inputsRef.current,inputsRefKeys});
|
|
const nextInput = inputsRefKeys ? inputsRef.current[inputsRefKeys[index + 1]] : null;
|
|
const nextInput = inputsRefKeys ? inputsRef.current[inputsRefKeys[index + 1]] : null;
|
|
@@ -486,17 +497,12 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
} else { set_ifCheckPage(false); }
|
|
} else { set_ifCheckPage(false); }
|
|
}, [location])
|
|
}, [location])
|
|
|
|
|
|
- let timer: string | number | NodeJS.Timeout | undefined;
|
|
|
|
|
|
+
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- //根据输入行的值重新计算
|
|
|
|
- clearTimeout(timer);
|
|
|
|
- timer = setTimeout(function () {
|
|
|
|
- if (needSaveData) {
|
|
|
|
- buildTableData(needSaveData, inputsRefKeys);
|
|
|
|
- }
|
|
|
|
- }, 300); // 这里的 500 是防抖的时间,单位是毫秒
|
|
|
|
-
|
|
|
|
|
|
+ if (needSaveData) {
|
|
|
|
+ buildTableData(needSaveData, inputsRefKeys);
|
|
|
|
+ }
|
|
}, [needSaveData]);
|
|
}, [needSaveData]);
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -662,9 +668,10 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
onMouseEnter={() => auditType == '0' ? commitStatus == '1' ? set_ifShowTip(true) : set_ifShowTip(false) : set_ifShowTip(true)}
|
|
onMouseEnter={() => auditType == '0' ? commitStatus == '1' ? set_ifShowTip(true) : set_ifShowTip(false) : set_ifShowTip(true)}
|
|
onMouseLeave={() => set_ifShowTip(false)}
|
|
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='cancel' onClick={commitStatus == '0' && auditType != '1' ? () => set_ifEditMode(true) : () => { }}>编辑</span>}
|
|
{ifEditMode && <span key="3" className='cancel' onClick={commitStatus == '0' ? () => set_ifEditMode(false) : () => { }}>取消</span>}
|
|
{ifEditMode && <span key="3" className='cancel' onClick={commitStatus == '0' ? () => set_ifEditMode(false) : () => { }}>取消</span>}
|
|
|
|
+ {ifEditMode && <span key="2" className='editBtn' onClick={commitStatus == '0' && auditType != '1' ? () => saveHandle() : () => { }}>保存</span>}
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
</Popover>
|
|
</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>}
|