{"remainingRequest":"/data/jenkins/workspace/badp-bcxin-web-5.x-mobile/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/badp-bcxin-web-5.x-mobile/src/components/o_file_kms.vue?vue&type=script&lang=js&","dependencies":[{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-mobile/src/components/o_file_kms.vue","mtime":1740130327257},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-mobile/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-mobile/node_modules/thread-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-mobile/node_modules/babel-loader/lib/index.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-mobile/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-mobile/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//\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 Constant from \"@/Constant.js\"\nimport controlHidden from \"@/assets/js/controlHidden.js\"\nexport default {\n name: \"o-file-kms\",\n props: [\"id\"],\n computed: {\n field: function() {\n let formData = this.$parent.findField(this.id);\n return formData;\n }\n },\n mounted(){\n this.$nextTick(()=>{\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 },\n data: function() {\n return { \n dialogVisible:false,\n Constant,\n isActive:false,\n errorMessage:'',\n searchValue:'',\n tableData:[],\n selectData:[],\n selectFileData:[],\n showLogsDialog: false,\n showLogsIcon:true,\n operationData:'',\n selectedDocIds: [],\n };\n },\n methods: {\n confirm(item,index){\n let name = item.name;\n // name = name.replace(/^(\\s|.)+|(\\s|.)+$/g, \"\");\n this.selectFileData[index].fileName = name + \".\" + item.suffix;\n this.selectFileData[index].isEdit = false;\n this.$forceUpdate();\n },\n\t\tcancel(index) {\n this.selectFileData[index].isEdit = false;\n this.$forceUpdate();\n },\n editFileName(item, index){\n this.selectFileData[index].isEdit = true;\n this.$forceUpdate();\n },\n handlePreview(file) {\n\t\t\tthis.$api.getenvironment(\n\t\t\t\t{\n\t\t\t\t\tonSucess: res => {\n\t\t\t\t\t\tif(res.data.errcode === 0) {\n\t\t\t\t\t\t\tif(res.data.data === true) {\n let realName = file.filePath.split(\"/\")[file.filePath.split(\"/\").length - 1];\n let kmsPath = \"/uploads/kms/\" + file.filePath;\n this.$api.getHasPdfFile(\n kmsPath,\n realName,\n {\n onSucess: resp => {\n if(res.data.data === true) {\n let isEdit = this.field.previewEdit?'edit':'';\n let waterMark = this.field.watermark?encodeURI(this.field.watermark):undefined;\n let openWaterMark = this.field.openWaterMark;\n let curEditUserId = file.curEditUserId;\n let userName = this.$store.state.myProfile.name;\n let showTrackRevisions = this.field.showTrackRevisions;\n let selectEditPlug = this.field.selectEditPlug;\n let 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\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\tpdfPath = cp;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n let url = pdfPath + '/portal/vue/pdf/pdfviewer.html?action=' + isEdit + \n \"&path=/uploads/kms/\" + file.filePath + \n \"&name=\" + realName + \n \"&showName=\" + file.fileName + \n \"&waterMark=\" + waterMark + \n \"&openWaterMark=\" + openWaterMark +\n \"&curEditUserId=\" + curEditUserId +\n \"&userName=\" + userName + \n \"&showTrackRevisions=\" + showTrackRevisions +\n \"&selectEditPlug=\" + selectEditPlug;\n window.open(url);\n }\n }\n }\n )\n\t\t\t\t\t\t\t\t\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\t\t},\n\n hiddenLogsDialog() {\n this.showLogsIcon = false;\n this.showLogsDialog = false;\n },\n enter(){\n if(this.field.isModified) {\n this.showLogsIcon = true;\n }\n },\n getOperationLogs() {\n let obj = {};\n obj.fieldName = this.field.name;\n this.operationData = obj;\n this.showLogsDialog = true;\n },\n\n downloadFile(item){\n let name = item.fileName;\n let path = '/uploads/kms/' + item.filePath;\n this.$api.templateDownload(\n name,\n path,\n {\n onSucess: response => {\n console.log(\"res--->\",response)\n let fileName = \"\";\n let type = response.headers['content-type'];\n if(response.headers['content-disposition']) {\n //fileName = decodeURIComponent(response.headers['content-disposition'].split(\"=\")[1]);\n fileName = name;\n }else {\n fileName=\"下载\";\n }\n this.download(response, type, fileName);\n }\n }\n )\n },\n\n download(res, type, filename){\n const blob = new Blob([res.data], {\n // 如果后端没返回下载文件类型,则需要手动设置:type: 'application/pdf;chartset=UTF-8' 表示下载文档为pdf,如果是word则设置为msword,excel为excel\n type: type\n });\n const a = document.createElement('a');\n const herf = window.URL.createObjectURL(blob);\n // 下载链接\n a.href = herf;\n // 下载文件名,如果后端没有返回,可以自己写a.download = '文件.pdf'\n a.download = filename;\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n window.URL.revokeObjectURL(herf);\n },\n\n deleteFile(item,index){\n let field = this.field;\n this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {\n confirmButtonText: '确定',\n cancelButtonText: '取消',\n type: 'warning'\n }).then(() => {\n this.$api.deleteKmsFile(\n this.$root.appid, \n field.formId, \n field.docId, \n item.filePath,\n {\n onSucess: res=> {\n if(res.data.errcode == 0) {\n this.selectFileData.splice(index,1);\n this.$notify({\n title: '',\n message: res.data.data,\n type: 'success'\n });\n }\n }\n }\n )\n }).catch(() => {\n \n });\n },\n\n onOk() {\n let td = this.tableData;\n let sd = this.selectedDocIds;\n let arr = [];\n if(sd.length > 0) {\n for (let i = 0; i < sd.length; i++) {\n for(let j = 0; j < td.length; j++) {\n if(sd[i] == td[j].id) {\n arr.push(td[j])\n }\n }\n }\n this.selectData = arr;\n }else {\n this.selectData = [];\n }\n\n let list = JSON.parse(JSON.stringify(this.selectData));\n list.forEach(el => {\n let a1 = el.fileName.split(\".\");\n el.isEdit = false;\n el.suffix = a1[a1.length - 1];\n a1.length = a1.length - 1;\n if(a1.length>1){\n el.name = a1.join(\".\");\n }else {\n el.name = a1[0];\n }\n });\n this.selectFileData = list;\n this.dialogVisible = false; \n },\n\n onCancel() {\n this.dialogVisible = false;\n },\n \n openKmDialog() {\n this.dialogVisible = true;\n //fileName=&orderByfield=CREATE_DATE&orderMode=desc&pageNo=1&linesPerPage=10&_=1594349604925\n let params = {\n fileName:this.searchValue,\n orderByfield:'CREATE_DATE',\n orderMode:'desc',\n pageNo:1,\n linesPerPage:10,\n _: new Date().getTime(),\n }\n this.$api.getKmsFiles(\n params,\n {\n onSucess: res => {\n let newData = res.data.data.datas.map(item => {\n return {\n fileName: item.name,\n createDate: item.createDate,\n filePath: item.url,\n curEditUserId: item.creatorId,\n id: item.id,\n fName: '名称',\n cTime: '创建时间'\n }\n });\n this.tableData = newData;\n }\n }\n )\n },\n onChange(){\n if (this.field.refreshOnChanged){\n this.$parent.refresh(this.id);\n }\n }\n },\n};\n",null]}