{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\common\\ImgFileUpload.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\common\\ImgFileUpload.vue","mtime":1675071991694},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\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\r\nimport { mapState } from \"vuex\";\r\nimport req from \"@/request.js\";\r\nimport { Base64 } from \"js-base64\";\r\nexport default {\r\n  components: {},\r\n props: [\"fileJson\"],\r\n  data() {\r\n    return {\r\n      src: \"\",\r\n      fileId: \"\",\r\n      fileTree: \"\",\r\n      iframeSrc: \"\",\r\n      files: [],\r\n      uploadingFiles: {},\r\n      list: [],\r\n      isChecking: true,\r\n      accept: \".jpg,.jpeg,.png,.JPG,.JPEG,.gif,.PNG,.GIF\",\r\n      num: 0\r\n    };\r\n  },\r\n  watch: {\r\n    fileJson: {\r\n      handler: function(val, oldVal) {\r\n        if(val){\r\n          this.files = JSON.parse(val);\r\n        }\r\n      }\r\n    }\r\n  },\r\n  computed: mapState({\r\n    header: state => {\r\n      return { Authorization: `Bearer ${state.login.currentUser.token}` };\r\n    },\r\n    actionUrl: function() {\r\n      return window.context.portal + \"/file/v1/upload\";\r\n    }\r\n  }),\r\n  mounted() {\r\n    if (this.$attrs.value) {\r\n      this.files = JSON.parse(this.$attrs.value);\r\n    }\r\n  },\r\n  methods: {\r\n    exceed(file, fileList) {\r\n      if (fileList.length == 1 || file.length > 1) {\r\n        this.$message.warning(\"只能上传一个文件\");\r\n      }\r\n    },\r\n    preview(files) {\r\n      var id = files.id;\r\n      alert(id);\r\n    },\r\n    beforeRemove(file, fileList) {\r\n      if (this.isChecking) {\r\n        return this.$confirm(`确定移除 ${file.name}？`).then(() => {\r\n          this.$emit(\"input\", \"\");\r\n        });\r\n      }\r\n    },\r\n    error(response, file, fileList) {\r\n      delete this.uploadingFiles[Base64.encode(file.name)];\r\n    },\r\n    success(response, file, fileList) {\r\n      this.$emit(\r\n        \"input\",\r\n        JSON.stringify([{ id: response.fileId, name: response.fileName }])\r\n      );\r\n    },\r\n    getFiles() {\r\n      if (this.files.length == 0) {\r\n        return \"\";\r\n      } else {\r\n        return this.files;\r\n      }\r\n    },\r\n    isFinishUpload() {\r\n      if (JSON.stringify(this.uploadingFiles) != \"{}\") {\r\n        this.$message.warning(\"正在上传附件，请稍后！\");\r\n        throw \"正在上传附件，请稍后！\";\r\n      }\r\n    },\r\n    beforeAvatarUpload(file) {\r\n      // 文件类型限制\r\n      const name = file.name ? file.name : \"\";\r\n      const ext = name\r\n        ? name.substr(name.lastIndexOf(\".\") + 1, name.length)\r\n        : true;\r\n      const isExt = this.accept.indexOf(ext) < 0;\r\n      this.isChecking = !isExt;\r\n      if (isExt) {\r\n        if (this.accept == \"false\") {\r\n          this.$message.error(\"请配置可上传文件的格式!\");\r\n        } else {\r\n          this.$message.error(\"上传的附件只能是 \" + this.accept + \"格式!\");\r\n        }\r\n        return !isExt;\r\n      }\r\n      this.uploadingFiles[Base64.encode(name)] = \"eror\";\r\n    }\r\n  }\r\n};\r\n",null]}