自动同步人员部门信息

This commit is contained in:
zhonghua.li
2026-04-29 22:28:50 +08:00
parent fa14955504
commit 46e98e664d
2 changed files with 53 additions and 0 deletions

View File

@@ -38,3 +38,11 @@ export function bindLbDepartmentUserParent(params) {
params
})
}
export function syncLbDepartmentUserFromDailyUserTrade(params) {
return request({
url: '/lbDepartmentUser/syncFromDailyUserTrade',
method: 'post',
params
})
}

View File

@@ -23,6 +23,23 @@
<el-card class="action-container" shadow="never">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
<el-date-picker
v-model="syncDateRange"
type="daterange"
range-separator=""
start-placeholder="同步开始日期"
end-placeholder="同步结束日期"
value-format="yyyy-MM-dd"
style="width: 280px; margin-left: 12px"
/>
<el-button
type="warning"
icon="el-icon-refresh"
:loading="syncLoading"
@click="handleSyncFromDailyUserTrade"
>
自动同步
</el-button>
</el-card>
<el-card class="table-container" shadow="never">
@@ -196,6 +213,7 @@ import {
bindLbDepartmentUserParent,
deleteLbDepartmentUser,
getLbDepartmentUserList,
syncLbDepartmentUserFromDailyUserTrade,
updateLbDepartmentUser
} from '@/api/lb-department-user'
@@ -205,6 +223,7 @@ export default {
return {
loading: false,
submitLoading: false,
syncLoading: false,
parentBindLoading: false,
list: [],
total: 0,
@@ -218,6 +237,7 @@ export default {
parentTotal: 0,
parentSelectedRows: [],
lastSelectedParentRow: null,
syncDateRange: [],
queryParams: {
current: 1,
size: 10,
@@ -326,6 +346,31 @@ export default {
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
})
},
handleSyncFromDailyUserTrade() {
if (!Array.isArray(this.syncDateRange) || this.syncDateRange.length !== 2) {
this.$message.warning('请选择同步开始日期和结束日期')
return
}
const [startDate, endDate] = this.syncDateRange
if (!startDate || !endDate) {
this.$message.warning('请选择同步开始日期和结束日期')
return
}
this.syncLoading = true
syncLbDepartmentUserFromDailyUserTrade({ startDate, endDate })
.then((res) => {
const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000)
if (!isSuccess) {
this.$message.error((res && res.message) || '自动同步失败')
return
}
this.$message.success((res && res.message) || '自动同步成功')
this.fetchList()
})
.finally(() => {
this.syncLoading = false
})
},
handleEdit(row) {
this.dialogTitle = '编辑部门人员'
this.isEdit = true