@@ -349,6 +349,39 @@ def role_confirm(confirm_trigger, operation_type, cur_role_info, role_name, role
349349 return [dash .no_update ] * 10
350350
351351
352+ @app .callback (
353+ [Output ('role-operations-store' , 'data' , allow_duplicate = True ),
354+ Output ('api-check-token' , 'data' , allow_duplicate = True ),
355+ Output ('global-message-container' , 'children' , allow_duplicate = True )],
356+ [Input ('role-list-table' , 'recentlySwitchDataIndex' ),
357+ Input ('role-list-table' , 'recentlySwitchStatus' ),
358+ Input ('role-list-table' , 'recentlySwitchRow' )],
359+ prevent_initial_call = True
360+ )
361+ def table_switch_role_status (recently_switch_data_index , recently_switch_status , recently_switch_row ):
362+ if recently_switch_data_index :
363+ if recently_switch_status :
364+ params = dict (role_id = int (recently_switch_row ['key' ]), status = '0' , type = 'status' )
365+ else :
366+ params = dict (role_id = int (recently_switch_row ['key' ]), status = '1' , type = 'status' )
367+ edit_button_result = edit_role_api (params )
368+ if edit_button_result ['code' ] == 200 :
369+
370+ return [
371+ {'type' : 'switch-status' },
372+ {'timestamp' : time .time ()},
373+ fuc .FefferyFancyMessage ('修改成功' , type = 'success' )
374+ ]
375+
376+ return [
377+ dash .no_update ,
378+ {'timestamp' : time .time ()},
379+ fuc .FefferyFancyMessage ('修改失败' , type = 'error' )
380+ ]
381+
382+ return [dash .no_update ] * 3
383+
384+
352385@app .callback (
353386 [Output ('role-delete-text' , 'children' ),
354387 Output ('role-delete-confirm-modal' , 'visible' ),
0 commit comments