@zgfe/modules-settings 2.0.0-zhongyuan.5 → 2.0.0-zhongyuan.7

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.
@@ -25,15 +25,16 @@ var Dragger = Upload.Dragger;
25
25
  var pageName = 'DocumentSetting';
26
26
  var confirm = Modal.confirm;
27
27
  var beforeUpload = function beforeUpload(file) {
28
- var isJpgOrPng = file.type == 'application/x-zip-compressed' || file.type == 'application/x-compressed';
29
- if (!isJpgOrPng) {
30
- message.error('只能传入是ZIP或者RAR文件');
31
- }
28
+ // const isJpgOrPng =
29
+ // file.type == 'application/x-zip-compressed' || file.type == 'application/x-compressed';
30
+ // if (!isJpgOrPng) {
31
+ // message.error('只能传入是ZIP或者RAR文件');
32
+ // }
32
33
  var isLt2M = file.size / 1024 / 1024 < 100;
33
34
  if (!isLt2M) {
34
35
  message.error('文件不能大于100M');
35
36
  }
36
- return isJpgOrPng && isLt2M;
37
+ return isLt2M;
37
38
  };
38
39
  var downloadFile = function downloadFile(resData, name) {
39
40
  var blob = resData.data;
@@ -66,19 +67,19 @@ var DocumentSetting = function DocumentSetting() {
66
67
  title: '序号',
67
68
  dataIndex: 'index',
68
69
  key: 'index',
70
+ width: 80,
69
71
  render: function render(_, obj, index) {
70
72
  return index + 1;
71
73
  }
72
74
  }, {
73
75
  title: '文档名称',
74
76
  dataIndex: 'name',
75
- key: 'name',
76
- with: 260
77
+ key: 'name'
77
78
  }, {
78
79
  title: '创建时间',
79
80
  dataIndex: 'createdTime',
80
81
  key: 'createdTime',
81
- with: 200,
82
+ width: 200,
82
83
  sorter: function sorter(a, b) {
83
84
  return moment(b.createdTime).valueOf() - moment(a.createdTime).valueOf();
84
85
  },
@@ -88,7 +89,7 @@ var DocumentSetting = function DocumentSetting() {
88
89
  }, {
89
90
  title: '操作',
90
91
  key: 'operation',
91
- with: 120,
92
+ width: 170,
92
93
  render: function render(_, record) {
93
94
  return /*#__PURE__*/React.createElement(Space, {
94
95
  size: "middle"
@@ -182,6 +183,7 @@ var DocumentSetting = function DocumentSetting() {
182
183
  isOpenUploadModal = _useState10[0],
183
184
  setIsOpenUploadModal = _useState10[1];
184
185
  var handleValueCancel = function handleValueCancel() {
186
+ setFileList(undefined);
185
187
  setIsOpenUploadModal(false);
186
188
  setDocumentFlagLoading(false);
187
189
  };
@@ -191,25 +193,33 @@ var DocumentSetting = function DocumentSetting() {
191
193
  setFileList = _useState12[1];
192
194
  var props = {
193
195
  name: 'file',
194
- multiple: true,
196
+ maxCount: 1,
197
+ accept: '.zip,.rar,.7z',
195
198
  beforeUpload: beforeUpload,
196
199
  onChange: function onChange(info) {
197
- console.log(info);
198
200
  var status = info.file.status;
199
201
  if (status !== 'uploading') {
200
- console.log(info.file, info.fileList);
202
+ if (info.fileList.length > 0) {
203
+ setFileList(info.fileList[0].originFileObj);
204
+ }
201
205
  }
202
- if (status === 'done') {
203
- setFileList(info.fileList[0].originFileObj);
204
- } else if (status === 'error') {
205
- message.error("".concat(info.file.name, " file upload failed."));
206
+ if (status == 'removed') {
207
+ setFileList(undefined);
206
208
  }
209
+ // if (status === 'done') {
210
+ // } else if (status === 'error') {
211
+ // message.error(`${info.file.name} file upload failed.`);
212
+ // }
207
213
  },
208
214
  onDrop: function onDrop(e) {
209
215
  console.log('Dropped files', e.dataTransfer.files);
210
216
  }
211
217
  };
212
218
  var saveFile = function saveFile() {
219
+ if (!fileList) {
220
+ message.error('请选择上传的文件');
221
+ return;
222
+ }
213
223
  var formData = new FormData();
214
224
  formData.append('file', fileList);
215
225
  request(apis.setting.uploadDocumentFile, {
@@ -310,7 +320,7 @@ var DocumentSetting = function DocumentSetting() {
310
320
  }
311
321
  }).then(function (res) {
312
322
  if (res && (res === null || res === void 0 ? void 0 : res.code) == '100000') {
313
- message.error('分享成功!');
323
+ message.success('分享成功!');
314
324
  handleShareCancel();
315
325
  } else {
316
326
  message.error('查询失败,联系管理员');
@@ -378,6 +388,7 @@ var DocumentSetting = function DocumentSetting() {
378
388
  title: "\u4E0A\u4F20",
379
389
  okText: "\u786E\u5B9A",
380
390
  cancelText: "\u53D6\u6D88",
391
+ destroyOnClose: true,
381
392
  open: isOpenUploadModal,
382
393
  onCancel: handleValueCancel,
383
394
  onOk: saveFile
@@ -420,7 +431,7 @@ var DocumentSetting = function DocumentSetting() {
420
431
  size: 20
421
432
  }, /*#__PURE__*/React.createElement(Radio, {
422
433
  value: 4
423
- }, "\u6240\u4EE5\u6210\u5458"), /*#__PURE__*/React.createElement(Radio, {
434
+ }, "\u6240\u6709\u6210\u5458"), /*#__PURE__*/React.createElement(Radio, {
424
435
  value: 1
425
436
  }, "\u6307\u5B9A\u5E94\u7528\uFF08\u6240\u6709\u62E5\u6709\u8BE5\u5E94\u7528\u6743\u9650\u7684\u89D2\u8272\uFF09"), currentShareType == 1 ? (/*#__PURE__*/React.createElement(React.Fragment, null, currentAppArr.length > 2 ? (/*#__PURE__*/React.createElement(Tooltip, {
426
437
  title: function title() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-settings",
3
- "version": "2.0.0-zhongyuan.5",
3
+ "version": "2.0.0-zhongyuan.7",
4
4
  "private": false,
5
5
  "module": "es/index.js",
6
6
  "typings": "es/index.d.ts",