Ben Lin
2025-03-11 8e977a7ec92bc1845079eda2473e9c3fc4691c8d
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-07-17 03:22:44
 */
import { buildUUID } from '../../utils/uuid';
import { ApiActionPage } from '../model/baseModel';
import { DeptListGetResultModel, DeptListItem, DeptPageParams } from './model/systemModel';
@@ -11,6 +19,37 @@
      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 async function getOrgTree(user: {}) {
  let res = await Promise.all([getTreeList(), optionsListApi(user['userId'])]);
  let treeData = res[0];
  treeData = treeData.filter((x) =>
    res[1].Data.Items.some((item) => item.ORG_CODE == x.deptCode),
  );
  return treeData;
}
export const getDeptListByPage = async (params: DeptPageParams) => {
  let sqlcmd = '';
@@ -106,10 +145,14 @@
// params: Recordable
// userid: string
// 据点下拉树
export const optionsListApi = async (params: Recordable) => {
export const optionsListApi = async (userId: string) => {
  // 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 = '" + userId + "'",
    order: '',
  });
  const data = await defHttp.post(
    { url: Api.QueryUrl, params: usParams },
    {
      errorMessageMode: 'none',
@@ -117,6 +160,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;
};