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