Browse Source

档案导入api

master
xuhuajiao 2 years ago
parent
commit
7f4cb023df
  1. 46
      src/api/archivesManage/fileImport.js
  2. 1
      src/assets/styles/archives-manage.scss
  3. 24
      src/views/archivesManage/archivesList/index.vue
  4. 89
      src/views/archivesManage/archivesList/module/oneClickDelete/index.vue
  5. 242
      src/views/archivesManage/fileImport/dataImport/index.vue
  6. 1
      src/views/archivesManage/fileImport/index.vue
  7. 44
      src/views/archivesManage/fileImport/module/detail.vue

46
src/api/archivesManage/fileImport.js

@ -0,0 +1,46 @@
import request from '@/utils/request'
import qs from 'qs'
import axios from 'axios'
import { getToken } from '@/utils/auth'
// 预览上传zip信息
export function zipUpload(api, file) {
var data = new FormData()
data.append('multipartFile', file)
const config = {
headers: { 'Authorization': getToken() }
}
return axios.post(api, data, config)
}
// 导入预览
export function FetchInitImportPreview(params) {
return request({
url: 'api/unzip/initImportPreview' + '?' + qs.stringify(params, { indices: false }),
method: 'get'
})
}
// 导入
export function FetchImportZip(parameter) {
return request({
url: 'api/unzip/importZip',
method: 'post',
data: parameter
})
}
// 导入日志
export function FetchInitImportLog(params) {
return request({
url: 'api/unzip/initImportLog' + '?' + qs.stringify(params, { indices: false }),
method: 'get'
})
}
export default {
zipUpload,
FetchInitImportPreview,
FetchImportZip,
FetchInitImportLog
}

1
src/assets/styles/archives-manage.scss

@ -87,6 +87,7 @@ $arcCyan: #0FBED9;
margin-bottom: 10px; margin-bottom: 10px;
::v-deep .el-checkbox .el-checkbox__label{ ::v-deep .el-checkbox .el-checkbox__label{
color: #fff; color: #fff;
line-height: 34px;
} }
} }
.archives-right-list{ .archives-right-list{

24
src/views/archivesManage/archivesList/index.vue

@ -26,6 +26,7 @@
<!-- 档案管理列表 --> <!-- 档案管理列表 -->
<el-col class="archives-right-list" :xs="14" :sm="18" :md="19" :lg="18" :xl="19"> <el-col class="archives-right-list" :xs="14" :sm="18" :md="19" :lg="18" :xl="19">
<div v-if="selectedCategory.isType !== 1 && !isRecycle" :class="['archives-top', {'archives-fixed-top': selectedCategory.isType === 2 || selectedCategory.isType === 4 }]"> <div v-if="selectedCategory.isType !== 1 && !isRecycle" :class="['archives-top', {'archives-fixed-top': selectedCategory.isType === 2 || selectedCategory.isType === 4 }]">
<el-button v-if="selectedCategory.isType !== 4" type="primary" class="one-click-delete el-icon-delete" @click="oneClickDeleteHandle">一键删除</el-button>
<el-checkbox v-model="fixedStatusBar" @change="statusBarChecked">隐藏状态栏</el-checkbox> <el-checkbox v-model="fixedStatusBar" @change="statusBarChecked">隐藏状态栏</el-checkbox>
</div> </div>
<!-- 项目 --> <!-- 项目 -->
@ -63,6 +64,7 @@
/> />
</el-col> </el-col>
</el-row> </el-row>
<oneClickDeltModule ref="oneClickRef" />
</div> </div>
</template> </template>
@ -71,13 +73,14 @@ import { getDicts } from '@/api/archivesConfig/dict'
import archivesProject from './archivesProject/index' import archivesProject from './archivesProject/index'
import archivesAnjuan from './archivesAnjuan/index' import archivesAnjuan from './archivesAnjuan/index'
import archivesJuannei from './archivesJuannei/index' import archivesJuannei from './archivesJuannei/index'
import oneClickDeltModule from './module/oneClickDelete/index'
import crudCategory from '@/api/category/category' import crudCategory from '@/api/category/category'
import CRUD, { presenter } from '@crud/crud' import CRUD, { presenter } from '@crud/crud'
import { archivesCrud } from './mixins/archives' import { archivesCrud } from './mixins/archives'
export default { export default {
name: 'ArchivesList', name: 'ArchivesList',
components: { archivesProject, archivesAnjuan, archivesJuannei },
components: { archivesProject, archivesAnjuan, archivesJuannei, oneClickDeltModule },
cruds() { cruds() {
return [ return [
CRUD({ CRUD({
@ -652,8 +655,12 @@ export default {
total: 0 total: 0
} }
} }
},
//
oneClickDeleteHandle() {
this.$refs.oneClickRef.getCategory = this.selectedCategory
this.$refs.oneClickRef.oneClickVisible = true
} }
} }
} }
</script> </script>
@ -671,4 +678,17 @@ export default {
.iconfont::before{ .iconfont::before{
margin-right: 6px; margin-right: 6px;
} }
.one-click-delete{
padding: 4px 10px;
margin-right: 20px;
&.active{
border-color: #f65163;
background-color: #f65163;
}
::v-deep span{
display: inline-block;
margin-left: 5px;
}
}
</style> </style>

89
src/views/archivesManage/archivesList/module/oneClickDelete/index.vue

@ -0,0 +1,89 @@
<template>
<!-- 一键删除 -->
<el-dialog class="oneClick" title="一键删除" :visible.sync="oneClickVisible" :close-on-click-modal="false" :before-close="handleClose">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
{{ getCategory }}
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="门类" prop="categoryId">
<el-input v-model="form.categoryId" disabled />
</el-form-item>
<el-form-item label="年度" prop="archiveYear">
<el-select v-model="form.archiveYear" placeholder="请选择">
<el-option v-for="item in roles" :key="item.name" />
</el-select>
</el-form-item>
<el-form-item label="保管期限" prop="retention">
<el-select v-model="form.retention" placeholder="请选择">
<el-option v-for="item in roles" :key="item.name" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click.native="handleDeltConfirm">确定</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
// import { del, FetchCompletelyDelete } from '@/api/archivesManage/archivesList'
import { header, form } from '@crud/crud'
const defaultForm = { id: null, categoryId: null, archiveYear: null, retention: null }
export default {
name: 'OneClickDelt',
components: { },
mixins: [
header(),
form(defaultForm)
],
props: {
},
inject: ['recycleMain'],
data() {
return {
getCategory: null,
roles: [],
oneClickVisible: false,
rules: {
'categoryId': [
{ required: true, trigger: 'blur' }
],
'archiveYear': [
{ required: true, trigger: 'change' }
],
'retention': [
{ required: true, trigger: 'change' }
]
}
}
},
watch: {
},
created() {
},
mounted() {
console.log(this.getCategory)
this.form.categoryId = this.getCategory.cnName
},
methods: {
handleDeltConfirm() {
},
// -
handleClose(done) {
this.oneClickVisible = false
done()
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "~@/assets/styles/archives-manage.scss";
.oneClick{
::v-deep .el-dialog{
width: 940px;
}
}
</style>

242
src/views/archivesManage/fileImport/dataImport/index.vue

@ -7,60 +7,49 @@
<li :class="['dot-img', {'dot-img-active':isShow03}]" /> <li :class="['dot-img', {'dot-img-active':isShow03}]" />
<li><i :class="['step-img03', {'step-img03-active':isShow03}]" /><span>导入数据</span></li> <li><i :class="['step-img03', {'step-img03-active':isShow03}]" /><span>导入数据</span></li>
</ul> </ul>
<!-- <div class="import-title step01">上传数据包</div> -->
<div v-if="isShow01" class="step-content step-upload"> <div v-if="isShow01" class="step-content step-upload">
<el-upload
ref="upload"
:headers="headers"
:before-upload="beforeUpload"
:before-remove="beforeRemove"
:auto-upload="false"
:on-success="handleSuccess"
:on-error="handleError"
:on-remove="handleRemove"
:on-change="changeFile"
accept=".zip"
:file-list="fileList"
:action="fileUploadApi + '?name=' + name"
>
<div class="upload-container">
<input ref="fileInput" type="file" accept=".zip" @change="handleFileChange">
<div class="upload-zip"><i class="el-icon-upload2" />选择文件</div> <div class="upload-zip"><i class="el-icon-upload2" />选择文件</div>
<div slot="tip" class="el-upload__tip">上传限制文件类型zip</div>
</el-upload>
</div>
<div class="el-upload__tip">上传限制文件类型zip</div>
<div v-for="item in fileList" :key="item.name" class="file-list">
{{ item.name }}
<i class="el-icon-close" @click="deleteFile(item)" />
</div>
</div> </div>
<div v-if="isShow01" class="step-bottom-btn"> <div v-if="isShow01" class="step-bottom-btn">
<el-button type="primary" @click="handleStep01">下一步</el-button> <el-button type="primary" @click="handleStep01">下一步</el-button>
</div> </div>
<!-- <div class="import-title step02">读取数据</div> -->
<div v-if="isShow02" class="step-content"> <div v-if="isShow02" class="step-content">
<div class="import-data-number">案卷<span>5000</span> / 卷内<span>10000</span> / 资料<span>8000</span> </div>
<detail />
<div class="import-data-number">案卷<span>{{ ajnum }}</span> / 卷内<span>{{ danum }}</span> / 资料<span>{{ djnum }}</span> </div>
<detail ref="importTableList" />
</div> </div>
<div v-if="isShow02" class="step-bottom-btn"> <div v-if="isShow02" class="step-bottom-btn">
<el-button @click="handleReturn02">上一步</el-button> <el-button @click="handleReturn02">上一步</el-button>
<el-button type="primary" @click="handleStep02">下一步</el-button> <el-button type="primary" @click="handleStep02">下一步</el-button>
</div> </div>
<!-- <div class="import-title step03">导入数据</div> -->
<div v-if="isShow03" class="step-content step-content03"> <div v-if="isShow03" class="step-content step-content03">
<el-form ref="form" :model="form" label-width="160px"> <el-form ref="form" :model="form" label-width="160px">
<el-row> <el-row>
<el-form-item label="案卷及文件数据"> <el-form-item label="案卷及文件数据">
<el-checkbox v-model="form.file">导入</el-checkbox>
<el-checkbox v-model="form.importArchive">导入</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item label="遇到重复数据导入方式"> <el-form-item label="遇到重复数据导入方式">
<el-radio-group v-model="form.fileType">
<el-radio label="跳过" />
<el-radio label="覆盖" />
<el-radio-group v-model="form.archivesImportType">
<el-radio label="1">跳过</el-radio>
<el-radio label="2">覆盖</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <el-row>
<el-form-item label="资料数据"> <el-form-item label="资料数据">
<el-checkbox v-model="form.data">导入</el-checkbox>
<el-checkbox v-model="form.importInformation">导入</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item label="遇到重复数据导入方式">
<el-radio-group v-model="form.dataType">
<el-radio label="跳过" />
<el-radio label="覆盖" />
<el-form-item label="遇到重复数据导入方式" pr>
<el-radio-group v-model="form.informationInputType">
<el-radio label="1">跳过</el-radio>
<el-radio label="2">覆盖</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-row> </el-row>
@ -84,47 +73,98 @@
</template> </template>
<script> <script>
import crudFileImport from '@/api/archivesManage/fileImport'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getToken } from '@/utils/auth'
import detail from '../module/detail.vue' import detail from '../module/detail.vue'
export default { export default {
name: 'DataImport', name: 'DataImport',
components: { detail }, components: { detail },
data() { data() {
return { return {
name: '',
headers: {
Authorization: getToken()
},
file: null,
fileList: [],
ajnum: null,
danum: null,
djnum: null,
deleteVisible: false, deleteVisible: false,
zipName: null,
form: { form: {
file: true,
data: true,
fileType: '跳过',
dataType: '跳过'
importArchive: true,
importInformation: true,
archivesImportType: '1',
informationInputType: '1'
}, },
isShow01: true, isShow01: true,
isShow02: false, isShow02: false,
isShow03: false,
fileList: []
isShow03: false
} }
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
'baseApi',
'fileUploadApi'
'baseApi'
]) ])
}, },
created() { created() {
}, },
methods: { methods: {
handleFileChange(event) {
const files = event.target.files
this.file = files[0]
// const sizeLimit = this.file.size / 1024 / 1024 > 10
// if (sizeLimit) {
// this.$message.warning(' 10MB!')
// }
for (let i = 0; i < files.length; i++) {
this.fileList = []
this.fileList.push(files[i])
}
},
deleteFile(file) {
this.$confirm('此操作将清空所选数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.fileList.indexOf(file)
this.fileList.splice(index, 1)
this.file = null
this.$message({
type: 'success',
message: '删除成功!'
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleStep01() { handleStep01() {
if (this.fileList.length === 0) {
if (this.fileList.length !== 0) {
this.zipName = this.file.name.split('.')[0]
//
crudFileImport.zipUpload(this.baseApi + '/api/unzip/preview', this.file).then(res => {
console.log(res)
if (res.data.code === 200) {
if (res.data.data) {
this.isShow01 = false
this.isShow02 = true
//
crudFileImport.FetchInitImportPreview({ page: 0, size: 10, type: 1 }).then(res => {
console.log(res)
this.ajnum = res.ajnum
this.danum = res.danum
this.djnum = res.djnum
this.$refs.importTableList.tableData = res.list.content
this.$refs.importTableList.page.total = res.list.totalElements
})
}
}
})
} else {
this.$message.warning('请上传相关文件 !') this.$message.warning('请上传相关文件 !')
return return
} }
this.isShow01 = false
this.isShow02 = true
}, },
handleReturn02() { handleReturn02() {
this.fileList = [] this.fileList = []
@ -142,55 +182,26 @@ export default {
this.isShow02 = true this.isShow02 = true
this.isShow03 = false this.isShow03 = false
}, },
//
changeFile(file, fileList) {
if (fileList.length > 1) {
fileList.splice(0, 1)
}
this.fileList = fileList
},
// , , false Promise reject
beforeUpload(file) {
const sizeLimit = file.size / 1024 / 1024 > 10
if (sizeLimit) {
this.$message.warning('上传文件大小不能超过 10MB!')
}
const fileFamart = file.name.split('.')[file.name.split('.').length - 1]
if (fileFamart !== 'zip') {
this.$message.warning('必须上传zip格式的文件!')
}
return !sizeLimit && fileFamart === 'zip'
},
beforeRemove(file, fileList) {
return this.$confirm('此操作将清空所选数据, 是否继续?', '提示')
},
//
handleRemove(file, fileList) {
this.fileList = []
console.log(file, fileList)
},
//
handleError(e, file, fileList) {
const msg = JSON.parse(e.message)
this.$message({
message: msg.message,
type: 'error',
duration: 2500
})
this.loading = false
},
//
handleSuccess(response, file, fileList) {
// this.crud.notify('', CRUD.NOTIFICATION_TYPE.SUCCESS)
// this.$refs.upload.clearFiles()
// this.crud.status.add = CRUD.STATUS.NORMAL
// this.crud.resetForm()
// this.crud.toQuery()
},
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
alert('submit!')
//
const params = {
'archivesImportType': this.form.archivesImportType,
'importArchive': this.form.importArchive,
'importInformation': this.form.importInformation,
'informationInputType': this.form.informationInputType,
'name': this.zipName
}
crudFileImport.FetchImportZip(params).then(res => {
console.log(res)
if (res) {
this.$message({
type: 'success',
message: '导入成功!'
})
}
})
} else { } else {
console.log('error submit!!') console.log('error submit!!')
return false return false
@ -295,21 +306,44 @@ export default {
background-size: 30px 30px; background-size: 30px 30px;
} }
} }
.upload-zip{
// margin-left: 50px;
flex-direction: row !important;
width: 100px;
padding: 6px 10px;
margin-bottom: 10px;
font-size: 14px;
.upload-container{
position: relative;
input{
position: absolute;
left: 50%;
top: 50%;
transform:translate(-50%,-50%);
opacity: 0;
border: 1px solid #000;
}
.upload-zip{
flex-direction: row !important;
width: 100px;
padding: 6px 10px;
font-size: 14px;
color: #fff;
border: 1px solid #339cff;
background-color: transparent;
border-radius: 3px;
& i{
margin-right: 4px;
}
}
}
.el-upload__tip{
text-align: center;
}
.file-list{
font-size: 16px;
color: #fff; color: #fff;
border: 1px solid #339cff;
background-color: transparent;
border-radius: 3px;
& i{
margin-right: 4px;
text-align: center;
margin-top: 20px;
i{
font-size: 12px;
cursor: pointer;
} }
} }
::v-deep .el-upload{ ::v-deep .el-upload{
display: block; display: block;
} }

1
src/views/archivesManage/fileImport/index.vue

@ -16,6 +16,7 @@
</template> </template>
<script> <script>
import dataImport from './dataImport/index.vue' import dataImport from './dataImport/index.vue'
import importLog from './importLog/index.vue' import importLog from './importLog/index.vue'
export default { export default {

44
src/views/archivesManage/fileImport/module/detail.vue

@ -13,21 +13,21 @@
@row-click="clickRowHandler" @row-click="clickRowHandler"
@selection-change="selectionChangeHandler" @selection-change="selectionChangeHandler"
> >
<el-table-column prop="security_class" label="密级" align="center" width="80px" />
<el-table-column prop="medium_type" label="载体类型" align="center" width="100px" />
<el-table-column prop="micro_number" label="缩微号" align="center" width="80px" />
<el-table-column prop="archive_no" label="档号" align="center" width="200px" />
<el-table-column prop="page_qty" label="文件件数" align="center" width="100px" />
<el-table-column prop="securityClass" label="密级" align="center" width="80px" />
<el-table-column prop="mediumType" label="载体类型" align="center" width="100px" />
<el-table-column prop="microfilm" label="缩微号" align="center" width="80px" />
<el-table-column prop="archiveNo" label="档号" align="center" width="240px" />
<el-table-column prop="pieceQty" label="文件件数" align="center" width="100px" />
<el-table-column prop="maintitle" label="案卷题名" align="center" show-overflow-tooltip width="240px" /> <el-table-column prop="maintitle" label="案卷题名" align="center" show-overflow-tooltip width="240px" />
<el-table-column prop="begin_date" label="起始时间" align="center" width="140px" />
<el-table-column prop="end_date" label="终止时间" align="center" width="140px" />
<el-table-column prop="archive_ctg_no" label="分类号" align="center" width="140px" />
<el-table-column prop="subject_term" label="主题词" align="center" width="140px" />
<el-table-column prop="beginDate" label="起始时间" align="center" width="140px" />
<el-table-column prop="endDate" label="终止时间" align="center" width="140px" />
<el-table-column prop="archiveCtgNo" label="分类号" align="center" width="140px" />
<el-table-column prop="keyword" label="主题词" align="center" width="140px" />
<el-table-column prop="remarks" label="附注" align="center" width="120px" /> <el-table-column prop="remarks" label="附注" align="center" width="120px" />
<el-table-column prop="retention" label="保管期限" align="center" width="120px" /> <el-table-column prop="retention" label="保管期限" align="center" width="120px" />
<el-table-column prop="archive_year" label="年度" align="center" width="100px" />
<el-table-column prop="fonds_no" label="全宗" align="center" width="100px" />
<el-table-column prop="piece_no" label="卷号" align="center" width="100px" />
<el-table-column prop="archiveYear" label="年度" align="center" width="100px" />
<el-table-column prop="fondsNo" label="全宗" align="center" width="100px" />
<el-table-column prop="recordNo" label="卷号" align="center" width="100px" />
</el-table> </el-table>
<!--分页组件--> <!--分页组件-->
<el-pagination <el-pagination
@ -43,7 +43,8 @@
</template> </template>
<script> <script>
import tableJson from './table.json'
// import tableJson from './table.json'
import crudFileImport from '@/api/archivesManage/fileImport'
export default { export default {
name: 'DataImport', name: 'DataImport',
components: { }, components: { },
@ -52,18 +53,28 @@ export default {
archivesTabIndex: 0, archivesTabIndex: 0,
tableData: [], tableData: [],
page: { page: {
page: 1,
page: 0,
size: 10, size: 10,
total: 0 total: 0
} }
} }
}, },
created() { created() {
this.tableData = tableJson
}, },
methods: { methods: {
changeActiveTab(index) { changeActiveTab(index) {
this.archivesTabIndex = index this.archivesTabIndex = index
this.getList()
},
getList() {
//
crudFileImport.FetchInitImportPreview({ page: this.page.page - 1, size: this.page.size, type: this.archivesTabIndex + 1 }).then(res => {
this.ajnum = res.ajnum
this.danum = res.danum
this.djnum = res.djnum
this.tableData = res.list.content
this.page.total = res.list.totalElements
})
}, },
// table // table
clickRowHandler(row) { clickRowHandler(row) {
@ -76,9 +87,10 @@ export default {
handleSizeChange(size) { handleSizeChange(size) {
this.page.size = size this.page.size = size
this.page.page = 1 this.page.page = 1
this.getList()
}, },
handleCurrentPage(val) { handleCurrentPage(val) {
this.page.page = val
this.page.page = val - 1
} }
} }
} }

Loading…
Cancel
Save