feat(miniprogram): migrate expense items and workflow admin from bx-mobile.
Enable mobile config of expense tree and advance/reimburse approval nodes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1bd0503409
commit
f13eba5623
7 files changed
+1209
-8
No files matched your search
+39
-2
@@ -1,4 +1,5 @@
|
||||
import { bxRequest, bxUploadFile, bxUploadInvoice } from '@/utils/bxRequest'
|
||||
import { request, parseResponseJson } from '@/utils/request'
|
||||
|
||||
export const advanceApi = {
|
||||
list: (params) => bxRequest({ url: '/advances/', method: 'GET', params }),
|
||||
@@ -29,7 +30,41 @@ export const reimburseApi = {
|
||||
}
|
||||
|
||||
export const expenseItemApi = {
|
||||
tree: () => bxRequest({ url: '/expense-items/tree', method: 'GET' })
|
||||
tree: () => bxRequest({ url: '/expense-items/tree', method: 'GET' }),
|
||||
create: (data) => bxRequest({ url: '/expense-items/', method: 'POST', data }),
|
||||
update: (id, data) => bxRequest({ url: `/expense-items/${id}`, method: 'PUT', data }),
|
||||
delete: (id) => bxRequest({ url: `/expense-items/${id}`, method: 'DELETE' })
|
||||
}
|
||||
|
||||
export const workflowApi = {
|
||||
getByBizType: (bizType) =>
|
||||
bxRequest({ url: `/workflows/biz/${bizType}`, method: 'GET' }),
|
||||
create: (data) => bxRequest({ url: '/workflows/', method: 'POST', data }),
|
||||
update: (id, data) => bxRequest({ url: `/workflows/${id}`, method: 'PUT', data }),
|
||||
saveNodes: (id, nodes) =>
|
||||
bxRequest({ url: `/workflows/${id}/nodes`, method: 'PUT', data: nodes }),
|
||||
delete: (id) => bxRequest({ url: `/workflows/${id}`, method: 'DELETE' })
|
||||
}
|
||||
|
||||
/**
|
||||
* 门户用户下拉(code===200 信封,非 bx code===0)
|
||||
* 对齐 bx-mobile portalAdminApi.userOptions → GET /web/admin/users/options
|
||||
*/
|
||||
export async function fetchPortalUserOptions() {
|
||||
const res = await request({
|
||||
url: '/web/admin/users/options',
|
||||
method: 'GET'
|
||||
})
|
||||
const result = parseResponseJson(res)
|
||||
if (result && typeof result === 'object' && 'code' in result) {
|
||||
if (result.code === 200 || result.code === 0) {
|
||||
const data = result.data !== undefined ? result.data : result
|
||||
return Array.isArray(data) ? data : []
|
||||
}
|
||||
const msg = result.message || result.msg || '加载用户失败'
|
||||
throw new Error(msg)
|
||||
}
|
||||
return Array.isArray(result) ? result : []
|
||||
}
|
||||
|
||||
export const invoiceWalletApi = {
|
||||
@@ -77,7 +112,9 @@ export default {
|
||||
advanceApi,
|
||||
reimburseApi,
|
||||
expenseItemApi,
|
||||
workflowApi,
|
||||
invoiceWalletApi,
|
||||
invoiceApi,
|
||||
attachmentApi
|
||||
attachmentApi,
|
||||
fetchPortalUserOptions
|
||||
}
|
||||
Reference in new issue
Block a user