货物同步功能
This commit is contained in:
@@ -37,3 +37,13 @@ export function deleteLbGoods(id) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 从 hxrd 第三方分页同步货品,可能较慢 */
|
||||||
|
export function syncLbGoodsFromHxr(params) {
|
||||||
|
return request({
|
||||||
|
url: '/lbGoods/sync-from-hxr',
|
||||||
|
method: 'post',
|
||||||
|
params,
|
||||||
|
timeout: 120000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -56,6 +56,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">
|
||||||
@@ -209,6 +218,7 @@ import {
|
|||||||
addLbGoods,
|
addLbGoods,
|
||||||
deleteLbGoods,
|
deleteLbGoods,
|
||||||
getLbGoodsList,
|
getLbGoodsList,
|
||||||
|
syncLbGoodsFromHxr,
|
||||||
updateLbGoods
|
updateLbGoods
|
||||||
} from '@/api/lb-goods'
|
} from '@/api/lb-goods'
|
||||||
import { getBusinessHeaders } from '@/utils/business-headers'
|
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||||
@@ -263,6 +273,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,
|
||||||
@@ -296,6 +307,27 @@ export default {
|
|||||||
const value = headers && headers['X-Tenant-Id']
|
const value = headers && headers['X-Tenant-Id']
|
||||||
return value ? String(value).trim() : ''
|
return value ? String(value).trim() : ''
|
||||||
},
|
},
|
||||||
|
handleSyncFromHxr() {
|
||||||
|
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||||
|
if (!tenantId) {
|
||||||
|
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.syncLoading = true
|
||||||
|
syncLbGoodsFromHxr({ 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
|
||||||
|
})
|
||||||
|
},
|
||||||
fetchList() {
|
fetchList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
getLbGoodsList(this.buildListParams())
|
getLbGoodsList(this.buildListParams())
|
||||||
|
|||||||
Reference in New Issue
Block a user