diff --git a/src/pages/details/otherStandardDetails/index.vue b/src/pages/details/otherStandardDetails/index.vue index c2ccd263e..1c08eb992 100644 --- a/src/pages/details/otherStandardDetails/index.vue +++ b/src/pages/details/otherStandardDetails/index.vue @@ -833,6 +833,32 @@ @click="editResolveList" >编辑 + + 拆分结果上传 + + + 模板下载 + + +
- - @@ -2140,12 +2164,134 @@ export default { itemsText: '', itemsTextDialogs: false, textStatusMap: {}, - standMap: {} + standMap: {}, + splitResultPath: 'api/lawss/sarFileSplitItems/importSplitItemsZip', + defaultImportSplitResultFileList:[], + // 记录上传文件相关信息 + uploadFilesplitEo: { + standId: '', + fileType: '', + attId: '', + fileName: '', + standNumSplit: '', + standNameSplit: '', + defaultFileList: [], + splitType: '全部章节' + }, + headers:{ + token: localStorage.getItem('userInfo').token + } } }, props: {}, watch: {}, methods: { + // 模板下载 + uploadImportSplitResultModal () { + window.open('/api/att/attFile/uploadModalFile?fileName=标准拆分导入拆分结果模板.zip') + }, + uploadSplitResultSuccess (res, file, fileList) { + if (res.ok) { + this.uploadFilesplitEo.attId = res.data.attId + this.uploadFilesplitEo.fileName = res.data.name + if (res.data.standNum != null && res.data.standNum !== '') { + this.uploadFilesplitEo.standNumSplit = res.data.standNum + } + if (res.data.standName != null && res.data.standName !== '') { + this.uploadFilesplitEo.standNameSplit = res.data.standName + } + this.defaultImportSplitResultFileList.push(file) + this.$message.success('文件上传成功') + setTimeout(()=>{ + this.handleImportSplitResult(); + },1000) + } else { + this.defaultImportSplitResultFileList = [] + this.uploadFilesplitEo.attId = '' + this.$message.error(res.message) + } + }, + handleImportSplitResult(){ + console.log(123333) + if (this.defaultImportSplitResultFileList.length) { + const file = this.defaultImportSplitResultFileList[0] + const fileTypeResult = this.beforeSplitResultImport(file.raw) + const _formData = new FormData() + _formData.append('standNumSplit', this.uploadFilesplitEo.standNumSplit) + _formData.append('standId', this.uploadFilesplitEo.standId) + _formData.append('standNameSplit', this.uploadFilesplitEo.standNameSplit) + _formData.append('fileType', this.uploadFilesplitEo.fileType) + _formData.append('file', file.raw) + if (fileTypeResult) { + this.importSplitResultLoading = true + this.$http.postData('lawss/sarFileSplitItems/importSplitItemsZip', _formData, { + }, res => { + this.importSplitResultLoading = false + if (res.ok) { + this.visibleImportSplitResultDialog = false + this.$message({ + dangerouslyUseHTMLString: true, + message: res.message, + type: 'success' + }) + } else { + this.$message({ + dangerouslyUseHTMLString: true, + message: res.message, + type: 'warning' + }) + } + }) + } + } else { + this.$message.warning('请上传文件') + } + }, + // 上传按钮 文件上传之前的钩子 + beforeSplitResultImport(file) { + if (this.sarStandardsInfoEO.standYear) { + this.sarStandardsInfoEO.lawsNumber = this.sarStandardsInfoEO.standSortShow + ' ' + this.sarStandardsInfoEO.standNumber + '-' + this.sarStandardsInfoEO.standYear + } else { + this.sarStandardsInfoEO.lawsNumber = this.sarStandardsInfoEO.standSortShow + ' ' + this.sarStandardsInfoEO.standNumber + } + this.sarStandardsInfoEO.lawsName = this.sarStandardsInfoEO.standName + this.sarStandardsInfoEO.stateName = this.sarStandardsInfoEO.standStateShow + // this.sarStandardsInfoEO.resType = this.$route.params.pageType + this.uploadFilesplitEo.standNumSplit = this.sarStandardsInfoEO.lawsNumber + this.uploadFilesplitEo.standNameSplit = this.sarStandardsInfoEO.lawsName + this.uploadFilesplitEo.standId = this.sarStandardsInfoEO.id + this.uploadFilesplitEo.fileType = this.$route.params.pageType + + var filename = file.name + var index1 = filename.lastIndexOf('.') + var index2 = filename.length + var fileSuffix = filename.substring(index1, index2) + // const fileSuffix = file.name.split('.')[1] // 后缀名 + if (this.defaultImportSplitResultFileList.length > 1) { + this.$message.warning('只能导入一个文件') + return false + } + if (fileSuffix !== '.zip') { + this.$message.warning('文件' + file.name + '格式不正确,请上传zip文件') + return false + } + if (file.size / 1024 / 1024 > 200) { + this.$message.warning('文件大小不能超过200M') + return false + } + return true + }, + removeSplitResultFile (file, fileList) { + this.defaultImportSplitResultFileList = fileList + this.uploadFilesplitEo.attId = fileList.length > 0 ? this.uploadFilesplitEo.attId : '' + this.uploadFilesplitEo.defaultFileList = fileList + }, + // 导入拆分结果 + handleUploadChange (file, fileList) { + this.defaultImportSplitResultFileList = fileList + this.uploadFilesplitEo.defaultFileList = fileList + // this.$refs['uploadFileSplitEO'].validateField('defaultFileList') + }, filterApplyArctic(row) { if (row.applyArctic) { return row.applyArctic.replaceAll('\"', '').replaceAll('\[', '').replaceAll('\]', '')