Blame view

src/pages/contract/AuthorizationSetting/api.ts 2.56 KB
fcdb5f0d   谢忠泽   add:合同授权
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  import { http } from "@/typing/http";
  import request from "@/utils/request";
  import qs from 'qs';
  import { CONTRACT_HOST, HOST } from "@/utils/host";
  import { Any } from "currency.js";
  
  type PrResArr<T> = http.PromiseResp<T[]>;
  
  export interface Item {
      id?:number, //授权ID
      typeName?:string, //合同类型名称
      createTime?:number, //创建时间
      updateTime?:number, //更新时间
      enabled?:boolean, //是否启用
      roles?:Roles[],//授权角色
  }
  export interface Roles {
      roleCode?:string, //角色编码
      roleName?:string, //角色名称
  }
  export interface TypesItem {
      id?: number; // id
      name?: string;
      fixedAmount?: boolean;
      contractableTradeCompCategories?: number[];
      feeType?: string;
      feeTypeValue?: string;
      bizType?: string;
      bizTypeValue?: number;
      subjectType?: string;
      subjectTypeValue?: string;
      servicePlaceTypes?: number[];
  }
  
  export interface PageParams {
      current?: number;
      pageSize?: number;
      contractTypeName?:string //合同类型名称
  }
  export interface SaveParams {
      contractAuthId?: number;
      typeId: number;//合同类型id
      typeName:string //合同类型名称
      roles?:Roles[],//授权角色
  }
  interface DelParams {
      contractAuthId?: number; //合同授权id
  }
  
  export interface DisableParams {
      contractAuthId?: number;//合同授权id
      enabled?: boolean;//是否启用
  }
  
  /**
   * 查询所有角色列表
   */
  export function getAllRoleCodeApi(params: CommonApi.RoleParams): PrResArr<CommonApi.RoleCodeVO> {
      return request.get(`${HOST}/role/listAll`, { params });
  }
  /**
   * 查询合同类型列表
   */
  export function getContractTypes(params: PageParams): http.PromisePageResp<TypesItem> {
      return request.get(`${CONTRACT_HOST}/erp/contract/type/page`, { params });
  }
  
  /**
   * 分页查询合同授权
   */
  export function getContractAuthPage(params?: PageParams): http.PromisePageResp<Item> {
      return request.get(`${CONTRACT_HOST}/erp/contractAuth/page`, {params});
  }
  
  /**
   * 新增合同授权/编辑合同授权
   */
  export function addContractAuth(params?: SaveParams): http.PromisePageResp<Any> {
      return request.post(`${CONTRACT_HOST}/erp/contractAuth/save`, {...params});
  }
  
  /**
   * 删除合同授权
   */
   export function delContractAuth(params?: DelParams): http.PromisePageResp<Any> {
      return request.post(`${CONTRACT_HOST}/erp/contractAuth/delete`, {...params});
  }
  
  /**
   * 启用或禁用
   */
   export function disableContractAuth(params?: DisableParams): http.PromisePageResp<Any> {
      return request.post(`${CONTRACT_HOST}/erp/contractAuth/enableOrDisable`, {...params});
  }