Commit 09cbacbc by 李伟康

Merge branch 'v1.0.0' of http://192.168.3.233:8090/ujia/uj-store into v1.0.0

2 parents a904059e b8e6dc2a
Pipeline #344 for 09cbacbc failed in 0 seconds
......@@ -22,7 +22,14 @@ export const PermButton = forwardRef<HTMLButtonElement, PermButtonProps>(
if (!ok && fallback === 'hide') return null;
const btn = <UButton ref={ref} {...rest} disabled={!ok || rest.disabled} />;
const btn = (
<UButton
ref={ref}
{...rest}
disabled={!ok || rest.disabled}
style={rest.type === 'text' ? { ...rest.style, paddingInline: 0 } : rest.style}
/>
);
if (!ok && fallback === 'disabled' && unauthorizedTip) {
return <UTooltip title={unauthorizedTip}>{btn}</UTooltip>;
......
......@@ -126,12 +126,21 @@ export function DataTable<T extends object>({
onClick: () => void,
key: string,
isRowAction = false,
style?: CSSProperties,
) => {
const type = action.type ?? (isRowAction ? ('text' as const) : undefined);
const buttonProps = {
danger: action.danger,
disabled: action.disabled,
onClick,
type: action.type ?? (isRowAction ? ('link' as const) : undefined),
type,
style:
isRowAction && type === 'text'
? {
color: action.danger ? 'var(--ant-color-error)' : 'var(--ant-color-primary)',
...style,
}
: style,
};
return action.permission ? (
......@@ -150,21 +159,27 @@ export function DataTable<T extends object>({
key: '__actions',
width: actionColumnWidth,
fixed: actionColumnFixed,
render: (_: unknown, record: T) =>
rowActions
.filter((action) => action.visible?.(record) ?? true)
.map((action, index) => {
const label =
typeof action.label === 'function' ? action.label(record) : action.label;
const danger =
typeof action.danger === 'function' ? action.danger(record) : action.danger;
return renderActionButton(
{ ...action, danger, label },
() => action.onClick(record),
`row-action-${index}`,
true,
);
}),
render: (_: unknown, record: T) => {
const visibleActions = rowActions.filter((action) => action.visible?.(record) ?? true);
const lastPermissionActionIndex = visibleActions.reduce(
(lastIndex, action, index) => (action.permission ? index : lastIndex),
-1,
);
return visibleActions.map((action, index) => {
const label = typeof action.label === 'function' ? action.label(record) : action.label;
const danger =
typeof action.danger === 'function' ? action.danger(record) : action.danger;
return renderActionButton(
{ ...action, danger, label },
() => action.onClick(record),
`row-action-${index}`,
true,
action.permission && index < lastPermissionActionIndex
? { marginRight: 8 }
: undefined,
);
});
},
}
: undefined;
const sourceColumns: DataTableColumnsType<T> = showIndex
......@@ -211,6 +226,10 @@ export function DataTable<T extends object>({
columns={tableColumns}
tableLayout={hasLineLimit ? 'fixed' : undefined}
rowSelection={resolvedSelection}
styles={{
header: { cell: { paddingLeft: 20 } },
body: { cell: { paddingLeft: 20 } },
}}
pagination={
resolvedPagination === false
? false
......
......@@ -129,13 +129,13 @@ export default function AccountManage() {
<UText style={{ color: '#315ce8', fontFamily: 'monospace' }}>{value}</UText>
),
},
{ title: '姓名', dataIndex: 'name', width: 110, line: 1 },
{ title: '姓名', dataIndex: 'name', width: 130, line: 1 },
{ title: '手机号', dataIndex: 'mobile', width: 120 },
{ title: '所属组织', dataIndex: 'orgPath', width: 230, line: 1 },
{
title: '角色',
dataIndex: 'roleNames',
width: 280,
width: 290,
render: (names: string[]) =>
names.length
? names.map((name, index) => (
......@@ -149,7 +149,7 @@ export default function AccountManage() {
))
: '—',
},
{ title: '数据域', dataIndex: 'dataScopeLabel', width: 140 },
{ title: '数据域', dataIndex: 'dataScopeLabel' },
{
title: '状态',
width: 90,
......
......@@ -114,13 +114,13 @@ export default function RoleManage() {
{
title: '角色编码',
dataIndex: 'code',
width: 150,
width: 200,
line: 1,
render: (v) => <UText style={{ color: '#315ce8', fontFamily: 'monospace' }}>{v}</UText>,
},
{ title: '默认数据域', dataIndex: 'scope', width: 130 },
{ title: '默认数据域', dataIndex: 'scope' },
{ title: '账号数', dataIndex: 'userCount', width: 90 },
{ title: '角色描述', dataIndex: 'description', width: 380, line: 1 },
{ title: '角色描述', dataIndex: 'description', width: 400, line: 1 },
{
title: '类型',
dataIndex: 'type',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!