@spacecorexdev/core 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -36
- package/src/api/_base.ts +243 -0
- package/src/api/index.ts +17 -0
- package/src/api/project.ts +1345 -0
- package/src/api/user.ts +1174 -0
- package/src/contract.ts +50 -0
- package/src/hooks/index.ts +2 -0
- package/{dist/hooks/index.js → src/hooks/useLongPress.ts} +53 -49
- package/src/hooks/useOnlineStatus.ts +22 -0
- package/src/index.ts +14 -0
- package/src/types/id.ts +2 -0
- package/src/types/index.ts +5 -0
- package/src/types/project/base.ts +63 -0
- package/src/types/project/contract.ts +79 -0
- package/src/types/project/contractStatus.tsx +15 -0
- package/src/types/project/index.ts +5 -0
- package/src/types/project/member.ts +46 -0
- package/src/types/project/progress.ts +43 -0
- package/src/types/projectRole.ts +17 -0
- package/src/types/theme.ts +1 -0
- package/src/types/user/index.ts +1 -0
- package/src/types/user/role.ts +7 -0
- package/src/ui/CommentTimeline/index.tsx +330 -0
- package/src/ui/FileManager/FileContextMenu.tsx +628 -0
- package/src/ui/FileManager/FileGridView.tsx +529 -0
- package/src/ui/FileManager/FileTableView.tsx +405 -0
- package/src/ui/FileManager/FileToolbar.tsx +119 -0
- package/src/ui/FileManager/FileVersionHistoryModal.tsx +175 -0
- package/src/ui/FileManager/MoveCopyToProjectModal.tsx +119 -0
- package/src/ui/FileManager/ShareToWechatModal.tsx +419 -0
- package/src/ui/FileManager/hooks/useFileManagerActions.ts +2532 -0
- package/src/ui/FileManager/hooks/useFileManagerState.ts +419 -0
- package/src/ui/FileManager/index.tsx +580 -0
- package/src/ui/FileManager/projectFileManagerApi.ts +57 -0
- package/src/ui/FileManager/types.ts +184 -0
- package/src/ui/FileManager/utils/fileDeltaWorker.ts +193 -0
- package/src/ui/FileManager/utils/fileTree.ts +178 -0
- package/src/ui/FileManager/utils/fileUpload.ts +714 -0
- package/src/ui/FileManager/utils/fileUtils.ts +65 -0
- package/src/ui/InvoiceRecordsList/index.tsx +813 -0
- package/src/ui/MyFileSelectorModal.tsx +261 -0
- package/src/ui/ProjectSelector/index.tsx +472 -0
- package/src/ui/ProjectSelector/projectCache.ts +40 -0
- package/src/ui/RoleSelector/index.tsx +473 -0
- package/src/ui/RoleSelector/roleCache.ts +40 -0
- package/src/ui/UIAlert.tsx +399 -0
- package/src/ui/UIAlertExample.tsx +129 -0
- package/src/ui/UIConfirm.tsx +335 -0
- package/src/ui/UIConfirmExample.tsx +165 -0
- package/src/ui/UIDatePicker.tsx +146 -0
- package/src/ui/UIDateRangePicker.tsx +38 -0
- package/src/ui/UIFilePreview/ExcelEditor/index.tsx +617 -0
- package/src/ui/UIFilePreview/ExcelEditor/types.ts +24 -0
- package/src/ui/UIFilePreview/ExportDropdown.css +85 -0
- package/src/ui/UIFilePreview/ExportDropdown.tsx +109 -0
- package/src/ui/UIFilePreview/IndexedDBUtils.ts +564 -0
- package/src/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.ts +576 -0
- package/src/ui/UIFilePreview/MarkdownEditor/index.tsx +677 -0
- package/src/ui/UIFilePreview/MarkdownEditor/markdownEditor.css +1005 -0
- package/src/ui/UIFilePreview/MarkdownEditor/types.ts +15 -0
- package/src/ui/UIFilePreview/PPTXEditor/index.tsx +602 -0
- package/src/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.ts +77 -0
- package/src/ui/UIFilePreview/RichDocEditor/exportRDocPdf.ts +374 -0
- package/src/ui/UIFilePreview/RichDocEditor/index.tsx +730 -0
- package/src/ui/UIFilePreview/RichDocEditor/richdoc-editor.css +59 -0
- package/src/ui/UIFilePreview/UIFilePreview.tsx +611 -0
- package/src/ui/UIFilePreview/WordEditor/index.tsx +3933 -0
- package/src/ui/UIFilePreview/WordEditor/style.ts +1213 -0
- package/src/ui/UIFilePreview/WordEditor/word-editor.css +999 -0
- package/src/ui/UIFilePreview/filePreview.css +193 -0
- package/src/ui/UIFilePreview/filetypes/archive.tsx +66 -0
- package/src/ui/UIFilePreview/filetypes/cad.tsx +287 -0
- package/src/ui/UIFilePreview/filetypes/excel.tsx +355 -0
- package/src/ui/UIFilePreview/filetypes/image.tsx +20 -0
- package/src/ui/UIFilePreview/filetypes/imageLoader.ts +63 -0
- package/src/ui/UIFilePreview/filetypes/pdf.tsx +156 -0
- package/src/ui/UIFilePreview/filetypes/ppt.tsx +535 -0
- package/src/ui/UIFilePreview/filetypes/pptExportPdf.ts +523 -0
- package/src/ui/UIFilePreview/filetypes/video.tsx +482 -0
- package/src/ui/UIFilePreview/filetypes/word.tsx +245 -0
- package/src/ui/UIFilePreview/filetypes/wordExportMarkdown.ts +86 -0
- package/src/ui/UIFilePreview/filetypes/wordExportPdf.tsx +427 -0
- package/src/ui/UIFilePreview/index.ts +35 -0
- package/src/ui/UIFilePreview/pdfPagination.ts +143 -0
- package/src/ui/UIFilePreview/previewUtils.tsx +531 -0
- package/src/ui/UIFileUpload.tsx +382 -0
- package/src/ui/UIImageUpload.tsx +195 -0
- package/src/ui/UILoading.tsx +255 -0
- package/src/ui/UILoadingExample.tsx +139 -0
- package/src/ui/UISelect.tsx +105 -0
- package/src/ui/UIToast.tsx +381 -0
- package/src/ui/UIToastExample.tsx +69 -0
- package/src/ui/UIToastSingle.tsx +279 -0
- package/src/ui/UIViewToggle.tsx +64 -0
- package/src/ui/UserSelector/index.tsx +583 -0
- package/src/ui/index.ts +84 -0
- package/src/ui/upload/image.ts +135 -0
- package/src/ui/upload/index.ts +73 -0
- package/src/ui/upload/submitFile.ts +106 -0
- package/src/ui/upload/submitForm.ts +124 -0
- package/src/ui/upload/upload.err.ts +15 -0
- package/src/ui/upload/upload.ts +250 -0
- package/src/utils/CacheDepartmentInfo.ts +372 -0
- package/src/utils/CacheFileContent.ts +315 -0
- package/src/utils/CachePermissionInfo.ts +235 -0
- package/src/utils/CacheRoleInfo.ts +303 -0
- package/src/utils/CacheUserInfo.ts +818 -0
- package/src/utils/CacheViewToggleInfo.ts +182 -0
- package/src/utils/MessageContentUtils.ts +268 -0
- package/src/utils/clipboard.ts +70 -0
- package/src/utils/companyEmail.ts +19 -0
- package/src/utils/forbidDebugger.ts +59 -0
- package/src/utils/formatters.ts +94 -0
- package/src/utils/htmlUtils.tsx +59 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/keyboard.ts +114 -0
- package/src/utils/mammothApi.ts +16 -0
- package/src/utils/polyfills.ts +928 -0
- package/src/utils/regex.ts +14 -0
- package/src/utils/storage.ts +95 -0
- package/src/utils/workerBootstrap.ts +87 -0
- package/dist/api/index.js +0 -1553
- package/dist/contract.js +0 -5
- package/dist/index.js +0 -4492
- package/dist/types/index.js +0 -49
- package/dist/ui/index.css +0 -1876
- package/dist/ui/index.js +0 -22245
- package/dist/utils/index.js +0 -4296
- /package/{dist → src}/styles/ant-modal.css +0 -0
- /package/{dist → src}/styles/ant-spin.css +0 -0
- /package/{dist → src}/styles/ant-table.css +0 -0
- /package/{dist → src}/styles/index.css +0 -0
package/dist/api/index.js
DELETED
|
@@ -1,1553 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __export = (target, all) => {
|
|
4
|
-
for (var name in all)
|
|
5
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
-
};
|
|
7
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
-
|
|
9
|
-
// src/api/_base.ts
|
|
10
|
-
var base_exports = {};
|
|
11
|
-
__export(base_exports, {
|
|
12
|
-
AuthorizationHandler: () => AuthorizationHandler,
|
|
13
|
-
HttpRequest: () => HttpRequest,
|
|
14
|
-
ResponseCode: () => ResponseCode
|
|
15
|
-
});
|
|
16
|
-
import axios, { AxiosError } from "axios";
|
|
17
|
-
|
|
18
|
-
// src/ui/UIToast.tsx
|
|
19
|
-
import { useEffect, useState, useRef } from "react";
|
|
20
|
-
import { notification } from "antd";
|
|
21
|
-
import { CheckCircleOutlined, CloseCircleOutlined, InfoCircleOutlined, WarningOutlined } from "@ant-design/icons";
|
|
22
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
var iconMap = {
|
|
24
|
-
success: /* @__PURE__ */ jsx(CheckCircleOutlined, { style: { color: "#52c41a" } }),
|
|
25
|
-
error: /* @__PURE__ */ jsx(CloseCircleOutlined, { style: { color: "#ff4d4f" } }),
|
|
26
|
-
info: /* @__PURE__ */ jsx(InfoCircleOutlined, { style: { color: "#1677ff" } }),
|
|
27
|
-
warning: /* @__PURE__ */ jsx(WarningOutlined, { style: { color: "#faad14" } })
|
|
28
|
-
};
|
|
29
|
-
notification.config({
|
|
30
|
-
placement: "topRight",
|
|
31
|
-
duration: 3,
|
|
32
|
-
// 确保 toast 显示在全屏 Modal(z-index 1000+)之上,避免被弹窗遮挡
|
|
33
|
-
...{ zIndex: 1e4 }
|
|
34
|
-
});
|
|
35
|
-
var _SingletonToastManager = class _SingletonToastManager {
|
|
36
|
-
constructor() {
|
|
37
|
-
__publicField(this, "currentToast", null);
|
|
38
|
-
__publicField(this, "api", null);
|
|
39
|
-
__publicField(this, "isInitialized", false);
|
|
40
|
-
__publicField(this, "pendingToast", null);
|
|
41
|
-
}
|
|
42
|
-
static getInstance() {
|
|
43
|
-
if (!_SingletonToastManager.instance) {
|
|
44
|
-
_SingletonToastManager.instance = new _SingletonToastManager();
|
|
45
|
-
}
|
|
46
|
-
return _SingletonToastManager.instance;
|
|
47
|
-
}
|
|
48
|
-
// 初始化 API
|
|
49
|
-
init(api2) {
|
|
50
|
-
this.api = api2;
|
|
51
|
-
this.isInitialized = true;
|
|
52
|
-
if (this.pendingToast) {
|
|
53
|
-
const config = this.pendingToast;
|
|
54
|
-
this.pendingToast = null;
|
|
55
|
-
this.show(config);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// 显示全局唯一Toast
|
|
59
|
-
show(config) {
|
|
60
|
-
const { key, type, message: message2, descs, duration, placement, onClose } = config;
|
|
61
|
-
if (!this.isInitialized || !this.api) {
|
|
62
|
-
this.pendingToast = config;
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (this.currentToast?.timer) {
|
|
66
|
-
clearTimeout(this.currentToast.timer);
|
|
67
|
-
}
|
|
68
|
-
if (this.currentToast && this.currentToast.key === key) {
|
|
69
|
-
notification.destroy(key);
|
|
70
|
-
this.createNotification({ key, type, message: message2, descs, duration, placement, onClose });
|
|
71
|
-
} else {
|
|
72
|
-
if (this.currentToast) {
|
|
73
|
-
notification.destroy(this.currentToast.key);
|
|
74
|
-
}
|
|
75
|
-
this.createNotification({ key, type, message: message2, descs, duration, placement, onClose });
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// 创建通知
|
|
79
|
-
createNotification(config) {
|
|
80
|
-
if (!this.api) return;
|
|
81
|
-
const { key, type, message: message2, descs, duration, placement, onClose } = config;
|
|
82
|
-
const notificationMethod = {
|
|
83
|
-
success: this.api.success.bind(this.api),
|
|
84
|
-
error: this.api.error.bind(this.api),
|
|
85
|
-
info: this.api.info.bind(this.api),
|
|
86
|
-
warning: this.api.warning.bind(this.api)
|
|
87
|
-
}[type];
|
|
88
|
-
notificationMethod({
|
|
89
|
-
key,
|
|
90
|
-
message: message2,
|
|
91
|
-
description: descs,
|
|
92
|
-
duration,
|
|
93
|
-
placement: placement || "topRight",
|
|
94
|
-
icon: iconMap[type],
|
|
95
|
-
onClose: () => {
|
|
96
|
-
if (this.currentToast?.key === key) {
|
|
97
|
-
if (this.currentToast.timer) {
|
|
98
|
-
clearTimeout(this.currentToast.timer);
|
|
99
|
-
}
|
|
100
|
-
this.currentToast = null;
|
|
101
|
-
}
|
|
102
|
-
onClose?.();
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
this.currentToast = {
|
|
106
|
-
key,
|
|
107
|
-
type,
|
|
108
|
-
message: message2,
|
|
109
|
-
descs,
|
|
110
|
-
duration,
|
|
111
|
-
placement,
|
|
112
|
-
timer: null
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
// 关闭当前 toast
|
|
116
|
-
close() {
|
|
117
|
-
if (this.currentToast) {
|
|
118
|
-
if (this.currentToast.timer) {
|
|
119
|
-
clearTimeout(this.currentToast.timer);
|
|
120
|
-
}
|
|
121
|
-
notification.destroy(this.currentToast.key);
|
|
122
|
-
this.currentToast = null;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// 销毁所有 toast
|
|
126
|
-
destroy() {
|
|
127
|
-
this.close();
|
|
128
|
-
notification.destroy();
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
__publicField(_SingletonToastManager, "instance");
|
|
132
|
-
var SingletonToastManager = _SingletonToastManager;
|
|
133
|
-
var singletonManager = SingletonToastManager.getInstance();
|
|
134
|
-
function parseToastOptions(options) {
|
|
135
|
-
if (typeof options === "string") {
|
|
136
|
-
return { message: options, duration: 3 };
|
|
137
|
-
}
|
|
138
|
-
return options;
|
|
139
|
-
}
|
|
140
|
-
function getIcon(type) {
|
|
141
|
-
return iconMap[type];
|
|
142
|
-
}
|
|
143
|
-
var uiToast = {
|
|
144
|
-
success: (options) => {
|
|
145
|
-
if (!options) return;
|
|
146
|
-
const config = parseToastOptions(options);
|
|
147
|
-
notification.success({
|
|
148
|
-
message: config.message,
|
|
149
|
-
description: config.descs,
|
|
150
|
-
duration: config.duration,
|
|
151
|
-
placement: config.placement,
|
|
152
|
-
icon: getIcon("success"),
|
|
153
|
-
onClose: config.onClose
|
|
154
|
-
});
|
|
155
|
-
},
|
|
156
|
-
error: (options) => {
|
|
157
|
-
if (!options) return;
|
|
158
|
-
const config = parseToastOptions(options);
|
|
159
|
-
notification.error({
|
|
160
|
-
message: config.message,
|
|
161
|
-
description: config.descs,
|
|
162
|
-
duration: config.duration,
|
|
163
|
-
placement: config.placement,
|
|
164
|
-
icon: getIcon("error"),
|
|
165
|
-
onClose: config.onClose
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
info: (options) => {
|
|
169
|
-
if (!options) return;
|
|
170
|
-
const config = parseToastOptions(options);
|
|
171
|
-
notification.info({
|
|
172
|
-
message: config.message,
|
|
173
|
-
description: config.descs,
|
|
174
|
-
duration: config.duration,
|
|
175
|
-
placement: config.placement,
|
|
176
|
-
icon: getIcon("info"),
|
|
177
|
-
onClose: config.onClose
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
|
-
warning: (options) => {
|
|
181
|
-
if (!options) return;
|
|
182
|
-
const config = parseToastOptions(options);
|
|
183
|
-
notification.warning({
|
|
184
|
-
message: config.message,
|
|
185
|
-
description: config.descs,
|
|
186
|
-
duration: config.duration,
|
|
187
|
-
placement: config.placement,
|
|
188
|
-
icon: getIcon("warning"),
|
|
189
|
-
onClose: config.onClose
|
|
190
|
-
});
|
|
191
|
-
},
|
|
192
|
-
// 自定义类型的toast
|
|
193
|
-
custom: (type, options) => {
|
|
194
|
-
const { message: message2, descs, duration, placement, onClose } = options;
|
|
195
|
-
notification[type]({
|
|
196
|
-
message: message2,
|
|
197
|
-
description: descs,
|
|
198
|
-
duration,
|
|
199
|
-
placement,
|
|
200
|
-
icon: getIcon(type),
|
|
201
|
-
onClose
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
var UIToast_default = uiToast;
|
|
206
|
-
|
|
207
|
-
// src/ui/UILoading.tsx
|
|
208
|
-
import { Spin } from "antd";
|
|
209
|
-
import { LoadingOutlined } from "@ant-design/icons";
|
|
210
|
-
import { createRoot } from "react-dom/client";
|
|
211
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
212
|
-
var loadingSymbol = /* @__PURE__ */ Symbol("loading");
|
|
213
|
-
function getLoadingGlobalProps() {
|
|
214
|
-
let props = window[loadingSymbol];
|
|
215
|
-
if (!props) {
|
|
216
|
-
props = { count: 0, timeoutId: 0, inTimeout: false };
|
|
217
|
-
window[loadingSymbol] = props;
|
|
218
|
-
}
|
|
219
|
-
return props;
|
|
220
|
-
}
|
|
221
|
-
var defaultOptions = {
|
|
222
|
-
tip: "",
|
|
223
|
-
fullscreen: true,
|
|
224
|
-
delay: 0,
|
|
225
|
-
mask: true,
|
|
226
|
-
iconSize: 40,
|
|
227
|
-
wrapperClassName: "ui-loading-wrapper"
|
|
228
|
-
};
|
|
229
|
-
var UILoading = (props) => {
|
|
230
|
-
const options = { ...defaultOptions, ...props };
|
|
231
|
-
const {
|
|
232
|
-
tip,
|
|
233
|
-
fullscreen,
|
|
234
|
-
mask,
|
|
235
|
-
maskStyle,
|
|
236
|
-
iconSize,
|
|
237
|
-
iconStyle,
|
|
238
|
-
containerStyle,
|
|
239
|
-
wrapperClassName
|
|
240
|
-
} = options;
|
|
241
|
-
const loadingIcon = /* @__PURE__ */ jsx2(
|
|
242
|
-
LoadingOutlined,
|
|
243
|
-
{
|
|
244
|
-
style: {
|
|
245
|
-
fontSize: iconSize,
|
|
246
|
-
color: "#1677ff",
|
|
247
|
-
...iconStyle
|
|
248
|
-
},
|
|
249
|
-
spin: true
|
|
250
|
-
}
|
|
251
|
-
);
|
|
252
|
-
const fullscreenStyle = fullscreen ? {
|
|
253
|
-
position: "fixed",
|
|
254
|
-
top: 0,
|
|
255
|
-
left: 0,
|
|
256
|
-
right: 0,
|
|
257
|
-
bottom: 0,
|
|
258
|
-
zIndex: 9999,
|
|
259
|
-
display: "flex",
|
|
260
|
-
justifyContent: "center",
|
|
261
|
-
alignItems: "center",
|
|
262
|
-
backgroundColor: mask ? "rgba(0, 0, 0, 0.45)" : "transparent",
|
|
263
|
-
...maskStyle
|
|
264
|
-
} : {};
|
|
265
|
-
const containerStyles = {
|
|
266
|
-
display: "flex",
|
|
267
|
-
flexDirection: "column",
|
|
268
|
-
alignItems: "center",
|
|
269
|
-
justifyContent: "center",
|
|
270
|
-
...containerStyle
|
|
271
|
-
};
|
|
272
|
-
return /* @__PURE__ */ jsx2("div", { style: fullscreenStyle, className: wrapperClassName, children: /* @__PURE__ */ jsx2("div", { style: containerStyles, children: /* @__PURE__ */ jsx2(Spin, { indicator: loadingIcon, children: tip }) }) });
|
|
273
|
-
};
|
|
274
|
-
var loadingInstance = null;
|
|
275
|
-
var rootInstance = null;
|
|
276
|
-
var createLoadingInstance = (options = {}) => {
|
|
277
|
-
if (loadingInstance && rootInstance) {
|
|
278
|
-
rootInstance.unmount();
|
|
279
|
-
document.body.removeChild(loadingInstance);
|
|
280
|
-
loadingInstance = null;
|
|
281
|
-
rootInstance = null;
|
|
282
|
-
}
|
|
283
|
-
loadingInstance = document.createElement("div");
|
|
284
|
-
document.body.appendChild(loadingInstance);
|
|
285
|
-
rootInstance = createRoot(loadingInstance);
|
|
286
|
-
rootInstance.render(/* @__PURE__ */ jsx2(UILoading, { ...options }));
|
|
287
|
-
return loadingInstance;
|
|
288
|
-
};
|
|
289
|
-
var uiLoading = {
|
|
290
|
-
// 显示加载
|
|
291
|
-
show: (options = {}) => {
|
|
292
|
-
let props = getLoadingGlobalProps();
|
|
293
|
-
props.count++;
|
|
294
|
-
const mergedOptions = { ...defaultOptions, ...options };
|
|
295
|
-
if (mergedOptions.delay && mergedOptions.delay > 0) {
|
|
296
|
-
if (props.timeoutId != 0) {
|
|
297
|
-
window.clearTimeout(props.timeoutId);
|
|
298
|
-
props.timeoutId = 0;
|
|
299
|
-
}
|
|
300
|
-
props.timeoutId = window.setTimeout(() => {
|
|
301
|
-
props.timeoutId = 0;
|
|
302
|
-
createLoadingInstance(mergedOptions);
|
|
303
|
-
}, mergedOptions.delay);
|
|
304
|
-
return;
|
|
305
|
-
} else {
|
|
306
|
-
createLoadingInstance(mergedOptions);
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
// 隐藏加载
|
|
310
|
-
hide: () => {
|
|
311
|
-
let props = getLoadingGlobalProps();
|
|
312
|
-
if (props.count <= 0) {
|
|
313
|
-
console.warn("Loading count is less than 0");
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
props.count--;
|
|
317
|
-
if (props.timeoutId != 0) {
|
|
318
|
-
window.clearTimeout(props.timeoutId);
|
|
319
|
-
props.timeoutId = 0;
|
|
320
|
-
}
|
|
321
|
-
if (props.count == 0 && loadingInstance && rootInstance) {
|
|
322
|
-
rootInstance.unmount();
|
|
323
|
-
document.body.removeChild(loadingInstance);
|
|
324
|
-
loadingInstance = null;
|
|
325
|
-
rootInstance = null;
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
// 服务方法 - 自动在Promise完成后隐藏
|
|
329
|
-
service: (promise, options = {}) => {
|
|
330
|
-
uiLoading.show(options);
|
|
331
|
-
return promise.then((res) => {
|
|
332
|
-
uiLoading.hide();
|
|
333
|
-
return res;
|
|
334
|
-
}).catch((err) => {
|
|
335
|
-
uiLoading.hide();
|
|
336
|
-
throw err;
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
var UILoading_default = uiLoading;
|
|
341
|
-
|
|
342
|
-
// src/api/_base.ts
|
|
343
|
-
import * as febs2 from "febs-browser";
|
|
344
|
-
|
|
345
|
-
// src/utils/storage.ts
|
|
346
|
-
import * as febs from "febs-browser";
|
|
347
|
-
import store from "store2";
|
|
348
|
-
var Store = class {
|
|
349
|
-
constructor(s) {
|
|
350
|
-
__publicField(this, "s");
|
|
351
|
-
this.s = s;
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* @descs: 数据条数.
|
|
355
|
-
*/
|
|
356
|
-
get length() {
|
|
357
|
-
return this.s.size();
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* @descs: 所有的key.
|
|
361
|
-
*/
|
|
362
|
-
keys() {
|
|
363
|
-
return this.s.keys();
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* @descs: 设置信息.
|
|
367
|
-
*/
|
|
368
|
-
set(key, data) {
|
|
369
|
-
if (!data) {
|
|
370
|
-
return this.remove(key);
|
|
371
|
-
}
|
|
372
|
-
data = JSON.stringify(data);
|
|
373
|
-
data = febs.crypt.base64_encode(data);
|
|
374
|
-
this.s.set(key, data, true);
|
|
375
|
-
return this;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* @descs: 获取信息.
|
|
379
|
-
* @param alt: 如果获取不到信息, 使用此数据返回.
|
|
380
|
-
*/
|
|
381
|
-
get(key, alt = null) {
|
|
382
|
-
if (!this.s.has(key)) {
|
|
383
|
-
return alt;
|
|
384
|
-
}
|
|
385
|
-
let r = this.s.get(key);
|
|
386
|
-
if (r) {
|
|
387
|
-
r = febs.crypt.base64_decode(r);
|
|
388
|
-
r = febs.string.bytesToUtf8(r || []);
|
|
389
|
-
try {
|
|
390
|
-
return JSON.parse(r);
|
|
391
|
-
} catch (e) {
|
|
392
|
-
this.remove(key);
|
|
393
|
-
return null;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
return r;
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* @descs: 移除信息.
|
|
400
|
-
*/
|
|
401
|
-
remove(key) {
|
|
402
|
-
this.s.remove(key);
|
|
403
|
-
return this;
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* @descs: 清空.
|
|
407
|
-
*/
|
|
408
|
-
clear() {
|
|
409
|
-
this.s.clearAll();
|
|
410
|
-
return this;
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
var storage = {
|
|
414
|
-
/**
|
|
415
|
-
* @descs: 通用命名空间获取一个新的store.
|
|
416
|
-
*/
|
|
417
|
-
namespace: function(nm) {
|
|
418
|
-
return new Store(store.namespace(nm || "default"));
|
|
419
|
-
},
|
|
420
|
-
/**
|
|
421
|
-
* @descs: 使用session方式存储.
|
|
422
|
-
*/
|
|
423
|
-
namespace_session: function(nm) {
|
|
424
|
-
return new Store(store.session.namespace(nm || "default"));
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
// src/api/_base.ts
|
|
429
|
-
var ResponseCode = /* @__PURE__ */ ((ResponseCode4) => {
|
|
430
|
-
ResponseCode4[ResponseCode4["SUCCESS"] = 200] = "SUCCESS";
|
|
431
|
-
ResponseCode4[ResponseCode4["OPERATOR_ERROR"] = 400] = "OPERATOR_ERROR";
|
|
432
|
-
ResponseCode4[ResponseCode4["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
433
|
-
ResponseCode4[ResponseCode4["UNPERMISSION"] = 402] = "UNPERMISSION";
|
|
434
|
-
ResponseCode4[ResponseCode4["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
435
|
-
ResponseCode4[ResponseCode4["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
436
|
-
ResponseCode4[ResponseCode4["PARAM_ERROR"] = 601] = "PARAM_ERROR";
|
|
437
|
-
ResponseCode4[ResponseCode4["REQUEST_LIMIT"] = 602] = "REQUEST_LIMIT";
|
|
438
|
-
return ResponseCode4;
|
|
439
|
-
})(ResponseCode || {});
|
|
440
|
-
function getResponseCodeMsg(code) {
|
|
441
|
-
switch (code) {
|
|
442
|
-
case 404 /* NOT_FOUND */:
|
|
443
|
-
return "\u8D44\u6E90\u4E0D\u5B58\u5728";
|
|
444
|
-
case 400 /* OPERATOR_ERROR */:
|
|
445
|
-
return "\u7CFB\u7EDF\u64CD\u4F5C\u9519\u8BEF";
|
|
446
|
-
case 601 /* PARAM_ERROR */:
|
|
447
|
-
return "\u53C2\u6570\u9519\u8BEF";
|
|
448
|
-
case 602 /* REQUEST_LIMIT */:
|
|
449
|
-
return "\u8FBE\u5230\u8BBF\u95EE\u9650\u5236";
|
|
450
|
-
case 503 /* SERVICE_UNAVAILABLE */:
|
|
451
|
-
return "\u670D\u52A1\u4E0D\u53EF\u7528";
|
|
452
|
-
case 401 /* UNAUTHORIZED */:
|
|
453
|
-
return "\u672A\u767B\u5F55";
|
|
454
|
-
case 402 /* UNPERMISSION */:
|
|
455
|
-
return "\u65E0\u6743\u9650";
|
|
456
|
-
default:
|
|
457
|
-
return "\u672A\u77E5\u9519\u8BEF";
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
var api = axios.create({
|
|
461
|
-
baseURL: import.meta.env.VITE_API_BASE,
|
|
462
|
-
timeout: Number(import.meta.env.VITE_API_TIMEOUT) || 5e3,
|
|
463
|
-
headers: {
|
|
464
|
-
"Content-Type": "application/json;charset=UTF-8"
|
|
465
|
-
},
|
|
466
|
-
withCredentials: true
|
|
467
|
-
});
|
|
468
|
-
var _AuthorizationHandler = class _AuthorizationHandler {
|
|
469
|
-
static clearStoreToken() {
|
|
470
|
-
this.setStoreToken(null, 0);
|
|
471
|
-
}
|
|
472
|
-
static getStoreToken() {
|
|
473
|
-
let token = storage.namespace("bp.ss").get("ss");
|
|
474
|
-
if (token) {
|
|
475
|
-
let exp = storage.namespace("bp.ss").get("exp");
|
|
476
|
-
return {
|
|
477
|
-
token: JSON.parse(token),
|
|
478
|
-
exp: exp ? JSON.parse(exp) : 0
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
return null;
|
|
482
|
-
}
|
|
483
|
-
static getValidStoreToken() {
|
|
484
|
-
const token = _AuthorizationHandler.getStoreToken();
|
|
485
|
-
if (token && token.exp > Date.now() - _AuthorizationHandler.TOKEN_EXP) {
|
|
486
|
-
return token.token;
|
|
487
|
-
}
|
|
488
|
-
return null;
|
|
489
|
-
}
|
|
490
|
-
static setStoreToken(token, exp) {
|
|
491
|
-
if (!token) {
|
|
492
|
-
storage.namespace("bp.ss").clear();
|
|
493
|
-
} else {
|
|
494
|
-
storage.namespace("bp.ss").set("ss", JSON.stringify(token));
|
|
495
|
-
storage.namespace("bp.ss").set("exp", JSON.stringify(exp));
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
static requestHandleSid(ctx) {
|
|
499
|
-
let token = _AuthorizationHandler.getStoreToken();
|
|
500
|
-
if (token) {
|
|
501
|
-
if (token.exp > Date.now() - _AuthorizationHandler.TOKEN_EXP) {
|
|
502
|
-
ctx.headers.set(
|
|
503
|
-
_AuthorizationHandler.HEADER_NAME,
|
|
504
|
-
_AuthorizationHandler.HEADER_PREFIX + token.token
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
static responseHandleSid(ctx) {
|
|
510
|
-
let token = ctx.headers.get(_AuthorizationHandler.HEADER_NAME);
|
|
511
|
-
if (token && token.startsWith(_AuthorizationHandler.HEADER_PREFIX.trim())) {
|
|
512
|
-
token = token.replace(_AuthorizationHandler.HEADER_PREFIX, "");
|
|
513
|
-
let oldToken = token;
|
|
514
|
-
token = token.split(".")[1];
|
|
515
|
-
if (token) {
|
|
516
|
-
token = febs2.string.bytesToUtf8(febs2.crypt.base64_decode(token));
|
|
517
|
-
if (token) {
|
|
518
|
-
let tokenObj = JSON.parse(token);
|
|
519
|
-
if (tokenObj.exp < Date.now() - _AuthorizationHandler.TOKEN_EXP) {
|
|
520
|
-
_AuthorizationHandler.clearStoreToken();
|
|
521
|
-
return false;
|
|
522
|
-
} else {
|
|
523
|
-
_AuthorizationHandler.setStoreToken(oldToken, tokenObj.exp);
|
|
524
|
-
return true;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
_AuthorizationHandler.clearStoreToken();
|
|
529
|
-
if (typeof navigator !== "undefined" && navigator.onLine) {
|
|
530
|
-
window.location.href = "/";
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
return false;
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
__publicField(_AuthorizationHandler, "HEADER_NAME", "Authorization");
|
|
537
|
-
__publicField(_AuthorizationHandler, "HEADER_PREFIX", "SPBearer ");
|
|
538
|
-
__publicField(_AuthorizationHandler, "TOKEN_EXP", 20 * 1e3);
|
|
539
|
-
var AuthorizationHandler = _AuthorizationHandler;
|
|
540
|
-
api.interceptors.request.use(
|
|
541
|
-
(config) => {
|
|
542
|
-
UILoading_default.show({
|
|
543
|
-
delay: 5e3
|
|
544
|
-
});
|
|
545
|
-
AuthorizationHandler.requestHandleSid(config);
|
|
546
|
-
return config;
|
|
547
|
-
},
|
|
548
|
-
(error) => {
|
|
549
|
-
UILoading_default.hide();
|
|
550
|
-
console.log("Request Error ==========");
|
|
551
|
-
return Promise.reject(error);
|
|
552
|
-
}
|
|
553
|
-
);
|
|
554
|
-
api.interceptors.response.use(
|
|
555
|
-
(res) => {
|
|
556
|
-
UILoading_default.hide();
|
|
557
|
-
if (res.data.code !== 200 /* SUCCESS */) {
|
|
558
|
-
UIToast_default.warning(res.data.message || getResponseCodeMsg(res.data.code));
|
|
559
|
-
}
|
|
560
|
-
AuthorizationHandler.responseHandleSid(res);
|
|
561
|
-
return res.data;
|
|
562
|
-
},
|
|
563
|
-
(error) => {
|
|
564
|
-
UILoading_default.hide();
|
|
565
|
-
if (error instanceof AxiosError) {
|
|
566
|
-
if (error.code === "ERR_NETWORK" || error.code === "ECONNABORTED") {
|
|
567
|
-
UIToast_default.error("\u7F51\u7EDC\u9519\u8BEF");
|
|
568
|
-
} else if (error.code === "ERR_BAD_RESPONSE") {
|
|
569
|
-
UIToast_default.error("\u670D\u52A1\u5668\u65E0\u54CD\u5E94");
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
console.log("Response Error ==========");
|
|
573
|
-
return Promise.reject(error);
|
|
574
|
-
}
|
|
575
|
-
);
|
|
576
|
-
var HttpRequest = {
|
|
577
|
-
get(url, params, data) {
|
|
578
|
-
const config = {
|
|
579
|
-
method: "get",
|
|
580
|
-
url,
|
|
581
|
-
params,
|
|
582
|
-
data
|
|
583
|
-
};
|
|
584
|
-
return api(config);
|
|
585
|
-
},
|
|
586
|
-
post(url, params, data) {
|
|
587
|
-
const config = {
|
|
588
|
-
method: "post",
|
|
589
|
-
url,
|
|
590
|
-
params,
|
|
591
|
-
data
|
|
592
|
-
};
|
|
593
|
-
return api(config);
|
|
594
|
-
},
|
|
595
|
-
put(url, params, data) {
|
|
596
|
-
const config = {
|
|
597
|
-
method: "put",
|
|
598
|
-
url,
|
|
599
|
-
params,
|
|
600
|
-
data
|
|
601
|
-
};
|
|
602
|
-
return api(config);
|
|
603
|
-
},
|
|
604
|
-
delete(url, params, data) {
|
|
605
|
-
const config = {
|
|
606
|
-
method: "delete",
|
|
607
|
-
url,
|
|
608
|
-
params,
|
|
609
|
-
data
|
|
610
|
-
};
|
|
611
|
-
return api(config);
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
// src/api/user.ts
|
|
616
|
-
var user_exports = {};
|
|
617
|
-
__export(user_exports, {
|
|
618
|
-
admin: () => admin,
|
|
619
|
-
gateway: () => gateway,
|
|
620
|
-
message: () => message,
|
|
621
|
-
role: () => role,
|
|
622
|
-
user: () => user
|
|
623
|
-
});
|
|
624
|
-
var admin = {
|
|
625
|
-
/*
|
|
626
|
-
* 注册管理员
|
|
627
|
-
* 注册管理员
|
|
628
|
-
*/
|
|
629
|
-
registerAdmin: (data) => {
|
|
630
|
-
return HttpRequest.post("/api/admin/registerAdmin", null, { phone: data.phone, email: data.email, displayModules: data.displayModules, username: data.username, nickname: data.nickname, pwd: data.pwd, smsCode: data.smsCode }).then((res) => {
|
|
631
|
-
return res;
|
|
632
|
-
});
|
|
633
|
-
},
|
|
634
|
-
/*
|
|
635
|
-
* 注册普通用户
|
|
636
|
-
* 注册普通用户
|
|
637
|
-
*/
|
|
638
|
-
registerUser: (data) => {
|
|
639
|
-
return HttpRequest.post("/api/admin/registerUser", null, { phone: data.phone, email: data.email, displayModules: data.displayModules, username: data.username, nickname: data.nickname, pwd: data.pwd, smsCode: data.smsCode, manager_id: data.manager_id }).then((res) => {
|
|
640
|
-
return res;
|
|
641
|
-
});
|
|
642
|
-
},
|
|
643
|
-
/*
|
|
644
|
-
* 更新其他用户信息: 用户名与手机号
|
|
645
|
-
* 更新其他用户信息: 用户名与手机号
|
|
646
|
-
*/
|
|
647
|
-
updateInfoByAdmin: (data) => {
|
|
648
|
-
return HttpRequest.post("/api/admin/updateByAdmin", null, { id: data.id, is_forbidden: data.is_forbidden, title: data.title, phone: data.phone, email: data.email, displayModules: data.displayModules, username: data.username, nickname: data.nickname, pwd: data.pwd, smsCode: data.smsCode, manager_id: data.manager_id, created_at: data.created_at, tick_avatar_self: data.tick_avatar_self, role_ids: data.role_ids, isAdmin: data.isAdmin, thirdPlatformInfo: data.thirdPlatformInfo, unreadMessageCount: data.unreadMessageCount }).then((res) => {
|
|
649
|
-
return res;
|
|
650
|
-
});
|
|
651
|
-
},
|
|
652
|
-
/*
|
|
653
|
-
* 获取管理员列表
|
|
654
|
-
* 获取管理员列表
|
|
655
|
-
*/
|
|
656
|
-
list: (params) => {
|
|
657
|
-
return HttpRequest.get("/api/admin/list", { pageNum: params.pageNum, pageSize: params.pageSize }, null).then((res) => {
|
|
658
|
-
return res;
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
var gateway = {
|
|
663
|
-
/*
|
|
664
|
-
* 注册用户
|
|
665
|
-
* 注册用户
|
|
666
|
-
*/
|
|
667
|
-
register: (data) => {
|
|
668
|
-
return HttpRequest.post("/api/register", null, { phone: data.phone, email: data.email, displayModules: data.displayModules, username: data.username, nickname: data.nickname, pwd: data.pwd, smsCode: data.smsCode, manager_id: data.manager_id }).then((res) => {
|
|
669
|
-
return res;
|
|
670
|
-
});
|
|
671
|
-
},
|
|
672
|
-
/*
|
|
673
|
-
* 发送短信
|
|
674
|
-
* 发送短信
|
|
675
|
-
*/
|
|
676
|
-
sendSms: (params) => {
|
|
677
|
-
return HttpRequest.post("/api/sendSms", { phone: params.phone, imageCode: params.imageCode }, null).then((res) => {
|
|
678
|
-
return res;
|
|
679
|
-
});
|
|
680
|
-
},
|
|
681
|
-
/*
|
|
682
|
-
* 判断是否登录
|
|
683
|
-
* 判断是否登录
|
|
684
|
-
*/
|
|
685
|
-
isLogin: () => {
|
|
686
|
-
return HttpRequest.get("/api/isLogin", null, null).then((res) => {
|
|
687
|
-
return res;
|
|
688
|
-
});
|
|
689
|
-
},
|
|
690
|
-
/*
|
|
691
|
-
* 登录
|
|
692
|
-
* 登录
|
|
693
|
-
*/
|
|
694
|
-
login: (data) => {
|
|
695
|
-
return HttpRequest.post("/api/login", null, { phone: data.phone, pwd: data.pwd, pwdSN: data.pwdSN, smsCode: data.smsCode }).then((res) => {
|
|
696
|
-
return res;
|
|
697
|
-
});
|
|
698
|
-
},
|
|
699
|
-
/*
|
|
700
|
-
* 校验当前登录用户的登录密码摘要,用于需要二次确认的业务入口。
|
|
701
|
-
* 校验当前登录用户的登录密码摘要,用于需要二次确认的业务入口。
|
|
702
|
-
*/
|
|
703
|
-
verifyPasswordHash: (data) => {
|
|
704
|
-
return HttpRequest.post("/api/verifyPasswordHash", null, { passwordHash: data.passwordHash, passwordSalt: data.passwordSalt }).then((res) => {
|
|
705
|
-
return res;
|
|
706
|
-
});
|
|
707
|
-
},
|
|
708
|
-
/*
|
|
709
|
-
* 退出登录
|
|
710
|
-
* 退出登录
|
|
711
|
-
*/
|
|
712
|
-
logout: () => {
|
|
713
|
-
return HttpRequest.get("/api/logout", null, null).then((res) => {
|
|
714
|
-
return res;
|
|
715
|
-
});
|
|
716
|
-
},
|
|
717
|
-
/*
|
|
718
|
-
* 列出所有权限
|
|
719
|
-
* 列出所有权限
|
|
720
|
-
*/
|
|
721
|
-
listPermissions: () => {
|
|
722
|
-
return HttpRequest.get("/api/listPermissions", null, null).then((res) => {
|
|
723
|
-
return res;
|
|
724
|
-
});
|
|
725
|
-
},
|
|
726
|
-
/*
|
|
727
|
-
* 列出角色权限
|
|
728
|
-
* 列出角色权限
|
|
729
|
-
*/
|
|
730
|
-
listRolePermissions: (params) => {
|
|
731
|
-
return HttpRequest.get("/api/listRolePermissions", { id: params.id }, null).then((res) => {
|
|
732
|
-
return res;
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
var message = {
|
|
737
|
-
/*
|
|
738
|
-
* /api/user/message/list
|
|
739
|
-
*/
|
|
740
|
-
list: (params) => {
|
|
741
|
-
return HttpRequest.get("/api/user/message/list", { pageNum: params.pageNum, pageSize: params.pageSize, unread_only: params.unread_only }, null).then((res) => {
|
|
742
|
-
return res;
|
|
743
|
-
});
|
|
744
|
-
},
|
|
745
|
-
/*
|
|
746
|
-
* /api/user/message/unread/count
|
|
747
|
-
*/
|
|
748
|
-
countUnread: () => {
|
|
749
|
-
return HttpRequest.get("/api/user/message/unread/count", null, null).then((res) => {
|
|
750
|
-
return res;
|
|
751
|
-
});
|
|
752
|
-
},
|
|
753
|
-
/*
|
|
754
|
-
* /api/user/message/read
|
|
755
|
-
*/
|
|
756
|
-
markRead: (data) => {
|
|
757
|
-
return HttpRequest.post("/api/user/message/read", null, { messageIds: data.messageIds }).then((res) => {
|
|
758
|
-
return res;
|
|
759
|
-
});
|
|
760
|
-
},
|
|
761
|
-
/*
|
|
762
|
-
* 清除已读消息
|
|
763
|
-
* 清除已读消息
|
|
764
|
-
*/
|
|
765
|
-
clearReaded: (data) => {
|
|
766
|
-
return HttpRequest.delete("/api/user/message/clearReaded", null, { messageIds: data.messageIds }).then((res) => {
|
|
767
|
-
return res;
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
|
-
};
|
|
771
|
-
var role = {
|
|
772
|
-
/*
|
|
773
|
-
* 列出所有角色
|
|
774
|
-
* 列出所有角色
|
|
775
|
-
*/
|
|
776
|
-
listRoles: () => {
|
|
777
|
-
return HttpRequest.get("/api/role/listRoles", null, null).then((res) => {
|
|
778
|
-
return res;
|
|
779
|
-
});
|
|
780
|
-
},
|
|
781
|
-
/*
|
|
782
|
-
* 创建新角色
|
|
783
|
-
* 创建新角色
|
|
784
|
-
*/
|
|
785
|
-
createRole: (params) => {
|
|
786
|
-
return HttpRequest.post("/api/role/createRole", { name: params.name, descs: params.descs, admin_id: params.admin_id, parent_id: params.parent_id }, null).then((res) => {
|
|
787
|
-
return res;
|
|
788
|
-
});
|
|
789
|
-
},
|
|
790
|
-
/*
|
|
791
|
-
* 更新角色
|
|
792
|
-
* 更新角色
|
|
793
|
-
*/
|
|
794
|
-
updateRole: (params) => {
|
|
795
|
-
return HttpRequest.post("/api/role/updateRole", { id: params.id, name: params.name, descs: params.descs, admin_id: params.admin_id, parent_id: params.parent_id }, null).then((res) => {
|
|
796
|
-
return res;
|
|
797
|
-
});
|
|
798
|
-
},
|
|
799
|
-
/*
|
|
800
|
-
* 为角色分配权限
|
|
801
|
-
* 为角色分配权限
|
|
802
|
-
*/
|
|
803
|
-
assignPermissionsToRole: (data) => {
|
|
804
|
-
return HttpRequest.post("/api/role/assignPermissionsToRole", null, { role_id: data.role_id, permissions: data.permissions }).then((res) => {
|
|
805
|
-
return res;
|
|
806
|
-
});
|
|
807
|
-
},
|
|
808
|
-
/*
|
|
809
|
-
* 为用户分配角色
|
|
810
|
-
* 为用户分配角色
|
|
811
|
-
*/
|
|
812
|
-
assignRoleToUserPermission: () => {
|
|
813
|
-
return HttpRequest.post("/api/role/assignRoleToUserPermission", null, null).then((res) => {
|
|
814
|
-
return res;
|
|
815
|
-
});
|
|
816
|
-
},
|
|
817
|
-
/*
|
|
818
|
-
* 为用户分配角色
|
|
819
|
-
* 为用户分配角色
|
|
820
|
-
*/
|
|
821
|
-
assignRoleToUser: (data) => {
|
|
822
|
-
return HttpRequest.post("/api/role/assignRoleToUser", null, { user_id: data.user_id, role_ids: data.role_ids }).then((res) => {
|
|
823
|
-
return res;
|
|
824
|
-
});
|
|
825
|
-
},
|
|
826
|
-
/*
|
|
827
|
-
* 获取用户拥有的所有角色
|
|
828
|
-
* 获取用户拥有的所有角色
|
|
829
|
-
*/
|
|
830
|
-
listUserRoles: (params) => {
|
|
831
|
-
return HttpRequest.get("/api/role/listUserRoles", { user_id: params.user_id }, null).then((res) => {
|
|
832
|
-
return res;
|
|
833
|
-
});
|
|
834
|
-
},
|
|
835
|
-
/*
|
|
836
|
-
* 获取用户拥有的所有权限
|
|
837
|
-
* 获取用户拥有的所有权限
|
|
838
|
-
*/
|
|
839
|
-
listUserPermissions: (params) => {
|
|
840
|
-
return HttpRequest.get("/api/role/listUserPermissions", { user_id: params.user_id }, null).then((res) => {
|
|
841
|
-
return res;
|
|
842
|
-
});
|
|
843
|
-
},
|
|
844
|
-
/*
|
|
845
|
-
* 列出所有部门
|
|
846
|
-
* 列出所有部门
|
|
847
|
-
*/
|
|
848
|
-
listCompanies: () => {
|
|
849
|
-
return HttpRequest.get("/api/role/listCompanies", null, null).then((res) => {
|
|
850
|
-
return res;
|
|
851
|
-
});
|
|
852
|
-
},
|
|
853
|
-
/*
|
|
854
|
-
* 创建新公司
|
|
855
|
-
* 创建新公司
|
|
856
|
-
*/
|
|
857
|
-
createCompany: (params) => {
|
|
858
|
-
return HttpRequest.post("/api/role/createCompany", { name: params.name, descs: params.descs, admin_id: params.admin_id, parent_id: params.parent_id, is_spv_company: params.is_spv_company }, null).then((res) => {
|
|
859
|
-
return res;
|
|
860
|
-
});
|
|
861
|
-
},
|
|
862
|
-
/*
|
|
863
|
-
* 更新公司
|
|
864
|
-
* 更新公司
|
|
865
|
-
*/
|
|
866
|
-
updateCompany: (params) => {
|
|
867
|
-
return HttpRequest.post("/api/role/updateCompany", { id: params.id, name: params.name, descs: params.descs, admin_id: params.admin_id, parent_id: params.parent_id, is_spv_company: params.is_spv_company }, null).then((res) => {
|
|
868
|
-
return res;
|
|
869
|
-
});
|
|
870
|
-
},
|
|
871
|
-
/*
|
|
872
|
-
* 列出所有部门
|
|
873
|
-
* 列出所有部门
|
|
874
|
-
*/
|
|
875
|
-
listDepartments: () => {
|
|
876
|
-
return HttpRequest.get("/api/role/listDepartments", null, null).then((res) => {
|
|
877
|
-
return res;
|
|
878
|
-
});
|
|
879
|
-
},
|
|
880
|
-
/*
|
|
881
|
-
* 创建新部门
|
|
882
|
-
* 创建新部门
|
|
883
|
-
*/
|
|
884
|
-
createDepartment: (params) => {
|
|
885
|
-
return HttpRequest.post("/api/role/createDepartment", { name: params.name, descs: params.descs, admin_id: params.admin_id, company_id: params.company_id, parent_id: params.parent_id }, null).then((res) => {
|
|
886
|
-
return res;
|
|
887
|
-
});
|
|
888
|
-
},
|
|
889
|
-
/*
|
|
890
|
-
* 更新部门
|
|
891
|
-
* 更新部门
|
|
892
|
-
*/
|
|
893
|
-
updateDepartment: (params) => {
|
|
894
|
-
return HttpRequest.post("/api/role/updateDepartment", { id: params.id, name: params.name, descs: params.descs, admin_id: params.admin_id, company_id: params.company_id, parent_id: params.parent_id }, null).then((res) => {
|
|
895
|
-
return res;
|
|
896
|
-
});
|
|
897
|
-
},
|
|
898
|
-
/*
|
|
899
|
-
* 为用户分配部门
|
|
900
|
-
* 为用户分配部门
|
|
901
|
-
*/
|
|
902
|
-
assignUserToDepartment: (params) => {
|
|
903
|
-
return HttpRequest.post("/api/role/assignUserToDepartment", { user_id: params.user_id, department_id: params.department_id, position: params.position }, null).then((res) => {
|
|
904
|
-
return res;
|
|
905
|
-
});
|
|
906
|
-
},
|
|
907
|
-
/*
|
|
908
|
-
* 为用户移除部门
|
|
909
|
-
* 为用户移除部门
|
|
910
|
-
*/
|
|
911
|
-
removeUserFromDepartment: (params) => {
|
|
912
|
-
return HttpRequest.post("/api/role/removeUserFromDepartment", { user_id: params.user_id, department_id: params.department_id }, null).then((res) => {
|
|
913
|
-
return res;
|
|
914
|
-
});
|
|
915
|
-
},
|
|
916
|
-
/*
|
|
917
|
-
* 获取公司拥有的所有部门
|
|
918
|
-
* 获取公司拥有的所有部门
|
|
919
|
-
*/
|
|
920
|
-
listCompanyDepartments: (params) => {
|
|
921
|
-
return HttpRequest.get("/api/role/listCompanyDepartments", { company_id: params.company_id }, null).then((res) => {
|
|
922
|
-
return res;
|
|
923
|
-
});
|
|
924
|
-
},
|
|
925
|
-
/*
|
|
926
|
-
* 获取用户拥有的所有部门
|
|
927
|
-
* 获取用户拥有的所有部门
|
|
928
|
-
*/
|
|
929
|
-
listUserDepartments: (params) => {
|
|
930
|
-
return HttpRequest.get("/api/role/listUserDepartments", { user_id: params.user_id }, null).then((res) => {
|
|
931
|
-
return res;
|
|
932
|
-
});
|
|
933
|
-
},
|
|
934
|
-
/*
|
|
935
|
-
* 获取用户拥有的所有部门
|
|
936
|
-
* 获取用户拥有的所有部门
|
|
937
|
-
*/
|
|
938
|
-
listDepartmentUsers: (params) => {
|
|
939
|
-
return HttpRequest.get("/api/role/listDepartmentUsers", { department_id: params.department_id }, null).then((res) => {
|
|
940
|
-
return res;
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
};
|
|
944
|
-
var user = {
|
|
945
|
-
/*
|
|
946
|
-
* 获取用户信息; (也可以获取管理员信息)
|
|
947
|
-
* 获取用户信息; (也可以获取管理员信息)
|
|
948
|
-
*/
|
|
949
|
-
getInfoByUsername: (params) => {
|
|
950
|
-
return HttpRequest.get("/api/user/infoByUsername", { username: params.username }, null).then((res) => {
|
|
951
|
-
return res;
|
|
952
|
-
});
|
|
953
|
-
},
|
|
954
|
-
/*
|
|
955
|
-
* 获取用户信息; (也可以获取管理员信息)
|
|
956
|
-
* 获取用户信息; (也可以获取管理员信息)
|
|
957
|
-
*/
|
|
958
|
-
getInfo: (params) => {
|
|
959
|
-
return HttpRequest.get("/api/user/info", { id: params.id }, null).then((res) => {
|
|
960
|
-
return res;
|
|
961
|
-
});
|
|
962
|
-
},
|
|
963
|
-
/*
|
|
964
|
-
* 获取用户头像信息; (也可以获取管理员信息)
|
|
965
|
-
* 获取用户头像信息; (也可以获取管理员信息)
|
|
966
|
-
*/
|
|
967
|
-
getAvatar: (params) => {
|
|
968
|
-
return HttpRequest.get("/api/user/avatar", { id: params.id, tick: params.tick }, null).then((res) => {
|
|
969
|
-
return res;
|
|
970
|
-
});
|
|
971
|
-
},
|
|
972
|
-
/*
|
|
973
|
-
* 获取用户头像列表信息; (也可以获取管理员信息)
|
|
974
|
-
* 获取用户头像列表信息; (也可以获取管理员信息)
|
|
975
|
-
*/
|
|
976
|
-
getAvatarList: (params) => {
|
|
977
|
-
return HttpRequest.get("/api/user/avatar_list", { ids: params.ids }, null).then((res) => {
|
|
978
|
-
return res;
|
|
979
|
-
});
|
|
980
|
-
},
|
|
981
|
-
/*
|
|
982
|
-
* 更新用户头像
|
|
983
|
-
* 更新用户头像
|
|
984
|
-
*/
|
|
985
|
-
updateAvatar: (data) => {
|
|
986
|
-
return HttpRequest.post("/api/user/updateAvatar", null, { id: data.id, avatar: data.avatar, avatar_small: data.avatar_small, tick_self: data.tick_self }).then((res) => {
|
|
987
|
-
return res;
|
|
988
|
-
});
|
|
989
|
-
},
|
|
990
|
-
/*
|
|
991
|
-
* 更新直接领导
|
|
992
|
-
* 更新直接领导
|
|
993
|
-
*/
|
|
994
|
-
updateManager: (params) => {
|
|
995
|
-
return HttpRequest.post("/api/user/updateManager", { id: params.id, managerid: params.managerid }, null).then((res) => {
|
|
996
|
-
return res;
|
|
997
|
-
});
|
|
998
|
-
},
|
|
999
|
-
/*
|
|
1000
|
-
* 更新用户信息
|
|
1001
|
-
* 更新用户信息
|
|
1002
|
-
*/
|
|
1003
|
-
updateInfo: (data) => {
|
|
1004
|
-
return HttpRequest.post("/api/user/update", null, { id: data.id, is_forbidden: data.is_forbidden, title: data.title, phone: data.phone, email: data.email, displayModules: data.displayModules, username: data.username, nickname: data.nickname, pwd: data.pwd, smsCode: data.smsCode, manager_id: data.manager_id, created_at: data.created_at, tick_avatar_self: data.tick_avatar_self, role_ids: data.role_ids, isAdmin: data.isAdmin, thirdPlatformInfo: data.thirdPlatformInfo, unreadMessageCount: data.unreadMessageCount }).then((res) => {
|
|
1005
|
-
return res;
|
|
1006
|
-
});
|
|
1007
|
-
},
|
|
1008
|
-
/*
|
|
1009
|
-
* 更新用户密码
|
|
1010
|
-
* 更新用户密码
|
|
1011
|
-
*/
|
|
1012
|
-
updatePassword: (data) => {
|
|
1013
|
-
return HttpRequest.post("/api/user/updatePassword", null, { old_password: data.old_password, old_password_sn: data.old_password_sn, new_password: data.new_password }).then((res) => {
|
|
1014
|
-
return res;
|
|
1015
|
-
});
|
|
1016
|
-
},
|
|
1017
|
-
/*
|
|
1018
|
-
* 删除用户
|
|
1019
|
-
* 删除用户
|
|
1020
|
-
*/
|
|
1021
|
-
deleteUser: (params) => {
|
|
1022
|
-
return HttpRequest.post("/api/user/delete", { id: params.id }, null).then((res) => {
|
|
1023
|
-
return res;
|
|
1024
|
-
});
|
|
1025
|
-
},
|
|
1026
|
-
/*
|
|
1027
|
-
* 获取用户列表
|
|
1028
|
-
* 获取用户列表
|
|
1029
|
-
*/
|
|
1030
|
-
list: (params) => {
|
|
1031
|
-
return HttpRequest.get("/api/user/list", { pageNum: params.pageNum, pageSize: params.pageSize }, null).then((res) => {
|
|
1032
|
-
return res;
|
|
1033
|
-
});
|
|
1034
|
-
},
|
|
1035
|
-
/*
|
|
1036
|
-
* 通过用户ids,获取用户列表(可以包含管理员)
|
|
1037
|
-
* 通过用户ids,获取用户列表(可以包含管理员)
|
|
1038
|
-
*/
|
|
1039
|
-
listByIds: (params) => {
|
|
1040
|
-
return HttpRequest.get("/api/user/list_by_ids", { ids: params.ids }, null).then((res) => {
|
|
1041
|
-
return res;
|
|
1042
|
-
});
|
|
1043
|
-
},
|
|
1044
|
-
/*
|
|
1045
|
-
* 搜索用户列表
|
|
1046
|
-
* 搜索用户列表
|
|
1047
|
-
*/
|
|
1048
|
-
search: (params) => {
|
|
1049
|
-
return HttpRequest.get("/api/user/search", { keyword: params.keyword, pageNum: params.pageNum, pageSize: params.pageSize }, null).then((res) => {
|
|
1050
|
-
return res;
|
|
1051
|
-
});
|
|
1052
|
-
},
|
|
1053
|
-
/*
|
|
1054
|
-
* 禁用用户
|
|
1055
|
-
* 禁用用户
|
|
1056
|
-
*/
|
|
1057
|
-
forbid: (params) => {
|
|
1058
|
-
return HttpRequest.post("/api/user/forbid", { id: params.id, forbid: params.forbid }, null).then((res) => {
|
|
1059
|
-
return res;
|
|
1060
|
-
});
|
|
1061
|
-
}
|
|
1062
|
-
};
|
|
1063
|
-
|
|
1064
|
-
// src/api/project.ts
|
|
1065
|
-
var project_exports = {};
|
|
1066
|
-
__export(project_exports, {
|
|
1067
|
-
contract: () => contract,
|
|
1068
|
-
file: () => file,
|
|
1069
|
-
fileversion: () => fileversion,
|
|
1070
|
-
project: () => project,
|
|
1071
|
-
projectprogress: () => projectprogress
|
|
1072
|
-
});
|
|
1073
|
-
var contract = {
|
|
1074
|
-
/*
|
|
1075
|
-
* /api/project/contract/create
|
|
1076
|
-
*/
|
|
1077
|
-
createContract: (data) => {
|
|
1078
|
-
return HttpRequest.post("/api/project/contract/create", null, { projectId: data.projectId, name: data.name, tag: data.tag, code: data.code, partyA: data.partyA, partyB: data.partyB, amount: data.amount, startDate: data.startDate, endDate: data.endDate, descs: data.descs }).then((res) => {
|
|
1079
|
-
return res;
|
|
1080
|
-
});
|
|
1081
|
-
},
|
|
1082
|
-
/*
|
|
1083
|
-
* /api/project/contract/delete
|
|
1084
|
-
*/
|
|
1085
|
-
deleteContract: (params) => {
|
|
1086
|
-
return HttpRequest.delete("/api/project/contract/delete", { id: params.id }, null).then((res) => {
|
|
1087
|
-
return res;
|
|
1088
|
-
});
|
|
1089
|
-
},
|
|
1090
|
-
/*
|
|
1091
|
-
* /api/project/contract/update
|
|
1092
|
-
*/
|
|
1093
|
-
updateContract: (data) => {
|
|
1094
|
-
return HttpRequest.post("/api/project/contract/update", null, { id: data.id, name: data.name, code: data.code, tag: data.tag, partyA: data.partyA, partyB: data.partyB, amount: data.amount, startDate: data.startDate, endDate: data.endDate, descs: data.descs, markdown: data.markdown }).then((res) => {
|
|
1095
|
-
return res;
|
|
1096
|
-
});
|
|
1097
|
-
},
|
|
1098
|
-
/*
|
|
1099
|
-
* /api/project/contract/detail
|
|
1100
|
-
*/
|
|
1101
|
-
getContractDetail: (params) => {
|
|
1102
|
-
return HttpRequest.get("/api/project/contract/detail", { id: params.id }, null).then((res) => {
|
|
1103
|
-
return res;
|
|
1104
|
-
});
|
|
1105
|
-
},
|
|
1106
|
-
/*
|
|
1107
|
-
* /api/project/contract/list
|
|
1108
|
-
*/
|
|
1109
|
-
getContractList: (params) => {
|
|
1110
|
-
return HttpRequest.get("/api/project/contract/list", { projectId: params.projectId, pageNum: params.pageNum, pageSize: params.pageSize }, null).then((res) => {
|
|
1111
|
-
return res;
|
|
1112
|
-
});
|
|
1113
|
-
},
|
|
1114
|
-
/*
|
|
1115
|
-
* 提交合同版本进行用印审批(提交后将变为PENDING状态).
|
|
1116
|
-
* 提交合同版本进行用印审批(提交后将变为PENDING状态).
|
|
1117
|
-
*/
|
|
1118
|
-
submitApproval: (params) => {
|
|
1119
|
-
return HttpRequest.post("/api/project/contract/submit", { id: params.id, sealType: params.sealType }, null).then((res) => {
|
|
1120
|
-
return res;
|
|
1121
|
-
});
|
|
1122
|
-
},
|
|
1123
|
-
/*
|
|
1124
|
-
* 撤销合同版本审批.
|
|
1125
|
-
* 撤销合同版本审批.
|
|
1126
|
-
*/
|
|
1127
|
-
cancelApproval: (params) => {
|
|
1128
|
-
return HttpRequest.post("/api/project/contract/cancelApproval", { id: params.id }, null).then((res) => {
|
|
1129
|
-
return res;
|
|
1130
|
-
});
|
|
1131
|
-
},
|
|
1132
|
-
/*
|
|
1133
|
-
* /api/project/contract/version/upload
|
|
1134
|
-
*/
|
|
1135
|
-
uploadVersion: (data) => {
|
|
1136
|
-
return HttpRequest.post("/api/project/contract/version/upload", null, { contractId: data.contractId, fileName: data.fileName, fileType: data.fileType, fileSize: data.fileSize, changeLog: data.changeLog }).then((res) => {
|
|
1137
|
-
return res;
|
|
1138
|
-
});
|
|
1139
|
-
},
|
|
1140
|
-
/*
|
|
1141
|
-
* /api/project/contract/version/list
|
|
1142
|
-
*/
|
|
1143
|
-
getVersionList: (params) => {
|
|
1144
|
-
return HttpRequest.get("/api/project/contract/version/list", { contractId: params.contractId }, null).then((res) => {
|
|
1145
|
-
return res;
|
|
1146
|
-
});
|
|
1147
|
-
},
|
|
1148
|
-
/*
|
|
1149
|
-
* 删除合同版本(仅草稿状态合同允许删除).
|
|
1150
|
-
* /api/project/contract/version/delete
|
|
1151
|
-
*/
|
|
1152
|
-
deleteVersion: (params) => {
|
|
1153
|
-
return HttpRequest.delete("/api/project/contract/version/delete", { id: params.id }, null).then((res) => {
|
|
1154
|
-
return res;
|
|
1155
|
-
});
|
|
1156
|
-
},
|
|
1157
|
-
/*
|
|
1158
|
-
* /api/project/contract/version/detail
|
|
1159
|
-
*/
|
|
1160
|
-
getVersionDetail: (params) => {
|
|
1161
|
-
return HttpRequest.get("/api/project/contract/version/detail", { id: params.id }, null).then((res) => {
|
|
1162
|
-
return res;
|
|
1163
|
-
});
|
|
1164
|
-
},
|
|
1165
|
-
/*
|
|
1166
|
-
* /api/project/contract/version/layerOpinion
|
|
1167
|
-
*/
|
|
1168
|
-
setVersionLayerOpinion: (data) => {
|
|
1169
|
-
return HttpRequest.post("/api/project/contract/version/layerOpinion", null, { contractId: data.contractId, version: data.version, opinion: data.opinion }).then((res) => {
|
|
1170
|
-
return res;
|
|
1171
|
-
});
|
|
1172
|
-
},
|
|
1173
|
-
/*
|
|
1174
|
-
* 获取新的合同编号.
|
|
1175
|
-
* 获取新的合同编号.
|
|
1176
|
-
*/
|
|
1177
|
-
getNewContractCode: (params) => {
|
|
1178
|
-
return HttpRequest.get("/api/project/contract/newCode", { contractCode: params.contractCode, sequenceLength: params.sequenceLength }, null).then((res) => {
|
|
1179
|
-
return res;
|
|
1180
|
-
});
|
|
1181
|
-
},
|
|
1182
|
-
/*
|
|
1183
|
-
* 获取合同历史参与方.
|
|
1184
|
-
* 获取合同历史参与方.
|
|
1185
|
-
*/
|
|
1186
|
-
getContractHistoryParties: () => {
|
|
1187
|
-
return HttpRequest.get("/api/project/contract/historyParties", null, null).then((res) => {
|
|
1188
|
-
return res;
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
};
|
|
1192
|
-
var file = {
|
|
1193
|
-
/*
|
|
1194
|
-
* /api/project/files/detail
|
|
1195
|
-
*/
|
|
1196
|
-
getDetail: (params) => {
|
|
1197
|
-
return HttpRequest.get("/api/project/files/detail", { fileId: params.fileId }, null).then((res) => {
|
|
1198
|
-
return res;
|
|
1199
|
-
});
|
|
1200
|
-
},
|
|
1201
|
-
/*
|
|
1202
|
-
* /api/project/files/list
|
|
1203
|
-
*/
|
|
1204
|
-
listFiles: (params) => {
|
|
1205
|
-
return HttpRequest.get("/api/project/files/list", { projectId: params.projectId }, null).then((res) => {
|
|
1206
|
-
return res;
|
|
1207
|
-
});
|
|
1208
|
-
},
|
|
1209
|
-
/*
|
|
1210
|
-
* 跨项目搜索当前用户有权限查看的项目文件.
|
|
1211
|
-
* 跨项目搜索当前用户有权限查看的项目文件.
|
|
1212
|
-
*/
|
|
1213
|
-
searchFiles: (params) => {
|
|
1214
|
-
return HttpRequest.get("/api/project/files/search", { keyword: params.keyword, pageNum: params.pageNum, pageSize: params.pageSize }, null).then((res) => {
|
|
1215
|
-
return res;
|
|
1216
|
-
});
|
|
1217
|
-
},
|
|
1218
|
-
/*
|
|
1219
|
-
* /api/project/files/add
|
|
1220
|
-
*/
|
|
1221
|
-
addFile: (params, data) => {
|
|
1222
|
-
return HttpRequest.post("/api/project/files/add", { projectId: params.projectId }, { fileName: data.fileName, filePath: data.filePath, isSecure: data.isSecure, descs: data.descs, fileType: data.fileType, fileSize: data.fileSize, crc32: data.crc32, fileResourcePath: data.fileResourcePath }).then((res) => {
|
|
1223
|
-
return res;
|
|
1224
|
-
});
|
|
1225
|
-
},
|
|
1226
|
-
/*
|
|
1227
|
-
* /api/project/files/remove
|
|
1228
|
-
*/
|
|
1229
|
-
removeFile: (params) => {
|
|
1230
|
-
return HttpRequest.post("/api/project/files/remove", { fileId: params.fileId }, null).then((res) => {
|
|
1231
|
-
return res;
|
|
1232
|
-
});
|
|
1233
|
-
},
|
|
1234
|
-
/*
|
|
1235
|
-
* /api/project/files/move
|
|
1236
|
-
*/
|
|
1237
|
-
moveFile: (params, data) => {
|
|
1238
|
-
return HttpRequest.post("/api/project/files/move", { projectId: params.projectId }, { oldFileName: data.oldFileName, oldFilePath: data.oldFilePath, newFileName: data.newFileName, newFilePath: data.newFilePath }).then((res) => {
|
|
1239
|
-
return res;
|
|
1240
|
-
});
|
|
1241
|
-
},
|
|
1242
|
-
/*
|
|
1243
|
-
* /api/project/files/updateDescs
|
|
1244
|
-
*/
|
|
1245
|
-
updateFileDescs: (data) => {
|
|
1246
|
-
return HttpRequest.post("/api/project/files/updateDescs", null, { fileId: data.fileId, descs: data.descs }).then((res) => {
|
|
1247
|
-
return res;
|
|
1248
|
-
});
|
|
1249
|
-
},
|
|
1250
|
-
/*
|
|
1251
|
-
* /api/project/files/copyToProject
|
|
1252
|
-
*/
|
|
1253
|
-
copyFileToProject: (params) => {
|
|
1254
|
-
return HttpRequest.post("/api/project/files/copyToProject", { projectId: params.projectId, fileId: params.fileId }, null).then((res) => {
|
|
1255
|
-
return res;
|
|
1256
|
-
});
|
|
1257
|
-
},
|
|
1258
|
-
/*
|
|
1259
|
-
* /api/project/files/moveToProject
|
|
1260
|
-
*/
|
|
1261
|
-
moveFileToProject: (params) => {
|
|
1262
|
-
return HttpRequest.post("/api/project/files/moveToProject", { projectId: params.projectId, fileId: params.fileId }, null).then((res) => {
|
|
1263
|
-
return res;
|
|
1264
|
-
});
|
|
1265
|
-
},
|
|
1266
|
-
/*
|
|
1267
|
-
* 增量更新文件 通过上传差异数据(BSDiff补丁)来更新文件,减少上传数据量
|
|
1268
|
-
* 增量更新文件 通过上传差异数据(BSDiff补丁)来更新文件,减少上传数据量
|
|
1269
|
-
*/
|
|
1270
|
-
updateFileDelta: (data) => {
|
|
1271
|
-
return HttpRequest.post("/api/project/files/updateDelta", null, { fileId: data.fileId, deltaData: data.deltaData, deltaSize: data.deltaSize, newFileSize: data.newFileSize, crc32: data.crc32, recordVersion: data.recordVersion, rotateResourcePath: data.rotateResourcePath }).then((res) => {
|
|
1272
|
-
return res;
|
|
1273
|
-
});
|
|
1274
|
-
},
|
|
1275
|
-
/*
|
|
1276
|
-
* 全量文件更新 通过上传完整文件数据来更新文件
|
|
1277
|
-
* 全量文件更新 通过上传完整文件数据来更新文件
|
|
1278
|
-
*/
|
|
1279
|
-
updateFile: (data) => {
|
|
1280
|
-
return HttpRequest.post("/api/project/files/updateData", null, { fileId: data.fileId, fileSize: data.fileSize, crc32: data.crc32, fileName: data.fileName, fileResourcePath: data.fileResourcePath, recordVersion: data.recordVersion, rotateResourcePath: data.rotateResourcePath }).then((res) => {
|
|
1281
|
-
return res;
|
|
1282
|
-
});
|
|
1283
|
-
},
|
|
1284
|
-
/*
|
|
1285
|
-
* 生成临时访问令牌 用于文件下载或上传
|
|
1286
|
-
* 生成临时访问令牌 用于文件下载或上传
|
|
1287
|
-
*/
|
|
1288
|
-
generateTempAccessToken: (params) => {
|
|
1289
|
-
return HttpRequest.post("/api/project/files/generateTempAccessToken", { fileId: params.fileId, expireSeconds: params.expireSeconds }, null).then((res) => {
|
|
1290
|
-
return res;
|
|
1291
|
-
});
|
|
1292
|
-
},
|
|
1293
|
-
/*
|
|
1294
|
-
* 发起文件夹异步打包下载(仅项目负责人/管理员)
|
|
1295
|
-
*/
|
|
1296
|
-
folderDownload: (params, data) => {
|
|
1297
|
-
return HttpRequest.post("/api/project/files/folderDownload", { projectId: params.projectId }, { folderPath: data.folderPath, folderName: data.folderName }).then((res) => {
|
|
1298
|
-
return res;
|
|
1299
|
-
});
|
|
1300
|
-
},
|
|
1301
|
-
/*
|
|
1302
|
-
* 查询文件夹打包下载任务状态
|
|
1303
|
-
*/
|
|
1304
|
-
folderDownloadStatus: (params) => {
|
|
1305
|
-
return HttpRequest.get("/api/project/files/folderDownloadStatus", { jobId: params.jobId }, null).then((res) => {
|
|
1306
|
-
return res;
|
|
1307
|
-
});
|
|
1308
|
-
},
|
|
1309
|
-
/*
|
|
1310
|
-
* /api/project/files/listByTempAccessToken
|
|
1311
|
-
*/
|
|
1312
|
-
listFilesByTempAccessToken: (params) => {
|
|
1313
|
-
return HttpRequest.get("/api/project/files/listByTempAccessToken", { tempToken: params.tempToken }, null).then((res) => {
|
|
1314
|
-
return res;
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
};
|
|
1318
|
-
var fileversion = {
|
|
1319
|
-
/*
|
|
1320
|
-
* 获取文件版本列表
|
|
1321
|
-
* 获取文件版本列表
|
|
1322
|
-
*/
|
|
1323
|
-
listVersions: (params) => {
|
|
1324
|
-
return HttpRequest.get("/api/project/files/version/list", { fileId: params.fileId }, null).then((res) => {
|
|
1325
|
-
return res;
|
|
1326
|
-
});
|
|
1327
|
-
},
|
|
1328
|
-
/*
|
|
1329
|
-
* 获取版本详情
|
|
1330
|
-
* 获取版本详情
|
|
1331
|
-
*/
|
|
1332
|
-
getVersionDetail: (params) => {
|
|
1333
|
-
return HttpRequest.get("/api/project/files/version/detail", { versionId: params.versionId }, null).then((res) => {
|
|
1334
|
-
return res;
|
|
1335
|
-
});
|
|
1336
|
-
}
|
|
1337
|
-
};
|
|
1338
|
-
var project = {
|
|
1339
|
-
/*
|
|
1340
|
-
* /api/project/enablePrivateProject
|
|
1341
|
-
*/
|
|
1342
|
-
enableUserPrivateProject: () => {
|
|
1343
|
-
return HttpRequest.post("/api/project/enablePrivateProject", null, null).then((res) => {
|
|
1344
|
-
return res;
|
|
1345
|
-
});
|
|
1346
|
-
},
|
|
1347
|
-
/*
|
|
1348
|
-
* /api/project/create
|
|
1349
|
-
*/
|
|
1350
|
-
createProject: (data) => {
|
|
1351
|
-
return HttpRequest.post("/api/project/create", null, { name: data.name, descs: data.descs, companyId: data.companyId, markdown: data.markdown, startTime: data.startTime, plannedEndTime: data.plannedEndTime, endTime: data.endTime, leaderId: data.leaderId, customerId: data.customerId, order: data.order, isUserPrivate: data.isUserPrivate }).then((res) => {
|
|
1352
|
-
return res;
|
|
1353
|
-
});
|
|
1354
|
-
},
|
|
1355
|
-
/*
|
|
1356
|
-
* /api/project/update
|
|
1357
|
-
*/
|
|
1358
|
-
updateProject: (data) => {
|
|
1359
|
-
return HttpRequest.post("/api/project/update", null, { id: data.id, name: data.name, descs: data.descs, companyId: data.companyId, markdown: data.markdown, status: data.status, startTime: data.startTime, plannedEndTime: data.plannedEndTime, endTime: data.endTime, leaderId: data.leaderId, customerId: data.customerId, order: data.order, isUserPrivate: data.isUserPrivate, createTime: data.createTime, updateTime: data.updateTime, createBy: data.createBy, updateBy: data.updateBy }).then((res) => {
|
|
1360
|
-
return res;
|
|
1361
|
-
});
|
|
1362
|
-
},
|
|
1363
|
-
/*
|
|
1364
|
-
* /api/project/updateUserdataOrder
|
|
1365
|
-
*/
|
|
1366
|
-
updateUserdataOrder: (data) => {
|
|
1367
|
-
return HttpRequest.post("/api/project/updateUserdataOrder", null, { projectIds: data.projectIds }).then((res) => {
|
|
1368
|
-
return res;
|
|
1369
|
-
});
|
|
1370
|
-
},
|
|
1371
|
-
/*
|
|
1372
|
-
* 获取用户的项目排序数据. [{pid,order}]
|
|
1373
|
-
* 获取用户的项目排序数据. [{pid,order}]
|
|
1374
|
-
*/
|
|
1375
|
-
getUserdataOrder: () => {
|
|
1376
|
-
return HttpRequest.get("/api/project/userdataOrder", null, null).then((res) => {
|
|
1377
|
-
return res;
|
|
1378
|
-
});
|
|
1379
|
-
},
|
|
1380
|
-
/*
|
|
1381
|
-
* /api/project/detail
|
|
1382
|
-
*/
|
|
1383
|
-
getProjectDetail: (params) => {
|
|
1384
|
-
return HttpRequest.get("/api/project/detail", { id: params.id }, null).then((res) => {
|
|
1385
|
-
return res;
|
|
1386
|
-
});
|
|
1387
|
-
},
|
|
1388
|
-
/*
|
|
1389
|
-
* 获取项目名称.
|
|
1390
|
-
* 获取项目名称.
|
|
1391
|
-
*/
|
|
1392
|
-
getProjectName: (params) => {
|
|
1393
|
-
return HttpRequest.get("/api/project/name", { projectId: params.projectId }, null).then((res) => {
|
|
1394
|
-
return res;
|
|
1395
|
-
});
|
|
1396
|
-
},
|
|
1397
|
-
/*
|
|
1398
|
-
* 仅查看当前用户参与的项目
|
|
1399
|
-
* 仅查看当前用户参与的项目
|
|
1400
|
-
*/
|
|
1401
|
-
listProjects: (params) => {
|
|
1402
|
-
return HttpRequest.get("/api/project/list", { pageNum: params.pageNum, pageSize: params.pageSize, status: params.status, companyId: params.companyId, customerId: params.customerId }, null).then((res) => {
|
|
1403
|
-
return res;
|
|
1404
|
-
});
|
|
1405
|
-
},
|
|
1406
|
-
/*
|
|
1407
|
-
* 仅查看当前用户为管理员及以上的项目
|
|
1408
|
-
* 仅查看当前用户为管理员及以上的项目
|
|
1409
|
-
*/
|
|
1410
|
-
listProjectsByManager: (params) => {
|
|
1411
|
-
return HttpRequest.get("/api/project/listByManager", { pageNum: params.pageNum, pageSize: params.pageSize }, null).then((res) => {
|
|
1412
|
-
return res;
|
|
1413
|
-
});
|
|
1414
|
-
},
|
|
1415
|
-
/*
|
|
1416
|
-
* /api/project/status
|
|
1417
|
-
*/
|
|
1418
|
-
changeStatus: (params) => {
|
|
1419
|
-
return HttpRequest.put("/api/project/status", { id: params.id, status: params.status }, null).then((res) => {
|
|
1420
|
-
return res;
|
|
1421
|
-
});
|
|
1422
|
-
},
|
|
1423
|
-
/*
|
|
1424
|
-
* /api/project/members
|
|
1425
|
-
*/
|
|
1426
|
-
getProjectMembers: (params) => {
|
|
1427
|
-
return HttpRequest.get("/api/project/members", { projectId: params.projectId }, null).then((res) => {
|
|
1428
|
-
return res;
|
|
1429
|
-
});
|
|
1430
|
-
},
|
|
1431
|
-
/*
|
|
1432
|
-
* 获取用户在项目中的角色.
|
|
1433
|
-
* 获取用户在项目中的角色.
|
|
1434
|
-
*/
|
|
1435
|
-
getMemberRole: (params) => {
|
|
1436
|
-
return HttpRequest.get("/api/project/member/role", { projectId: params.projectId, userId: params.userId }, null).then((res) => {
|
|
1437
|
-
return res;
|
|
1438
|
-
});
|
|
1439
|
-
},
|
|
1440
|
-
/*
|
|
1441
|
-
* /api/project/members/assign
|
|
1442
|
-
*/
|
|
1443
|
-
assignMember: (data) => {
|
|
1444
|
-
return HttpRequest.post("/api/project/members/assign", null, { userId: data.userId, role: data.role, projectId: data.projectId }).then((res) => {
|
|
1445
|
-
return res;
|
|
1446
|
-
});
|
|
1447
|
-
},
|
|
1448
|
-
/*
|
|
1449
|
-
* /api/project/members/remove
|
|
1450
|
-
*/
|
|
1451
|
-
removeMember: (data) => {
|
|
1452
|
-
return HttpRequest.post("/api/project/members/remove", null, { userId: data.userId, role: data.role, projectId: data.projectId }).then((res) => {
|
|
1453
|
-
return res;
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
var projectprogress = {
|
|
1458
|
-
/*
|
|
1459
|
-
* 创建项目进展记录 POST /api/project/progress/create
|
|
1460
|
-
* 创建项目进展记录 POST /api/project/progress/create
|
|
1461
|
-
*/
|
|
1462
|
-
createProgress: (data) => {
|
|
1463
|
-
return HttpRequest.post("/api/project/progress/create", null, { projectId: data.projectId, descs: data.descs, commentCount: data.commentCount, progressTime: data.progressTime }).then((res) => {
|
|
1464
|
-
return res;
|
|
1465
|
-
});
|
|
1466
|
-
},
|
|
1467
|
-
/*
|
|
1468
|
-
* 更新项目进展记录 PUT /api/project/progress/update/:id
|
|
1469
|
-
* 更新项目进展记录 PUT /api/project/progress/update/:id
|
|
1470
|
-
*/
|
|
1471
|
-
updateProgress: (data) => {
|
|
1472
|
-
return HttpRequest.put("/api/project/progress/update", null, { id: data.id, descs: data.descs, progressTime: data.progressTime }).then((res) => {
|
|
1473
|
-
return res;
|
|
1474
|
-
});
|
|
1475
|
-
},
|
|
1476
|
-
/*
|
|
1477
|
-
* 删除项目进展记录 DELETE /api/project/progress/delete/:id
|
|
1478
|
-
* 删除项目进展记录 DELETE /api/project/progress/delete/:id
|
|
1479
|
-
*/
|
|
1480
|
-
deleteProgress: (params) => {
|
|
1481
|
-
return HttpRequest.delete("/api/project/progress/delete", { id: params.id }, null).then((res) => {
|
|
1482
|
-
return res;
|
|
1483
|
-
});
|
|
1484
|
-
},
|
|
1485
|
-
/*
|
|
1486
|
-
* 获取项目进展列表 GET /api/project/progress/list/:projectId
|
|
1487
|
-
* 获取项目进展列表 GET /api/project/progress/list/:projectId
|
|
1488
|
-
*/
|
|
1489
|
-
getProgressList: (params) => {
|
|
1490
|
-
return HttpRequest.get("/api/project/progress/list", { projectId: params.projectId }, null).then((res) => {
|
|
1491
|
-
return res;
|
|
1492
|
-
});
|
|
1493
|
-
},
|
|
1494
|
-
/*
|
|
1495
|
-
* 添加进展评论 POST /api/project/progress/comment/add
|
|
1496
|
-
* 添加进展评论 POST /api/project/progress/comment/add
|
|
1497
|
-
*/
|
|
1498
|
-
addComment: (data) => {
|
|
1499
|
-
return HttpRequest.post("/api/project/progress/comment/add", null, { progressId: data.progressId, comment: data.comment }).then((res) => {
|
|
1500
|
-
return res;
|
|
1501
|
-
});
|
|
1502
|
-
},
|
|
1503
|
-
/*
|
|
1504
|
-
* 删除进展评论 DELETE /api/project/progress/comment/delete/:id
|
|
1505
|
-
* 删除进展评论 DELETE /api/project/progress/comment/delete/:id
|
|
1506
|
-
*/
|
|
1507
|
-
deleteComment: (params) => {
|
|
1508
|
-
return HttpRequest.delete("/api/project/progress/comment/delete", { id: params.id }, null).then((res) => {
|
|
1509
|
-
return res;
|
|
1510
|
-
});
|
|
1511
|
-
},
|
|
1512
|
-
/*
|
|
1513
|
-
* 更新进展评论 PUT /api/project/progress/comment/update/:id
|
|
1514
|
-
* 更新进展评论 PUT /api/project/progress/comment/update/:id
|
|
1515
|
-
*/
|
|
1516
|
-
updateComment: (params) => {
|
|
1517
|
-
return HttpRequest.put("/api/project/progress/comment/update", { id: params.id }, {}).then((res) => {
|
|
1518
|
-
return res;
|
|
1519
|
-
});
|
|
1520
|
-
},
|
|
1521
|
-
/*
|
|
1522
|
-
* 获取进展评论列表 GET /api/project/progress/comment/list/:progressId
|
|
1523
|
-
* 获取进展评论列表 GET /api/project/progress/comment/list/:progressId
|
|
1524
|
-
*/
|
|
1525
|
-
getCommentList: (params) => {
|
|
1526
|
-
return HttpRequest.get("/api/project/progress/comment/list", { progressId: params.progressId, pageNum: params.pageNum, pageSize: params.pageSize }, null).then((res) => {
|
|
1527
|
-
return res;
|
|
1528
|
-
});
|
|
1529
|
-
}
|
|
1530
|
-
};
|
|
1531
|
-
|
|
1532
|
-
// src/api/index.ts
|
|
1533
|
-
var API = {
|
|
1534
|
-
base: base_exports,
|
|
1535
|
-
user: user_exports,
|
|
1536
|
-
project: project_exports
|
|
1537
|
-
};
|
|
1538
|
-
export {
|
|
1539
|
-
API,
|
|
1540
|
-
AuthorizationHandler,
|
|
1541
|
-
HttpRequest,
|
|
1542
|
-
ResponseCode,
|
|
1543
|
-
admin,
|
|
1544
|
-
contract,
|
|
1545
|
-
file,
|
|
1546
|
-
fileversion,
|
|
1547
|
-
gateway,
|
|
1548
|
-
message,
|
|
1549
|
-
project,
|
|
1550
|
-
projectprogress,
|
|
1551
|
-
role,
|
|
1552
|
-
user
|
|
1553
|
-
};
|