Commit d802edd5 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复权限菜单有时候更新不到的问题

parent bf4444c1
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-26 16:36:30
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-26 16:41:39
* @LastEditTime: 2021-04-19 16:58:00
* @Description: 待提交审核详情信息
*/
import React, { useState, useEffect, useRef } from 'react';
......@@ -17,6 +17,7 @@ import {
Modal,
Button,
Spin,
message,
} from 'antd';
import { FormOutlined } from '@ant-design/icons';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
......@@ -51,11 +52,11 @@ interface DetailInfoProps {
/**
* 数据id
*/
id?: string;
id: string;
/**
* 审核id
*/
validateId?: string;
validateId: string;
/**
* 是否是编辑的
*/
......@@ -175,7 +176,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
} else {
if (isEditForm) {
// 有填写过表单
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
Modal.confirm({
content: '确认要离开当前页面吗,您提交的数据尚未保存',
onOk() {
......@@ -232,8 +233,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (isEditForm) {
// 更新右侧按钮
await PublicApi.postMemberValidateCommitUpdatebutton({
memberId: id,
validateId,
memberId: +id,
validateId: +validateId,
menuId: nodeRecord.id,
buttonIds: buttonIds,
});
......@@ -247,43 +248,44 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
const updateMenu = () => {
const menuIds: any = treeActions.getSelectKeys();
return PublicApi.postMemberValidateCommitUpdatemenu({
memberId: id,
validateId,
memberId: +id,
validateId: +validateId,
menuIds,
}, {
ctlType: 'none',
});
};
const handleSubmit = values => {
const handleSubmit = async (values) => {
if (!isEdit) {
return;
}
setConfirmLoading(true);
const promises = [
updateMenu(),
const updateRes = await updateMenu();
if (updateRes.code !== 1000) {
message.error(updateRes.message || '未知错误');
setConfirmLoading(false);
return;
}
PublicApi.postMemberValidateCommitSubmit({
memberId: id,
validateId,
...values,
}),
];
Promise.all(promises).then(resArr => {
if (resArr.every(item => item && item.code === 1000)) {
}).then((res) => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack();
}, 800);
setModalVisible(false);
}
setConfirmLoading(false);
setPowerUnsaved(false);
}).catch(() => {
}
}).finally(() => {
setConfirmLoading(false);
});
};
const handleCheck = () => {
const handleCheck = (keys: any, nodes: any): any => {
setPowerUnsaved(true);
};
......@@ -398,6 +400,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
handleSelect={handleSelect}
handleCheck={handleCheck}
disabled={!isEdit}
checkStrictly
checkable
/>
</MellowCard>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment