Browse Source

批量挂接

master
xuhuajiao 1 year ago
parent
commit
a837ac8b2a
  1. 8
      src/api/collect/collect.js
  2. 18
      src/utils/upload.js
  3. 86
      src/views/collectReorganizi/batchConnection/index.vue
  4. 98
      src/views/collectReorganizi/batchConnection/module/detail.vue
  5. 71
      src/views/collectReorganizi/batchConnection/module/form.vue
  6. 13
      src/views/collectReorganizi/batchConnection/table.json
  7. 26
      src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue
  8. 2
      src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/index.vue

8
src/api/collect/collect.js

@ -275,6 +275,14 @@ export function FetchBecomeDocument(data) {
})
}
export function FetchInitMountDetailsList(params) {
return request({
url: 'api/collect/initMountDetailsList',
method: 'get',
params
})
}
export default {
collectAdd,
collectEdit,

18
src/utils/upload.js

@ -66,3 +66,21 @@ export function modelUpload(api, file, name) {
return axios.post(api, data, config)
}
// 收集库 - 批量挂接
export function batchMountUpload(api, file, params) {
var data = new FormData()
for (const item in file) { // 现在
data.append('file', file[item])
}
data.append('categoryId', params.categoryId)
data.append('mountType', params.mountType)
data.append('checkRepeatType', params.checkRepeatType)
data.append('matchingMode', params.matchingMode)
data.append('fields', params.fields)
const config = {
headers: {
'Authorization': getToken()
}
}
return axios.post(api, data, config)
}

86
src/views/collectReorganizi/batchConnection/index.vue

@ -8,6 +8,7 @@
<div class="head-search">
<date-range-picker v-model="blurryTime" class="date-item" />
<rrOperation />
<el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
</div>
<crudOperation>
<template v-slot:right>
@ -24,18 +25,31 @@
</div>
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler" @row-dblclick="handleDetail">
<el-table-column type="selection" align="center" width="55" />
<el-table-column prop="code" label="编号" width="300" />
<el-table-column prop="create_by" label="操作人" width="100" />
<el-table-column prop="create_time" label="操作时间">
<el-table-column prop="id" label="编号" width="120" show-overflow-tooltip />
<el-table-column prop="createBy" label="操作人" />
<el-table-column prop="createTime" label="操作时间" width="200">
<template slot-scope="scope">
<div>{{ scope.row.create_time | parseTime }}</div>
<div>{{ scope.row.createTime | parseTime }}</div>
</template>
</el-table-column>
<el-table-column prop="checkRepeatType" label="重复检验方式" align="center">
<template slot-scope="scope">
{{ scope.row.checkRepeatType === 1 ? '跳过' : (scope.row.checkRepeatType === 2 ? '覆盖' : '追加') }}
</template>
</el-table-column>
<el-table-column prop="queryDetails" label="挂接字段" min-width="200">
<template slot-scope="scope">
{{ scope.row.queryDetails.split(",").map(item => "$" + item + "$").join("") }}
</template>
</el-table-column>
<el-table-column prop="matchingMode" label="匹配模式" align="center">
<template slot-scope="scope">
{{ scope.row.matchingMode === 1 ? '全量匹配' : (scope.row.checkRepeatType === 2 ? '前缀模糊匹配' : '后缀模糊匹配') }}
</template>
</el-table-column>
<el-table-column prop="type" label="重复检验方式" />
<el-table-column prop="filed" label="挂接字段" />
<el-table-column prop="total" label="挂接结果" width="240">
<template slot-scope="scope">
<div> {{ scope.row.total }} 条原文成功<span class="success-status"> {{ scope.row.success }} </span>失败<span class="error-status"> {{ scope.row.error }} </span></div>
<div> {{ scope.row.total }} 条原文成功<span class="success-status"> {{ scope.row.successNum }} </span>失败<span class="error-status"> {{ scope.row.failNum }} </span></div>
</template>
</el-table-column>
</el-table>
@ -49,8 +63,7 @@
</template>
<script>
// import crudConnection from '@/api/system/role'
import crudRoles from '@/api/system/role'
import CRUD, { presenter, header, crud } from '@crud/crud'
import DateRangePicker from '@/components/DateRangePicker'
import rrOperation from '@crud/RR.operation'
@ -59,25 +72,23 @@ import pagination from '@crud/Pagination'
import CategoryTree from '@/views/components/categoryTree'
import LocalForm from './module/form'
import HitchDetail from './module/detail'
// import { exportFile } from '@/utils/index'
// import qs from 'qs'
import { exportFile } from '@/utils/index'
import qs from 'qs'
import { mapGetters } from 'vuex'
import tableData from './table.json'
export default {
name: 'BatchConnection',
components: { CategoryTree, LocalForm, HitchDetail, DateRangePicker, rrOperation, crudOperation, pagination },
cruds() {
return [
CRUD({
title: '批量挂接', url: 'api/role/initRoleList',
crudMethod: { ...crudRoles },
title: '批量挂接', url: 'api/collect/initMountList',
crudMethod: {},
optShow: {
add: false,
edit: false,
del: false,
reset: true,
reset: false,
download: false,
group: false
}
@ -97,7 +108,17 @@ export default {
computed: {
...mapGetters([
'baseApi'
])
]),
collectLevel() {
if (this.currentCategory.arrangeType === 1) {
return 3
} else if (this.currentCategory.arrangeType === 2) {
return 2
} else if (this.currentCategory.arrangeType === 3) {
return 1
}
return null
}
},
created() {
},
@ -111,18 +132,32 @@ export default {
}
},
[CRUD.HOOK.afterRefresh]() {
this.crud.data = tableData
},
resetQuery() {
this.blurryTime = []
this.crud.query.startTime = ''
this.crud.query.endTime = ''
this.crud.refresh()
},
handleNodeClick(data) {
this.currentCategory = data
if (data) {
this.crud.query.categoryId = data.id
this.crud.refresh()
}
},
doLoalHitch() {
this.$nextTick(() => {
this.$refs.localForm.localHitchVisible = true
})
},
handleDetail() {
handleDetail(row) {
this.$refs.mDetail.hitchDetialVisible = true
this.$nextTick(() => {
this.$refs.mDetail.hitchObject = row
this.$refs.mDetail.mountId = row.id
this.$refs.mDetail.getInitMountDetailsList(row.id)
})
},
doExport(data) {
crud.downloadLoading = true
@ -132,14 +167,11 @@ export default {
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
const ids = []
data.forEach(val => {
ids.push(val.id)
})
// const params = {
// 'roleIds': ids
// }
// exportFile(this.baseApi + '/api/role/exportRole?' + qs.stringify(params, { indices: false }))
const ids = data.map(item => item.id)
const params = {
'mountIds': ids
}
exportFile(this.baseApi + '/api/collect/exportMount?' + qs.stringify(params, { indices: false }))
}).catch(() => {
})
}

98
src/views/collectReorganizi/batchConnection/module/detail.vue

@ -3,68 +3,102 @@
<el-dialog title="挂接详情" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="hitchDetialVisible">
<div class="setting-dialog">
<ul class="hitch-info">
<li><span>操作编号</span>e57d742c-7d0d-4704-a12a-f9d8d2777d24</li>
<li><span style="width: 114px;">重复验证方式</span>跳过</li>
<li><span>操作人</span>admin</li>
<li><span style="width: 114px;">操作时间</span>2016-09-21 08:50:08</li>
<li style="width: 100%;"><span>挂接字段</span>$archival_code$</li>
<li style="width: 100%;"><span>挂接结果</span> 2 条原文成功 <i class="success-status">1</i> 失败 <i class="error-status">1</i> </li>
<li><span>操作编号</span>{{ hitchObject && hitchObject.id }}</li>
<li><span style="width: 114px;">重复验证方式</span>{{ hitchObject && hitchObject.checkRepeatType === 1 ? '跳过' : (hitchObject && hitchObject.checkRepeatType === 2 ? '覆盖' : '追加') }}</li>
<li><span>操作人</span>{{ hitchObject && hitchObject.createBy }}</li>
<li><span style="width: 114px;">操作时间</span>{{ hitchObject && hitchObject.createTime | parseTime }}</li>
<li><span>挂接字段</span>{{ hitchObject && hitchObject.queryDetails.split(",").map(item => "$" + item + "$").join("") }}</li>
<li><span style="width: 114px;">匹配模式</span>{{ hitchObject && hitchObject.matchingMode === 1 ? '全量匹配' : (hitchObject && hitchObject.checkRepeatType === 2 ? '前缀模糊匹配' : '后缀模糊匹配') }}</li>
<li style="width: 100%;"><span>挂接结果</span> {{ hitchObject &&hitchObject.total }} 条原文成功 <i class="success-status"> {{ hitchObject &&hitchObject.successNum }}</i> 失败 <i class="error-status"> {{ hitchObject &&hitchObject.failNum }}</i> </li>
</ul>
<el-table ref="table" :data="tableData" style="width: 100%;">
<el-table-column prop="name" label="文件名称" />
<el-table-column prop="res" label="操作结果" width="100px" align="center">
<el-table ref="table" v-loading="tableLoading" :data="tableData" style="width: 100%;">
<el-table-column prop="fileName" label="文件名称" />
<el-table-column prop="mountResult" label="操作结果" width="100px" align="center">
<template slot-scope="scope">
<span v-if="scope.row.res===1" class="row-state end-state">成功</span>
<span v-if="scope.row.mountResult===1" class="row-state end-state">成功</span>
<span v-else class="row-state cancel-state">失败</span>
</template>
</el-table-column>
<el-table-column prop="detail" label="详情" />
<el-table-column prop="reason" label="详情" />
<el-table-column prop="create_time" label="操作时间">
<template slot-scope="scope">
<div>{{ scope.row.create_time | parseTime }}</div>
</template>
</el-table-column>
<el-table-column prop="archives" label="所属档案" />
<el-table-column prop="archivesNo" label="所属档案">
<template slot-scope="scope">
<div>{{ '('+scope.row.archivesNo +')'+ scope.row.maintitle }}</div>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
v-if="tableData.length !== 0"
:current-page="page.page"
:total="page.total"
:page-size="page.size"
:pager-count="5"
layout="total, prev, pager, next, sizes"
@size-change="handleSizeChange"
@current-change="handleCurrentPage"
/>
</div>
</el-dialog>
</template>
<script>
const data = [
{
'id': '005E76FEC5A2AAB368CA1F',
'name': 'xxxxxxxxxxxxxxxx.doc',
'res': 1,
'detail': '1条原文数据追加成功!',
'archives': '档号+题名',
'create_time': 1687330805000
},
{
'id': '005E76FEC5A2AAB368CA1F',
'name': 'xxxxxxxxxxxxxxxx.doc',
'res': 0,
'detail': '1条原文数据追加成功!',
'archives': '档号+题名',
'create_time': 1687330805000
}
]
import { FetchInitMountDetailsList } from '@/api/collect/collect'
export default {
name: 'ConnectionDetail',
components: { },
mixins: [],
data() {
return {
tableLoading: false,
hitchDetialVisible: false,
tableData: []
hitchObject: null,
tableData: [],
mountId: null,
page: {
page: 1,
size: 10,
total: 0
}
}
},
created() {
},
mounted() {
this.tableData = data
},
methods: {
getInitMountDetailsList(mountId) {
this.tableLoading = true
const params = {
'mountId': mountId,
'page': this.page.page - 1,
'size': this.page.size
}
FetchInitMountDetailsList(params).then((res) => {
if (res.code !== 500) {
this.tableData = res.content
this.page.total = res.totalElements
} else {
this.$message.error('获取失败')
}
this.tableLoading = false
}).catch(err => {
console.log(err)
})
},
handleSizeChange(size) {
this.page.size = size
this.page.page = 1
this.getInitMountDetailsList(this.mountId)
},
handleCurrentPage(val) {
this.page.page = val
this.getInitMountDetailsList(this.mountId)
}
}
}
</script>

71
src/views/collectReorganizi/batchConnection/module/form.vue

@ -22,13 +22,13 @@
/>
</el-select>
</el-form-item>
<el-form-item label="挂接详情" prop="hitchRemark">
<el-form-item label="挂接详情" prop="fields">
<div class="tag-wrapper">
<el-tag v-for="item in hitchRemarkArray" :key="item" :closable="item !== '*'" @close="removeTag(item)">
{{ item }}
</el-tag>
</div>
<el-input v-model="form.hitchRemark" style="display: none;" type="hidden" />
<el-input v-model="form.fields" style="display: none;" type="hidden" />
</el-form-item>
<el-form-item label="匹配模式" prop="matchingMode">
<el-select v-model="form.matchingMode" placeholder="请选择" style="width: 400px;" @change="changeMatchedType">
@ -64,11 +64,14 @@
</template>
<script>
import { crud } from '@crud/crud'
import { FetchInitCategoryInputFieldByPid } from '@/api/system/category/category'
import { batchMountUpload } from '@/utils/upload'
import { mapGetters } from 'vuex'
export default {
name: 'LocalHitch',
components: { },
mixins: [],
mixins: [crud()],
props: {
currentCategory: {
type: Object,
@ -85,7 +88,7 @@ export default {
checkRepeatType: null,
hitchFiled: null,
matchingMode: 1,
hitchRemark: null,
fields: null,
file: null
},
fileList: [],
@ -125,19 +128,19 @@ export default {
hitchFiled: [
{ required: true, message: '请选择', trigger: 'change' }
],
hitchRemark: [
fields: [
{ required: true, message: '请选择上面挂接字段生成挂接详情', trigger: 'blur' }
],
matchingMode: [
{ required: true, message: '请选择', trigger: 'change' }
],
file: [
{ required: true, message: '请选择', trigger: 'change' }
]
}
}
},
computed: {
...mapGetters([
'baseApi'
]),
collectLevel() {
if (this.currentCategory.arrangeType === 1) {
return 3
@ -152,7 +155,6 @@ export default {
created() {
},
mounted() {
},
methods: {
opened() {
@ -160,30 +162,49 @@ export default {
},
handleFile(event) {
const files = event.target.files
console.log(files)
for (let i = 0; i < files.length; i++) {
this.fileList = []
this.fileList.push(files[i])
// this.form.file = files[i]
}
},
handleComfired() {
if (this.hitchRemarkArray.length !== 0) {
if (this.hitchRemarkArray.length === 1) {
const index = this.hitchRemarkArray.indexOf('*')
if (index !== -1) {
this.form.hitchRemark = ''
}
} else {
this.form.hitchRemark = this.hitchRemarkArray.join('')
}
if (this.fileList.length === 0) {
this.$message.info('请先选择相关文件!')
return false
}
if (this.hitchRemarkArray.length === 1 && this.hitchRemarkArray[0] === '*') {
this.form.fields = ''
} else {
this.form.hitchRemark = ''
this.form.fields = this.hitchRemarkArray.join('')
}
console.log(this.form)
this.$refs['form'].validate((valid) => {
if (valid) {
this.localHitchVisible = false
let newhitchRemark = this.hitchRemarkArray.map(item => item.replace(/^\$|\$$|\*$/g, ''))
newhitchRemark = newhitchRemark.filter(item => item !== '')
const params = {
'categoryId': this.currentCategory.id,
'mountType': 1, // 1. 2. 3. 1
'checkRepeatType': this.form.checkRepeatType,
'matchingMode': this.form.matchingMode,
'fields': newhitchRemark
}
console.log(params)
batchMountUpload(this.baseApi + '/api/collect/batchMount',
this.fileList,
params
).then(res => {
console.log(res)
if (res.data.code === 200) {
console.log(res.data.data)
this.$message.success('操作成功')
this.localHitchVisible = false
} else {
this.$message.error('上传附件失败!')
}
this.crud.refresh()
})
} else {
return false
}
@ -207,7 +228,7 @@ export default {
selectFiled(val) {
if (val) {
if (this.hitchRemarkArray && this.hitchRemarkArray.includes('$' + val + '$')) {
this.$message.warning('请注意当前选择的挂接字段,在挂接详情内已存在!')
this.$message.info('请注意当前选择的挂接字段,在挂接详情内已存在!')
} else {
const lastItemIndex = this.hitchRemarkArray.length - 1
const index = this.hitchRemarkArray.indexOf('*')
@ -250,7 +271,7 @@ export default {
handleCancel() {
this.$refs.form.resetFields()
this.hitchRemarkArray = []
this.form.file = null
this.fileList = []
this.localHitchVisible = false
}
}

13
src/views/collectReorganizi/batchConnection/table.json

@ -1,13 +0,0 @@
[
{
"id": "005E76FEC5A2AAB368CA1F",
"code": "e57d742c-7d0d-4704-a12a-f9d8d2777d24",
"type": "跳过",
"filed": "$archival_code$",
"total": 5,
"success": 5,
"error": 0,
"create_by": "admin",
"create_time": 1687330805000
}
]

26
src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue

@ -927,32 +927,6 @@ export default {
return false
}
this.$refs.archivesFillingRef.archivesFillingVisible = true
// this.$confirm('' + '<span></span>', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning',
// dangerouslyUseHTMLString: true
// }).then(() => {
// const archivesIds = this.selections.map(item => item.id)
// const params = {
// 'categoryId': this.selectedCategory.id,
// 'categoryLevel': this.collectLevel,
// 'archivesIds': archivesIds
// }
// console.log(params)
// FetchBecomeDocumentConfirm(params).then((res) => {
// console.log(res)
// if (res.code !== 500) {
// this.crud.notify('', CRUD.NOTIFICATION_TYPE.SUCCESS)
// this.handleSearch(this.collectLevel)
// } else {
// this.crud.notify('', CRUD.NOTIFICATION_TYPE.ERROR)
// }
// }).catch(err => {
// console.log(err)
// })
// }).catch(() => {
// })
},
// 退
handleReturn() {

2
src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/index.vue

@ -164,7 +164,7 @@ export default {
this.$emit('close-dialog')
this.uploadVisible = false
} else {
this.$message.error('上传附件失败!')
this.$message.error('操作失败!')
}
})
} else {

Loading…
Cancel
Save