Skip to content

Commit

Permalink
fix(frontend): 开区单据权限展示bug修复 #6004
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 25349
  • Loading branch information
JustaCattt authored and jinquantianxia committed Nov 29, 2024
1 parent 73ac5d9 commit b55bd28
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,24 @@
},
]);

const { run: getPermissionRulesRun, loading: isLoading } = useRequest(getPermissionRules, {
manual: true,
onSuccess({ results }) {
tableData.value = results.map((item) => ({
user: item.account.user,
rules: item.rules.map((rule) => ({
priv: rule.privilege,
access_db: rule.access_db,
})),
}));
},
});

watch(
() => props.ticketDetails,
() => {
// 有权限快照返回直接渲染
if (props.ticketDetails.details.rules_set?.[0].privileges?.length) {
if (props.ticketDetails.details.rules_set?.[0]?.privileges?.length) {
const rulesMemo: Record<string, boolean> = {}
tableData.value = props.ticketDetails.details.rules_set.reduce<IDataRow[]>((acc, cur) => {
if (!rulesMemo[cur.user]) {
Expand All @@ -142,7 +155,7 @@
() => props.templateDetail,
() => {
// 无权限返回则现查
if (props.templateDetail && tableData.value.length === 0) {
if (props.templateDetail.related_authorize.length && tableData.value.length === 0) {
const accountTypeMap = {
[ClusterTypes.TENDBHA]: AccountTypes.MYSQL,
[ClusterTypes.TENDBSINGLE]: AccountTypes.MYSQL,
Expand All @@ -159,19 +172,6 @@
},
);

const { run: getPermissionRulesRun, loading: isLoading } = useRequest(getPermissionRules, {
manual: true,
onSuccess({ results }) {
tableData.value = results.map((item) => ({
user: item.account.user,
rules: item.rules.map((rule) => ({
priv: rule.privilege,
access_db: rule.access_db,
})),
}));
},
});

const handleToogleExpand = (user: string) => {
rowFlodMap.value[user] = !rowFlodMap.value[user];
};
Expand Down

0 comments on commit b55bd28

Please sign in to comment.