diff --git a/src/api/model/wpm.js b/src/api/model/wpm.js index d17e14f8..382986cc 100644 --- a/src/api/model/wpm.js +++ b/src/api/model/wpm.js @@ -341,6 +341,12 @@ export default { }, mlogbw: { + files: { + name: "产出附件", + req: async function (id, data) { + return await http.put(`${config.API_URL}/wpm/mlogbw/${id}/files/`, data); + }, + }, list: { name: "列表", req: async function (data) { diff --git a/src/components/OutputMaterialFiles.vue b/src/components/OutputMaterialFiles.vue new file mode 100644 index 00000000..2899dc11 --- /dev/null +++ b/src/components/OutputMaterialFiles.vue @@ -0,0 +1,77 @@ + + + diff --git a/src/components/scUpload/file.vue b/src/components/scUpload/file.vue index 79c5b072..b8c2b305 100644 --- a/src/components/scUpload/file.vue +++ b/src/components/scUpload/file.vue @@ -26,6 +26,11 @@ + @@ -53,7 +58,9 @@ data() { return { value: "", - defaultFileList: [] + defaultFileList: [], + previewVisible: false, + previewIndex: 0, } }, watch:{ @@ -151,7 +158,9 @@ this.$message.warning(`当前设置最多上传 ${this.limit} 个文件,请移除后上传!`) }, handlePreview(uploadFile){ - window.open(uploadFile.url) + const index = this.defaultFileList.indexOf(uploadFile) + this.previewIndex = index >= 0 ? index : 0 + this.previewVisible = true }, request(param){ var apiObj = config.apiObjFile; diff --git a/src/components/scUpload/filed.vue b/src/components/scUpload/filed.vue index 0a0160f7..a7a29f17 100644 --- a/src/components/scUpload/filed.vue +++ b/src/components/scUpload/filed.vue @@ -25,6 +25,11 @@
{{tip}}
+ @@ -52,7 +57,10 @@ }, data() { return { - defaultFileList: [] + defaultFileList: [], + uploadingCount: 0, + previewVisible: false, + previewIndex: 0, } }, watch:{ @@ -100,14 +108,23 @@ arr.forEach(item => { if(item){ _arr.push({ + id: item.id, name: item.name, - url: item.path + url: item.path || item.url, + path: item.path || item.url, + mime: item.mime, + type: item.type, + status: "success", }) } }) return _arr }, before(file){ + if (file.size <= 0) { + this.$message.warning("不能上传空文件"); + return false; + } const maxSize = file.size / 1024 / 1024 < this.maxSize; if (!maxSize) { this.$message.warning(`上传文件大小不能超过 ${this.maxSize}MB!`); @@ -121,7 +138,10 @@ } file.name = res.name file.url = res.path + file.path = res.path file.id = res.id + file.mime = res.mime + file.type = res.type }, error(err){ this.$notify.error({ @@ -142,7 +162,9 @@ this.$message.warning(`当前设置最多上传 ${this.limit} 个文件,请移除后上传!`) }, handlePreview(uploadFile){ - window.open(uploadFile.url) + const index = this.defaultFileList.indexOf(uploadFile) + this.previewIndex = index >= 0 ? index : 0 + this.previewVisible = true }, request(param){ var apiObj = config.apiObjFile; @@ -154,6 +176,8 @@ for (const key in param.data) { data.append(key, param.data[key]); } + this.uploadingCount += 1 + this.$emit('uploading-change', true) apiObj.post(data, { onUploadProgress: e => { const complete = parseInt(((e.loaded / e.total) * 100) | 0, 10) @@ -164,6 +188,9 @@ param.onSuccess(res) }).catch(err => { param.onError(err) + }).finally(() => { + this.uploadingCount = Math.max(0, this.uploadingCount - 1) + this.$emit('uploading-change', this.uploadingCount > 0) }) } } diff --git a/src/components/scUpload/multiple.vue b/src/components/scUpload/multiple.vue index 6b9c8651..b139a28d 100644 --- a/src/components/scUpload/multiple.vue +++ b/src/components/scUpload/multiple.vue @@ -25,7 +25,7 @@ @@ -69,7 +74,9 @@ data(){ return { value: "", - defaultFileList: [] + defaultFileList: [], + previewVisible: false, + previewIndex: 0, } }, watch:{ @@ -235,7 +242,9 @@ this.$message.warning(`当前设置最多上传 ${this.limit} 个文件,请移除后上传!`) }, handlePreview(uploadFile){ - window.open(uploadFile.url) + const index = this.defaultFileList.indexOf(uploadFile) + this.previewIndex = index >= 0 ? index : 0 + this.previewVisible = true }, request(param){ var apiObj = config.apiObj; diff --git a/src/components/xtFilePreview/index.vue b/src/components/xtFilePreview/index.vue new file mode 100644 index 00000000..2111b771 --- /dev/null +++ b/src/components/xtFilePreview/index.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/src/views/pum/supplieraudit.vue b/src/views/pum/supplieraudit.vue index a3dda98b..d96e80cf 100644 --- a/src/views/pum/supplieraudit.vue +++ b/src/views/pum/supplieraudit.vue @@ -30,17 +30,23 @@ @@ -70,4 +76,4 @@ const exportCols = [ { header: "物料名称", key: "material_name", wch: 20 }, { header: "物料类别", key: "material_cate", wch: 20 }, ] - \ No newline at end of file + diff --git a/src/views/rpm/rfile.vue b/src/views/rpm/rfile.vue index bf78051a..df72048a 100644 --- a/src/views/rpm/rfile.vue +++ b/src/views/rpm/rfile.vue @@ -22,9 +22,13 @@