From 06ddcd39c0d3e1eb3341d6e858b5de0fa0a42bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E7=BA=A2=E5=85=B5?= <374362909@qq.com> Date: Sun, 1 Feb 2026 20:14:51 +0800 Subject: [PATCH] 1 --- .env.development | 2 +- src/api/order/purchase-apply.ts | 16 ++ src/api/purchase/purchasingBusinessDept.ts | 106 ++++++++ .../components/handle-job/dynamic-link.vue | 1 + src/flow/components/handle-job/handle.vue | 10 +- src/flow/components/index.ts | 4 +- src/flow/components/user-role/picker.vue | 15 +- src/views/purchase/apply/flow.vue | 225 +++++++++++++++++ .../purchase/purchasingBusinessDept/form.vue | 142 +++++++++++ .../purchase/purchasingBusinessDept/index.vue | 228 ++++++++++++++++++ 10 files changed, 737 insertions(+), 12 deletions(-) create mode 100644 src/api/order/purchase-apply.ts create mode 100644 src/api/purchase/purchasingBusinessDept.ts create mode 100644 src/views/purchase/apply/flow.vue create mode 100644 src/views/purchase/purchasingBusinessDept/form.vue create mode 100644 src/views/purchase/purchasingBusinessDept/index.vue diff --git a/.env.development b/.env.development index cda5ee5..9071fb8 100644 --- a/.env.development +++ b/.env.development @@ -8,4 +8,4 @@ VITE_OPEN=true ENV=development # ADMIN 服务地址 -VITE_ADMIN_PROXY_PATH = http://scj-v3.zhxy.link/api +VITE_ADMIN_PROXY_PATH = http://127.0.0.1:9999 diff --git a/src/api/order/purchase-apply.ts b/src/api/order/purchase-apply.ts new file mode 100644 index 0000000..5c3f5ae --- /dev/null +++ b/src/api/order/purchase-apply.ts @@ -0,0 +1,16 @@ +import request from "/@/utils/request" + +export function getObj(id: any) { + return request({ + url: '/purchase/purchasingapply/' + id, + method: 'get' + }) +} + +export function putObj(obj?: Object) { + return request({ + url: '/purchase/purchasingapply/edit', + method: 'post', + data: obj + }) +} diff --git a/src/api/purchase/purchasingBusinessDept.ts b/src/api/purchase/purchasingBusinessDept.ts new file mode 100644 index 0000000..c836823 --- /dev/null +++ b/src/api/purchase/purchasingBusinessDept.ts @@ -0,0 +1,106 @@ +import request from "/@/utils/request" + +// ========== 基础CRUD接口 ========== + +/** + * 分页查询列表数据 + * @param query - 查询参数对象 + * @returns Promise<分页数据> + */ +export function fetchList(query?: Object) { + return request({ + url: '/purchase/purchasingBusinessDept/page', + method: 'get', + params: query + }) +} + +/** + * 新增数据 + * @param obj - 要新增的数据对象 + * @returns Promise - 操作结果 + */ +export function addObj(obj?: Object) { + return request({ + url: '/purchase/purchasingBusinessDept', + method: 'post', + data: obj + }) +} + +/** + * 获取详情数据 + * @param obj - 查询参数对象(包含ID等) + * @returns Promise<数据详情> + */ +export function getObj(obj?: Object) { + return request({ + url: '/purchase/purchasingBusinessDept/details', + method: 'get', + params: obj + }) +} + +/** + * 批量删除数据 + * @param ids - 要删除的ID数组 + * @returns Promise<操作结果> + */ +export function delObjs(ids?: Object) { + return request({ + url: '/purchase/purchasingBusinessDept', + method: 'delete', + data: ids + }) +} + +/** + * 更新数据 + * @param obj - 要更新的数据对象 + * @returns Promise<操作结果> + */ +export function putObj(obj?: Object) { + return request({ + url: '/purchase/purchasingBusinessDept', + method: 'put', + data: obj + }) +} + +// ========== 工具函数 ========== + +/** + * 验证字段值唯一性 + * @param rule - 验证规则对象 + * @param value - 要验证的值 + * @param callback - 验证回调函数 + * @param isEdit - 是否为编辑模式 + * + * @example + * // 在表单验证规则中使用 + * fieldName: [ + * { + * validator: (rule, value, callback) => { + * validateExist(rule, value, callback, form.id !== ''); + * }, + * trigger: 'blur', + * }, + * ] + */ +export function validateExist(rule: any, value: any, callback: any, isEdit: boolean) { + // 编辑模式下跳过验证 + if (isEdit) { + return callback(); + } + + // 查询是否存在相同值 + getObj({ [rule.field]: value }).then((response) => { + const result = response.data; + if (result !== null && result.length > 0) { + callback(new Error('数据已经存在')); + } else { + callback(); + } + }); +} + diff --git a/src/flow/components/handle-job/dynamic-link.vue b/src/flow/components/handle-job/dynamic-link.vue index d82ace1..3e2177d 100644 --- a/src/flow/components/handle-job/dynamic-link.vue +++ b/src/flow/components/handle-job/dynamic-link.vue @@ -32,6 +32,7 @@ useMessage().error("不存在的表单,请检查") return } + data.currTabComp = `../../views${path}.vue` } diff --git a/src/flow/components/handle-job/handle.vue b/src/flow/components/handle-job/handle.vue index 2fd8608..d96fc86 100644 --- a/src/flow/components/handle-job/handle.vue +++ b/src/flow/components/handle-job/handle.vue @@ -35,7 +35,10 @@ + + +