自动填成当前登陆
This commit is contained in:
@@ -1,4 +1,16 @@
|
||||
import request from '@/utils/request'
|
||||
import store from '@/store'
|
||||
import { getLoginAccount } from '@/utils/auth'
|
||||
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||
|
||||
function resolveCurrentLoginAccount() {
|
||||
const fromStore = (store.getters.account || '').trim()
|
||||
if (fromStore) return fromStore
|
||||
const fromStorage = getLoginAccount()
|
||||
if (fromStorage) return fromStorage
|
||||
const fromHeader = (getBusinessHeaders()['X-Account-Name'] || '').trim()
|
||||
return fromHeader || ''
|
||||
}
|
||||
|
||||
// 分页查询客户列表
|
||||
export function getCustomerList(params) {
|
||||
@@ -54,12 +66,17 @@ export function batchDeleteCustomer(ids) {
|
||||
})
|
||||
}
|
||||
|
||||
// 添加新的客户信息
|
||||
// 添加新的客户信息(自动附带当前登录人姓名、账号,供后端 salesName / salesPhone)
|
||||
export function addCustomer(data) {
|
||||
const body = data && typeof data === 'object' ? { ...data } : {}
|
||||
const salesName = (store.getters.name || '').trim()
|
||||
const salesPhone = resolveCurrentLoginAccount()
|
||||
if (salesName) body.salesName = salesName
|
||||
if (salesPhone) body.salesPhone = salesPhone
|
||||
return request({
|
||||
url: '/customerManagement/add',
|
||||
method: 'post',
|
||||
data
|
||||
data: body
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user