Commit d802edd5 authored by XieZhiXiong's avatar XieZhiXiong

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

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