1 |
- {"remainingRequest":"C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\babel-loader\\lib\\index.js!C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\style-vw-loader\\index.js??ref--0-2!C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\src\\components\\common\\XKUpload.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\src\\components\\common\\XKUpload.vue","mtime":1663828782924},{"path":"C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\babel.config.js","mtime":1663828782900},{"path":"C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000},{"path":"C:\\Users\\100zone\\Desktop\\baizong\\community\\SmartCommunity\\videoSurveillance\\node_modules\\style-vw-loader\\index.js","mtime":1540864632000}],"contextDependencies":[],"result":["import \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.number.constructor\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport envConfig from '@/config';\nvar fileMatch = {\n excel: {\n label: \"Excel表格\",\n reg: /\\.(xls|xlsx|xlsm)$/,\n tip: \"导入文件只支持.xls、.xlsx或.xlsm格式的Excel\"\n },\n image: {\n label: \"图片\",\n reg: /\\.(png|gif|jpg|jpeg|PNG|GIF|JPG)$/,\n tip: \"导入文件只支持.png、.gif、.jpg或.jpeg格式的图片\"\n }\n};\nexport default {\n name: \"xk-upload\",\n props: {\n actionUrl: {\n type: String,\n default: function _default() {\n return \"/sc-community/excel/import/excel\";\n }\n },\n params: {\n type: Object,\n default: function _default() {\n return {};\n }\n },\n fileType: {\n type: String,\n default: function _default() {\n return \"excel\";\n }\n },\n limitSize: {\n type: Number,\n // 单位M\n default: function _default() {\n return 0;\n }\n }\n },\n methods: {\n beforeUpload: function beforeUpload(file) {\n var currentSize = this.limitSize || envConfig.upload[\"\".concat(this.fileType, \"Size\")] || 5;\n var currentType = fileMatch[this.fileType];\n var isMatchType = currentType.reg.test(file.name);\n var isMatchSize = file.size / 1024 / 1024 < currentSize;\n\n if (!isMatchType) {\n this.$message.error(currentType.tip);\n return false;\n }\n\n if (!isMatchSize) {\n this.$message.error(\"\\u4E0A\\u4F20\".concat(currentType.label, \"\\u5927\\u5C0F\\u4E0D\\u80FD\\u8D85\\u8FC7\").concat(currentSize, \"Mb!\"));\n return false;\n }\n\n return isMatchType && isMatchSize;\n },\n formUpload: function formUpload(content) {\n var _this = this;\n\n if (!this.actionUrl) {\n return;\n }\n\n var formData = new FormData();\n formData.append(\"file\", content.file);\n\n _.each(_.keys(this.params), function (v) {\n formData.append(v, _this.params[v]);\n });\n\n var loading = this.$loading();\n this.$http.post(this.actionUrl, formData).then(function (_ref) {\n var status = _ref.status,\n msg = _ref.msg;\n loading.close();\n\n if (status === 0) {\n _this.$message.success(_this.fileType == \"excel\" ? \"上传成功,请稍后在消息查看上传结果\" : msg);\n\n setTimeout(function () {\n _this.$store.dispatch(\"getMessageCount\");\n\n _this.$emit(\"callback\");\n }, 1500);\n } else {\n _this.$message.error(msg);\n }\n }).catch(function () {\n loading.close();\n });\n }\n }\n};",{"version":3,"mappings":";;;;;;;;;;;;;;;AAaA;AACA;AACAA;AACAC,oBADA;AAEAC,6BAFA;AAGAC;AAHA,GADA;AAMAC;AACAH,eADA;AAEAC,4CAFA;AAGAC;AAHA;AANA;AAYA;AACAE,mBADA;AAEAC;AACAC;AACAC,kBADA;AAEAC,aAFA,sBAEA;AACA;AACA;AAJA,KADA;AAOAC;AACAF,kBADA;AAEAC,aAFA,sBAEA;AACA;AACA;AAJA,KAPA;AAaAE;AACAH,kBADA;AAEAC,aAFA,sBAEA;AACA;AACA;AAJA,KAbA;AAmBAG;AACAJ,kBADA;AACA;AACAC,aAFA,sBAEA;AACA;AACA;AAJA;AAnBA,GAFA;AA4BAI;AACAC,gBADA,wBACAC,IADA,EACA;AACA,wBACA,yEADA;AAEA;AACA;AACA;;AACA;AACA;AACA;AACA;;AACA;AACA,kDACAC,iBADA,iDACAC,WADA;AAGA;AACA;;AACA;AACA,KAlBA;AAmBAC,cAnBA,sBAmBAC,OAnBA,EAmBA;AAAA;;AACA;AACA;AACA;;AACA;AACAC;;AACAC;AACAD;AACA,OAFA;;AAGA;AACA,iBACAE,IADA,CACA,cADA,EACAF,QADA,EAEAG,IAFA,CAEA;AAAA;AAAA;AACAC;;AACA;AACA,iCACA,4BACA,mBADA,GAEAC,GAHA;;AAKAC;AACA;;AACA;AACA,WAHA,EAGA,IAHA;AAIA,SAVA,MAUA;AACA;AACA;AACA,OAjBA,EAkBAC,KAlBA,CAkBA;AACAH;AACA,OApBA;AAqBA;AAlDA;AA5BA","names":["excel","label","reg","tip","image","name","props","actionUrl","type","default","params","fileType","limitSize","methods","beforeUpload","file","currentType","currentSize","formUpload","content","formData","_","post","then","loading","msg","setTimeout","catch"],"sourceRoot":"src/components/common","sources":["XKUpload.vue"],"sourcesContent":["<template>\r\n <el-upload\r\n class=\"uploader\"\r\n action\r\n :http-request=\"formUpload\"\r\n :show-file-list=\"false\"\r\n :before-upload=\"beforeUpload\"\r\n >\r\n <slot name=\"content\"></slot>\r\n </el-upload>\r\n</template>\r\n\r\n<script>\r\nimport envConfig from '@/config';\r\nconst fileMatch = {\r\n excel: {\r\n label: \"Excel表格\",\r\n reg: /\\.(xls|xlsx|xlsm)$/,\r\n tip: \"导入文件只支持.xls、.xlsx或.xlsm格式的Excel\"\r\n },\r\n image: {\r\n label: \"图片\",\r\n reg: /\\.(png|gif|jpg|jpeg|PNG|GIF|JPG)$/,\r\n tip: \"导入文件只支持.png、.gif、.jpg或.jpeg格式的图片\"\r\n }\r\n};\r\nexport default {\r\n name: \"xk-upload\",\r\n props: {\r\n actionUrl: {\r\n type: String,\r\n default() {\r\n return \"/sc-community/excel/import/excel\";\r\n }\r\n },\r\n params: {\r\n type: Object,\r\n default() {\r\n return {};\r\n }\r\n },\r\n fileType: {\r\n type: String,\r\n default() {\r\n return \"excel\";\r\n }\r\n },\r\n limitSize: {\r\n type: Number, // 单位M\r\n default() {\r\n return 0;\r\n }\r\n }\r\n },\r\n methods: {\r\n beforeUpload(file) {\r\n let currentSize =\r\n this.limitSize || envConfig.upload[`${this.fileType}Size`] || 5;\r\n let currentType = fileMatch[this.fileType];\r\n const isMatchType = currentType.reg.test(file.name);\r\n const isMatchSize = file.size / 1024 / 1024 < currentSize;\r\n if (!isMatchType) {\r\n this.$message.error(currentType.tip);\r\n return false;\r\n }\r\n if (!isMatchSize) {\r\n this.$message.error(\r\n `上传${currentType.label}大小不能超过${currentSize}Mb!`\r\n );\r\n return false;\r\n }\r\n return isMatchType && isMatchSize;\r\n },\r\n formUpload(content) {\r\n if (!this.actionUrl) {\r\n return;\r\n }\r\n let formData = new FormData();\r\n formData.append(\"file\", content.file);\r\n _.each(_.keys(this.params), v => {\r\n formData.append(v, this.params[v]);\r\n });\r\n let loading = this.$loading();\r\n this.$http\r\n .post(this.actionUrl, formData)\r\n .then(({ status, msg }) => {\r\n loading.close();\r\n if (status === 0) {\r\n this.$message.success(\r\n this.fileType == \"excel\"\r\n ? \"上传成功,请稍后在消息查看上传结果\"\r\n : msg\r\n );\r\n setTimeout(() => {\r\n this.$store.dispatch(\"getMessageCount\");\r\n this.$emit(\"callback\");\r\n }, 1500);\r\n } else {\r\n this.$message.error(msg);\r\n }\r\n })\r\n .catch(() => {\r\n loading.close();\r\n });\r\n }\r\n }\r\n};\r\n</script>\r\n\r\n<style></style>\r\n"]}]}
|