Commit 6f236680 authored by xiexiuxing's avatar xiexiuxing

fix:保存按钮修复

parent a4ecb82b
...@@ -193,7 +193,6 @@ const MemberDetail: React.FC<{}> = () => { ...@@ -193,7 +193,6 @@ const MemberDetail: React.FC<{}> = () => {
const { node } = await handleSelect(selectKey, selectNode); const { node } = await handleSelect(selectKey, selectNode);
console.log(node) console.log(node)
setcheckflag(treeActions.getSelectKeys().indexOf(selectKey) != -1) setcheckflag(treeActions.getSelectKeys().indexOf(selectKey) != -1)
console.log(node.buttonIds, 'node.buttonIds')
actionRef.current.setSelected(node.buttonIds) actionRef.current.setSelected(node.buttonIds)
if (nodeRecord) { if (nodeRecord) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -221,8 +220,13 @@ const MemberDetail: React.FC<{}> = () => { ...@@ -221,8 +220,13 @@ const MemberDetail: React.FC<{}> = () => {
// 左边勾选按钮监听 // 左边勾选按钮监听
const handleCheck = async (e) => { const handleCheck = async (e) => {
const { checked } = e; const { checked } = e;
console.log(nodeRecord, checked)
if (nodeRecord) { if (nodeRecord) {
setcheckflag(checked.indexOf(nodeRecord.id) != -1 ? true : false) setcheckflag(checked.indexOf(nodeRecord.id) != -1 ? true : false)
} else {
let ids = [...dataId];
ids = checked;
setdataId(ids)
} }
} }
...@@ -303,6 +307,7 @@ const MemberDetail: React.FC<{}> = () => { ...@@ -303,6 +307,7 @@ const MemberDetail: React.FC<{}> = () => {
for (let i in checkIds) { for (let i in checkIds) {
cheIds.push(checkIds[i]); cheIds.push(checkIds[i]);
} }
// console.log(cheIds, 'cheIds')
// 判断后台返回的选中id 是否和和当前选中id是一样 // 判断后台返回的选中id 是否和和当前选中id是一样
const flag = treeCheckIds.join(',') === cheIds.join(',') ? true : false; const flag = treeCheckIds.join(',') === cheIds.join(',') ? true : false;
// 如果后台返回的选中的id 和 当前选中id 是一样 则午休修改 提交一个空数据过去 // 如果后台返回的选中的id 和 当前选中id 是一样 则午休修改 提交一个空数据过去
...@@ -343,19 +348,21 @@ const MemberDetail: React.FC<{}> = () => { ...@@ -343,19 +348,21 @@ const MemberDetail: React.FC<{}> = () => {
list = publicarr.filter((element, index, self) => { list = publicarr.filter((element, index, self) => {
return self.findIndex(x => x.menuId === element.menuId) === index return self.findIndex(x => x.menuId === element.menuId) === index
}) })
// console.log(list);
const publicParams = { const publicParams = {
...values, ...values,
imFlag: !!values.imFlag, imFlag: !!values.imFlag,
auth: (flag && dataId.length === 0) ? [] : list.map(v => ({ auth: (flag && dataId.length < 0) ? [] : list.map(v => ({
menuId: v.menuId, menuId: v.menuId,
buttonIds: authInfos[v.menuId].buttonIds ? authInfos[v.menuId].buttonIds : [], buttonIds: (Object.keys(authInfos).length != 0 && authInfos[v.menuId].buttonIds) ? authInfos[v.menuId].buttonIds : [],
checked: v.checked, checked: v.checked,
hasDataAuth: authInfos[v.menuId]?.hasDataAuth ? authInfos[v.menuId]?.hasDataAuth : 0, hasDataAuth: (Object.keys(authInfos).length != 0 && authInfos[v.menuId]?.hasDataAuth) ? authInfos[v.menuId]?.hasDataAuth : 0,
orgIds: authInfos[v.menuId]?.hasDataAuth ? authInfos[v.menuId]?.orgIds : [], orgIds: (Object.keys(authInfos).length != 0 && authInfos[v.menuId]?.hasDataAuth) ? authInfos[v.menuId]?.orgIds : [],
})) }))
}; };
console.log(publicParams, 'publicParams')
delete publicParams.checkIds delete publicParams.checkIds
if (pageStatus === PageStatus.EDIT) { if (pageStatus === PageStatus.EDIT) {
......
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