用户同步功能
This commit is contained in:
@@ -37,3 +37,11 @@ export function deleteLbUser(id) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function syncLbUserFromHxr(params) {
|
||||||
|
return request({
|
||||||
|
url: '/lbUser/sync-from-hxr',
|
||||||
|
method: 'post',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -68,6 +68,15 @@
|
|||||||
|
|
||||||
<el-card class="action-container" shadow="never">
|
<el-card class="action-container" shadow="never">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
:loading="syncLoading"
|
||||||
|
style="margin-left: 12px"
|
||||||
|
@click="handleSyncFromHxr"
|
||||||
|
>
|
||||||
|
同步用户
|
||||||
|
</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="table-container" shadow="never">
|
<el-card class="table-container" shadow="never">
|
||||||
@@ -84,6 +93,7 @@
|
|||||||
<el-table-column label="联系方式" prop="mobile" min-width="120" show-overflow-tooltip />
|
<el-table-column label="联系方式" prop="mobile" min-width="120" show-overflow-tooltip />
|
||||||
<el-table-column label="上级ID" prop="pid" min-width="110" show-overflow-tooltip />
|
<el-table-column label="上级ID" prop="pid" min-width="110" show-overflow-tooltip />
|
||||||
<el-table-column label="上级姓名" prop="pname" min-width="100" show-overflow-tooltip />
|
<el-table-column label="上级姓名" prop="pname" min-width="100" show-overflow-tooltip />
|
||||||
|
<el-table-column label="上级电话" prop="pmobile" min-width="130" show-overflow-tooltip />
|
||||||
<el-table-column label="最高可抢单数" prop="maxOrder" width="110" align="center" />
|
<el-table-column label="最高可抢单数" prop="maxOrder" width="110" align="center" />
|
||||||
<el-table-column label="今日购买总金额" prop="todayBuyTotal" min-width="120" show-overflow-tooltip />
|
<el-table-column label="今日购买总金额" prop="todayBuyTotal" min-width="120" show-overflow-tooltip />
|
||||||
<el-table-column label="今日卖出总金额" prop="todaySellTotal" min-width="120" show-overflow-tooltip />
|
<el-table-column label="今日卖出总金额" prop="todaySellTotal" min-width="120" show-overflow-tooltip />
|
||||||
@@ -372,8 +382,10 @@ import {
|
|||||||
addLbUser,
|
addLbUser,
|
||||||
deleteLbUser,
|
deleteLbUser,
|
||||||
getLbUserList,
|
getLbUserList,
|
||||||
|
syncLbUserFromHxr,
|
||||||
updateLbUser
|
updateLbUser
|
||||||
} from '@/api/lb-user'
|
} from '@/api/lb-user'
|
||||||
|
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||||
|
|
||||||
function emptyForm() {
|
function emptyForm() {
|
||||||
return {
|
return {
|
||||||
@@ -448,6 +460,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
submitLoading: false,
|
submitLoading: false,
|
||||||
|
syncLoading: false,
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
@@ -602,6 +615,32 @@ export default {
|
|||||||
pname: row.pname || ''
|
pname: row.pname || ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getTenantIdFromBusinessHeaders() {
|
||||||
|
const headers = getBusinessHeaders()
|
||||||
|
const value = headers && headers['X-Tenant-Id']
|
||||||
|
return value ? String(value).trim() : ''
|
||||||
|
},
|
||||||
|
handleSyncFromHxr() {
|
||||||
|
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||||
|
if (!tenantId) {
|
||||||
|
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.syncLoading = true
|
||||||
|
syncLbUserFromHxr({ 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.syncLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.dialogTitle = '新增用户'
|
this.dialogTitle = '新增用户'
|
||||||
this.isEdit = false
|
this.isEdit = false
|
||||||
|
|||||||
Reference in New Issue
Block a user