feat:部门选择
This commit is contained in:
@@ -7,6 +7,7 @@ import Request from 'luch-request'
|
||||
import { getBaseUrl, getTenantId } from '@/defaultBaseUrl'
|
||||
import $store from '@/nx/store'
|
||||
import qs from 'qs'
|
||||
import { COMPANY_DEPT_RETRY_HEADER, VISIT_COMPANY_STORAGE_KEY, VISIT_DEPT_STORAGE_KEY } from '@/nx/config'
|
||||
|
||||
const options = {
|
||||
// 显示操作成功消息 默认不显示
|
||||
@@ -27,9 +28,6 @@ const options = {
|
||||
isTransformResponse: true
|
||||
}
|
||||
|
||||
const COMPANY_DEPT_RETRY_HEADER = '__companyDeptRetried'
|
||||
const VISIT_COMPANY_STORAGE_KEY = 'visit-company-info'
|
||||
const VISIT_DEPT_STORAGE_KEY = 'visit-dept-info'
|
||||
// Loading全局实例
|
||||
let LoadingInstance = {
|
||||
target: null,
|
||||
@@ -99,27 +97,19 @@ http.interceptors.request.use(
|
||||
config.header['Pragma'] = 'no-cache'
|
||||
}
|
||||
|
||||
let params = config.params || {}
|
||||
let data = config.data || false
|
||||
// if (process.env.NODE_ENV == 'development') console.log('development--params', params)
|
||||
// if (process.env.NODE_ENV == 'development') console.log('development--data', data)
|
||||
|
||||
// const visitCompanyId = getVisitCompanyId()
|
||||
const visitCompanyId = '101'
|
||||
const visitCompanyId = getVisitCompanyId()
|
||||
if (visitCompanyId !== undefined && visitCompanyId !== null && visitCompanyId !== '') {
|
||||
config.header['visit-company-id'] = visitCompanyId
|
||||
// const visitCompanyName = getVisitCompanyName()
|
||||
const visitCompanyName = '"深圳总公司'
|
||||
const visitCompanyName = getVisitCompanyName()
|
||||
if (visitCompanyName !== undefined && visitCompanyName !== null) {
|
||||
config.header['visit-company-name'] = encodeURIComponent(visitCompanyName || '')
|
||||
}
|
||||
}
|
||||
// const visitDeptId = getVisitDeptId()
|
||||
const visitDeptId = '103'
|
||||
const visitDeptId = getVisitDeptId()
|
||||
if (visitDeptId !== undefined && visitDeptId !== null && visitDeptId !== '') {
|
||||
config.header['visit-dept-id'] = visitDeptId
|
||||
// const visitDeptName = getVisitDeptName()
|
||||
const visitDeptName = '研发部门'
|
||||
const visitDeptName = getVisitDeptName()
|
||||
|
||||
if (visitDeptName !== undefined && visitDeptName !== null) {
|
||||
config.header['visit-dept-name'] = encodeURIComponent(visitDeptName || '')
|
||||
}
|
||||
@@ -153,7 +143,6 @@ http.interceptors.response.use(
|
||||
|
||||
// 统一处理【公司/部门二次选择】:参考 PC 端逻辑,自动补全或提示选择后重试
|
||||
if (code === 400 && Array.isArray(data)) {
|
||||
debugger
|
||||
const companyDeptList = data
|
||||
const config = response.config
|
||||
config.header = config.header || {}
|
||||
@@ -161,7 +150,7 @@ http.interceptors.response.use(
|
||||
const item = companyDeptList[0]
|
||||
if (!config.header[COMPANY_DEPT_RETRY_HEADER]) {
|
||||
applyCompanyDeptSelection(item, config)
|
||||
return request(config)
|
||||
return http.request(config)
|
||||
}
|
||||
uni.showToast({
|
||||
title: '公司/部门信息缺失,且自动补全失败,请联系管理员',
|
||||
@@ -187,7 +176,7 @@ http.interceptors.response.use(
|
||||
},
|
||||
config
|
||||
)
|
||||
resolve(request(config))
|
||||
resolve(http.request(config))
|
||||
},
|
||||
onCancel: () => {
|
||||
uni.showToast({
|
||||
|
||||
Reference in New Issue
Block a user