From a745761147b17a42b4698250a170ef4c0fa0b09b Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 03 七月 2024 21:18:39 +0800 Subject: [PATCH] 产品绑定工艺优化 --- src/api/tigerapi/dept.ts | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/api/tigerapi/dept.ts b/src/api/tigerapi/dept.ts index 86f302e..7181c5b 100644 --- a/src/api/tigerapi/dept.ts +++ b/src/api/tigerapi/dept.ts @@ -1,3 +1,11 @@ +/* + * @Description: file content + * @Author: Ben Lin + * @version: + * @Date: 2024-06-18 15:09:47 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-06-19 14:30:04 + */ import { buildUUID } from '../../utils/uuid'; import { ApiActionPage } from '../model/baseModel'; import { DeptListGetResultModel, DeptListItem, DeptPageParams } from './model/systemModel'; @@ -11,6 +19,28 @@ isTransformResponse: false, }, ); + +export const getProdTreeList = () => + defHttp.get<DeptListGetResultModel>( + { url: Api.GetProdTreeList }, + { + isTransformResponse: false, + }, + ); + +/** + * @description: 鑾峰彇宸ュ巶鍒楄〃甯︽潈闄愭帶鍒� + * @param {string} userId + * @return {*} + */ +export async function getProdTree(user: {}) { + let res = await Promise.all([getProdTreeList(), prodListApi(user['userId'])]); + let treeData = res[0]; + treeData = treeData.filter((x) => + res[1].Data.Items.some((item) => item.PROD_CODE == x.deptCode), + ); + return treeData; +} export const getDeptListByPage = async (params: DeptPageParams) => { let sqlcmd = ''; @@ -108,8 +138,12 @@ // 鎹偣涓嬫媺鏍� export const optionsListApi = async (params: Recordable) => { // const usParams = genAction('V_USER_ORG', `USER_ID='${userid}'`); - const usParams = genAction('V_USER_ORG', { QueryAble_T:"", where: "USER_ID = '" + params + "'", order:''}); - var data = await defHttp.post( + const usParams = genAction('V_USER_ORG', { + QueryAble_T: '', + where: "USER_ID = '" + params + "'", + order: '', + }); + const data = await defHttp.post( { url: Api.QueryUrl, params: usParams }, { errorMessageMode: 'none', @@ -117,6 +151,23 @@ // apiUrl: globSetting.taskApiUrl }, ); - return data + return data; }; +export const prodListApi = async (userId: string) => { + // const usParams = genAction('V_USER_ORG', `USER_ID='${userid}'`); + const usParams = genAction('V_USER_PROD', { + QueryAble_T: '', + where: "USER_ID = '" + userId + "'", + order: '', + }); + const data = await defHttp.post( + { url: Api.QueryUrl, params: usParams }, + { + errorMessageMode: 'none', + isTransformResponse: false, + // apiUrl: globSetting.taskApiUrl + }, + ); + return data; +}; -- Gitblit v1.9.3