国内外标准-拆分结果上传、模板下载
This commit is contained in:
@@ -833,6 +833,32 @@
|
|||||||
@click="editResolveList"
|
@click="editResolveList"
|
||||||
>编辑
|
>编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-upload
|
||||||
|
style="display: inline-block;margin:0 5px;"
|
||||||
|
:show-file-list = 'false'
|
||||||
|
v-btn-permission="$route.params.pageType === 'INLAND_STAND' ? 'bd291146ac1e42c48968c5142ae55375' : '960a97045a6e47b0b8e33ebc347e5fd9'"
|
||||||
|
:limit="1"
|
||||||
|
ref="importSplitResultFile"
|
||||||
|
:action="splitResultPath"
|
||||||
|
:file-list="defaultImportSplitResultFileList"
|
||||||
|
:data="uploadFilesplitEo"
|
||||||
|
:headers="headers"
|
||||||
|
:on-success="uploadSplitResultSuccess"
|
||||||
|
:on-remove="removeSplitResultFile"
|
||||||
|
:before-upload="beforeSplitResultImport"
|
||||||
|
:on-change="handleUploadChange"
|
||||||
|
>
|
||||||
|
<el-button size="mini" icon="el-icon-upload">拆分结果上传
|
||||||
|
</el-button>
|
||||||
|
</el-upload>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
@click="uploadImportSplitResultModal"
|
||||||
|
>模板下载
|
||||||
|
</el-button>
|
||||||
|
<!--<el-button size="mini" type="primary" @click="handleImportSplitResult">拆分结果提交-->
|
||||||
|
<!--</el-button>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-table
|
<el-table
|
||||||
@@ -968,8 +994,6 @@
|
|||||||
:total="total7"
|
:total="total7"
|
||||||
@pageChange="pageChange7"
|
@pageChange="pageChange7"
|
||||||
@pageSizeChange="pageSizeChange7"></pagination>
|
@pageSizeChange="pageSizeChange7"></pagination>
|
||||||
|
|
||||||
|
|
||||||
<!-- <el-pagination-->
|
<!-- <el-pagination-->
|
||||||
<!-- @size-change="pageSizeChange"-->
|
<!-- @size-change="pageSizeChange"-->
|
||||||
<!-- @current-change="pageChange"-->
|
<!-- @current-change="pageChange"-->
|
||||||
@@ -2140,12 +2164,134 @@ export default {
|
|||||||
itemsText: '',
|
itemsText: '',
|
||||||
itemsTextDialogs: false,
|
itemsTextDialogs: false,
|
||||||
textStatusMap: {},
|
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: {},
|
props: {},
|
||||||
watch: {},
|
watch: {},
|
||||||
methods: {
|
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) {
|
filterApplyArctic(row) {
|
||||||
if (row.applyArctic) {
|
if (row.applyArctic) {
|
||||||
return row.applyArctic.replaceAll('\"', '').replaceAll('\[', '').replaceAll('\]', '')
|
return row.applyArctic.replaceAll('\"', '').replaceAll('\[', '').replaceAll('\]', '')
|
||||||
|
|||||||
Reference in New Issue
Block a user