{"remainingRequest":"/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/thread-loader/dist/cjs.js!/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/babel-loader/lib/index.js!/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/cache-loader/dist/cjs.js??ref--0-0!/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/test-v5inweb-5.x-vue/src/components/o_file_upload.vue?vue&type=script&lang=js&","dependencies":[{"path":"/data/jenkins/workspace/test-v5inweb-5.x-vue/src/components/o_file_upload.vue","mtime":1739760944320},{"path":"/data/jenkins/workspace/test-v5inweb-5.x-vue/babel.config.js","mtime":1739760943855},{"path":"/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/thread-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/babel-loader/lib/index.js","mtime":315532800000},{"path":"/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/test-v5inweb-5.x-vue/node_modules/vue-loader/lib/index.js","mtime":1655715099000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.to-string\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.split\";\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: form_operation\n },\n computed: {\n field: function field() {\n var 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 formData.picUrl = obpmConfig.obpmFilePath;\n return this.$parent.findField(this.id);\n }\n },\n data: function data() {\n return {\n isActiveError: false,\n errorMessage: \"\",\n marks: 0,\n marksValue: \"0%\",\n Constant: 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 // 新的文件名字\n fileSuffix: \"\",\n // 文件名后缀\n dialogVisible: false,\n dialogImageUrl: \"\",\n dialogHeight: \"\",\n imgDetails: {\n scaleNum: 1,\n zoom: \"\"\n }\n };\n },\n mounted: function mounted() {\n var _this = this;\n this.$nextTick(function () {\n //使用nextTick为了保证dom元素都已经渲染完毕\n var field = _this.field;\n if (field.isHideType) {\n var id = _this.id,\n formShowType = field.formShowType;\n controlHidden({\n id: id,\n field: field,\n formShowType: formShowType\n });\n }\n if (field.fileh) {\n document.getElementById(_this.field.id).getElementsByClassName(\"el-upload\")[0].style.width = parseInt(_this.field.filew) + \"px\";\n document.getElementById(_this.field.id).getElementsByClassName(\"el-upload\")[0].style.height = parseInt(_this.field.fileh) + \"px\";\n document.getElementById(_this.field.id).getElementsByClassName(\"el-upload\")[0].style.lineHeight = 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: function rollImg() {\n /* 获取当前页面的缩放比 若未设置zoom缩放比,则为默认100%,即1,原图大小 */\n var 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 var zoomNum = zoom / 100;\n this.imgDetails.scaleNum = zoomNum;\n }\n return false;\n },\n setClass: function setClass(item) {\n var 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 hiddenLogsDialog: function hiddenLogsDialog() {\n this.showLogsIcon = false;\n this.showLogsDialog = false;\n },\n listUp: function listUp(index) {\n if (index == 0) {} else {\n var arr = this.field.value;\n arr[index] = arr.splice(index - 1, 1, arr[index])[0];\n this.field.value = arr;\n }\n },\n listDown: function listDown(index) {\n if (index == this.field.value.length - 1) {} else {\n var arr = this.field.value;\n arr[index] = arr.splice(index + 1, 1, arr[index])[0];\n this.field.value = arr;\n }\n },\n enter: function enter() {\n if (this.field.isModified) {\n this.showLogsIcon = true;\n }\n },\n getOperationLogs: function getOperationLogs() {\n var obj = {};\n obj.fieldName = this.field.name;\n this.operationData = obj;\n this.showLogsDialog = true;\n },\n uploadImg: function uploadImg(e) {\n var _this2 = this;\n //obs文件上传start\n if (__network__) {\n this.obsFile(e); //obs文件上传\n return;\n }\n //obs文件上传end\n var ob = {};\n ob.uid = e.file.uid;\n ob.name = e.file.name;\n ob.marks = 0;\n ob.marksValue = '0%';\n this.allfileArray.push(ob);\n var fileArray = e.file;\n var file = fileArray;\n var that = this;\n var form = new FormData();\n form.append(\"files\", file);\n form.forEach(function (value, key) {\n if (value instanceof File) {\n form.set(key, value, value.name.replace(/ /g, '')); //去掉文件名称所有空格\n }\n });\n var files = form;\n var actionType = this.fileType;\n var appId = this.$root.appid;\n var allowedTypes = this.field.fileType;\n var fieldId = this.id;\n var fileSaveMode = this.field.fileSaveMode;\n var path = this.field.path;\n this.$api.uploadFile(files, appId, allowedTypes, fieldId, fileSaveMode, path, actionType, {\n onSucess: function onSucess(response) {\n for (var i = 0; i < _this2.allfileArray.length; i++) {\n if (e.file.uid === _this2.allfileArray[i].uid) {\n _this2.allfileArray.splice(i, 1);\n i--;\n }\n }\n var uploadTime = '';\n var date = new Date();\n var Y = date.getFullYear() + '-';\n var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';\n var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';\n var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';\n var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';\n var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();\n uploadTime = Y + M + D + h + m + s;\n that.picUrl = obpmConfig.obpmFilePath + \"/\";\n var obj = {\n name: response.data.data[0].fileName,\n path: response.data.data[0].filePath,\n url: obpmConfig.obpmFilePath + \"/\" + response.data.data[0].filePath,\n fileType: response.data.data[0].fileType,\n uploader: sessionStorage.getItem(\"myProfileName\") || '',\n uploadTime: uploadTime,\n userName: sessionStorage.getItem(\"myProfileName\") || '',\n time: uploadTime,\n size: fileArray.size.toString()\n };\n that.fileArray.push(obj);\n if (that.field.value && that.field.value instanceof Array) {\n that.field.value = that.fileArray.concat(that.field.value);\n } else {\n that.field.value = that.fileArray;\n }\n that.fileArray = [];\n if (that.field.refreshOnChanged) {\n that.refresh(that.id);\n }\n if (that.field.instantValidate) {\n _this2.evenCheck();\n }\n }\n }, function (res) {\n for (var i = 0; i < _this2.allfileArray.length; i++) {\n if (res.uid === _this2.allfileArray[i].uid) {\n _this2.allfileArray[i].marks = res.num;\n _this2.allfileArray[i].marksValue = res.complete;\n _this2.$forceUpdate();\n }\n }\n // \n // console.log(\"res--->\",res)\n // this.marks = res.num;\n // this.marksValue = res.complete;\n }, e.file.uid);\n },\n handlePreview: function handlePreview(file) {\n var _this3 = this;\n if (file.path.indexOf(\"http\") > -1) {\n //obs路径\n window.open(file.path);\n return;\n }\n var field = this.field;\n var isImg = false;\n var isVideo = false;\n if (file.name) {\n var name = file.name.split('.')[file.name.split('.').length - 1];\n name = name.toLowerCase();\n if (name == 'png' || name == 'jpg' || name == 'jpeg' || name == 'gif') {\n isImg = true;\n } else if (name == 'mp3' || name == 'mp4') {\n isVideo = true;\n } else if (name == 'rar' || name == 'zip') {\n //压缩包直接下载\n if (file.path.indexOf('/obpm') > -1) {\n file.path += file.path.indexOf('?') > -1 ? '&' : '?';\n window.open(file.path + 'v=' + new Date().getTime());\n return;\n } else {\n file.path += file.path.indexOf('?') > -1 ? '&' : '?';\n window.open('/obpm' + file.path + 'v=' + new Date().getTime());\n return;\n }\n }\n }\n if (isImg) {\n file.path += file.path.indexOf('?') > -1 ? '&' : '?';\n this.dialogImageUrl = obpmConfig.obpmFilePath + \"/\" + file.path + 'v=' + new Date().getTime();\n this.dialogVisible = true;\n return;\n }\n if (isVideo) {\n file.path += file.path.indexOf('?') > -1 ? '&' : '?';\n var url = window.location.origin + obpmConfig.obpmFilePath + file.path + 'v=' + new Date().getTime();\n window.open(url);\n return;\n }\n var realName = file.path.split(\"/\")[file.path.split(\"/\").length - 1];\n this.$api.getHasPdfFile(file.path, realName, {\n onSucess: function onSucess(res) {\n if (res.data.data) {\n _this3.$api.getenvironment({\n onSucess: function onSucess(res) {\n if (res.data.errcode === 0) {\n if (res.data.data === true) {\n var isEdit = field.previewEdit ? 'edit' : '';\n var waterMark = field.watermark;\n var openWaterMark = field.openWaterMark;\n var curEditUserId = _this3.$store.state.myProfile.id;\n var userName = _this3.$store.state.myProfile.name;\n var showTrackRevisions = field.showTrackRevisions;\n var selectEditPlug = field.selectEditPlug;\n var cp = obpmConfig.obpmFilePath;\n sessionStorage.setItem(\"obpmContextPath\", cp);\n var statiContextPath = obpmConfig.statiContextPath;\n var pdfPath = \"\";\n if (statiContextPath) {\n //5.0 trunk\n sessionStorage.setItem(\"isTrunk\", true);\n pdfPath = obpmConfig.statiContextPath;\n } else {\n //4.4 stable\n sessionStorage.setItem(\"isTrunk\", false);\n pdfPath = cp;\n }\n var _url = pdfPath + '/portal/vue/pdf/pdfviewer.html?action=' + isEdit + \"&path=\" + file.path + \"&name=\" + realName + \"&showName=\" + file.name + \"&waterMark=\" + waterMark + \"&openWaterMark=\" + openWaterMark + \"&curEditUserId=\" + curEditUserId + \"&userName=\" + userName + \"&showTrackRevisions=\" + showTrackRevisions + \"&selectEditPlug=\" + selectEditPlug;\n var URL = encodeURI(_url);\n window.open(URL);\n }\n }\n }\n });\n } else {\n _this3.$message({\n message: _this3.$t('view.trandformAndWait'),\n type: 'warning'\n });\n }\n }\n });\n },\n download: function download(file) {\n if (file.path.indexOf(\"http\") > -1) {\n //obs路径\n window.open(file.path);\n return;\n }\n if (file.name) {\n var name = file.name.split('.')[file.name.split('.').length - 1];\n name = name.toLowerCase();\n if (name == 'mp3' || name == 'mp4' || name == 'rar' || name == 'zip') {\n //压缩包直接下载\n if (file.path.indexOf('/obpm') > -1) {\n file.path += file.path.indexOf('?') > -1 ? '&' : '?';\n window.open(file.path + 'v=' + new Date().getTime());\n return;\n } else {\n file.path += file.path.indexOf('?') > -1 ? '&' : '?';\n window.open('/obpm' + file.path + 'v=' + new Date().getTime());\n return;\n }\n }\n }\n if (this.field.watermark) {\n this.$api.downloadWaterMarkFile(this.field.watermark, '', '', {\n onSucess: function onSucess(res) {\n if (res.data.waterMarkStr) {\n var url = encodeURI(obpmConfig.contextPath + \"/runtime/file/download?filename=\" + file.name + \"&filepath=\" + file.path + \"&watermarkStr=\" + res.data.waterMarkStr);\n window.open(url);\n }\n }\n });\n } else {\n // $t('report.download')\n var link = document.createElement('a');\n link.style.display = 'none';\n var op = obpmConfig.obpmFilePath;\n var statiContextPath = obpmConfig.statiContextPath;\n if (statiContextPath) {\n //5.0 trunk\n op = op + \"/api\";\n }\n link.href = op + \"/runtime/file/download?filename=\" + encodeURI(file.name) + \"&filepath=\" + file.path + '&v=' + new Date().getTime();\n link.setAttribute('download', file.name);\n link.click();\n }\n },\n handleExceed: function handleExceed(files, fileList) {\n //文件超出个数限制时的钩子\n if (this.field.limitNumber == \"1\") {\n //上传限制一张用覆盖的方式重新上传\n\n files[0].uid = new Date().getTime();\n this.field.value = [];\n var e = {\n file: files[0]\n };\n this.uploadImg(e);\n } else {\n this.$message.warning(this.$t('view.out')); //文件上传超出数量限制。\n }\n },\n beforeUpload: function beforeUpload(file) {\n var field = this.field;\n if (field.customizeType) {\n var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1);\n this.fileType = file.type;\n // const extension = testmsg === field.customizeType;\n var extension = field.customizeType.indexOf(testmsg) > -1;\n if (!extension) {\n this.$message({\n message: this.$t('view.upload_only') + \"\".concat(field.customizeType) + this.$t('form.format'),\n type: 'error'\n });\n this.fileList = [];\n }\n return extension;\n } else {\n this.fileType = file.type;\n }\n if (file.size / 1024 > this.field.maxsize) {\n this.$message({\n message: this.$t('view.upload_over') + \"\".concat(this.field.maxsize / 1024, \"M!\"),\n type: 'error'\n });\n this.fileList = [];\n return false;\n }\n },\n beforeRemove: function beforeRemove(file) {\n // if(this.field.customizeType != \"xmind\") {\n // \treturn this.$confirm(`确定移除 ${ file.name }?`).then(() => {});\n // }\n if (file && file.status == \"success\") {\n return this.$confirm(this.$t('btns.comfirm_remove') + \"\".concat(file.name, \"\\uFF1F\")).then(function () {});\n }\n },\n opendialog: function opendialog(item, index) {\n var _this4 = this;\n this.$confirm(this.$t('view.goon'), this.$t('tip'), {\n confirmButtonText: this.$t('msg.confirm'),\n cancelButtonText: this.$t('btns.cancel'),\n type: 'warning'\n }).then(function () {\n _this4.$message({\n type: 'success',\n message: _this4.$t('msg.es')\n });\n _this4.handleRemove(item, index);\n }).catch(function () {\n _this4.$message({\n type: 'info',\n message: _this4.$t('msg.cancel_del')\n });\n });\n },\n /**\n * $t('view.rename')文件的名称\n */\n editFileName: function editFileName(item) {\n this.field.value.forEach(function (item) {\n return item.isEdit = false;\n });\n item.isEdit = true;\n if (!item.fileType) {\n var fileType;\n var itemName;\n itemName = item.name;\n fileType = itemName.substring(itemName.lastIndexOf(\".\"), itemName.length);\n item.fileType = fileType;\n }\n this.fileSuffix = item.fileType;\n this.newFileName = this.cutSuffix(item.name);\n this.$forceUpdate();\n },\n /**\n * 确认修改文件名\n */\n confirm: function confirm(item) {\n item.name = this.newFileName + this.fileSuffix;\n item.isEdit = false;\n this.$forceUpdate();\n },\n /**\n * 取消修改文件名\n */\n cancel: function cancel(item) {\n item.isEdit = false;\n this.$forceUpdate();\n },\n /**\n * 截取文件名后缀\n */\n cutSuffix: function cutSuffix(name) {\n return name.replace(this.fileSuffix, '');\n },\n handleRemove: function handleRemove(file, fileList) {\n var _this5 = this;\n var appId = this.$root.appid;\n var formId = this.field.formId;\n var docId = this.field.docId;\n var path = file.path;\n var field = this.field;\n API.deleteUpload(appId, formId, docId, path, {\n onSucess: function onSucess(res) {\n if (res.data.errcode == 0) {\n var arr = _this5.field.value;\n for (var i = 0; i < arr.length; i++) {\n if (file.path == arr[i].path) {\n arr.splice(i, 1);\n }\n }\n }\n if (_this5.field.refreshOnChanged) {\n _this5.refresh(_this5.field.id);\n }\n if (field.instantValidate) {\n _this5.evenCheck();\n }\n }\n });\n },\n evenCheck: function evenCheck() {\n var _this6 = this;\n var value = true;\n var formData = this.$parent.checkData(value);\n this.$api.formValidation(this.$root.appid, formData, {\n onSucess: function onSucess(response) {\n if (response.data.errcode == 4001) {\n if (response.data.errors && response.data.errors.length > 0) {\n var arr = response.data.errors;\n for (var i = 0; i < arr.length; i++) {\n if (_this6.field.name == arr[i].field) {\n _this6.isActiveError = true;\n _this6.errorMessage = arr[i].errmsg;\n return;\n } else {\n _this6.isActiveError = false;\n _this6.errorMessage = '';\n }\n }\n }\n } else if (response.data.errcode == 0) {\n _this6.isActive = false;\n }\n }\n });\n },\n obsFile: function obsFile(e) {\n //obs文件上传\n\n //去掉文件名称空格start\n var form = new FormData();\n form.append(\"files\", e.file);\n form.forEach(function (value, key) {\n if (value instanceof File) {\n form.set(key, value, value.name.replace(/ /g, '')); //去掉文件名称所有空格\n }\n });\n form.get('files');\n e.file = form.get('files');\n //去掉文件名称空格end\n\n var that = this;\n var domainId = localStorage.getItem(\"domainId\") || \"default\"; //保存本地企业id\n // var objectKey=\"uploads/\"+domainId+\"/\"+new Date().getFullYear()+\"/\"+new Date().getTime()+e.file.name\n // https://bcxin-v5-prod.obs.cn-north-1.myhuaweicloud.com/uploads/2022/06-20/公司id/uuid/文件名.xls\t\t\n var now = new Date();\n var y = now.getFullYear();\n var m = now.getMonth() + 1 < 10 ? '0' + (now.getMonth() + 1) : now.getMonth() + 1;\n var d = now.getDate() < 10 ? '0' + now.getDate() : now.getDate();\n var md = m + '-' + d;\n var objectKey = \"uploads/\".concat(y, \"/\").concat(md, \"/\").concat(domainId, \"/\").concat(now.getTime(), \"/\").concat(e.file.name);\n var obs = new ObsClient({\n access_key_id: ak,\n secret_access_key: sk,\n server: urlserver,\n timeout: 60 * 5\n });\n obs.putObject({\n Bucket: BucketName,\n Key: objectKey,\n SourceFile: e.file //获取file文件\n }).then(function (result) {\n if (result.CommonMsg.Status < 300) {\n var httpurl = \"https://\".concat(BucketName, \".\").concat(urlserver, \"/\").concat(objectKey);\n httpurl = convertCdnPath(httpurl);\n // let ob = {};\n // ob.uid = e.file.uid;\n // ob.name = e.file.name\n // ob.marks = 100;\n // ob.marksValue = '100%';\n // that.allfileArray.push(ob);\n\n var uploadTime = '';\n var date = new Date();\n var Y = date.getFullYear() + '-';\n var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';\n var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';\n var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';\n var _m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';\n var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();\n uploadTime = Y + M + D + h + _m + s;\n that.picUrl = obpmConfig.obpmFilePath + \"/\";\n var obj = {\n name: e.file.name,\n path: httpurl,\n url: httpurl,\n fileType: \"\",\n uploader: sessionStorage.getItem(\"myProfileName\") || '',\n uploadTime: uploadTime,\n userName: sessionStorage.getItem(\"myProfileName\") || '',\n time: uploadTime,\n size: e.file.size\n };\n that.fileArray.push(obj);\n if (that.field.value && that.field.value instanceof Array) {\n that.field.value = that.fileArray.concat(that.field.value);\n } else {\n that.field.value = that.fileArray;\n }\n that.fileArray = [];\n if (that.field.refreshOnChanged) {\n that.$parent.refresh(that.id);\n }\n if (that.field.instantValidate) {\n this.evenCheck();\n }\n // var pushstring=`${e.file.name},${httpurl},${e.file.size}`\n // if(values.indexOf(pushstring)===-1){\n // \tvalues.push(pushstring)\n // \tflag++\n // \tconsole.log(\"上传几个:\"+flag)\n // \t\tif(fileCount===flag){\n // \t\t\tconsole.log(\"已上传成功\")\n // \t\t\t$info.html(\"已上传成功\");\n // \t\t\t$('.state-ok').show();\n // \t\t}\n\n // }\n // console.log(values)\n }\n });\n }\n }\n};",null]}