|
@@ -2,7 +2,7 @@
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
* @Date: 2023-01-04 14:12:31
|
|
* @Date: 2023-01-04 14:12:31
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
- * @LastEditTime: 2023-03-02 12:01:10
|
|
|
|
|
|
+ * @LastEditTime: 2023-03-02 16:06:48
|
|
* @FilePath: /BudgetManaSystem/src/pages/budgetMana/oneBatch/index.tsx
|
|
* @FilePath: /BudgetManaSystem/src/pages/budgetMana/oneBatch/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
|
|
*/
|
|
*/
|
|
@@ -22,9 +22,9 @@ import './style.less';
|
|
|
|
|
|
import { create, all } from 'mathjs'
|
|
import { create, all } from 'mathjs'
|
|
|
|
|
|
-const config = {
|
|
|
|
|
|
+const config = {
|
|
number: 'number',
|
|
number: 'number',
|
|
- precision:14
|
|
|
|
|
|
+ precision: 14
|
|
}
|
|
}
|
|
const math = create(all, config as any);
|
|
const math = create(all, config as any);
|
|
|
|
|
|
@@ -44,10 +44,12 @@ const OneBatch = () => {
|
|
|
|
|
|
const [auditType, set_auditType] = useState('0');
|
|
const [auditType, set_auditType] = useState('0');
|
|
|
|
|
|
- const [ifShowTip,set_ifShowTip] = useState(false);
|
|
|
|
|
|
+ const [ifShowTip, set_ifShowTip] = useState(false);
|
|
|
|
|
|
const tableRef = useRef<ActionType>();
|
|
const tableRef = useRef<ActionType>();
|
|
|
|
|
|
|
|
+ const [tableH, set_tableH] = useState(0);
|
|
|
|
+
|
|
|
|
|
|
const onTabChange = (activeKey: string) => {
|
|
const onTabChange = (activeKey: string) => {
|
|
set_currentTabKey(activeKey);
|
|
set_currentTabKey(activeKey);
|
|
@@ -147,10 +149,10 @@ const OneBatch = () => {
|
|
|
|
|
|
|
|
|
|
const confirmCaculateHandle = async () => {
|
|
const confirmCaculateHandle = async () => {
|
|
- const resp = await caculate(currentComputeDate as string);
|
|
|
|
- if(resp){
|
|
|
|
- tableRef.current?.reload();
|
|
|
|
- }
|
|
|
|
|
|
+ const resp = await caculate(currentComputeDate as string);
|
|
|
|
+ if (resp) {
|
|
|
|
+ tableRef.current?.reload();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
const generateFunc = () => {
|
|
const generateFunc = () => {
|
|
@@ -164,6 +166,19 @@ const OneBatch = () => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const handleResize = (e: any) => {
|
|
|
|
+ const wH = e.target.innerHeight;
|
|
|
|
+ const tableHeight = wH - 320;
|
|
|
|
+ set_tableH(tableHeight);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function doResize() {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ const ev: any = new Event('resize');
|
|
|
|
+ window.dispatchEvent(ev);
|
|
|
|
+ }, 0)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (currentComputeDate) {
|
|
if (currentComputeDate) {
|
|
@@ -174,18 +189,20 @@ const OneBatch = () => {
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
getCurrentComputeDate();
|
|
getCurrentComputeDate();
|
|
|
|
+ window.addEventListener('resize',(e)=>handleResize(e)) //监听窗口大小改变
|
|
|
|
+ doResize();
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
<BMSPagecontainer className='OneBatch' title={`核算年月:${currentComputeDate}`}>
|
|
<BMSPagecontainer className='OneBatch' title={`核算年月:${currentComputeDate}`}>
|
|
<div className='btnGroup'>
|
|
<div className='btnGroup'>
|
|
- <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} >
|
|
|
|
- <div className={auditType == '0'?'caculateBtn':'caculateBtn disabled'}
|
|
|
|
- onMouseEnter={()=>auditType == '0'?set_ifShowTip(false):set_ifShowTip(true)}
|
|
|
|
- onMouseLeave={()=>set_ifShowTip(false)}
|
|
|
|
- onClick={() => auditType == '0' ? generateFunc() : () => { }}>计算</div>
|
|
|
|
- </Popover>
|
|
|
|
|
|
+ <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} >
|
|
|
|
+ <div className={auditType == '0' ? 'caculateBtn' : 'caculateBtn disabled'}
|
|
|
|
+ onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
|
|
|
|
+ onMouseLeave={() => set_ifShowTip(false)}
|
|
|
|
+ onClick={() => auditType == '0' ? generateFunc() : () => { }}>计算</div>
|
|
|
|
+ </Popover>
|
|
<div className='checkBtn' onClick={() => checkHandle(`${auditType}`)}>{auditType == '0' ? '审核' : '取消审核'}</div>
|
|
<div className='checkBtn' onClick={() => checkHandle(`${auditType}`)}>{auditType == '0' ? '审核' : '取消审核'}</div>
|
|
</div>
|
|
</div>
|
|
<div className='content'>
|
|
<div className='content'>
|
|
@@ -214,7 +231,7 @@ const OneBatch = () => {
|
|
<div className='tabContent'>
|
|
<div className='tabContent'>
|
|
{currentComputeDate && <BMSTable actionRef={tableRef} rowKey='unitCode' pagination={false} columns={tableColumn as ProColumns[]}
|
|
{currentComputeDate && <BMSTable actionRef={tableRef} rowKey='unitCode' pagination={false} columns={tableColumn as ProColumns[]}
|
|
params={tableDataFilterParams}
|
|
params={tableDataFilterParams}
|
|
- scroll={{ x: 120 * 10, y: 500 }}
|
|
|
|
|
|
+ scroll={{ x: 120 * 10, y:tableH }}
|
|
request={(params, sort, filter) => getTableData(params, sort, filter)}
|
|
request={(params, sort, filter) => getTableData(params, sort, filter)}
|
|
|
|
|
|
summary={(pageData) => {
|
|
summary={(pageData) => {
|
|
@@ -224,14 +241,14 @@ const OneBatch = () => {
|
|
|
|
|
|
const total = pageData.reduce((prev, cur) => {
|
|
const total = pageData.reduce((prev, cur) => {
|
|
//return prev + cur[`${dataIndex}`]
|
|
//return prev + cur[`${dataIndex}`]
|
|
- if(typeof cur[`${dataIndex}`] == 'number'){
|
|
|
|
- return math.add(prev,cur[`${dataIndex}`] as number);
|
|
|
|
|
|
+ if (typeof cur[`${dataIndex}`] == 'number') {
|
|
|
|
+ return math.add(prev, cur[`${dataIndex}`] as number);
|
|
}
|
|
}
|
|
}, 0);
|
|
}, 0);
|
|
|
|
|
|
return (
|
|
return (
|
|
//<span>{typeof total == 'number'?math.format(total, {precision: 14}) : '合计'}</span>
|
|
//<span>{typeof total == 'number'?math.format(total, {precision: 14}) : '合计'}</span>
|
|
- <span>{typeof total == 'number'? Number(total.toFixed(4)) : '合计'}</span>
|
|
|
|
|
|
+ <span>{typeof total == 'number' ? Number(total.toFixed(4)) : '合计'}</span>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|