提交
This commit is contained in:
1 parent
8be55c08e9
commit
a903fcf6d4
75 files changed
+9547
-124
No files matched your search
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 管理端公共选项(审批人选人等)
|
||||
* 协议:门户信封 code===200
|
||||
*/
|
||||
import { request, parseResponseJson } from '@/utils/request'
|
||||
|
||||
function unwrap(res) {
|
||||
const body = parseResponseJson(res)
|
||||
if (!body || typeof body !== 'object') {
|
||||
throw new Error('接口响应异常')
|
||||
}
|
||||
if (body.code != null && body.code !== 200) {
|
||||
throw new Error(body.message || body.msg || '请求失败')
|
||||
}
|
||||
return body.data != null ? body.data : body
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<Array<{ userId: string, nickName: string, userNo: string, label: string }>>}
|
||||
*/
|
||||
export async function fetchUserOptions() {
|
||||
const res = await request({
|
||||
url: '/web/admin/users/options',
|
||||
method: 'GET'
|
||||
})
|
||||
const data = unwrap(res)
|
||||
const list = Array.isArray(data) ? data : []
|
||||
return list
|
||||
.map((item) => {
|
||||
const userId = String(item.value ?? item.userId ?? item.id ?? '')
|
||||
const nickName = String(item.nickName ?? item.label ?? item.userName ?? '')
|
||||
const userNo = String(item.userNo ?? item.userName ?? '')
|
||||
return {
|
||||
userId,
|
||||
nickName,
|
||||
userNo,
|
||||
label: nickName || userNo || userId
|
||||
}
|
||||
})
|
||||
.filter((u) => u.userId)
|
||||
}
|
||||
Reference in new issue
Block a user