fmui-base 2.2.11 → 2.2.13
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/README.md +2 -0
- package/lib/react_grid/react_grid.js +8 -8
- package/package.json +1 -1
- package/lib/ScrollList/BottomTip.jsx +0 -25
- package/lib/ScrollList/EmptyContent.jsx +0 -19
- package/lib/ScrollList/Item.jsx +0 -132
- package/lib/ScrollList/ScrollList.jsx +0 -412
- package/lib/ScrollList/TagList.jsx +0 -54
- package/lib/button/button.jsx +0 -46
- package/lib/care/care.jsx +0 -26
- package/lib/chart/chart.jsx +0 -344
- package/lib/comment_list/List.jsx +0 -285
- package/lib/form/form.jsx +0 -3434
- package/lib/form/subForm.jsx +0 -793
- package/lib/form/table.jsx +0 -1804
- package/lib/form_info/formInfo.jsx +0 -5158
- package/lib/loading/loading.jsx +0 -23
- package/lib/no_data/no_data.jsx +0 -34
- package/lib/poppage/check.jsx +0 -500
- package/lib/poppage/table/table.jsx +0 -641
- package/lib/poppage/tree/tree.jsx +0 -548
- package/lib/poppage/treetable/treetable.jsx +0 -340
- package/lib/positioning/positioning.jsx +0 -92
- package/lib/process_batch/processBatch.jsx +0 -1629
- package/lib/process_info/processInfo.jsx +0 -7752
- package/lib/process_list/processList.jsx +0 -1299
- package/lib/react_grid/react_grid.jsx +0 -1166
- package/lib/select-fileno/pageHome.jsx +0 -569
- package/lib/select-serialnumber/pageHome.jsx +0 -503
- package/lib/select-serialnumber/pageHome1.jsx +0 -503
- package/lib/selectMember/select.jsx +0 -9568
- package/lib/signature/sign.jsx +0 -274
- package/lib/upload/upload.jsx +0 -647
package/lib/upload/upload.jsx
DELETED
|
@@ -1,647 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import Toast from 'saltui/lib/Toast';
|
|
4
|
-
import Progress from 'saltui/lib/Progress';
|
|
5
|
-
import { UploadCore, Events, Status, VERSION } from 'uploadcore';
|
|
6
|
-
|
|
7
|
-
import 'whatwg-fetch';
|
|
8
|
-
import 'es6-promise';
|
|
9
|
-
export default class PageHome extends React.Component {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
constructor(props) {
|
|
14
|
-
super(props);
|
|
15
|
-
var label = props.label;
|
|
16
|
-
if (!label) {
|
|
17
|
-
label = '';
|
|
18
|
-
}
|
|
19
|
-
const keyNum = this.GenNonDuplicateID(8);
|
|
20
|
-
// 上传个数限制
|
|
21
|
-
var limitNo = props.limitNo;
|
|
22
|
-
if (limitNo && limitNo > 0) {
|
|
23
|
-
limitNo = limitNo;
|
|
24
|
-
} else {
|
|
25
|
-
limitNo = 9;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var setting = getSysAttachSetting();
|
|
29
|
-
// 上传类型images:图片,audios:附件,videos:视频
|
|
30
|
-
var uploadType = props.uploadType;
|
|
31
|
-
// 上传格式
|
|
32
|
-
var extensions = props.extensions;
|
|
33
|
-
if (!extensions) {//如果组件没有设置则取后台默认
|
|
34
|
-
extensions = setting.sysAttachmentCate;
|
|
35
|
-
}
|
|
36
|
-
//累加
|
|
37
|
-
// 可上传
|
|
38
|
-
var canAdd = props.canAdd;
|
|
39
|
-
// 可删除
|
|
40
|
-
var canDel = props.canDel;
|
|
41
|
-
//可下载
|
|
42
|
-
var canDownload = props.canDownload;
|
|
43
|
-
// 公众号不展示下载按钮
|
|
44
|
-
if(getLoginUserInfo().thirdMenuType == 'WeChat'){
|
|
45
|
-
canDownload = false;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//单次返回,默认返回所有
|
|
49
|
-
var returnOnce = props.returnOnce;
|
|
50
|
-
if (!returnOnce) {
|
|
51
|
-
returnOnce = false;
|
|
52
|
-
}
|
|
53
|
-
//预览类型,view:永中预览,download:下载
|
|
54
|
-
var viewType = props.viewType;
|
|
55
|
-
if (typeof (viewType) == 'undefined' || viewType == null || viewType == '') {
|
|
56
|
-
viewType = 'view';
|
|
57
|
-
}
|
|
58
|
-
if (setting.sysAttachmentView == 0) {//如果设置中预览关闭则默认下载
|
|
59
|
-
viewType = "download";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
//是否必填
|
|
63
|
-
var required = props.required;
|
|
64
|
-
|
|
65
|
-
//初始化List
|
|
66
|
-
var initList = props.initList;
|
|
67
|
-
if (typeof (initList) == 'undefined' || initList == null || !(initList instanceof Array)) {//判断初始化id集合有没有
|
|
68
|
-
initList = [];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// 文件大小限制,默认单位byte,默认0,表示不限制
|
|
73
|
-
var fileSizeLimit = props.fileSizeLimit;
|
|
74
|
-
if (fileSizeLimit == null || fileSizeLimit == '' || fileSizeLimit == undefined || fileSizeLimit == 'undefined') {
|
|
75
|
-
//fileSizeLimit = 0;
|
|
76
|
-
//如果组件没有设置则取后台默认
|
|
77
|
-
fileSizeLimit = setting.sysAttachmentSize;
|
|
78
|
-
}
|
|
79
|
-
fileSizeLimit = parseInt(fileSizeLimit);
|
|
80
|
-
|
|
81
|
-
//文件总大小限制
|
|
82
|
-
var fileAllSizeLimit = props.fileAllSizeLimit;
|
|
83
|
-
if (fileAllSizeLimit == null || fileAllSizeLimit == '' || fileAllSizeLimit == undefined || fileAllSizeLimit == 'undefined') {
|
|
84
|
-
fileAllSizeLimit = 0;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
var accept = {};
|
|
88
|
-
if (uploadType == 'image') {//图片
|
|
89
|
-
accept = {
|
|
90
|
-
title: '图片',
|
|
91
|
-
extensions: 'jpg,jpeg,png,gif,webp,bmp',
|
|
92
|
-
mimeTypes: 'image/*' // or 'image/jpeg,image/png'
|
|
93
|
-
};
|
|
94
|
-
if (extensions) {
|
|
95
|
-
accept.extensions = extensions;
|
|
96
|
-
}
|
|
97
|
-
} else {
|
|
98
|
-
uploadType = "file";
|
|
99
|
-
if (extensions) {
|
|
100
|
-
accept.title = '文件';
|
|
101
|
-
accept.extensions = extensions;
|
|
102
|
-
} else {
|
|
103
|
-
accept = null;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// extensions="image/jpg,image/png";
|
|
107
|
-
// if(extensions){
|
|
108
|
-
// accept = extensions;
|
|
109
|
-
// }
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
var dir = props.dir;
|
|
113
|
-
var businessExt = props.extensions?props.extensions:"";
|
|
114
|
-
var context = document.getElementById("context").value;
|
|
115
|
-
var token = getLoginUserInfo().token;
|
|
116
|
-
this.state = {
|
|
117
|
-
required: required,
|
|
118
|
-
canAdd: canAdd,
|
|
119
|
-
canDel: canDel,
|
|
120
|
-
canDownload:canDownload,
|
|
121
|
-
keyNum: keyNum,
|
|
122
|
-
uploadType: uploadType,
|
|
123
|
-
accept: accept,
|
|
124
|
-
fileSizeLimit: fileSizeLimit * 1024 * 1024,
|
|
125
|
-
fileAllSizeLimit: fileAllSizeLimit,
|
|
126
|
-
label: label,
|
|
127
|
-
dir: dir,
|
|
128
|
-
businessExt:btoa(unescape(encodeURIComponent(businessExt))) ,
|
|
129
|
-
limitNo: limitNo,
|
|
130
|
-
context: context,
|
|
131
|
-
uploadUrl: context + '/api/m/plugin/attachment/mobile/createFile',
|
|
132
|
-
urlPrev: context + '/api/m/plugin/attachment/mobile/viewImage?token=' + token + '&fid=',
|
|
133
|
-
queryUrl: context + '/api/m/plugin/attachment/mobile/getAttachmentByIds?ids=',
|
|
134
|
-
//queryUrl: context + '/client/approve/getCanBackActivity?ids=',
|
|
135
|
-
token: token,
|
|
136
|
-
isInit: false,
|
|
137
|
-
addQueNum: 0,
|
|
138
|
-
viewType: viewType,
|
|
139
|
-
initList: initList,
|
|
140
|
-
returnOnce: returnOnce,
|
|
141
|
-
percent1: 0,
|
|
142
|
-
showProgress: true
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
GenNonDuplicateID(randomLength) {
|
|
147
|
-
return Number(Math.random().toString().substr(3, randomLength) + Date.now()).toString(36)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
del(delIndex) {
|
|
151
|
-
var initList = this.props.initList;
|
|
152
|
-
initList.splice(delIndex, 1);
|
|
153
|
-
this.props.onChange(initList);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
componentDidMount() {
|
|
159
|
-
let t = this;
|
|
160
|
-
var param = {
|
|
161
|
-
name: 'file',
|
|
162
|
-
url: this.state.uploadUrl,
|
|
163
|
-
autoPending: true,
|
|
164
|
-
accept: t.state.accept,
|
|
165
|
-
multiple: true,
|
|
166
|
-
fileSizeLimit: t.state.fileSizeLimit
|
|
167
|
-
};
|
|
168
|
-
let limitNo = t.state.limitNo;
|
|
169
|
-
//param.queueCapcity= limitNo;
|
|
170
|
-
var up = this.getCore(param);
|
|
171
|
-
const picker = up.getPickerCollector();
|
|
172
|
-
picker.addArea(document.getElementById('ddUploadPic' + t.state.keyNum));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
getCore(param) {
|
|
176
|
-
const t = this;
|
|
177
|
-
const up = new UploadCore(param);
|
|
178
|
-
up
|
|
179
|
-
.on(Events.FILE_UPLOAD_PREPARING, (request) => {
|
|
180
|
-
request.setHeader("Authorization", "Bearer " + t.state.token);
|
|
181
|
-
request.setParam('dir', t.state.dir);
|
|
182
|
-
request.setParam('businessExt', t.state.businessExt);
|
|
183
|
-
console.info(request.getParam('token'));
|
|
184
|
-
})
|
|
185
|
-
.on(Events.QUEUE_FILE_ADDED, (file) => {
|
|
186
|
-
// return false;
|
|
187
|
-
//判断总文件大小不超过
|
|
188
|
-
var fileAllSizeLimit = t.state.fileAllSizeLimit;
|
|
189
|
-
if (fileAllSizeLimit > 0) {
|
|
190
|
-
let fileAllSize = 0;
|
|
191
|
-
t.state.initList.map(function (item) {
|
|
192
|
-
if (item.fileSize == null) {
|
|
193
|
-
fileAllSize += item.size;
|
|
194
|
-
} else {
|
|
195
|
-
fileAllSize += item.fileSize;
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
if (fileAllSizeLimit * 1024 * 1024 <= (fileAllSize + file.size)) {
|
|
199
|
-
file.cancel();
|
|
200
|
-
Toast.show({
|
|
201
|
-
type: 'error',
|
|
202
|
-
content: '文件总大小不能超过' + fileAllSizeLimit + 'M!',
|
|
203
|
-
});
|
|
204
|
-
return false;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
// console.info('queuefileadded', file);
|
|
208
|
-
file.session().progress((e) => {
|
|
209
|
-
// console.info('progress', e);
|
|
210
|
-
}).fail((error) => {
|
|
211
|
-
console.info(error)
|
|
212
|
-
}).done((response) => {
|
|
213
|
-
console.info(response.getJson())
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
.on(Events.FILE_UPLOAD_PROGRESS, (file, progress) => {
|
|
219
|
-
this.setState({
|
|
220
|
-
percent1: progress.percentage
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
})
|
|
224
|
-
.on(Events.FILE_UPLOAD_ERROR, (error) => {
|
|
225
|
-
if (error.name == 'AbortError') {//网络中断
|
|
226
|
-
Toast.show({
|
|
227
|
-
type: 'error',
|
|
228
|
-
content: '网络中断!',
|
|
229
|
-
});
|
|
230
|
-
return false;
|
|
231
|
-
} else if (error.name == 'TimeoutError') {//网络超时
|
|
232
|
-
Toast.show({
|
|
233
|
-
type: 'error',
|
|
234
|
-
content: '网络中断!',
|
|
235
|
-
});
|
|
236
|
-
return false;
|
|
237
|
-
} else if (error.name == 'NetworkError') {//网络错误
|
|
238
|
-
Toast.show({
|
|
239
|
-
type: 'error',
|
|
240
|
-
content: '网络错误!',
|
|
241
|
-
});
|
|
242
|
-
return false;
|
|
243
|
-
} else {
|
|
244
|
-
Toast.show({
|
|
245
|
-
type: 'error',
|
|
246
|
-
content: '上传失败!',
|
|
247
|
-
});
|
|
248
|
-
return false;
|
|
249
|
-
}
|
|
250
|
-
})
|
|
251
|
-
.on(Events.QUEUE_ERROR, (error) => {
|
|
252
|
-
var accept = t.state.accept;
|
|
253
|
-
var fileSizeLimit = t.state.fileSizeLimit;
|
|
254
|
-
if (error.name == 'FilterError') {//过滤文件报错
|
|
255
|
-
if (accept) {//扩展名出错
|
|
256
|
-
var extensions = accept.extensions;
|
|
257
|
-
if (extensions.indexOf(error.file.ext) < 0) {
|
|
258
|
-
Toast.show({
|
|
259
|
-
type: 'error',
|
|
260
|
-
content: '文件类型错误!',
|
|
261
|
-
});
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (fileSizeLimit > 0) {
|
|
267
|
-
if (error.file.size > fileSizeLimit) {
|
|
268
|
-
var fileSizeLimitName = t.calculate(fileSizeLimit);
|
|
269
|
-
Toast.show({
|
|
270
|
-
type: 'error',
|
|
271
|
-
content: '文件不能大于' + fileSizeLimitName + '!',
|
|
272
|
-
});
|
|
273
|
-
return false;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
Toast.show({
|
|
278
|
-
type: 'error',
|
|
279
|
-
content: '文件不能重复!',
|
|
280
|
-
});
|
|
281
|
-
return false;
|
|
282
|
-
|
|
283
|
-
} else if (error.name == 'QueueLimitError') {//队列限制
|
|
284
|
-
Toast.show({
|
|
285
|
-
type: 'error',
|
|
286
|
-
content: '不能上传更多文件了!',
|
|
287
|
-
});
|
|
288
|
-
return false;
|
|
289
|
-
} else {
|
|
290
|
-
Toast.show({
|
|
291
|
-
type: 'error',
|
|
292
|
-
content: '上传失败!',
|
|
293
|
-
});
|
|
294
|
-
return false;
|
|
295
|
-
}
|
|
296
|
-
})
|
|
297
|
-
.on(Events.FILE_UPLOAD_COMPLETED, (file) => {
|
|
298
|
-
if (file.getStatus() === Status.SUCCESS) {
|
|
299
|
-
// alert('上传成功');
|
|
300
|
-
var result = file.response.getJson();
|
|
301
|
-
if (result.code == -1) {
|
|
302
|
-
alert(result.message);
|
|
303
|
-
} else {
|
|
304
|
-
var json = file.response.getJson().data;
|
|
305
|
-
|
|
306
|
-
if (typeof getSensitive === "function") {
|
|
307
|
-
|
|
308
|
-
var returnMsg = getSensitive(json[0].fileDisplayName);
|
|
309
|
-
if (returnMsg) {
|
|
310
|
-
Toast.show({
|
|
311
|
-
type: 'error',
|
|
312
|
-
content: '附件名称包含' + returnMsg + '敏感词!',
|
|
313
|
-
});
|
|
314
|
-
this.setState({
|
|
315
|
-
showProgress:false
|
|
316
|
-
})
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
this.setState({
|
|
321
|
-
showProgress: false
|
|
322
|
-
})
|
|
323
|
-
//var checksum = json[0].checksum;
|
|
324
|
-
var initList = t.state.initList;
|
|
325
|
-
if (initList.length < this.state.limitNo) {
|
|
326
|
-
initList = initList.concat(json);
|
|
327
|
-
this.setState({
|
|
328
|
-
showProgress: true,
|
|
329
|
-
percent1: 0
|
|
330
|
-
})
|
|
331
|
-
if (t.state.returnOnce) {
|
|
332
|
-
t.props.onChange(json);
|
|
333
|
-
} else {
|
|
334
|
-
t.props.onChange(initList);
|
|
335
|
-
}
|
|
336
|
-
t.setState({
|
|
337
|
-
initList: initList
|
|
338
|
-
});
|
|
339
|
-
} else {
|
|
340
|
-
Toast.show({
|
|
341
|
-
type: 'error',
|
|
342
|
-
content: '不能上传更多文件了!',
|
|
343
|
-
});
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
} else {
|
|
349
|
-
//file.cancel();
|
|
350
|
-
// var json = [ {
|
|
351
|
-
// "fileName" : "d33087332a6c477a806d823209fef5c7.png",
|
|
352
|
-
// "previewUrl" : null,
|
|
353
|
-
// "fileDisplayName" : "1511353597(1).png",
|
|
354
|
-
// "downloadUrl" : "/attachment/download?fid=402887dc630ba7e701630bb4fe8f0011&chksum=04c8e2fdbb7ec02bc3492f9c98fa8e36",
|
|
355
|
-
// "imageSmallerUrl" : "/attachment/dingding/201804/d33087332a6c477a806d823209fef5c7_sm.png",
|
|
356
|
-
// "imageMiddleUrl" : "/attachment/dingding/201804/d33087332a6c477a806d823209fef5c7_mid.png",
|
|
357
|
-
// "fileExt" : ".png",
|
|
358
|
-
// "delFlag" : "0",
|
|
359
|
-
// "fileModule" : null,
|
|
360
|
-
// "multiCorpId" : false,
|
|
361
|
-
// "previewDate" : null,
|
|
362
|
-
// "imediaUrl" : "/attachment/dingding/201804/d33087332a6c477a806d823209fef5c7.png",
|
|
363
|
-
// "fileSize" : 67577,
|
|
364
|
-
// "fileDisplayNameNoExt" : "1511353597(1)",
|
|
365
|
-
// "relativePath" : "dingding/201804",
|
|
366
|
-
// "isEncrypted" : 0,
|
|
367
|
-
// "imageUrl" : "/attachment/image?fid=402887dc630ba7e701630bb4fe8f0011&chksum=04c8e2fdbb7ec02bc3492f9c98fa8e36",
|
|
368
|
-
// "checksum" : "04c8e2fdbb7ec02bc3492f9c98fa8e36",
|
|
369
|
-
// "deleteUrl" : "/attachment/delete?fid=402887dc630ba7e701630bb4fe8f0011&chksum=ef9f55278b3594f3eaefef23feacaa7d",
|
|
370
|
-
// "id" : "402887dc630ba7e701630bb4fe8f0011",
|
|
371
|
-
// "contentType" : null
|
|
372
|
-
// } ];
|
|
373
|
-
// var img = json;
|
|
374
|
-
// //var checksum = json[0].checksum;
|
|
375
|
-
// var initList = t.props.initList;
|
|
376
|
-
// if(initList.length < this.state.limitNo){
|
|
377
|
-
// initList = initList.concat(json);
|
|
378
|
-
|
|
379
|
-
// t.props.onChange(initList);
|
|
380
|
-
// }else{
|
|
381
|
-
// Toast.show({
|
|
382
|
-
// type: 'error',
|
|
383
|
-
// content: '不能上传更多文件了!',
|
|
384
|
-
// });
|
|
385
|
-
// return false;
|
|
386
|
-
// }
|
|
387
|
-
|
|
388
|
-
Toast.show({
|
|
389
|
-
type: 'error',
|
|
390
|
-
content: '上传失败!',
|
|
391
|
-
});
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
return up;
|
|
396
|
-
}
|
|
397
|
-
//计算大小
|
|
398
|
-
calculate(no) {
|
|
399
|
-
let a = no / 1024;
|
|
400
|
-
if (a < 1) {
|
|
401
|
-
return no + 'B';
|
|
402
|
-
}
|
|
403
|
-
let b = a / 1024;
|
|
404
|
-
if (b < 1) {
|
|
405
|
-
return Math.round(a * 100) / 100 + 'KB';
|
|
406
|
-
}
|
|
407
|
-
return Math.round(b * 100) / 100 + 'MB';
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
//预览
|
|
411
|
-
view(file) {
|
|
412
|
-
var id = file.id;
|
|
413
|
-
if (this.state.viewType == 'view') {
|
|
414
|
-
// var isLoadWatermark = this.props.isLoadWatermark;
|
|
415
|
-
var allowDownLoad = this.props.allowDownLoad;
|
|
416
|
-
var isCopy = this.props.isCopy;
|
|
417
|
-
var isPrint = this.props.isPrint;
|
|
418
|
-
var fileExt = file.fileExt;
|
|
419
|
-
downloadFile(id, 'android', fileExt, isCopy, isPrint, allowDownLoad);
|
|
420
|
-
} else {
|
|
421
|
-
downloadFile(id);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
downloadFile(file){
|
|
426
|
-
downloadFile(file.id);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
//初始化ids
|
|
430
|
-
initData() {
|
|
431
|
-
let t = this;
|
|
432
|
-
var initIds = this.props.initIds;
|
|
433
|
-
var initList = [];
|
|
434
|
-
if (typeof (initIds) == 'undefined' || initIds == null || initIds == '') {//判断初始化附件id字符串有没有
|
|
435
|
-
initList = this.props.initList;
|
|
436
|
-
if (typeof (initList) == 'undefined' || initList == null || !(initList instanceof Array)) {//判断初始化id集合有没有
|
|
437
|
-
initList = [];
|
|
438
|
-
}
|
|
439
|
-
t.setState({
|
|
440
|
-
initList: initList
|
|
441
|
-
});
|
|
442
|
-
} else {
|
|
443
|
-
//let formData = new FormData();
|
|
444
|
-
//formData.append('token', t.state.token);
|
|
445
|
-
fetch(t.state.queryUrl + initIds, {
|
|
446
|
-
method: "POST",
|
|
447
|
-
headers: {
|
|
448
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
449
|
-
'Authorization': 'Bearer '+getLoginUserInfo().token,
|
|
450
|
-
}
|
|
451
|
-
// body:'token='+t.state.token,
|
|
452
|
-
// headers: {
|
|
453
|
-
// "Content-Type": "application/x-www-form-urlencoded",
|
|
454
|
-
// "Authorization": "Bearer "+t.state.token,
|
|
455
|
-
// "Cookie":"epname=zhaoyh; isRemembered=1; epsid=89f2b25f-7719-4b62-8df5-d11303112f4f; eptoken=emhhb3lofDBjOTdlNjI2MmY1YjMwYWUwODJmNDkyYTNlNDM4NGIyNTUxNGQ3N2ZhNWJmMWM2ZmE0ZThlM2Q3ZWQ0Yjg1ZDUyMzc5MDY0ODBkZGYwODc0ODJjZDBmNDJhOWI5ODY4MzllZjRhNjM0MjAzODRjOWI4YjliY2IyMjM5ZmRjODEzOGUyYjVkMTdlMzA1OGUxMDNlNTdiNjA2YzkxZWM2NGMyMGYzZDRiZGRjMTRjZTFhYjFlZmZkZTI5YTgwN2JkNDMyY2FiMDA3YTA1MzI0YWVhMjIyMjViY2IxMzZmMGNlOGYxY2YzMTkwNTZmOTgzODM1M2E5Njk2Y2I4Mjg2YzU="
|
|
456
|
-
// }
|
|
457
|
-
}).then(function (res) {
|
|
458
|
-
|
|
459
|
-
// var json = [ {
|
|
460
|
-
// "fileName" : "d33087332a6c477a806d823209fef5c7.png",
|
|
461
|
-
// "previewUrl" : null,
|
|
462
|
-
// "fileDisplayName" : "1511353597(1).png",
|
|
463
|
-
// "downloadUrl" : "/attachment/download?fid=402887dc630ba7e701630bb4fe8f0011&chksum=04c8e2fdbb7ec02bc3492f9c98fa8e36",
|
|
464
|
-
// "imageSmallerUrl" : "/attachment/dingding/201804/d33087332a6c477a806d823209fef5c7_sm.png",
|
|
465
|
-
// "imageMiddleUrl" : "/attachment/dingding/201804/d33087332a6c477a806d823209fef5c7_mid.png",
|
|
466
|
-
// "fileExt" : ".png",
|
|
467
|
-
// "delFlag" : "0",
|
|
468
|
-
// "fileModule" : null,
|
|
469
|
-
// "multiCorpId" : false,
|
|
470
|
-
// "previewDate" : null,
|
|
471
|
-
// "imediaUrl" : "/attachment/dingding/201804/d33087332a6c477a806d823209fef5c7.png",
|
|
472
|
-
// "fileSize" : 67577,
|
|
473
|
-
// "fileDisplayNameNoExt" : "1511353597(1)",
|
|
474
|
-
// "relativePath" : "dingding/201804",
|
|
475
|
-
// "isEncrypted" : 0,
|
|
476
|
-
// "imageUrl" : "/attachment/image?fid=402887dc630ba7e701630bb4fe8f0011&chksum=04c8e2fdbb7ec02bc3492f9c98fa8e36",
|
|
477
|
-
// "checksum" : "04c8e2fdbb7ec02bc3492f9c98fa8e36",
|
|
478
|
-
// "deleteUrl" : "/attachment/delete?fid=402887dc630ba7e701630bb4fe8f0011&chksum=ef9f55278b3594f3eaefef23feacaa7d",
|
|
479
|
-
// "id" : "402887dc630ba7e701630bb4fe8f0011",
|
|
480
|
-
// "contentType" : null
|
|
481
|
-
// } ];
|
|
482
|
-
// initList = initList.concat(json);
|
|
483
|
-
// t.props.onChange(initList);
|
|
484
|
-
if (res.ok) {
|
|
485
|
-
res.json().then(function (obj) {
|
|
486
|
-
var objList = obj.data;
|
|
487
|
-
initList = initList.concat(objList);
|
|
488
|
-
if(t.props.onChange){
|
|
489
|
-
t.props.onChange(initList);
|
|
490
|
-
}
|
|
491
|
-
t.setState({
|
|
492
|
-
initList: initList
|
|
493
|
-
});
|
|
494
|
-
// Get the JSON
|
|
495
|
-
})
|
|
496
|
-
} else if (res.status == 401) {
|
|
497
|
-
// To do with res
|
|
498
|
-
}
|
|
499
|
-
}, function (e) {
|
|
500
|
-
// Handling errors
|
|
501
|
-
}).catch((error) => {
|
|
502
|
-
console.log("错误:" + error);
|
|
503
|
-
});
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// 文件图标
|
|
509
|
-
getIcon=(filetype)=>{
|
|
510
|
-
var currentFileName = ''
|
|
511
|
-
if(filetype == '.dps'){
|
|
512
|
-
currentFileName = 'iconfont icon-DPS iconfont-fontsize'
|
|
513
|
-
}else if(filetype == '.xls' || filetype == '.xlsx'){
|
|
514
|
-
currentFileName = 'iconfont icon-XLS iconfont-fontsize'
|
|
515
|
-
}else if(filetype == '.doc' || filetype == '.docx'){
|
|
516
|
-
currentFileName = 'iconfont icon-DOC iconfont-fontsize'
|
|
517
|
-
}else if (filetype == ".et") {
|
|
518
|
-
currentFileName = 'iconfont icon-ET iconfont-fontsize'
|
|
519
|
-
} else if (filetype == ".ofd") {
|
|
520
|
-
currentFileName = 'iconfont icon-OFD iconfont-fontsize'
|
|
521
|
-
} else if (filetype == ".wps") {
|
|
522
|
-
currentFileName = 'iconfont icon-WPS iconfont-fontsize'
|
|
523
|
-
} else if (filetype == ".zip") {
|
|
524
|
-
currentFileName = 'iconfont icon-ZIP iconfont-fontsize'
|
|
525
|
-
} else if (filetype == ".txt") {
|
|
526
|
-
currentFileName = 'iconfont icon-TXT iconfont-fontsize'
|
|
527
|
-
} else if (filetype == ".tif") {
|
|
528
|
-
currentFileName = 'iconfont icon-TIF iconfont-fontsize'
|
|
529
|
-
} else if (filetype == ".swf") {
|
|
530
|
-
currentFileName = 'iconfont icon-SWF iconfont-fontsize'
|
|
531
|
-
} else if (filetype == ".rar") {
|
|
532
|
-
currentFileName = 'iconfont icon-RAR iconfont-fontsize'
|
|
533
|
-
} else if (filetype == '.ppt' || filetype == '.pptx') {
|
|
534
|
-
currentFileName = 'iconfont icon-PPT iconfont-fontsize'
|
|
535
|
-
} else if (filetype == ".mp3") {
|
|
536
|
-
currentFileName = 'iconfont icon-MP3 iconfont-fontsize'
|
|
537
|
-
} else if (filetype == ".mp4") {
|
|
538
|
-
currentFileName = 'iconfont icon-MP4 iconfont-fontsize'
|
|
539
|
-
} else if (filetype == ".pdf") {
|
|
540
|
-
currentFileName = 'iconfont icon-PDF iconfont-fontsize'
|
|
541
|
-
} else if (filetype == ".mov") {
|
|
542
|
-
currentFileName = 'iconfont icon-MOV iconfont-fontsize'
|
|
543
|
-
} else if (filetype == ".gif") {
|
|
544
|
-
currentFileName = 'iconfont icon-GIF iconfont-fontsize'
|
|
545
|
-
} else if (filetype == ".flv") {
|
|
546
|
-
currentFileName = 'iconfont icon-FLV iconfont-fontsize'
|
|
547
|
-
} else if (filetype == ".exe") {
|
|
548
|
-
currentFileName = 'iconfont icon-EXE iconfont-fontsize'
|
|
549
|
-
} else if (filetype == ".avi") {
|
|
550
|
-
currentFileName = 'iconfont icon-AVI iconfont-fontsize'
|
|
551
|
-
} else if (filetype == ".7z") {
|
|
552
|
-
currentFileName = 'iconfont icon-7Z iconfont-fontsize'
|
|
553
|
-
} else{
|
|
554
|
-
currentFileName = 'iconfont icon-file2 iconfont-fontsize'
|
|
555
|
-
}
|
|
556
|
-
return currentFileName
|
|
557
|
-
}
|
|
558
|
-
//加载文件列表
|
|
559
|
-
|
|
560
|
-
render() {
|
|
561
|
-
const t = this;
|
|
562
|
-
return (
|
|
563
|
-
<div className="">
|
|
564
|
-
<div className={this.state.label == '' ? 't-DN' : 't-field-box t-FBH t-FBAC t-FBJ'}>
|
|
565
|
-
<div className={this.state.required ? 't-field-layout-h-label t-FS16 required' : 't-field-layout-h-label t-FS16'}>{this.props.label}</div>
|
|
566
|
-
</div>
|
|
567
|
-
<div className={t.state.uploadType == 'image' ? "t-FBH t-fw" : "upload"}>
|
|
568
|
-
{/* <div className= {t.state.uploadType == 'image' ? 'upload-image-test' : 'upload-image-test-hidden'}>
|
|
569
|
-
<div className='upload-image-test-left'>相关图片</div>
|
|
570
|
-
<div className='upload-image-test-right'>可上传jpg,gif类型文件,大小限制3M</div>
|
|
571
|
-
</div> */}
|
|
572
|
-
{t.state.initList.map((item, i) => {
|
|
573
|
-
function calculate(no) {
|
|
574
|
-
let a = no / 1024;
|
|
575
|
-
if (a < 1) {
|
|
576
|
-
return no + 'B';
|
|
577
|
-
}
|
|
578
|
-
let b = a / 1024;
|
|
579
|
-
if (b < 1) {
|
|
580
|
-
return Math.round(a * 100) / 100 + 'KB';
|
|
581
|
-
}
|
|
582
|
-
let c = b / 1024;
|
|
583
|
-
if (c < 1) {
|
|
584
|
-
return Math.round(b * 100) / 100 + 'MB';
|
|
585
|
-
}
|
|
586
|
-
return Math.round(c * 100) / 100 + 'GB';
|
|
587
|
-
}
|
|
588
|
-
return (
|
|
589
|
-
t.state.uploadType == 'image' ?
|
|
590
|
-
<div className="upload-image-item" key={i}>
|
|
591
|
-
<img width="100" height="98" src={t.state.urlPrev + item.id } />
|
|
592
|
-
<i className={t.state.canDel ? 'iconfont icon-minus' : 't-DN'} onClick={this.del.bind(this, i)} ></i>
|
|
593
|
-
</div>
|
|
594
|
-
:
|
|
595
|
-
// <div className="t-FBH" key={i} >
|
|
596
|
-
// <div className="dd-t-border t-P6 t-MB10 t-FB1" onClick={this.view.bind(this, item)}>
|
|
597
|
-
// <i className="iconfont icon-file t-FC9 t-FL t-MR6" ></i>
|
|
598
|
-
// <div className="dd-t-list-text-content" >
|
|
599
|
-
// <div className="t-list-title t-omit t-LH1_4" >
|
|
600
|
-
// {typeof(item.fileDisplayName)=='undefined'?item.name:item.fileDisplayName}
|
|
601
|
-
// </div>
|
|
602
|
-
// <div className="dd-t-list-time t-FBAC" >{calculate(typeof(item.fileSize)=='undefined'?item.size:item.fileSize)}</div>
|
|
603
|
-
// </div>
|
|
604
|
-
// </div>
|
|
605
|
-
// <i className={t.state.canDel?'iconfont icon-minus t-BC04 t-WH25 t-R50 t-ML10 t-FCf t-LH1 t-MT10':'t-DN'} onClick={this.del.bind(this,i)}></i>
|
|
606
|
-
// </div>
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
/* 4.0修改 */
|
|
610
|
-
<div className="upload-list" key={i} >
|
|
611
|
-
<div className='upload-content'>
|
|
612
|
-
<div className="dd-t-border upload-list-item">
|
|
613
|
-
<div className="upload-list-item-content" onClick={this.view.bind(this, item)}>
|
|
614
|
-
<div className='upload-name-icon'>
|
|
615
|
-
<i className={this.getIcon(item.fileExt)}></i>
|
|
616
|
-
<div className="t-list-title t-omit t-LH1_4" >
|
|
617
|
-
{typeof (item.fileDisplayName) == 'undefined' ? item.name : item.fileDisplayName}
|
|
618
|
-
</div>
|
|
619
|
-
</div>
|
|
620
|
-
<div className="dd-t-list-time t-FBAC" >{calculate(typeof (item.fileSize) == 'undefined' ? item.size : item.fileSize)}</div>
|
|
621
|
-
</div>
|
|
622
|
-
<div className={t.props.canDownload || t.state.canDel ?'upload-icon':'t-DN'}>
|
|
623
|
-
<i className={t.props.canDownload ? 'iconfont icon-download1' : 't-DN'} onClick={this.downloadFile.bind(this,item)}></i>
|
|
624
|
-
<i className={t.state.canDel ? 'iconfont icon-delete' : 't-DN'} onClick={this.del.bind(this, i)}></i>
|
|
625
|
-
</div>
|
|
626
|
-
</div>
|
|
627
|
-
</div>
|
|
628
|
-
</div>
|
|
629
|
-
);
|
|
630
|
-
})}
|
|
631
|
-
<div className={t.state.canAdd && (t.state.limitNo > t.state.initList.length || t.state.limitNo == -1) && t.state.percent1 > 0 && t.state.showProgress ? t.state.uploadType == 'image' ? 'upload-image-p' : 'upload-file-p' : 't-DN'}>
|
|
632
|
-
<div style={{ width: '100%' }}>
|
|
633
|
-
<span className='upload-progress-tip'>文件上传中</span>
|
|
634
|
-
<Progress className="upload-progress" percent={t.state.percent1} status="normal" strokeWidth={4} showInfo={false} />
|
|
635
|
-
</div>
|
|
636
|
-
</div>
|
|
637
|
-
<div flex={1} className={t.state.canAdd && (t.state.limitNo > t.state.initList.length || t.state.limitNo == -1) ? t.state.uploadType == 'image' ? 'upload-image' : 'upload-file' : 't-DN'}>
|
|
638
|
-
<i id={'ddUploadPic' + t.state.keyNum} className='iconfont icon-plus'></i>
|
|
639
|
-
</div>
|
|
640
|
-
|
|
641
|
-
</div>
|
|
642
|
-
</div>
|
|
643
|
-
|
|
644
|
-
);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|