构建父链
This commit is contained in:
@@ -46,3 +46,11 @@ export function syncLbDepartmentUserFromDailyUserTrade(params) {
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function syncLbDepartmentUserFromLbUser(params) {
|
||||
return request({
|
||||
url: '/lbDepartmentUser/syncFromLbUser',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -40,6 +40,15 @@
|
||||
>
|
||||
自动同步
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-connection"
|
||||
:loading="syncParentChainLoading"
|
||||
style="margin-left: 12px"
|
||||
@click="handleSyncFromLbUser"
|
||||
>
|
||||
构建父链
|
||||
</el-button>
|
||||
</el-card>
|
||||
|
||||
<el-card class="table-container" shadow="never">
|
||||
@@ -53,12 +62,14 @@
|
||||
{{ scope.row.parentName || scope.row.parentUserName || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="地址" prop="address" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="行业" prop="industry" min-width="120" />
|
||||
<el-table-column label="加入日期" prop="joinDate" min-width="120" />
|
||||
<el-table-column label="创建时间" prop="createTime" min-width="170">
|
||||
<el-table-column label="组织链" prop="orgChain" min-width="220" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ formatDateTime(scope.row.createTime) }}
|
||||
{{ scope.row.orgChain || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="加入日期" prop="joinDate" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.joinDate || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="170">
|
||||
@@ -214,8 +225,10 @@ import {
|
||||
deleteLbDepartmentUser,
|
||||
getLbDepartmentUserList,
|
||||
syncLbDepartmentUserFromDailyUserTrade,
|
||||
syncLbDepartmentUserFromLbUser,
|
||||
updateLbDepartmentUser
|
||||
} from '@/api/lb-department-user'
|
||||
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||
|
||||
export default {
|
||||
name: 'LbDepartmentUser',
|
||||
@@ -224,6 +237,7 @@ export default {
|
||||
loading: false,
|
||||
submitLoading: false,
|
||||
syncLoading: false,
|
||||
syncParentChainLoading: false,
|
||||
parentBindLoading: false,
|
||||
list: [],
|
||||
total: 0,
|
||||
@@ -346,6 +360,11 @@ export default {
|
||||
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||
})
|
||||
},
|
||||
getTenantIdFromBusinessHeaders() {
|
||||
const headers = getBusinessHeaders()
|
||||
const value = headers && headers['X-Tenant-Id']
|
||||
return value ? String(value).trim() : ''
|
||||
},
|
||||
handleSyncFromDailyUserTrade() {
|
||||
if (!Array.isArray(this.syncDateRange) || this.syncDateRange.length !== 2) {
|
||||
this.$message.warning('请选择同步开始日期和结束日期')
|
||||
@@ -371,6 +390,27 @@ export default {
|
||||
this.syncLoading = false
|
||||
})
|
||||
},
|
||||
handleSyncFromLbUser() {
|
||||
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||
if (!tenantId) {
|
||||
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||
return
|
||||
}
|
||||
this.syncParentChainLoading = true
|
||||
syncLbDepartmentUserFromLbUser({ tenantId })
|
||||
.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.syncParentChainLoading = false
|
||||
})
|
||||
},
|
||||
handleEdit(row) {
|
||||
this.dialogTitle = '编辑部门人员'
|
||||
this.isEdit = true
|
||||
|
||||
Reference in New Issue
Block a user