fix: bug#11269

This commit is contained in:
JiangQiming 2023-03-31 18:55:45 +08:00
parent c178d22691
commit d58ec295a9
1 changed files with 32 additions and 21 deletions

View File

@ -98,7 +98,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { cloneDeep } from 'lodash-es'; import { cloneDeep, uniqBy } from 'lodash-es';
import { getPrimissTree_api } from '@/api/system/role'; import { getPrimissTree_api } from '@/api/system/role';
import { getCurrentInstance } from 'vue'; import { getCurrentInstance } from 'vue';
const emits = defineEmits(['update:selectItems']); const emits = defineEmits(['update:selectItems']);
@ -156,7 +156,7 @@ const selectAllChange = () => {
}); });
} }
}); });
console.log('selectAllChange: ', flatTableData); // console.log('selectAllChange: ', flatTableData);
indeterminate.value = false; indeterminate.value = false;
emits( emits(
'update:selectItems', 'update:selectItems',
@ -165,24 +165,25 @@ const selectAllChange = () => {
}; };
// - // -
const bulkShow = ref<boolean>(false); const bulkShow = ref<boolean>(false);
const bulkOptions = [ const bulkOptions = ref();
{ // const bulkOptions = [
label: '全部数据', // {
value: 'ignore', // label: '',
}, // value: 'ignore',
{ // },
label: '所在组织及下级组织', // {
value: 'org-include-children', // label: '',
}, // value: 'org-include-children',
{ // },
label: '所在组织', // {
value: 'org', // label: '',
}, // value: 'org',
{ // },
label: '自己创建的', // {
value: 'creator', // label: '',
}, // value: 'creator',
]; // },
// ];
const bulkValue = ref<string>(''); const bulkValue = ref<string>('');
const bulkChange = () => { const bulkChange = () => {
if (!bulkValue) return; if (!bulkValue) return;
@ -198,7 +199,7 @@ const bulkChange = () => {
}); });
} }
}); });
console.log('bulkChange: ', flatTableData); // console.log('bulkChange: ', flatTableData);
emits( emits(
'update:selectItems', 'update:selectItems',
flatTableData.filter((item) => item.granted), flatTableData.filter((item) => item.granted),
@ -396,6 +397,16 @@ function treeToSimple(treeData: tableItemType[]) {
flatTableData.push(item); flatTableData.push(item);
item.children && treeToSimple(item.children); item.children && treeToSimple(item.children);
}); });
// console.log('flatTableData: ', flatTableData);
// , assetAccesses
let assets: any[] = [];
flatTableData?.forEach((item: any) => {
assets = [...assets, ...item.assetAccesses];
});
bulkOptions.value = uniqBy(assets, 'supportId')?.map((m: any) => ({
label: m.name,
value: m.supportId,
}));
} }
/** /**
* 设置子节点的状态 * 设置子节点的状态