{"remainingRequest":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/o_file_upload.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/o_file_upload.vue","mtime":1732857533163},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["\nimport Constant from \"@/Constant.js\";\nimport API from \"@/api.js\";\nimport form_operation from \"@/components/form_operation_log\";\nimport controlHidden from \"@/assets/js/controlHidden.js\";\nexport default {\n name: \"o-file-upload\",\n props: [\"id\"],\n inject: [\"refresh\"],\n components: {\n form_operation,\n },\n computed: {\n field: function () {\n let formData = this.$parent.findField(this.id);\n if (formData.value && typeof formData.value == \"string\") {\n formData.value = JSON.parse(formData.value);\n }\n if (formData.value && formData.value instanceof Array) {\n if (formData.value.length == 0) {\n formData.value = \"\";\n } else {\n formData.value = formData.value;\n }\n formData.value = formData.value;\n } else {\n formData.value = \"\";\n }\n\n formData.picUrl = obpmConfig.obpmFilePath;\n return this.$parent.findField(this.id);\n },\n },\n data: function () {\n return {\n isActiveError: false,\n errorMessage: \"\",\n marks: 0,\n marksValue: \"0%\",\n Constant,\n fileList: [],\n fileType: \"\",\n showLogsDialog: false,\n showLogsIcon: true,\n isShow: false,\n isActive: -1,\n operationData: \"\",\n fileArray: [],\n allfileArray: [],\n newFileName: \"\", // 新的文件名字\n fileSuffix: \"\", // 文件名后缀\n dialogVisible: false,\n dialogImageUrl: \"\",\n dialogHeight: \"\",\n imgDetails: {\n scaleNum: 1,\n zoom: \"\",\n },\n };\n },\n mounted() {\n this.$nextTick(() => {\n //使用nextTick为了保证dom元素都已经渲染完毕\n let field = this.field;\n if (field.isHideType) {\n let id = this.id,\n formShowType = field.formShowType;\n controlHidden({ id, field, formShowType });\n }\n\n if (field.fileh) {\n document\n .getElementById(this.field.id)\n .getElementsByClassName(\"el-upload\")[0].style.width =\n parseInt(this.field.filew) + \"px\";\n document\n .getElementById(this.field.id)\n .getElementsByClassName(\"el-upload\")[0].style.height =\n parseInt(this.field.fileh) + \"px\";\n document\n .getElementById(this.field.id)\n .getElementsByClassName(\"el-upload\")[0].style.lineHeight =\n parseInt(this.field.fileh) + \"px\";\n // document.getElementById(this.field.id).getElementsByClassName(\"el-upload-list__item\")[0].style.width = parseInt(this.field.imgw) +\"px\";\n // document.getElementById(this.field.id).getElementsByClassName(\"el-upload-list__item\")[0].style.height = parseInt(this.field.imgh) +\"px\";\n }\n });\n },\n methods: {\n // 缩放图片\n rollImg() {\n /* 获取当前页面的缩放比 若未设置zoom缩放比,则为默认100%,即1,原图大小 */\n let zoom = parseInt(this.zoom) || 100;\n /* event.wheelDelta 获取滚轮滚动值并将滚动值叠加给缩放比zoom wheelDelta统一为±120,其中正数表示为向上滚动,负数表示向下滚动 */\n zoom += event.wheelDelta / 12;\n /* 最小范围 和 最大范围 的图片缩放尺度 */\n if (zoom >= 5 && zoom < 500) {\n this.imgDetails.zoom = zoom + \"%\";\n let zoomNum = zoom / 100;\n this.imgDetails.scaleNum = zoomNum;\n }\n return false;\n },\n\n setClass(item) {\n let obj = \"\";\n if (item.fileType) {\n obj = item.fileType.substr(1);\n } else {\n obj = item.name.split(\".\")[1];\n }\n return obj;\n },\n\n hiddenLogsDialog() {\n this.showLogsIcon = false;\n this.showLogsDialog = false;\n },\n\n listUp(index) {\n if (index == 0) {\n console.log(\"最顶部-->\");\n } else {\n let arr = this.field.value;\n arr[index] = arr.splice(index - 1, 1, arr[index])[0];\n this.field.value = arr;\n }\n },\n\n listDown(index) {\n if (index == this.field.value.length - 1) {\n console.log(\"最底部-->\");\n } else {\n let arr = this.field.value;\n arr[index] = arr.splice(index + 1, 1, arr[index])[0];\n this.field.value = arr;\n }\n },\n\n enter() {\n if (this.field.isModified) {\n this.showLogsIcon = true;\n }\n },\n\n getOperationLogs() {\n let obj = {};\n obj.fieldName = this.field.name;\n this.operationData = obj;\n this.showLogsDialog = true;\n\t\t},\n\t\n\t\tuploadImg(e){\n\t\t\tconsole.log(e.file)\n\t\t\t//obs文件上传start\n if(__network__){\n this.obsFile(e)//obs文件上传\n\t\t\t return\n\t\t }\n\t\t\t//obs文件上传end\n\t\t\tlet ob = {};\n\t\t\tob.uid = e.file.uid;\n\t\t\tob.name = e.file.name\n\t\t\tob.marks = 0;\n\t\t\tob.marksValue = '0%';\n\t\t\tthis.allfileArray.push(ob);\n\t\t\t\n\t\t\tlet fileArray = e.file;\n\t\t\tlet file = fileArray;\n\t\t\tlet that = this;\n\t\t\tlet form = new FormData();\n\t\t\tform.append(\"files\", file);\n\t\t\t\n\t\t\tform.forEach(function (value, key) {\n\t\t\t\tif (value instanceof File) {\n\t\t\t\t\tform.set(key, value, value.name.replace(/ /g, ''))//去掉文件名称所有空格\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tlet files = form;\n\t\t\tlet actionType = this.fileType;\n\t\t\tlet appId = this.$root.appid;\n\t\t\tlet allowedTypes = this.field.fileType;\n\t\t\tlet fieldId = this.id;\n\t\t\tlet fileSaveMode = this.field.fileSaveMode;\n\t\t\tlet path = this.field.path;\n\t\t\tthis.$api.uploadFile(\n\t\t\t\tfiles, \n\t\t\t\tappId, \n\t\t\t\tallowedTypes, \n\t\t\t\tfieldId, \n\t\t\t\tfileSaveMode, \n\t\t\t\tpath, \n\t\t\t\tactionType,\n\t\t\t\t{\n\t\t\t\t\tonSucess: response => {\n\t\t\t\t\t\tfor(let i=0; i{\n\t\t\t\t\tfor(let i=0; i\",res)\n\t\t\t\t\t// this.marks = res.num;\n\t\t\t\t\t// this.marksValue = res.complete;\n\t\t\t\t},\n\t\t\t\te.file.uid,\n\t\t\t)\n\t\t},\n\n\t\thandlePreview(file) {\n\t\t\tif(file.path.indexOf(\"http\")>-1){//obs路径\n\t\t\t\twindow.open(file.path)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet field = this.field\n\t\t\tlet isImg = false\n\t\t\tlet isVideo = false\n\t\t\tif(file.name) {\n\t\t\t\tlet name = file.name.split('.')[file.name.split('.').length - 1];\n\t\t\t\tname = name.toLowerCase();\t\t\n\t\t\t\tif(name == 'png' ||name == 'jpg' ||name == 'jpeg' || name == 'gif' ) {\n\t\t\t\t isImg = true;\n\t\t\t\t}else if(name == 'mp3' || name == 'mp4' ) {\n\t\t\t\t\tisVideo = true\n\t\t\t\t}else if(name=='rar'||name=='zip'){//压缩包直接下载\n\t\t\t\t if(file.path.indexOf('/obpm')>-1){\n\t\t\t\t\t\tfile.path+=file.path.indexOf('?')>-1?'&':'?'\n\t\t\t\t\t\twindow.open(file.path+'v='+new Date().getTime())\n\t\t\t\t\t\treturn\n\t\t\t\t\t}else{\t\t\t\t\t\t\n\t\t\t\t\t\tfile.path+=file.path.indexOf('?')>-1?'&':'?'\n\t\t\t\t\t\twindow.open('/obpm'+file.path+'v='+new Date().getTime())\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t }\n\t\t\tif(isImg) {\n\t\t\t\tfile.path+=file.path.indexOf('?')>-1?'&':'?'\n\t\t\t\tthis.dialogImageUrl = obpmConfig.obpmFilePath + \"/\" + file.path+'v='+new Date().getTime()\n\t\t\t\tthis.dialogVisible = true\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif(isVideo) {\n\t\t\t\tfile.path+=file.path.indexOf('?')>-1?'&':'?'\n\t\t\t\tlet url = window.location.origin + obpmConfig.obpmFilePath + file.path+'v='+new Date().getTime()\n\t\t\t\twindow.open(url)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet realName = file.path.split(\"/\")[file.path.split(\"/\").length - 1];\n\t\t\tthis.$api.getHasPdfFile(file.path, realName,\n\t\t\t\t{\n\t\t\t\t\tonSucess: res => {\n\t\t\t\t\t\tif(res.data.data){\n\t\t\t\t\t\t\tthis.$api.getenvironment(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tonSucess: res => {\n\t\t\t\t\t\t\t\t\t\tif(res.data.errcode === 0) {\n\t\t\t\t\t\t\t\t\t\t\tif(res.data.data === true) {\n\t\t\t\t\t\t\t\t\t\t\t\tlet isEdit = field.previewEdit?'edit':'';\n\t\t\t\t\t\t\t\t\t\t\t\tlet waterMark = field.watermark;\n\t\t\t\t\t\t\t\t\t\t\t\tlet openWaterMark = field.openWaterMark;\n\t\t\t\t\t\t\t\t\t\t\t\tlet curEditUserId = this.$store.state.myProfile.id;\n\t\t\t\t\t\t\t\t\t\t\t\tlet userName = this.$store.state.myProfile.name;\n\t\t\t\t\t\t\t\t\t\t\t\tlet showTrackRevisions = field.showTrackRevisions;\n\t\t\t\t\t\t\t\t\t\t\t\tlet selectEditPlug = field.selectEditPlug;\n\t\t\t\t\t\t\t\t\t\t\t\tlet cp = obpmConfig.obpmFilePath;\n\t\t\t\t\t\t\t\t\t\t\t\tsessionStorage.setItem(\"obpmContextPath\", cp);\n\t\t\t\t\t\t\t\t\t\t\t\tlet statiContextPath = obpmConfig.statiContextPath;\n\t\t\t\t\t\t\t\t\t\t\t\tlet pdfPath = \"\";\n\t\t\t\t\t\t\t\t\t\t\t\tif(statiContextPath) { //5.0 trunk\n\t\t\t\t\t\t\t\t\t\t\t\t\tsessionStorage.setItem(\"isTrunk\", true);\n\t\t\t\t\t\t\t\t\t\t\t\t\tpdfPath = obpmConfig.statiContextPath;\n\t\t\t\t\t\t\t\t\t\t\t\t}else { //4.4 stable\n\t\t\t\t\t\t\t\t\t\t\t\t\tsessionStorage.setItem(\"isTrunk\", false);\n\t\t\t\t\t\t\t\t\t\t\t\t\tpdfPath = cp;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tlet url = pdfPath + '/portal/vue/pdf/pdfviewer.html?action=' + isEdit + \n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&path=\" + file.path + \n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&name=\" + realName + \n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&showName=\" + file.name + \n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&waterMark=\" + waterMark + \n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&openWaterMark=\" + openWaterMark +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&curEditUserId=\" + curEditUserId +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&userName=\" + userName + \n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&showTrackRevisions=\" + showTrackRevisions +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"&selectEditPlug=\" + selectEditPlug;\n\t\t\t\t\t\t\t\t\t\t\t\t\tlet URL = encodeURI(url)\n\t\t\t\t\t\t\t\t\t\t\t\t\twindow.open(URL);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tthis.$message({\n\t\t\t\t\t\t\t\tmessage: this.$t('view.trandformAndWait'),\n\t\t\t\t\t\t\t\ttype: 'warning'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t)\n\n\t\t},\n\t\t\n\t\tdownload(file){ \t\t\t\n\t\t\tif(file.path.indexOf(\"http\")>-1){//obs路径\n\t\t\t\twindow.open(file.path)\n\t\t\t\treturn\n\t\t\t}\t\n\t\t\tif(file.name) {\n\t\t\t\tlet name = file.name.split('.')[file.name.split('.').length - 1];\n\t\t\t\tname = name.toLowerCase();\t\t\n\t\t\t\tif(name == 'mp3' || name == 'mp4'|| name=='rar'|| name=='zip'){//压缩包直接下载\n\t\t\t\t if(file.path.indexOf('/obpm')>-1){\n\t\t\t\t\t\tfile.path+=file.path.indexOf('?')>-1?'&':'?'\n\t\t\t\t\t\twindow.open(file.path+'v='+new Date().getTime())\n\t\t\t\t\t\treturn\n\t\t\t\t\t}else{\n\t\t\t\t\t\tfile.path+=file.path.indexOf('?')>-1?'&':'?'\n\t\t\t\t\t\twindow.open('/obpm'+file.path+'v='+new Date().getTime())\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t }\n\t\t\tif(this.field.watermark) {\n\t\t\t\tthis.$api.downloadWaterMarkFile(\n\t\t\t\t\tthis.field.watermark,\n\t\t\t\t\t'',\n\t\t\t\t\t'',\n\t\t\t\t\t{\n\t\t\t\t\t\tonSucess: res => {\n\t\t\t\t\t\t\tif(res.data.waterMarkStr) {\n\t\t\t\t\t\t\t\tlet url = encodeURI(\n\t\t\t\t\t\t\t\t\tobpmConfig.contextPath + \"/runtime/file/download?filename=\" + file.name + \n\t\t\t\t\t\t\t\t\t\"&filepath=\" + file.path + \n\t\t\t\t\t\t\t\t\t\"&watermarkStr=\" + res.data.waterMarkStr);\n window.open(url);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}else {\n\t\t\t\t// $t('report.download')\n\t\t\t\tlet link = document.createElement('a')\n\t\t\t\tlink.style.display = 'none'\n\t\t\t\tlet op = obpmConfig.obpmFilePath;\n\t\t\t\tlet statiContextPath = obpmConfig.statiContextPath;\n\t\t\t\tif(statiContextPath) { //5.0 trunk\n\t\t\t\t\top = op + \"/api\";\n\t\t\t\t}\n\t\t\t\tlink.href = op + \"/runtime/file/download?filename=\" + encodeURI(file.name) + \"&filepath=\" + file.path+'&v='+new Date().getTime();\n\t\t\t\tconsole.log(link.href)\n\t\t\t\tlink.setAttribute('download', file.name);\n\t\t\t\tlink.click();\n\t\t\t}\n\t\t},\n\n\t\thandleExceed(files, fileList) {\t//文件超出个数限制时的钩子\n\t\t\tif(this.field.limitNumber==\"1\"){//上传限制一张用覆盖的方式重新上传\n\t\t\t console.log(files[0])\n\t\t\t files[0].uid=new Date().getTime()\n\t\t\t this.field.value=[]\n\t\t\t let e={file:files[0]}\n\t\t\t this.uploadImg(e)\t\t\n\t\t\t}else{\n this.$message.warning(this.$t('view.out'));//文件上传超出数量限制。\n\t\t\t}\n\t\t},\n\t\t\n\t\tbeforeUpload(file) {\n\t\t\tlet field = this.field;\n\t\t\tif(field.customizeType) {\n\t\t\t\tlet testmsg = file.name.substring(file.name.lastIndexOf('.')+1);\n\t\t\t\tthis.fileType = file.type;\n\t\t\t\t// const extension = testmsg === field.customizeType;\n\t\t\t\tconst extension = field.customizeType.indexOf(testmsg) > -1;\n\t\t\t\tif(!extension) {\n\t\t\t\t\tthis.$message({\n\t\t\t\t\t\tmessage: this.$t('view.upload_only')+`${field.customizeType}`+this.$t('form.format'),\n\t\t\t\t\t\ttype: 'error'\n\t\t\t\t\t});\n\t\t\t\t\tthis.fileList = [];\n\t\t\t\t}\n\t\t\t\treturn extension ;\n\t\t\t}else {\n\t\t\t\tthis.fileType = file.type;\n\t\t\t}\n\t\t\tif(file.size/1024 > this.field.maxsize){\n\t\t\t\tthis.$message({\n\t\t\t\t\tmessage: this.$t('view.upload_over')+`${this.field.maxsize/1024}M!`,\n\t\t\t\t\ttype: 'error'\n\t\t\t\t});\n\t\t\t\tthis.fileList = [];\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\n\t\tbeforeRemove(file) {\n\t\t\t// if(this.field.customizeType != \"xmind\") {\n\t\t\t// \treturn this.$confirm(`确定移除 ${ file.name }?`).then(() => {});\n\t\t\t// }\n\t\t\tif(file && file.status==\"success\") {\n\t\t\t\treturn this.$confirm(this.$t('btns.comfirm_remove')+`${ file.name }?`).then(() => {});\n\t\t\t}\t\n\t\t},\n\n\t\topendialog(item,index) {\n\t\t\tthis.$confirm(this.$t('view.goon'), this.$t('tip'), {\n\t\t\t\tconfirmButtonText: this.$t('msg.confirm'),\n\t\t\t\tcancelButtonText: this.$t('btns.cancel'),\n\t\t\t\ttype: 'warning'\n\t\t\t}).then(() => {\n\t\t\t\tthis.$message({\n\t\t\t\t\ttype: 'success',\n\t\t\t\t\tmessage: this.$t('msg.es')\n\t\t\t\t});\n\t\t\t\tthis.handleRemove(item,index);\n\t\t\t}).catch(() => {\n\t\t\t\tthis.$message({\n\t\t\t\t\ttype: 'info',\n\t\t\t\t\tmessage: this.$t('msg.cancel_del')\n\t\t\t\t}); \n\t\t\t});\n\t\t},\n\n\t\t/**\n\t\t * $t('view.rename')文件的名称\n\t\t */\n\t\teditFileName(item){\n\t\t\tthis.field.value.forEach(item => item.isEdit = false)\n\t\t\titem.isEdit = true\n\t\t\tif(!item.fileType) {\n\t\t\t\tlet fileType;\n\t\t\t\tlet itemName;\n\t\t\t\titemName = item.name;\n\t\t\t\tfileType = itemName.substring(itemName.lastIndexOf(\".\"),itemName.length);\n\t\t\t\titem.fileType = fileType;\n\t\t\t}\n\t\t\tthis.fileSuffix = item.fileType\n\t\t\tthis.newFileName = this.cutSuffix(item.name)\n\t\t\tthis.$forceUpdate()\n\t\t},\n\n\t\t/**\n\t\t * 确认修改文件名\n\t\t */\n\t\tconfirm(item){\n\t\t\titem.name = this.newFileName + this.fileSuffix\n\t\t\titem.isEdit = false\n\t\t\tthis.$forceUpdate()\n\t\t},\n\n\t\t/**\n\t\t * 取消修改文件名\n\t\t */\n\t\tcancel(item){\n\t\t\titem.isEdit = false\n\t\t\tthis.$forceUpdate()\n },\n\n\t\t/**\n\t\t* 截取文件名后缀\n\t\t*/\n\t\tcutSuffix(name){\n return name.replace(this.fileSuffix, '')\n },\n\n handleRemove(file, fileList) {\n let appId = this.$root.appid;\n let formId = this.field.formId;\n let docId = this.field.docId;\n let path = file.path;\n let field = this.field;\n API.deleteUpload(appId, formId, docId, path, {\n onSucess: (res) => {\n\t\t\t\t\tif(res.data.errcode == 0) {\n\t\t\t\t\t\tlet arr = this.field.value;\n\t\t\t\t\t\tfor(let i=0; i {\n if(response.data.errcode == 4001) {\n if(response.data.errors && response.data.errors.length > 0) {\n let arr = response.data.errors;\n for(let i=0; i