{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\common\\ImgPreviewUpload.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\common\\ImgPreviewUpload.vue","mtime":1667327529075},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\babel.config.js","mtime":1667327525434},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.function.name\";\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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { mapState } from 'vuex';\nimport req from '@/request.js';\nimport utils from '@/hotent-ui-util.js';\nexport default {\n props: ['accept'],\n data: function data() {\n return {\n limits: this.limit,\n src: '',\n fileId: '',\n fileTree: '',\n iframeSrc: '',\n files: [],\n uploadingFiles: {},\n list: [],\n isChecking: true,\n num: 0,\n imgUrl: '',\n dialogVisible: false\n };\n },\n computed: mapState({\n header: function header(state) {\n if (state.login && state.login.currentUser) {\n return {\n Authorization: \"Bearer \".concat(state.login.currentUser.token)\n };\n }\n\n return {};\n },\n actionUrl: function actionUrl() {\n return window.context.portal + '/file/v1/upload';\n }\n }),\n mounted: function mounted() {\n if (!this.limit) {\n this.limits = 9999999;\n }\n\n if (!this.accept) {\n this.accept = '.jpg,.jpeg,.png,.bmp,.pdf,.JPG,.JPEG,.PNG,.BMP,.PDF,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.rtf,.txt,.zip,.rar,.vsd,.dwg';\n }\n },\n methods: {\n handlePictureCardPreview: function handlePictureCardPreview() {\n this.dialogVisible = true;\n },\n exceed: function exceed(file, fileList) {\n if (this.limit == 1 && (fileList.length == 1 || file.length > 1)) {\n this.$message.warning('正文只能上传一个文件');\n }\n },\n preview: function preview(files) {\n var _this = this;\n\n var id = files.id;\n this.$store.dispatch('menu/onlinePreview', id).then(function (data) {\n _this.fileId = id;\n\n if (data.result == 'html') {\n _this.iframeSrc = window.context.portal + data.pdfUrl;\n\n _this.$refs.iframeSrcSearch.handleOpen();\n } else if (data.result == 'txt') {\n _this.iframeSrc = window.context.portal + data.TxtUrl;\n\n _this.$refs.iframeSrcSearch.handleOpen();\n } else if (data.result == 'picture') {\n _this.iframeSrc = window.context.portal + data.currentUrl;\n\n _this.$refs.iframeSrcSearch.handleOpen();\n } else if (data.result == 'compress') {\n _this.fileTree = JSON.parse(data.fileTree).childList;\n\n _this.$refs.fileTreeSearch.handleOpen();\n } else {\n _this.src = window.context.portal + data.pdfUrl;\n\n _this.$refs.pdfSearch.handleOpen();\n }\n });\n },\n remove: function remove(files) {\n console.log(this.$refs.upload);\n this.$refs.upload.clearFiles();\n this.files = [];\n this.uploadingFiles = {};\n this.list = [];\n this.imgUrl = '';\n },\n beforeRemove: function beforeRemove(file, fileList) {\n var _this2 = this;\n\n console.log(file, 'file');\n\n if (this.isChecking) {\n return this.$confirm(\"\\u786E\\u5B9A\\u79FB\\u9664 \".concat(file.name, \"\\uFF1F\")).then(function () {\n _this2.num = 0;\n var value = {};\n\n if (file.response) {\n value = JSON.parse(file.response.value);\n } else {\n value = file;\n value.fileId = file.id;\n }\n\n for (var i = 0; i < _this2.files.length; i++) {\n if (_this2.files[i].id == value.fileId) {\n _this2.files.splice(i, 1); //删除数组某一项\n\n }\n }\n });\n } else {\n this.num = 0;\n var value = {};\n\n if (file.response) {\n value = JSON.parse(file.response.value);\n } else {\n value = file;\n value.fileId = file.id;\n }\n\n for (var i = 0; i < this.files.length; i++) {\n if (this.files[i].id == value.fileId) {\n this.files.splice(i, 1); //删除数组某一项\n\n delete this.uploadingFiles[Base64.encode(this.files[i].name)];\n }\n }\n }\n },\n error: function error(response, file, fileList) {\n delete this.uploadingFiles[Base64.encode(file.name)];\n },\n success: function success(response, file, fileList) {\n console.log(response, file, fileList, '参数');\n\n for (var i = 0; i < fileList.length; i++) {\n delete this.uploadingFiles[Base64.encode(fileList[i].name)];\n }\n\n if (this.num == 0) {\n this.list = [];\n\n for (var _i = 0; _i < fileList.length; _i++) {\n this.list.push(fileList[_i]);\n }\n }\n\n this.num = this.num + 1;\n\n for (var j = 0; j < this.list.length; j++) {\n if (!this.list[j].raw) {\n for (var k = 0; k < fileList.length; k++) {\n if (this.list[j].name == fileList[k].name) {\n fileList.splice(k, 1);\n break;\n }\n }\n }\n }\n\n if (this.num == fileList.length) {\n for (var n = 0; n < fileList.length; n++) {\n if (fileList[n].response) {\n var value = fileList[n].response;\n var arrarFile = {};\n this.getUrlByfileId(value.fileId);\n arrarFile.id = value.fileId;\n arrarFile.name = value.fileName;\n arrarFile.size = value.size;\n this.files.push(arrarFile);\n }\n }\n\n this.$emit('input', JSON.stringify(this.files));\n }\n },\n getUrlByfileId: function getUrlByfileId(id) {\n var _this3 = this;\n\n req.get(window.context.portal + '/file/onlinePreviewController/v1/getFileById_' + id, 'arraybuffer').then(function (response) {\n var type = response.headers['content-type'];\n\n if (type) {\n _this3.imgUrl = window.URL.createObjectURL(new Blob([response.data], {\n type: type\n }));\n } else {\n _this3.imgUrl = window.URL.createObjectURL(new Blob([response.data]));\n }\n });\n },\n // handleChange(file, fileList) {\n // if(file.status==\"success\"){\n // let value = JSON.parse(file.response.value);\n // let arrarFile = {};\n // arrarFile.id = value.fileId;\n // arrarFile.name = value.fileName;\n // arrarFile.size = value.size;\n // this.files.push(arrarFile);\n // this.$emit(\"input\", JSON.stringify(this.files));\n // }\n // },\n getFiles: function getFiles() {\n if (this.files.length == 0) {\n return '';\n } else {\n return this.files;\n }\n },\n //清除附件\n clearFiles: function clearFiles() {\n this.$refs.fileUp.clearFiles();\n },\n setFiles: function setFiles(files) {\n this.files = files;\n },\n isFinishUpload: function isFinishUpload() {\n if (JSON.stringify(this.uploadingFiles) != '{}') {\n this.$message.warning('正在上传附件,请稍后!');\n throw '正在上传附件,请稍后!';\n }\n },\n beforeAvatarUpload: function beforeAvatarUpload(file) {\n // 文件类型限制\n var name = file.name ? file.name : '';\n var ext = name ? name.substr(name.lastIndexOf('.') + 1, name.length) : true;\n var isExt = this.accept.indexOf(ext) < 0;\n this.isChecking = !isExt;\n\n if (isExt) {\n if (this.accept == 'false') {\n this.$message.error('请配置可上传文件的格式!');\n } else {\n this.$message.error('上传的附件只能是 ' + this.accept + '格式!');\n }\n\n return !isExt;\n }\n\n this.uploadingFiles[Base64.encode(name)] = 'eror';\n }\n }\n};",null]}