FEAT => 本次更新项目为:

This commit is contained in:
超级老白兔
2025-08-14 17:05:36 +08:00
parent 7be8ff2e94
commit 5f58a1a2c4
2 changed files with 51 additions and 28 deletions

View File

@@ -191,6 +191,19 @@
margin-top: 16px;
}
.formFooter {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 20px;
background: #fff;
border-top: 1px solid #f0f0f0;
}
.footerBtn {
min-width: 80px;
}
// 步骤条美化
.formSteps :global(.ant-steps-item-title) {
font-size: 15px;

View File

@@ -184,7 +184,21 @@ const TrafficDistributionForm: React.FC = () => {
};
// 步骤切换
const next = () => setCurrent(cur => cur + 1);
const next = () => {
if (current === 0) {
// 第一步需要验证表单
form
.validateFields()
.then(() => {
setCurrent(cur => cur + 1);
})
.catch(() => {
// 验证失败,不进行下一步
});
} else {
setCurrent(cur => cur + 1);
}
};
const prev = () => setCurrent(cur => cur - 1);
// 过滤流量池
@@ -201,6 +215,29 @@ const TrafficDistributionForm: React.FC = () => {
</>
}
loading={detailLoading}
footer={
<div className="footer-btn-group">
{current > 0 && (
<Button size="large" onClick={prev}>
</Button>
)}
{current < 2 ? (
<Button size="large" type="primary" onClick={next}>
</Button>
) : (
<Button
type="primary"
size="large"
onClick={handleFinish}
loading={loading}
>
</Button>
)}
</div>
}
>
<div className={style.formPage}>
<div className={style.formBody}>
@@ -208,7 +245,6 @@ const TrafficDistributionForm: React.FC = () => {
<Form
form={form}
layout="vertical"
onFinish={() => next()}
initialValues={{
name: isEdit ? "" : generateDefaultName(),
distributeType: 1,
@@ -314,16 +350,6 @@ const TrafficDistributionForm: React.FC = () => {
</div>
</Form.Item>
)}
<Form.Item>
<Button
type="primary"
htmlType="submit"
loading={loading}
block
>
</Button>
</Form.Item>
</Form>
)}
{current === 1 && (
@@ -361,14 +387,6 @@ const TrafficDistributionForm: React.FC = () => {
className={style.checkboxGroup}
/>
</div>
<div className={style.formStepBtns}>
<Button onClick={prev} style={{ marginRight: 12 }}>
</Button>
<Button type="primary" onClick={next}>
</Button>
</div>
</div>
)}
{current === 2 && (
@@ -409,14 +427,6 @@ const TrafficDistributionForm: React.FC = () => {
<span>{selectedPools.length}</span>
</div>
</div>
<div className={style.formStepBtns}>
<Button onClick={prev} style={{ marginRight: 12 }}>
</Button>
<Button type="primary" onClick={handleFinish} loading={loading}>
</Button>
</div>
</div>
)}
</div>