public.ts
2.15 KB
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
95
96
97
98
99
100
101
102
103
import axios, { AxiosRequestConfig } from "axios";
import qs from "qs";
export interface JsonCommonVo {
name: string;
value: string;
}
/**
* 获取字典
* @param dictType 字典类型
* @returns
*/
export function getDict(dictType: string) {
return axios.get<any>(`/system/dict/data/type/${dictType}`);
}
/**
* 获取字典-list
* @param dictType 字典类型
* @returns
*/
export function getDictList(dictType: string) {
return axios.get<any>(`/system/dict/data/list?dictSn=${dictType}`);
}
/**
* 根据字典类型、字典值查询多级信息
* @param dictType 字典类型
* @returns
*/
export function dictDataMultiLevel(dictType: string, dictValue: number) {
return axios.get<any>(
`/system/dict/data/dictDataMultiLevel?dictType=${dictType}&dictValue=${dictValue}`
);
}
/**
* 获取站点列表
* @param params 搜索参数
* @returns
*/
export function getStationList(params: any) {
return axios.get("/system/public/getStationlist", {
params,
paramsSerializer: (obj) => {
return qs.stringify(obj);
},
});
}
/**
* 获取用户当前企业
* @returns
*/
export function getEnterprise() {
return axios.get<any>("/system/public/getEnterprise");
}
/**
* 获取用户当前站点
* @returns
*/
export function getStation() {
return axios.get<any>("/system/public/getStation");
}
/**
* 保存用户选择的站点
* @returns
*/
export function setStation(deptId: any) {
const formData = new FormData();
formData.append("deptId", deptId);
return axios.post<any>("/system/public/setStation", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
});
}
/**
* 保存用户选择的站点
* @returns
*/
export function getWeather(location: String) {
let params: any = {
location: location,
key: "ede0270be04c4adf9834d7b92cb312c2",
};
return axios.get<any>("/system/public/getWeather")
// return axios.get(`https://devapi.qweather.com/v7/weather/now?location=${params.location}&key=${params.key}`);
}
/**
* 保存用户选择的站点
* @returns
*/
export function getNetwork(deptId: Number) {
return axios.get<any>(
`/system/channel-device/status/all/${deptId}`
);
}