|
@@ -4,7 +4,7 @@
|
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
|
* @Date: 2022-12-16 09:42:52
|
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
|
- * @LastEditTime: 2023-05-25 15:54:48
|
|
|
+ * @LastEditTime: 2023-05-26 10:11:27
|
|
|
* @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
*/
|
|
@@ -58,7 +58,7 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
const location = useLocation();
|
|
|
const access = useAccess();
|
|
|
const userFunctionInThispage = access.whatCanIDoInThisPage(location.pathname);
|
|
|
- const [ifCheckPage,set_ifCheckPage] = useState(false); //是否为二次分配审核页面
|
|
|
+ const [ifCheckPage, set_ifCheckPage] = useState(false); //是否为二次分配审核页面
|
|
|
const [treeData, set_treeData] = useState<getTreeDataRespType[]>([]);
|
|
|
const [tableColumn, set_tableColumn] = useState<ProColumns[]>([]);
|
|
|
const [currentSelectedTreeNode, set_currentSelectedTreeNode] = useState<any | undefined>();
|
|
@@ -114,10 +114,14 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
];
|
|
|
|
|
|
|
|
|
- const onSelect: TreeProps['onSelect'] = (selectedKeys, info) => {
|
|
|
+ const onSelect: TreeProps['onSelect'] = (selectedKeys, info:any) => {
|
|
|
// console.log('selected', selectedKeys, info);
|
|
|
+
|
|
|
const { node } = info;
|
|
|
- set_currentSelectedTreeNode(node);
|
|
|
+ if(!node.child){
|
|
|
+ set_currentSelectedTreeNode(node);
|
|
|
+ }
|
|
|
+
|
|
|
};
|
|
|
|
|
|
|
|
@@ -127,16 +131,9 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
}
|
|
|
|
|
|
const getCheckStatus = async (computeDate: string) => {
|
|
|
-
|
|
|
- if (!ifCheckPage) {
|
|
|
- //计算界面
|
|
|
- const resp = await getCurrentCheckStatus(computeDate);
|
|
|
- set_auditType(`${resp}`); //0 未审核 1 已审核
|
|
|
- } else {
|
|
|
- //审核界面
|
|
|
- const resp = await getCurrentCheckStatusReq(computeDate);
|
|
|
- set_auditType(`${resp}`); //0 未审核 1 已审核
|
|
|
- }
|
|
|
+
|
|
|
+ const resp = await getCurrentCheckStatusReq(computeDate);
|
|
|
+ set_auditType(`${resp}`); //0 未审核 1 已审核
|
|
|
|
|
|
}
|
|
|
|
|
@@ -297,7 +294,7 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
|
|
|
const commitBtnhandle = async () => {
|
|
|
|
|
|
- if(ifCheckPage){
|
|
|
+ if (ifCheckPage) {
|
|
|
const resp = await checkRequest({
|
|
|
computeDate: currentComputeDate as string,
|
|
|
auditType: auditType == '1' ? '0' : '1', //1 审核 0 取消审核
|
|
@@ -307,28 +304,35 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
getTreeReqFunc(currentComputeDate as string);
|
|
|
getCheckStatus(currentComputeDate as string);
|
|
|
}
|
|
|
- }else{
|
|
|
- Modal.confirm({
|
|
|
- title: '注意',
|
|
|
- okText: '确定',
|
|
|
- cancelText: '取消',
|
|
|
- content: `${commitStatus == '1' ? '取消提交' : '提交'}当前选择的核算单元的数据?`,
|
|
|
- onOk: async () => {
|
|
|
- const resp = await commitRequest({
|
|
|
- computeDate: currentComputeDate as string,
|
|
|
- unitCode: currentSelectedTreeNode.code,
|
|
|
- type: commitStatus == '1' ? '0' : '1', //1 提交 0 取消
|
|
|
- });
|
|
|
- if (resp) {
|
|
|
- message.success('提交成功!');
|
|
|
- getTreeReqFunc(currentComputeDate as string);
|
|
|
- getCurrentCommitStatus();
|
|
|
+ } else {
|
|
|
+ if (pageData.leftTotal == 0) {
|
|
|
+ Modal.confirm({
|
|
|
+ title: '注意',
|
|
|
+ okText: '确定',
|
|
|
+ cancelText: '取消',
|
|
|
+ content: `${commitStatus == '1' ? '取消提交' : '提交'}当前选择的核算单元的数据?`,
|
|
|
+ onOk: async () => {
|
|
|
+ const resp = await commitRequest({
|
|
|
+ computeDate: currentComputeDate as string,
|
|
|
+ unitCode: currentSelectedTreeNode.code,
|
|
|
+ type: commitStatus == '1' ? '0' : '1', //1 提交 0 取消
|
|
|
+ });
|
|
|
+ if (resp) {
|
|
|
+ message.success('提交成功!');
|
|
|
+ getTreeReqFunc(currentComputeDate as string);
|
|
|
+ getCurrentCommitStatus();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ Modal.confirm({
|
|
|
+ title: '提交时需有单元的剩余分配金额必须是0'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -408,16 +412,10 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
|
|
|
const saveHandle = async () => {
|
|
|
|
|
|
- if (pageData.leftTotal == 0) {
|
|
|
- const resp = await save(needSaveData);
|
|
|
- if (resp) {
|
|
|
- message.success('操作成功!');
|
|
|
- set_ifEditMode(false);
|
|
|
- }
|
|
|
- } else {
|
|
|
- Modal.confirm({
|
|
|
- title: '提交时需有单元的剩余分配金额必须是0'
|
|
|
- })
|
|
|
+ const resp = await save(needSaveData);
|
|
|
+ if (resp) {
|
|
|
+ message.success('操作成功!');
|
|
|
+ set_ifEditMode(false);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -433,11 +431,11 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
//tableRef.current?.reload();
|
|
|
|
|
|
if (currentComputeDate && currentSelectedTreeNode) {
|
|
|
-
|
|
|
- if(!ifCheckPage){
|
|
|
+
|
|
|
+ if (!ifCheckPage) {
|
|
|
getCurrentCommitStatus();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
getTableData({});
|
|
|
}
|
|
|
}, [currentSelectedTreeNode, currentComputeDate]);
|
|
@@ -460,11 +458,11 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
}
|
|
|
}, [treeData]);
|
|
|
|
|
|
- useEffect(()=>{
|
|
|
- if(location.pathname == "/secondaryDistribute/secondaryDitriCheck"){
|
|
|
+ useEffect(() => {
|
|
|
+ if (location.pathname == "/secondaryDistribute/secondaryDitriCheck") {
|
|
|
set_ifCheckPage(true);
|
|
|
- }else{set_ifCheckPage(false);}
|
|
|
- },[location])
|
|
|
+ } else { set_ifCheckPage(false); }
|
|
|
+ }, [location])
|
|
|
|
|
|
let timer: string | number | NodeJS.Timeout | undefined;
|
|
|
|
|
@@ -630,7 +628,7 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
|
|
|
<div className='btnGroupWrap'>
|
|
|
{
|
|
|
- !ifCheckPage && (
|
|
|
+ !ifCheckPage && (
|
|
|
//计算界面
|
|
|
<>
|
|
|
<Popover open={ifShowTip} content={auditType == '1' ? '当前处于审核中,无法操作!' : '当前处于提交中,无法操作!'} >
|
|
@@ -652,8 +650,8 @@ const SecondaryDitriComputed: React.FC = () => {
|
|
|
)
|
|
|
}
|
|
|
{
|
|
|
- ifCheckPage&&(userFunctionInThispage.findIndex((a:{code:string,name:string})=>a.code == 'audit') != -1) && (
|
|
|
- <div key="4" className={'commit'} onClick={() => commitBtnhandle() }>{auditType == '1' ? '取消审核' : '审核'}</div>
|
|
|
+ ifCheckPage && (userFunctionInThispage.findIndex((a: { code: string, name: string }) => a.code == 'audit') != -1) && (
|
|
|
+ <div key="4" className={'commit'} onClick={() => commitBtnhandle()}>{auditType == '1' ? '取消审核' : '审核'}</div>
|
|
|
)
|
|
|
}
|
|
|
|