{"remainingRequest":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\bzzgj-fvue\\src\\views\\Manage\\components\\ZUpload.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\src\\views\\Manage\\components\\ZUpload.vue","mtime":1667545182708},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\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//\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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\n\r\nimport qs from 'qs'\r\nimport { mapState } from 'vuex'\r\nimport CommonApi from '@/views/Manage/CommonApi.js'\r\n\r\nexport default {\r\n name: 'UploadFile',\r\n props: {\r\n value: {\r\n type: [String, Number, Object],\r\n default: null\r\n },\r\n formItem: {\r\n type: Boolean,\r\n default: false\r\n },\r\n placeholder: {\r\n type: String,\r\n default: '点击上传'\r\n },\r\n handleClass: {\r\n type: String,\r\n default: null\r\n },\r\n subPath: {\r\n type: String,\r\n default: 'temp'\r\n },\r\n btnLabel: {\r\n type: String,\r\n required: false,\r\n default: '上传'\r\n },\r\n winTitle: {\r\n type: String,\r\n default: '文件上传'\r\n },\r\n btnIcon: {\r\n type: String,\r\n default: 'el-icon-upload'\r\n },\r\n fileMaxSize: {\r\n type: Number,\r\n default: 100\r\n },\r\n fileTemplate: {\r\n type: [String, Array],\r\n default: null\r\n },\r\n action: {\r\n type: String,\r\n default: window.context.portal + '/manager/common/upload/excel'\r\n }\r\n },\r\n data() {\r\n return {\r\n loading: false,\r\n vloading: false,\r\n winStatus: false,\r\n form: { id: null, code: null, name: null, remark: null, parentId: null, sort: null },\r\n upladUrlParam: ''\r\n }\r\n },\r\n\r\n computed: mapState({\r\n header: state => {\r\n return {\r\n Authorization: `Bearer ${state.login.currentUser.token}`\r\n }\r\n }\r\n }),\r\n\r\n mounted() {\r\n const param = { subpath: this.subPath }\r\n if (this.handleClass) {\r\n param.handle = this.handleClass\r\n }\r\n if (this.value && this.value instanceof Object) {\r\n for (const k in this.value) {\r\n param[k] = this.value[k]\r\n }\r\n }\r\n\r\n this.upladUrlParam = '&' + qs.stringify(param, { indices: false })\r\n },\r\n\r\n methods: {\r\n updateVal: function(val) {\r\n this.$emit('input', val)\r\n },\r\n cancelCU() {\r\n this.winStatus = false\r\n },\r\n toUpload() {\r\n this.form.name = ''\r\n this.winStatus = true\r\n },\r\n // 上传文件\r\n upload() {\r\n this.$refs.upload.submit()\r\n },\r\n handleOnChange(file, fileList) {\r\n if (!this.form.name || this.form.name === '') {\r\n this.form.name = file.name\r\n }\r\n },\r\n handleOnremove(file) {\r\n this.form.name = ''\r\n },\r\n beforeUpload(file) {\r\n let isLt2M = true\r\n // console.log(file)\r\n isLt2M = file.size / 1024 / 1024 < this.fileMaxSize\r\n if (!isLt2M) {\r\n this.loading = false\r\n this.vloading = false\r\n this.$message.error('上传文件大小不能超过 ' + this.fileMaxSize + 'MB!')\r\n return false\r\n }\r\n this.$emit('before-upload', file)\r\n this.vloading = true\r\n this.loading = true\r\n return isLt2M\r\n },\r\n handleSuccess(response, file, fileList) {\r\n // this.crud.notify('上传成功', CRUD.NOTIFICATION_TYPE.SUCCESS)\r\n this.$refs.upload.clearFiles()\r\n this.winStatus = false\r\n this.loading = false\r\n this.$emit('after-upload', response, file, fileList)\r\n this.updateVal('/' + this.subPath + '/' + response.type + '/' + response.realName)\r\n this.vloading = false\r\n },\r\n // 监听上传失败\r\n handleError(e, file, fileList) {\r\n this.loading = false\r\n this.vloading = false\r\n const msg = JSON.parse(e.message)\r\n this.$notify({\r\n title: msg.message,\r\n type: 'error',\r\n duration: 3500\r\n })\r\n this.$refs.upload.clearFiles()\r\n this.winStatus = false\r\n }\r\n }\r\n}\r\n",null]}