@@ -27,6 +27,7 @@ export default function VersionModal(props: IProps) {
27
27
const [ form ] = Form . useForm ( ) ;
28
28
const [ formLoading , setFormLoading ] = useState < boolean > ( false ) ;
29
29
const [ shiliFetching , setShiliFetching ] = useState < boolean > ( false ) ;
30
+ const [ deleting , setDeleting ] = useState < boolean > ( false ) ;
30
31
const [ saving , setSaving ] = useState < boolean > ( false ) ;
31
32
const [ devopsShiLiId , setDevopsShiLiId ] = useState < number | undefined > ( undefined ) ;
32
33
const [ devopsShiLiList , setDevopsShiLiList ] = useState < any [ ] > ( [ ] ) ;
@@ -127,13 +128,18 @@ export default function VersionModal(props: IProps) {
127
128
title : '是否删除该版本?' ,
128
129
icon : < ExclamationCircleOutlined /> ,
129
130
onOk ( ) {
130
- API . deleteVersion ( { versionId } ) . then ( ( ) => {
131
- // 删除版本后重新获取任务列表
132
- handleVersionChange ( undefined ) ;
131
+ setDeleting ( true ) ;
132
+ API . deleteVersion ( { versionId } )
133
+ . then ( ( ) => {
134
+ // 删除版本后重新获取任务列表
135
+ handleVersionChange ( undefined ) ;
133
136
134
- onCancel ( true ) ;
135
- message . success ( '操作完成!' ) ;
136
- } ) ;
137
+ onCancel ( true ) ;
138
+ message . success ( '操作完成!' ) ;
139
+ } )
140
+ . finally ( ( ) => {
141
+ setDeleting ( false ) ;
142
+ } ) ;
137
143
} ,
138
144
} ) ;
139
145
} ;
@@ -145,15 +151,16 @@ export default function VersionModal(props: IProps) {
145
151
} ;
146
152
147
153
const footerRender = ( ) => {
154
+ const loading = deleting || saving || formLoading ;
148
155
return (
149
156
< div className = "footer-btn" >
150
157
{ isEdit && yiceRole === YICE_ROLE . ADMIN ? (
151
- < Button danger onClick = { handleDelete } >
158
+ < Button danger loading = { loading } onClick = { handleDelete } >
152
159
删除
153
160
</ Button >
154
161
) : null }
155
162
< Button onClick = { onCancel } > 取消</ Button >
156
- < Button type = "primary" loading = { saving || formLoading } onClick = { handleOk } >
163
+ < Button type = "primary" loading = { loading } onClick = { handleOk } >
157
164
确定
158
165
</ Button >
159
166
</ div >
0 commit comments