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

fixed: Fixed an issue with duplicate requests #4144

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions src/components/Form/DataForm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ElFormRender
:id="id"
ref="form"
:class="mobile? 'mobile' : 'desktop'"
:class="mobile ? 'mobile' : 'desktop'"
:content="fields"
:form="basicForm"
:label-position="labelPosition"
Expand All @@ -11,8 +11,16 @@
v-on="$listeners"
>
<!-- slot 透传 -->
<slot v-for="item in fields" :slot="`id:${item.id}`" :name="`id:${item.id}`" />
<slot v-for="item in fields" :slot="`$id:${item.id}`" :name="`$id:${item.id}`" />
<slot
v-for="item in fields"
:slot="`id:${item.id}`"
:name="`id:${item.id}`"
/>
<slot
v-for="item in fields"
:slot="`$id:${item.id}`"
:name="`$id:${item.id}`"
/>

<el-form-item v-if="hasButtons" class="form-buttons">
<el-button
Expand All @@ -30,10 +38,14 @@
size="small"
@click="submitForm('form', true)"
>
{{ $t('SaveAndAddAnother') }}
{{ $t("SaveAndAddAnother") }}
</el-button>
<el-button v-if="defaultButton && hasReset" size="small" @click="resetForm('form')">
{{ $t('Reset') }}
<el-button
v-if="defaultButton && hasReset"
size="small"
@click="resetForm('form')"
>
{{ $t("Reset") }}
</el-button>
<el-button
v-for="button in moreButtons"
Expand Down Expand Up @@ -136,18 +148,22 @@ export default {
}
const dialogs = [...document.getElementsByClassName('el-dialog__body')]
if (dialogs.length > 0) {
const dialog = dialogs.find((d) => d.innerHTML.indexOf(this.id) !== -1)
const dialog = dialogs.find(d => d.innerHTML.indexOf(this.id) !== -1)
if (dialog) {
this.iSubmitBtnText = this.$t('Confirm')
return
}
}
this.iSubmitBtnText = this.$t('Submit')
},
// 获取表单数据
/**
* 提交表单数据
* @param {string} formName - 表单的引用名称
* @param {boolean} [addContinue] - 是否继续添加
*/
submitForm(formName, addContinue) {
const form = this.$refs[formName]
form.validate((valid) => {
form.validate(valid => {
if (valid) {
this.$emit('submit', form.getFormValue(), form, addContinue)
} else {
Expand All @@ -162,9 +178,11 @@ export default {
this.$refs['form'].resetFields()
},
handleClick(button) {
const callback = button.callback || function(values, form) {
// debug('Click ', button.title, ': ', values)
}
const callback =
button.callback ||
function(values, form) {
// debug('Click ', button.title, ': ', values)
}
const form = this.$refs['form']
const values = form.getFormValue()
callback(values, form, button)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,8 @@ export default {
if (query) {
this.page = parseInt(query[this.pageKey])
this.size = parseInt(query[this.pageSizeKey])
// 恢复查询条件,但对slot=search无效

// 恢复查询条件,但对 slot = search 无效
if (this.$refs.searchForm) {
delete query[this.pageKey]
delete query[this.pageSizeKey]
Expand All @@ -879,6 +880,9 @@ export default {
this.getList()
}
},
created() {
this.debouncedGetListFromRemote = _.debounce(this.getListFromRemote, 300)
},
methods: {
getQuery() {
// 构造query对象
Expand Down Expand Up @@ -927,7 +931,7 @@ export default {
getList({ loading = true } = {}) {
const { url } = this
if (url) {
return this.getListFromRemote({ loading: loading })
return this.debouncedGetListFromRemote({ loading })
}
if (this.totalData) {
return this.getListFromStaticData({ loading: true })
Expand Down
1 change: 0 additions & 1 deletion src/components/Table/ListTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export default {
isDeactivated: false
}
},

computed: {
...mapGetters(['currentOrgIsRoot']),
dataTable() {
Expand Down
7 changes: 1 addition & 6 deletions src/layout/components/GenericListPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ export default {
components: {
Page, GenericListTable
},
activated() {
this.reloadTable()
},
methods: {
reloadTable() {
setTimeout(() => {
this.$refs.ListTable.reloadTable()
}, 300)
this.$refs.ListTable.reloadTable()
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/layout/components/GenericListTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default {
},
activated() {
setTimeout(() => {
console.log('actived')
this.reloadTable()
}, 300)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,3 @@ export default {
}
}
</script>

<style scoped>

</style>
4 changes: 0 additions & 4 deletions src/views/accounts/AccountBackup/AccountBackupList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,3 @@ export default {
}
}
</script>

<style scoped>

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,3 @@ export default {
}
}
</script>

<style scoped>

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,3 @@ export default {
}
}
</script>

<style scoped>

</style>
3 changes: 0 additions & 3 deletions src/views/accounts/AccountChangeSecret/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,3 @@ export default {
}
}
</script>

<style scoped>
</style>
9 changes: 5 additions & 4 deletions src/views/accounts/AccountGather/AccountGatherList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,11 @@ export default {
]
}
}
},
activated() {
setTimeout(() => {
this.$refs.AssetTreeTable.$refs.TreeList.reloadTable()
}, 300)
}
}
</script>

<style>

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,3 @@ export default {
}
}
</script>

<style lang='less' scoped>

</style>
6 changes: 1 addition & 5 deletions src/views/accounts/AccountPush/AccountPushExecutionList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<GenericListTable :header-actions="headerActions" :table-config="tableConfig" />
<GenericListTable ref="listTable" :header-actions="headerActions" :table-config="tableConfig" />
</template>

<script>
Expand Down Expand Up @@ -133,7 +133,3 @@ export default {
}
}
</script>

<style scoped>

</style>
2 changes: 1 addition & 1 deletion src/views/accounts/AccountPush/AccountPushList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<GenericListTable :header-actions="headerActions" :table-config="tableConfig" />
<GenericListTable ref="listTable" :header-actions="headerActions" :table-config="tableConfig" />
</template>

<script>
Expand Down
4 changes: 0 additions & 4 deletions src/views/accounts/AccountTemplate/AccountTemplateList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,3 @@ export default {
}
}
</script>

<style scoped>

</style>
11 changes: 6 additions & 5 deletions src/views/accounts/VirtualAccount/VirtualList.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<ListTable v-bind="config" />
<ListTable ref="listTable" v-bind="config" />
</div>
</template>

Expand Down Expand Up @@ -44,10 +44,11 @@ export default {
}
}
}
},
activated() {
setTimeout(() => {
this.$refs.listTable.reloadTable()
}, 300)
}
}
</script>

<style scoped>

</style>
5 changes: 0 additions & 5 deletions src/views/users/Group/UserGroupList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ export default {
createRoute: 'UserGroupCreate'
}
}
},
activated() {
setTimeout(() => {
this.$refs.listPage.reloadTable()
})
}
}
</script>
4 changes: 1 addition & 3 deletions src/views/users/Role/RoleList/BaseRoleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ export default {
return !row['builtin'] && this.$hasPerm(perm)
},
reloadTable() {
setTimeout(() => {
this.$refs.ListTable.reloadTable()
}, 300)
this.$refs.ListTable.reloadTable()
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/views/users/Role/RoleList/OrgRoleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default {
BaseRoleList
},
activated() {
this.$refs.roleList.reloadTable()
setTimeout(() => {
this.$refs.roleList.reloadTable()
}, 300)
}
}
</script>
4 changes: 3 additions & 1 deletion src/views/users/Role/RoleList/SysRoleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default {
BaseRoleList
},
activated() {
this.$refs.roleList.reloadTable()
setTimeout(() => {
this.$refs.roleList.reloadTable()
})
}
}
</script>
3 changes: 0 additions & 3 deletions src/views/users/User/UserList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,6 @@ export default {
mounted() {
this.setRolesFilter()
},
activated() {
this.reloadTable()
},
methods: {
setRolesFilter() {
const roleTypes = [{ name: 'system-roles', perm: 'systemrole' }, { name: 'org-roles', perm: 'orgrole' }]
Expand Down