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
import Axios from 'axios'
import {
SUBNET_ADMQ, REQUEST_CONFIG, SUBNET_CONDITION_QUERY, SUBNET_UPLOAD,
SUBNET_DOWNLOAD, SUBNET_DELETE
} from '../../utils/RequestUrls'
var staticMethods = {
// 获取所有子网
getSubnetCollection: function () {
return Axios.get(SUBNET_ADMQ)
},
// 添加子网
postAddSubnet: function (subnet) {
return Axios.post(SUBNET_ADMQ, subnet, REQUEST_CONFIG)
},
// 删除子网
deleteDeleteSubnet: function (subnetKeyList) {
return Axios.delete(SUBNET_ADMQ, {
data: subnetKeyList,
headers: {'Content-Type': 'application/json', 'Encoding': 'utf-8'}
})
},
// 修改子网
putModifySubnet: function (subnet) {
return Axios.put(SUBNET_ADMQ, subnet, REQUEST_CONFIG)
},
// 条件查询子网
putConditionQuerySubnet: function (conditionSet) {
return Axios.put(SUBNET_CONDITION_QUERY, conditionSet, REQUEST_CONFIG)
},
// 子网文件下载
putDownloadSubnet: function (conditionSet) {
return Axios.put(SUBNET_DOWNLOAD, conditionSet, {
headers: {
'Content-Type': 'application/json'
},
responseType: 'arraybuffer'
})
},
// 子网文件上传
postUploadSubnet: function (fileFormData) {
return Axios.post(SUBNET_UPLOAD + '/1', fileFormData, {headers: {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json'
}})
}
}
function SubnetAPI (websocketService = null) {
return Object.freeze(Object.assign(
{
// object methods comes here
},
staticMethods
))
}
// inject static methods
Object.assign(SubnetAPI, staticMethods)
export default SubnetAPI