{"remainingRequest":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/thread-loader/dist/cjs.js!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/babel-loader/lib/index.js!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/cache-loader/dist/cjs.js??ref--0-0!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/components/base/uploadFileV2.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/components/base/uploadFileV2.vue","mtime":1705486173098},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/babel.config.js","mtime":1701742078504},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/thread-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport { importInvoiceApi } from '@/api/finance';\nimport { getToken } from '@/utils/auth';\nexport default {\n  name: 'UploadFile',\n  data: function data() {\n    return {\n      myHeaders: {\n        'X-Token': getToken()\n      },\n      url: '',\n      fileType: '',\n      fileInfo: {}\n    };\n  },\n  beforeMount: function beforeMount() {\n    if (this.value) {\n      this.url = this.value;\n      this.getFileType(this.value);\n    }\n  },\n  methods: {\n    // 上传\n    handleUploadForm: function handleUploadForm(param) {\n      var _this = this;\n      var formData = new FormData();\n      var loading = this.$loading({\n        lock: true,\n        text: '上传中，请稍候...',\n        spinner: 'el-icon-loading',\n        background: 'rgba(0, 0, 0, 0.7)'\n      });\n      this.fileInfo = param.file;\n      formData.append('file', param.file);\n      importInvoiceApi(formData).then(function (res) {\n        _this.$emit('onSuccess', res);\n        loading.close();\n        _this.url = res.url;\n        _this.getFileType(res.url);\n        _this.$message.success('上传成功');\n      }).catch(function (res) {\n        loading.close();\n      });\n    },\n    getFileType: function getFileType(file) {\n      var first = file.lastIndexOf('.'); //取到文件名开始到最后一个点的长度\n      var namelength = file.length; //取到文件名长度\n      var filesuffix = file.substring(first + 1, namelength); //截取获得后缀名\n      this.fileType = filesuffix.toUpperCase();\n    },\n    clear: function clear() {\n      this.fileInfo = {};\n    }\n  }\n};",null]}