From f13eba5623580e8344d1117d276d6500c6d4836e Mon Sep 17 00:00:00 2001 From: wuzilong <704541015@qq.com> Date: Fri, 11 Sep 2026 23:42:16 +0800 Subject: [PATCH] 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 --- miniprogram/api/bx.js | 41 +- .../components/bx-ui/bx-wf-config-page.vue | 466 ++++++++++++++++++ miniprogram/pages/bx/admin/expense-item.vue | 428 +++++++++++++++- miniprogram/pages/bx/admin/wf-advance.vue | 4 +- miniprogram/pages/bx/admin/wf-reimburse.vue | 4 +- miniprogram/styles/bx-theme.scss | 254 ++++++++++ miniprogram/utils/bxFormat.js | 20 + 7 files changed, 1209 insertions(+), 8 deletions(-) create mode 100644 miniprogram/components/bx-ui/bx-wf-config-page.vue diff --git a/miniprogram/api/bx.js b/miniprogram/api/bx.js index 98a81bdff..91481a5fc 100644 --- a/miniprogram/api/bx.js +++ b/miniprogram/api/bx.js @@ -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 } diff --git a/miniprogram/components/bx-ui/bx-wf-config-page.vue b/miniprogram/components/bx-ui/bx-wf-config-page.vue new file mode 100644 index 000000000..717e93753 --- /dev/null +++ b/miniprogram/components/bx-ui/bx-wf-config-page.vue @@ -0,0 +1,466 @@ + + + + + diff --git a/miniprogram/pages/bx/admin/expense-item.vue b/miniprogram/pages/bx/admin/expense-item.vue index 963fb45c9..c5487b72e 100644 --- a/miniprogram/pages/bx/admin/expense-item.vue +++ b/miniprogram/pages/bx/admin/expense-item.vue @@ -1,7 +1,431 @@