货物同步功能
This commit is contained in:
@@ -56,6 +56,15 @@
|
||||
|
||||
<el-card class="action-container" shadow="never">
|
||||
<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 class="table-container" shadow="never">
|
||||
@@ -209,6 +218,7 @@ import {
|
||||
addLbGoods,
|
||||
deleteLbGoods,
|
||||
getLbGoodsList,
|
||||
syncLbGoodsFromHxr,
|
||||
updateLbGoods
|
||||
} from '@/api/lb-goods'
|
||||
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||
@@ -263,6 +273,7 @@ export default {
|
||||
return {
|
||||
loading: false,
|
||||
submitLoading: false,
|
||||
syncLoading: false,
|
||||
list: [],
|
||||
total: 0,
|
||||
dialogVisible: false,
|
||||
@@ -296,6 +307,27 @@ export default {
|
||||
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
|
||||
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() {
|
||||
this.loading = true
|
||||
getLbGoodsList(this.buildListParams())
|
||||
|
||||
Reference in New Issue
Block a user