{"remainingRequest":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\artfess-module\\src\\components\\common\\FileUpload.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\artfess-module\\src\\components\\common\\FileUpload.vue","mtime":1675232038590},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.array.find-index\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.number.constructor\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport utils from \"@/utils.js\";\nimport { setTimeout } from \"timers\";\nexport default {\n name: \"file-upload\",\n props: {\n withCredentials: {\n type: Boolean,\n default: false\n },\n value: {\n type: Array,\n required: true\n },\n actionUrl: {\n type: String,\n required: true\n },\n multiple: {\n type: Boolean\n },\n accept: {\n type: String\n },\n limit: {\n type: Number,\n default: 5\n },\n header: {\n type: Object\n },\n size: {\n type: Number,\n default: 50\n },\n readonly: {\n type: Boolean,\n default: false\n },\n beforeUpload: {\n type: Function\n },\n onSuccess: {\n type: Function\n },\n onError: {\n type: Function\n }\n },\n data: function data() {\n return {\n files: []\n };\n },\n watch: {\n files: function files(newVal) {\n if (newVal && newVal.constructor === Array) {\n var ary = [];\n newVal.forEach(function (m) {\n if (m && m.constructor === Object) {\n ary.push(m);\n } else if (m && m.constructor === File) {\n var name = m.name;\n var index = name.lastIndexOf(\".\");\n var type = name.substring(index + 1, name.length);\n ary.push({\n name: name,\n size: m.size,\n percentage: m.percentage,\n status: m.status,\n state: m.state,\n response: m.response,\n type: type,\n uid: m.uid\n });\n }\n });\n this.$emit(\"input\", ary);\n }\n }\n },\n computed: {\n acceptLabel: function acceptLabel() {\n return this.accept ? this.accept : \"所有格式\";\n }\n },\n created: function created() {\n this.files = this.value || [];\n },\n methods: {\n // 附件是否超过最大尺寸\n exceedFileSize: function exceedFileSize(file) {\n return file.size > this.size * 1024 * 1024;\n },\n handleBeforeUpload: function handleBeforeUpload(file) {\n var resultVal = false;\n\n if (this.exceedFileSize(file)) {\n var computerSize = this.$options.filters[\"computerSize\"](file.size);\n this.$message({\n message: \"\\u9644\\u4EF6\\u7684\\u5927\\u5C0F\\u4E3A\".concat(computerSize, \"\\uFF0C\\u8D85\\u8FC7\\u4E86\\u5141\\u8BB8\\u7684\\u6700\\u5927\\u5C3A\\u5BF8\").concat(this.size, \"MB.\"),\n type: \"warning\"\n });\n resultVal = false;\n } else {\n resultVal = true;\n }\n\n if (this.beforeUpload && this.beforeUpload.constructor == Function && resultVal) {\n resultVal = this.beforeUpload(file);\n }\n\n if (resultVal) {\n this.files.push(file);\n }\n\n return resultVal;\n },\n handleProgress: function handleProgress(event, file, fileList) {\n var index = this.files.findIndex(function (m) {\n return m === file;\n });\n index > -1 && this.$set(this.files, index, file);\n this.$emit('on-progress', event, file, fileList);\n },\n handleExceed: function handleExceed(files, fileList) {\n this.$message({\n message: \"\\u6700\\u591A\\u5141\\u8BB8\\u4E0A\\u4F20\".concat(this.limit, \"\\u4E2A\\u9644\\u4EF6.\"),\n type: \"warning\"\n });\n },\n handleSuccess: function handleSuccess(response, file, fileList) {\n if (this.onSuccess && this.onSuccess.constructor == Function) {\n this.onSuccess(response, file, fileList);\n }\n\n var index = this.files.findIndex(function (m) {\n return m === file;\n });\n file.state = \"success\";\n index > -1 && this.$set(this.files, index, file);\n },\n handleError: function handleError(err, file, fileList) {\n var _this = this;\n\n if (this.onError && this.onError.constructor == Function) {\n this.onError(err, file, fileList);\n }\n\n this.$emit('handle-error');\n var index = this.files.findIndex(function (m) {\n return m === file;\n });\n file.state = \"exception\";\n index > -1 && this.$set(this.files, index, file);\n this.$message({\n message: \"\\u9644\\u4EF6\".concat(file.name, \"\\u4E0A\\u4F20\\u5931\\u8D25.\"),\n type: \"error\",\n onClose: function onClose() {\n _this.files.remove(file);\n }\n });\n },\n handleClear: function handleClear() {\n var _this2 = this;\n\n this.$confirm(\"确定清空所有附件?\").then(function () {\n _this2.files.forEach(function (m) {\n _this2.abort(m);\n });\n\n _this2.$refs.elUploadEl.clearFiles();\n\n _this2.files = [];\n });\n },\n abort: function abort(file) {\n // 附件还在上传中,则中止上传。\n if (file && file.status === \"uploading\") {\n this.$refs.elUploadEl.abort(file);\n }\n },\n remove: function remove(file) {\n this.abort(file);\n this.files.remove(file);\n\n for (var i = 0; i < this.files.length; i++) {\n if (this.files[i].uid == file.uid) {\n this.files.splice(i, 1); //删除数组某一项\n }\n }\n }\n }\n};",null]}