Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dialogConfirmDisabled 避免重复提交 #479

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

RelaxedDong
Copy link
Contributor

现状:

action layer 为各个业务系统带来灵活性,可以自定义业务表单。不过当自定义dialog表单时,提交按钮可以多次点击,会产生重复提交数据的情况,而且后端处理逻辑如果比较耗时,前端没有任何友好提示。

解决:

点击dialog提交按钮,添加loading与disable属性

案例代码:

    actions = ('layer_input',)

    def layer_input(self, request, queryset):
        url = request.POST.get("url")
        # handle url ......
        return JsonResponse(data={'status': 'success', 'msg': '处理成功!'})

    layer_input.short_description = '数据导入'
    layer_input.type = 'success'
    layer_input.icon = 'el-icon-s-promotion'
    layer_input.layer = {
        'title': '数据导入',
        'tips': '数据导入, 请输入链接地址',
        'confirm_button': '确认提交',
        'cancel_button': '取消',
        'width': '40%',
        'labelWidth': "80px",
        'params': [{
            'type': 'input',
            'key': 'url',
            'label': '地址',
            'require': True
        }]
    }

原始效果:

image

更正后效果:

image image

@newpanjing newpanjing merged commit 6e996f0 into newpanjing:dev Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants