content.ts
3.51 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import { defHttp } from '@/utils/external/http/axios'
import {
BaseSaveContentParams,
BaseUpdateContentParams,
DataViewListRecord,
DateViewConfigurationInfoType
} from './model/contentModel'
import type { ErrorMessageMode, PaginationResult } from '/#/external/axios'
import { ChartType } from '@/views/three/items'
enum Api {
//大屏设计器
DATA_VIEW_CONTENT = '/data_view/content',
//大屏内容
DATA_VIEW = '/data_view',
FILE_UPLOAD = '/oss/upload',
// 针对3D模型
THREE_JS_MODEL = '/3d_component'
}
/**
* @description: 大屏设计器 update api
*/
export function contentUpdateApi(params: BaseUpdateContentParams, mode: ErrorMessageMode = 'modal') {
return defHttp.put<BaseUpdateContentParams>(
{
url: Api.DATA_VIEW_CONTENT,
params
},
{
errorMessageMode: mode
}
)
}
/**
* @description: 大屏设计器 save api
*/
export function contentSaveApi(params: object, mode: ErrorMessageMode = 'modal') {
return defHttp.post<BaseSaveContentParams>(
{
url: Api.DATA_VIEW_CONTENT,
params
},
{
errorMessageMode: mode
}
)
}
/**
* @description: 大屏设计器 delete api
*/
export function contentDeleteApi(data: [string], mode: ErrorMessageMode = 'modal') {
return defHttp.delete(
{
url: Api.DATA_VIEW_CONTENT,
data
},
{
errorMessageMode: mode
}
)
}
/**
* @description:大屏内容 content get api
*/
export const getDataView = (id: string) => {
return defHttp.get<DateViewConfigurationInfoType>({
url: `${Api.DATA_VIEW}/get_configuration_info/${id}`
})
}
/**
* @description: 大屏内容 get api
*/
export const getDataViewList = (params: object) => {
return defHttp.get<PaginationResult<DataViewListRecord>>({
url: `${Api.DATA_VIEW}`,
params
})
}
/**
* @description: 大屏内容 保存 api
*/
export const saveDataViewList = (data: object) => {
return defHttp.put({
url: `${Api.DATA_VIEW}`,
data
})
}
/**
* @description: file Upload
*/
export const uploadFile = async (file: FormData, mode: ErrorMessageMode = 'modal') => {
return defHttp.post(
{ url: Api.FILE_UPLOAD, params: file },
{
errorMessageMode: mode
}
)
}
/**
* @description: 3D模型编辑 delete api
*/
export function threeJsDeleteApi(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete(
{
url: Api.THREE_JS_MODEL +'?ids=' + ids,
},
{
errorMessageMode: mode
}
)
}
/**
* @description: 3D模型编辑 分页 api
*/
export const getThreeJsModelList = (params: object) => {
return defHttp.get<PaginationResult<ChartType>>({
url: Api.THREE_JS_MODEL + '/page',
params
})
}
/**
* @description: 3D模型 发布 api
*/
export const putThreeJsModelRelease = (params: { id: string | number; state: number }) => {
return defHttp.put({
url: Api.THREE_JS_MODEL + '/publish' + '/' + params['id'] + '/' + params['state'],
params
})
}
/**
* @description: 3D模型 更新 api
*/
export const updateThreeJsModel = (params: { id: string; name: string }) => {
return defHttp.put({
url: Api.THREE_JS_MODEL +'/' + params['id'] + '/' + params['name'],
params
})
}
/**
* @description: 3D模型 保存 api
*/
export function saveOrUpdateThreeJsModel(params: Recordable) {
return defHttp.post({
url: Api.THREE_JS_MODEL +'/' + params['id'],
data: params['data']
})
}
/**
* @description: 3D模型 获取 api
*/
export function getThreeJsModel(id: string) {
return defHttp.get({
url: Api.THREE_JS_MODEL +'/' + id,
})
}