{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\bizComponents\\common\\fileUploadFlow.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\bizComponents\\common\\fileUploadFlow.vue","mtime":1675071991194},{"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":["import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.number.constructor\";\nimport \"core-js/modules/es6.number.parse-int\";\nimport \"core-js/modules/es6.regexp.split\";\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//\n//\n//\nimport { mapState } from \"vuex\";\nimport req from \"@/request.js\";\nimport utils from \"@/components/bizComponents/utils.js\";\nimport FilePreview from \"@/components/bizComponents/common/FilePreview.vue\";\nimport { Loading } from \"element-ui\";\nexport default {\n  props: [\"fileVal\", \"multiples\", \"accept\", \"limit\", \"conf\", \"isSimple\"],\n  components: {\n    FilePreview: FilePreview\n  },\n  data: function data() {\n    return {\n      src: \"\",\n      files: [],\n      fileId: \"\",\n      fileTree: \"\",\n      isChecking: true,\n      num: 0,\n      list: [],\n      filesData: [],\n      maxWidth: \"100%\"\n    };\n  },\n  computed: mapState({\n    header: function header(state) {\n      return {\n        Authorization: \"Bearer \".concat(state.login.currentUser.token)\n      };\n    },\n    intLimit: function intLimit() {\n      if (!this.multiples) return 1;\n      return this.limit ? parseInt(this.limit) : 5;\n    },\n    actionUrl: function actionUrl() {\n      return window.context.portal + \"/system/file/v1/upload\";\n    },\n    acceptType: function acceptType() {\n      if (!this.accept) {\n        return \"\";\n      }\n\n      var acceptTypeArr = [];\n\n      for (var i = 0, type; type = this.accept.split(\",\")[i++];) {\n        acceptTypeArr.push(\".\" + type);\n      }\n\n      return acceptTypeArr.join(\",\");\n    }\n  }),\n  watch: {\n    files: {\n      handler: function handler(newVal, oldVal) {\n        this.$emit(\"input\", JSON.stringify(newVal));\n      },\n      deep: true\n    }\n  },\n  methods: {\n    //附件下载\n    download: function download(file) {\n      this.$store.dispatch(\"menu/downloadFile\", file.id);\n    },\n    //上移按钮\n    up: function up(idx) {\n      idx = Number.parseInt(idx);\n\n      if (idx < 1) {\n        return;\n      } //table数据改变\n\n\n      var t = this.filesData[idx - 1];\n      this.$set(this.filesData, idx - 1, this.filesData[idx]);\n      this.$set(this.filesData, idx, t); //boData数据也跟着改变\n\n      var t = this.files[idx - 1];\n      this.$set(this.files, idx - 1, this.files[idx]);\n      this.$set(this.files, idx, t);\n      this.$emit(\"input\", JSON.stringify(this.files));\n    },\n    //下移按钮\n    down: function down(idx) {\n      idx = Number.parseInt(idx);\n\n      if (idx >= this.filesData.length - 1) {\n        return;\n      } //table数据改变\n\n\n      var t = this.filesData[idx + 1];\n      this.$set(this.filesData, idx + 1, this.filesData[idx]);\n      this.$set(this.filesData, idx, t); //boData数据也跟着改变\n\n      var t = this.files[idx + 1];\n      this.$set(this.files, idx + 1, this.files[idx]);\n      this.$set(this.files, idx, t);\n      this.$emit(\"input\", JSON.stringify(this.files));\n    },\n    preview: function preview(files) {\n      var obj = {};\n      obj.id = files.id;\n      obj.name = files.name;\n      obj.size = files.size;\n      this.$refs.filePreview.preview(obj);\n    },\n    beforeRemove: function beforeRemove(file) {\n      var _this = this;\n\n      if (this.isChecking) {\n        return this.$confirm(\"\\u786E\\u5B9A\\u79FB\\u9664 \".concat(file.name, \"\\uFF1F\")).then(function () {\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            }\n          }\n\n          if (JSON.stringify(_this.files) == \"[]\") {\n            _this.filesData = [];\n\n            _this.$emit(\"input\", \"\");\n          } else {\n            _this.filesData = [];\n\n            for (var _i = 0; _i < _this.files.length; _i++) {\n              _this.filesData.push({\n                id: _this.files[_i].id,\n                name: _this.files[_i].name,\n                size: _this.files[_i].size,\n                type: utils.substringType(_this.files[_i].name, \".\"),\n                bytes: utils.bigDecimal(_this.files[_i].size),\n                username: _this.files[_i].username\n              });\n            }\n\n            _this.$emit(\"input\", JSON.stringify(_this.files));\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        }\n\n        if (JSON.stringify(this.files) == \"[]\") {\n          this.filesData = [];\n          this.$emit(\"input\", \"\");\n        } else {\n          this.filesData = [];\n\n          for (var _i2 = 0; _i2 < this.files.length; _i2++) {\n            this.filesData.push({\n              id: this.files[_i2].id,\n              name: this.files[_i2].name,\n              size: this.files[_i2].size,\n              type: utils.substringType(this.files[_i2].name, \".\"),\n              bytes: utils.bigDecimal(this.files[_i2].size),\n              username: this.files[_i2].username\n            });\n          }\n\n          this.$emit(\"input\", JSON.stringify(this.files));\n        }\n      }\n    },\n    //文件上传时\n    progress: function progress(event, file, fileList) {\n      Loading.service(\"文件上传中\");\n    },\n    //文件上传成功时\n    success: function success(response, file, fileList) {\n      var loadingInstance = Loading.service(\"文件上传中\");\n      this.$nextTick(function () {\n        // 以服务的方式调用的 Loading 需要异步关闭\n        loadingInstance.close();\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 _i3 = 0; _i3 < fileList.length; _i3++) {\n            if (this.list[j].name == fileList[_i3].name) {\n              fileList.splice(_i3, 1);\n              break;\n            }\n          }\n        }\n      }\n\n      if (this.num == fileList.length) {\n        for (var _i4 = 0; _i4 < fileList.length; _i4++) {\n          if (fileList[_i4].response) {\n            var value = JSON.parse(fileList[_i4].response.value);\n            var arrarFile = {};\n            arrarFile.id = value.fileId;\n            arrarFile.name = value.fileName;\n            arrarFile.size = value.size;\n            arrarFile.username = JSON.parse(sessionStorage.getItem(\"currentUser\")).username;\n            this.files.push(arrarFile);\n          }\n        }\n\n        this.filesData = [];\n\n        for (var _i5 = 0; _i5 < this.files.length; _i5++) {\n          this.filesData.push({\n            id: this.files[_i5].id,\n            name: this.files[_i5].name,\n            size: this.files[_i5].size,\n            type: utils.substringType(this.files[_i5].name, \".\"),\n            bytes: utils.bigDecimal(this.files[_i5].size),\n            username: this.files[_i5].username\n          });\n        }\n\n        this.$emit(\"input\", JSON.stringify(this.files));\n      }\n    },\n    // handleChange(file, fileList) {\n    //   debugger\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    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  },\n  // mounted() {\n  //   let _this = this;\n  //   debugger\n  //   //监听表单提交事件，如果附件上传配置了扩展属性则进行更新\n  //   if (this.conf && this.conf.length>0) {\n  //     this.$root.$on('bpmFormSubmit', function(value) {\n  //       debugger\n  //       _this.$store.dispatch(\"menu/updateFileExtraProp\",_this.files);\n  //     });\n  //   }\n  // },\n  created: function created() {\n    var _this2 = this;\n\n    this.$nextTick(function () {\n      this.maxWidth = this.$el.offsetWidth;\n    });\n    setTimeout(function () {\n      if (_this2.fileVal) {\n        var value = JSON.parse(_this2.fileVal);\n\n        for (var i = 0; i < value.length; i++) {\n          _this2.files.push(value[i]);\n        }\n\n        for (var _i6 = 0; _i6 < value.length; _i6++) {\n          _this2.filesData.push({\n            id: _this2.files[_i6].id,\n            name: _this2.files[_i6].name,\n            size: _this2.files[_i6].size,\n            type: utils.substringType(_this2.files[_i6].name, \".\"),\n            bytes: utils.bigDecimal(_this2.files[_i6].size),\n            username: _this2.files[_i6].username\n          });\n        }\n      }\n    }, 100);\n    this.$validator = this.$root.$validator;\n  }\n};",null]}