Commit 1b222cf8 by 张立顺

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

2 parents ceffd6a0 4bb714cf
Pipeline #364 for 1b222cf8 failed in 0 seconds
......@@ -79,7 +79,7 @@ export function DataTable<T extends object>({
rowSelection,
actionColumnTitle = '操作',
actionColumnWidth,
actionColumnFixed,
actionColumnFixed = 'right',
toolbarClassName,
toolbarTitle,
fillHeight = false,
......@@ -196,6 +196,7 @@ export function DataTable<T extends object>({
]
: [...columns, ...(actionColumn ? [actionColumn] : [])];
const hasLineLimit = hasLineConfigured(sourceColumns);
const minTableWidth = getMinimumTableWidth(sourceColumns);
const tableColumns = withLineLimit(sourceColumns);
const TableComponent = fillHeight ? FillTable<T> : UTable<T>;
return (
......@@ -226,6 +227,7 @@ export function DataTable<T extends object>({
columns={tableColumns}
tableLayout={hasLineLimit ? 'fixed' : undefined}
rowSelection={resolvedSelection}
scroll={{ ...props.scroll, x: props.scroll?.x ?? minTableWidth }}
styles={{
header: { cell: { paddingLeft: 20 } },
body: { cell: { paddingLeft: 20 } },
......@@ -266,6 +268,15 @@ function hasLineConfigured<T extends object>(columns: ColumnsType<T>): boolean {
});
}
function getMinimumTableWidth<T extends object>(columns: ColumnsType<T>): number {
return columns.reduce((width, column) => {
if ('children' in column && column.children) {
return width + getMinimumTableWidth(column.children);
}
return width + (typeof column.width === 'number' ? column.width : 120);
}, 0);
}
function withLineLimit<T extends object>(columns: DataTableColumnsType<T>): ColumnsType<T> {
return columns.map((column) => {
if ('children' in column && column.children) {
......
......@@ -80,16 +80,17 @@ function NodeIcon({ status, index }: NodeIconProps) {
);
}
const lineColor = (status: ChainNodeStatus) => (status === 'done' ? '#16A34A' : '#E5E7EB');
function NodeLine({ status }: { status: ChainNodeStatus }) {
const bg = status === 'done' ? '#16A34A' : '#E5E7EB';
return (
<div
style={{
flex: 1,
height: 2,
background: bg,
alignSelf: 'center',
marginTop: -16,
background: lineColor(status),
alignSelf: 'flex-start',
marginTop: 15,
}}
/>
);
......@@ -159,50 +160,72 @@ export function ApprovalChainPreview({
}
>
<div style={{ display: 'flex', padding: '20px 8px 8px' }}>
{finalNodes.map((n, i) => (
<div key={i} style={{ flex: 1, display: 'flex', position: 'relative' }}>
{finalNodes.map((n, i) => {
const prev = finalNodes[i - 1];
const hasLeft = i > 0;
const hasRight = i < finalNodes.length - 1;
return (
<div
style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', flex: 1 }}
key={i}
style={{
flex: 1,
display: 'flex',
alignItems: 'flex-start',
}}
>
<NodeIcon status={n.status} index={i} />
<div style={{ flex: 1 }}>{hasLeft && <NodeLine status={prev.status} />}</div>
<div
style={{
marginTop: 14,
fontSize: 14,
fontWeight: 600,
color:
n.status === 'active' ? '#2B5CE6' : n.status === 'done' ? '#16A34A' : '#6B7280',
textAlign: 'center',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
flex: 'none',
}}
>
{n.title}
</div>
<div
style={{
marginTop: 4,
fontSize: 12,
color: '#9CA3AF',
textAlign: 'center',
}}
>
{n.subtitle}
</div>
{n.time && (
<NodeIcon status={n.status} index={i} />
<div
style={{
marginTop: 14,
fontSize: 14,
fontWeight: 600,
color:
n.status === 'active'
? '#2B5CE6'
: n.status === 'done'
? '#16A34A'
: '#6B7280',
textAlign: 'center',
}}
>
{n.title}
</div>
<div
style={{
marginTop: 4,
fontSize: 11,
color: '#C7CDD6',
fontSize: 12,
color: '#9CA3AF',
textAlign: 'center',
}}
>
{n.time}
{n.subtitle}
</div>
)}
{n.time && (
<div
style={{
marginTop: 4,
fontSize: 11,
color: '#C7CDD6',
textAlign: 'center',
}}
>
{n.time}
</div>
)}
</div>
<div style={{ flex: 1 }}>{hasRight && <NodeLine status={n.status} />}</div>
</div>
{i < finalNodes.length - 1 && <NodeLine status={finalNodes[i].status} />}
</div>
))}
);
})}
</div>
</UCard>
);
......
......@@ -105,8 +105,8 @@ export default function TemplateImport() {
cancelText: '知道了',
// 非阻塞(不强制跳转):「知道了」留在当前页
onOk: () => {
// 跳转门店审批页(对应路由:/store/approval
window.location.href = '/store/approval';
// 跳转门店审批页,tab=mine 默认定位到「我发起的」页签
window.location.href = '/store/approval?tab=mine';
},
});
} catch (e) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!