@newview/file-ui 1.1.25 → 1.1.27
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 +6 -0
- package/dist/file-ui.js +40 -11
- package/dist/file-ui.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +59 -58
package/README.md
CHANGED
package/dist/file-ui.js
CHANGED
|
@@ -254,6 +254,11 @@ const propDefine$6 = {
|
|
|
254
254
|
//只读状态且无附件信息下的显示
|
|
255
255
|
type: String,
|
|
256
256
|
default: "暂无附件"
|
|
257
|
+
},
|
|
258
|
+
// 控制附件上传的个数
|
|
259
|
+
uploadQuantity: {
|
|
260
|
+
type: Number,
|
|
261
|
+
default: 0
|
|
257
262
|
}
|
|
258
263
|
};
|
|
259
264
|
const _sfc_main$6 = defineComponent({
|
|
@@ -335,8 +340,27 @@ let UploadFileInstance$1 = class UploadFileInstance extends BaseInstance {
|
|
|
335
340
|
* 上传之前
|
|
336
341
|
*/
|
|
337
342
|
__publicField(this, "doBeforeUpload", () => {
|
|
338
|
-
|
|
339
|
-
|
|
343
|
+
return new Promise(async (resolve, reject) => {
|
|
344
|
+
let flag = true;
|
|
345
|
+
if (this.props.uploadQuantity > 0) {
|
|
346
|
+
let apiResult = await this.fileInfoApi.getEntities(QueryWrapper.create().eq("Token", this.currentToken));
|
|
347
|
+
const result = this.utilities.parseApiResult(apiResult);
|
|
348
|
+
if (result && result.length >= this.props.uploadQuantity) {
|
|
349
|
+
this.message.warning(`仅能上传${this.props.uploadQuantity}个附件`);
|
|
350
|
+
flag = false;
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
flag = true;
|
|
354
|
+
}
|
|
355
|
+
if (flag) {
|
|
356
|
+
resolve(() => {
|
|
357
|
+
});
|
|
358
|
+
this.message.info("文件上传中,请稍等");
|
|
359
|
+
this.uploading.value = true;
|
|
360
|
+
} else {
|
|
361
|
+
reject();
|
|
362
|
+
}
|
|
363
|
+
});
|
|
340
364
|
});
|
|
341
365
|
/**
|
|
342
366
|
* 移除
|
|
@@ -525,10 +549,14 @@ let UploadFileInstance$1 = class UploadFileInstance extends BaseInstance {
|
|
|
525
549
|
* 预览文件
|
|
526
550
|
* @param fileInfo
|
|
527
551
|
*/
|
|
528
|
-
__publicField(this, "doView", (fileInfo) => {
|
|
529
|
-
|
|
552
|
+
__publicField(this, "doView", async (fileInfo, index = 0) => {
|
|
553
|
+
console.log("预览文件", fileInfo);
|
|
554
|
+
const apiResult = await this.fileInfoApi.getEntities(QueryWrapper.create().eq("Token", fileInfo.Token));
|
|
555
|
+
const result = this.utilities.parseApiResult(apiResult);
|
|
556
|
+
console.log("点击预览文件查询接口", result);
|
|
557
|
+
this.previewFileInfo = result[index];
|
|
530
558
|
this.previewVisible.value = true;
|
|
531
|
-
this.previewIndex.value =
|
|
559
|
+
this.previewIndex.value = index;
|
|
532
560
|
});
|
|
533
561
|
this.props = props;
|
|
534
562
|
this.ctx = ctx;
|
|
@@ -602,8 +630,8 @@ let UploadFileInstance$1 = class UploadFileInstance extends BaseInstance {
|
|
|
602
630
|
}
|
|
603
631
|
//#endregion 业务逻辑 文件预览 END
|
|
604
632
|
};
|
|
605
|
-
const
|
|
606
|
-
const _withScopeId$1 = (n) => (pushScopeId("data-v-
|
|
633
|
+
const UploadFile_vue_vue_type_style_index_0_scoped_5d3c256e_lang = "";
|
|
634
|
+
const _withScopeId$1 = (n) => (pushScopeId("data-v-5d3c256e"), n = n(), popScopeId(), n);
|
|
607
635
|
const _hoisted_1$3 = { class: "uploadFile uploadPage" };
|
|
608
636
|
const _hoisted_2$3 = ["onClick", "title"];
|
|
609
637
|
const _hoisted_3$3 = { class: "file-upload-list-cover" };
|
|
@@ -658,7 +686,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
658
686
|
}, [
|
|
659
687
|
createElementVNode("div", {
|
|
660
688
|
class: "file-upload-list-content",
|
|
661
|
-
onClick: ($event) => _ctx.doView(item),
|
|
689
|
+
onClick: ($event) => _ctx.doView(item, index),
|
|
662
690
|
title: item.FileName
|
|
663
691
|
}, [
|
|
664
692
|
createVNode(_component_Image, {
|
|
@@ -818,7 +846,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
818
846
|
}, null, 8, ["modelValue", "preview-list", "preview-index", "file-info"])
|
|
819
847
|
]);
|
|
820
848
|
}
|
|
821
|
-
const UploadFile = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-
|
|
849
|
+
const UploadFile = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-5d3c256e"]]);
|
|
822
850
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
823
851
|
function getDefaultExportFromCjs(x) {
|
|
824
852
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -19443,7 +19471,7 @@ class UploadFileInstance2 extends BaseInstance {
|
|
|
19443
19471
|
* @param fileInfo
|
|
19444
19472
|
*/
|
|
19445
19473
|
__publicField(this, "doView", (fileInfo) => {
|
|
19446
|
-
this.previewFileInfo = fileInfo;
|
|
19474
|
+
this.previewFileInfo.value = fileInfo;
|
|
19447
19475
|
this.previewVisible.value = true;
|
|
19448
19476
|
this.previewIndex.value = fileInfo.PreviewIndex;
|
|
19449
19477
|
});
|
|
@@ -19782,8 +19810,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
19782
19810
|
readonly: _ctx.getPropValue(item.uploadFileProp, "readonly") || _ctx.onlyView,
|
|
19783
19811
|
token: _ctx.formModel[item.model],
|
|
19784
19812
|
multiple: _ctx.getPropValue(item.uploadFileProp, "multiple"),
|
|
19813
|
+
uploadQuantity: _ctx.getPropValue(item.uploadFileProp, "uploadQuantity", 0),
|
|
19785
19814
|
onReturnFileList: ($event) => _ctx.tokenList($event, item)
|
|
19786
|
-
}, null, 8, ["readonly", "token", "multiple", "onReturnFileList"])) : createCommentVNode("", true),
|
|
19815
|
+
}, null, 8, ["readonly", "token", "multiple", "uploadQuantity", "onReturnFileList"])) : createCommentVNode("", true),
|
|
19787
19816
|
item.type === "TextEditor" ? (openBlock(), createBlock(_component_TextEditor, {
|
|
19788
19817
|
key: 1,
|
|
19789
19818
|
ref: "textEditorRef",
|