bigscreenCenter.ts
3.14 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import { defHttp } from '/@/utils/http/axios';
import type {
queryPageParams,
BigScreenCenterParams,
ConfigurationCenterInfo,
BigScreenCenterItemsModel,
BigScreenInterfaceParams,
} from './model/bigscreenCenterModel';
import { getPageData } from '../../base';
import { FileUploadResponse } from '../../oem/model';
enum API {
basicUrl = '/data_view',
UPLOAD = '/oss/upload',
//大屏公共接口
DATA_VIEW_INTERFACE = '/data_view_interface',
SHARE = '/data_view/share',
}
export const getPage = (params: queryPageParams) => {
return getPageData<BigScreenCenterItemsModel>(params, API.basicUrl);
};
export const saveConfigurationCenter = (params: BigScreenCenterParams) => {
return defHttp.post({
url: API.basicUrl,
data: params,
});
};
export const updateConfigurationCenter = (params: BigScreenCenterParams) => {
return defHttp.put({
url: API.basicUrl,
data: params,
});
};
export const deleteBigScreenenter = (ids: string[]) => {
return defHttp.delete({
url: API.basicUrl,
data: {
ids: ids,
},
});
};
export const saveOrUpdateBigScreenCenter = (params: ConfigurationCenterInfo, isUpdate: boolean) => {
return isUpdate ? updateConfigurationCenter(params) : saveConfigurationCenter(params);
};
export const uploadThumbnail = (file: FormData) => {
return defHttp.post<FileUploadResponse>({ url: API.UPLOAD, params: file });
};
export const bigScreenPublish = (id) => {
return defHttp.get({
url: API.basicUrl + '/publish/' + id,
});
};
export const bigScreenCancelPublish = (id) => {
return defHttp.get({
url: API.basicUrl + '/cancel_publish/' + id,
});
};
/**
* 大屏公共接口
*/
export const getDataViewInterfacePage = (params: queryPageParams) => {
return getPageData<BigScreenCenterItemsModel>(params, API.DATA_VIEW_INTERFACE);
};
export const saveDataViewInterface = (params: BigScreenInterfaceParams) => {
return defHttp.post({
url: API.DATA_VIEW_INTERFACE,
data: params,
});
};
export const updateDataViewInterface = (params: BigScreenInterfaceParams) => {
return defHttp.put({
url: API.DATA_VIEW_INTERFACE,
data: params,
});
};
export const deleteBigViewInterface = (ids: string[]) => {
return defHttp.delete({
url: API.DATA_VIEW_INTERFACE,
data: {
ids: ids,
},
});
};
export const getPublish = (id) => {
return defHttp.get({
url: API.DATA_VIEW_INTERFACE + '/publish/' + id,
});
};
export const getCancelPublish = (id) => {
return defHttp.get({
url: API.DATA_VIEW_INTERFACE + '/cancel_publish/' + id,
});
};
//批量发布和取消发布
export const putPublishOrCancelPublish = (type, ids) => {
return defHttp.put({
url: `${API.DATA_VIEW_INTERFACE}/${
type === 'batchPublish' ? 'batch_publish' : 'batch_cancel_publish'
}/?ids=${ids.join(',')}`,
});
};
export const shareLargeScreen = (record: {
id: string;
accessCredentials?: string;
isShare: boolean;
}) => {
const { accessCredentials, isShare, id } = record;
return defHttp.post(
{
url: `${API.SHARE}/${id}`,
params: { isShare, ...(accessCredentials ? { accessCredentials } : {}) },
},
{
joinParamsToUrl: true,
}
);
};