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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
| import request from "@/plugin/axios/index";
| import { tokenKey } from "@/assets/js/config";
| import { handleQueryResourceListData } from "../tool";
| import toolClass from "@/assets/js/toolClass";
| const resourceApi = {
| /*
| **获取资源列表&详情**
| path: 数据路径
| storeInfo: 仓储
| repositoryInfo: 仓库
| queryType: 检索类型
| paging: 分页
| sort: 排序
| fields: 自定义字段
| itemId: 获取详情时的资源ID
| */
| getItem: ({
| path,
| storeInfo,
| repositoryInfo,
| queryType,
| linkType,
| paging,
| sort,
| fields,
| itemId,
| itemIds,
| itemType,
| coverSize,
| itemIdArr,
| SysType,
| tourism_isHighQualityResources,
| }) => {
| if (!path) return Promise.reject("接口请求必要参数不能为空!");
|
|
|
|
|
| const query = {
| AccessControl: {
| Path: path,
| StoreRefCode: storeInfo + "",
| RepositoryRefCode: repositoryInfo + "",
| Type: queryType || "\\",
| LinkType: linkType || "",
| },
| PageQuery: {
| Start: paging?.start || "0",
| Size: paging?.size || "10",
| },
| SortQuery: sort ? [sort] : [{
| LinkOrder: "Desc"
| }],
| CreateDate: [],
| Description: [],
| Name: [],
| Icon: [],
| RefCode: [],
| Type: [],
| TypeId: [],
| State: [],
| Tag: [],
| LinkInfo: [],
| LinkFile: [],
| CmsItemType: [],
| ChildrenFolderCount: [],
| ChildrenCount: [],
| ...fields,
| };
| if (itemIdArr) query["Id"] = itemIdArr;
| if (SysType) query["SysType="] = [`${SysType}`];
| if (tourism_isHighQualityResources)
| query["tourism_isHighQualityResources="] = [
| `${tourism_isHighQualityResources}`,
| ];
| if (itemId) query["Id="] = [`${itemId}`];
| if (itemIds) query["Id="] = itemIds;
| if (itemType) query["Type="] = [`${itemType}`];
| const body = { query: JSON.stringify({ Query: [{ Q1: query }] }) };
| let token = localStorage.getItem(tokenKey);
| return request({
| url: token ? "/resource/api/ApiAppUserQuery" : "/resource/api/ApiQuery",
| method: "post",
| data: body,
| }).then((resp) => {
| if (resp.length > 0) {
| const data = resp[0];
| const datas = handleQueryResourceListData({
| datas: data.datas,
| fields,
| path,
| storeInfo,
| repositoryInfo,
| coverSize,
| });
| return { datas, total: data.totalCount };
| }
| return { datas: [], total: 0 };
| });
| },
| // 模糊搜索
| EsQuery(query) {
| let { params, path, paging } = query;
| let queryBody = {
| Type: "*",
| Store: [],
| ItemType: [],
| CmsType: [],
| SysType: ["CmsItem"],
| LinkInfo: [],
| PageQuery: {
| Start: paging?.start || "0",
| Size: paging?.size || "10",
| },
| };
| // 设置不同的Path
|
| // 如果没有搜索关键字,则只用获取名称
| if (params.length > 0) {
| let data = {
| "||Name": [...params],
| "||tourism_content*": [...params],
| "||tourism_workflow*": [...params],
| "||tourism_notes*": [...params],
| "||tourism_caseIndex*": [...params],
| "||tourism_basicCase*": [...params],
| "||tourism_judgmentAndReasons*": [...params],
| "||tourism_legalIssuesInvolvedInThisCase*": [...params],
| "||tourism_referenceAnswerAndLegalAnalysis*": [...params],
| "||tourism_case*": [...params],
| "||tourism_clause*": [...params],
| "||tourism_unscramble*": [...params],
| "||tourism_specialRemind*": [...params],
| "||tourism_fiction*": [...params],
| "||tourism_authorityNature*": [...params],
| "||tourism_authorityGist*": [...params],
| "||tourism_penaltyGist*": [...params],
| "||tourism_penaltyTerms*": [...params],
| "||tourism_penaltyType*": [...params],
| "||tourism_remarksNote*": [...params],
| "||tourism_keyword*": [...params],
| };
| Object.assign(queryBody, data);
| } else {
| let data = {
| Name: [],
| };
| Object.assign(queryBody, data);
| }
|
| // 全部搜索 - 单独的某个库
| if (path != "All") {
| let data = {
| Path: [
| {
| Repository: "tourism_tourismLawsAndRegulationsDatabase",
| Path: path,
| },
| ],
| };
| Object.assign(queryBody, data);
| }
| const body = { query: JSON.stringify({ Query: [{ Q1: queryBody }] }) };
|
| return request({
| url: "/resource/api/ApiEsQuery",
| method: "post",
| data: body,
| }).then((res) => {
| if (res.length > 0) {
| const data = res[0];
|
| const datas = handleQueryResourceListData({
| datas: data.datas,
| path,
| });
| return { datas, total: data.totalCount };
| }
| return { data: [], total: 0 };
| });
| },
|
| //获取资源类型
| getCmsTypeByRefCode(data) {
| return request({
| url: "resource/api/ApiGetCmsTypeByRefCode",
| method: "post",
| data,
| });
| },
|
| //取消cms收藏
| delCmsItemLink(data) {
| return request({
| url: "/resource/api/ApiDelCmsItemLink",
| method: "post",
| data,
| });
| },
|
| //cms收藏
| collectCmsItem(data) {
| return request({
| url: "/resource/api/ApiAddCmsItemLink",
| method: "post",
| data,
| });
| },
|
| // 获取cms收藏列表
| getCmsCollectList(data) {
| const body = { query: JSON.stringify({ Query: [{ Q1: data }] }) };
| return request({
| url: "/resource/api/ApiAppUserQuery",
| method: "post",
| data: body,
| });
| },
| };
|
| export default resourceApi;
|
|