You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
522 lines
19 KiB
522 lines
19 KiB
<template>
|
|
<div class="app-container">
|
|
<!-- 门类列表 -->
|
|
<div class="container-main">
|
|
<div class="elect-cont-left">
|
|
<TreeList ref="treeList" @nodeClick="handleNodeClick" />
|
|
</div>
|
|
<div v-if="selectedDocument.isType!==1" class="elect-cont-right">
|
|
<!--工具栏-->
|
|
<div class="head-container" :style="isRecycle?'display:flex;justify-content: space-between; align-items: center;':'' ">
|
|
<div class="head-search" :style="isRecycle?'margin: 0;':''">
|
|
<!-- 搜索 -->
|
|
<el-input v-model="query.search" clearable size="small" placeholder="输入题名搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
|
<rrOperation />
|
|
<el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
|
|
</div>
|
|
<crudOperation v-if="!isRecycle" :permission="permission">
|
|
<template v-slot:left>
|
|
<!-- 新增 -->
|
|
<el-button size="mini" @click="handleForm('add')"><i class="iconfont icon-xinzeng" />新增</el-button>
|
|
<!-- 修改 -->
|
|
<el-button size="mini" :disabled="crud.selections.length !== 1" @click="handleForm('edit')"><i class="iconfont icon-bianji" />编辑</el-button>
|
|
<!-- 删除btn 多选 -->
|
|
<el-button size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)"><i class="iconfont icon-shanchu" />删除</el-button>
|
|
<el-button :loading="crud.downloadLoading" size="mini" :disabled="crud.selections.length === 0" @click="doExport(crud.selections)">
|
|
<i class="iconfont icon-daochu" />
|
|
导出
|
|
</el-button>
|
|
</template>
|
|
<template v-slot:rightButtonGroup>
|
|
<div>
|
|
<el-button size="mini" :disabled="crud.selections.length === 0" @click="doPrint(crud.selections)"><i class="iconfont icon-dayin" />打印处理单</el-button>
|
|
</div>
|
|
</template>
|
|
</crudOperation>
|
|
<div v-if="isRecycle">
|
|
<el-button size="mini" type="success" @click="toRecover"><i class="iconfont icon-huifu" />恢复</el-button>
|
|
<el-button size="mini" type="success" @click="toCompletelyDelete"><i class="iconfont icon-shanchu" />彻底删除</el-button>
|
|
</div>
|
|
</div>
|
|
<!--表格渲染-->
|
|
<div class="container-right">
|
|
<span class="right-top-line" />
|
|
<span class="left-bottom-line" />
|
|
<el-table
|
|
ref="table"
|
|
v-loading="crud.loading"
|
|
class="archives-table"
|
|
:data="crud.data"
|
|
style="width: 100%;"
|
|
@row-click="clickRowHandler"
|
|
@select="crud.selectChange"
|
|
@select-all="crud.selectAllChange"
|
|
@selection-change="crud.selectionChangeHandler"
|
|
@cell-dblclick="tableDoubleClick"
|
|
>
|
|
<el-table-column type="selection" align="center" width="55" />
|
|
<el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
|
|
<template slot="header">
|
|
<el-tooltip
|
|
class="item"
|
|
effect="dark"
|
|
:content="field.fieldCnName"
|
|
placement="top-start"
|
|
>
|
|
<span>{{ field.fieldCnName }}</span>
|
|
</el-tooltip>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<!-- 仅针对read_type字段添加特殊处理 -->
|
|
<span
|
|
v-if="field.fieldName === 'read_type'"
|
|
:class="{
|
|
'row-state row-packing': scope.row.read_type === '未传阅',
|
|
'row-state row-warehousing state-active': scope.row.read_type === '传阅中',
|
|
'row-state row-binding state-active': scope.row.read_type === '已完成',
|
|
}"
|
|
>
|
|
{{ scope.row[field.fieldName] }}
|
|
</span>
|
|
<span v-else>{{ scope.row[field.fieldName] }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--分页组件-->
|
|
<pagination v-if="crud.data.length !== 0" />
|
|
</div>
|
|
<detail ref="archivesInfo" :selected-document="selectedDocument" />
|
|
|
|
<!--新增 / 编辑 表单组件-->
|
|
<el-dialog class="preview-dialog" :modal-append-to-body="false" :close-on-click-modal="false" append-to-body :before-close="closeDialog" :visible="formVisible" :title="formTitle">
|
|
<span class="dialog-right-top" />
|
|
<span class="dialog-left-bottom" />
|
|
<div class="setting-dialog">
|
|
<PreviewForm
|
|
ref="previewForm"
|
|
:form-preview-data.sync="formPreviewData"
|
|
:selected-category="selectedCategory"
|
|
:parents-id="parentsId"
|
|
:arc-id="arcId"
|
|
:is-des-form-type="isDesFormType"
|
|
:is-disabled="isDisabled"
|
|
:selected-document="selectedDocument"
|
|
:is-has-code="isHasCode"
|
|
@close-dialog="closeDialog"
|
|
@formLoadingShow="formLoadingShow"
|
|
@refreshTree="refreshTreeList"
|
|
/>
|
|
<div slot="footer" class="dialog-footer" style="margin-top: 20px !important;">
|
|
<el-button type="text" @click="closeDialog">取消</el-button>
|
|
<el-button :loading="archivesBtnLoading" type="primary" @click="handlerArchivesSubmit">保存</el-button>
|
|
<!-- @click="handlerArchivesSubmit" -->
|
|
<el-button :loading="bindSaveLoading" type="primary">保存并绑定标签</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
<!--表单组件-->
|
|
<el-dialog class="tip-dialog" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body title="提示" :visible.sync="printVisible">
|
|
<div class="setting-dialog">
|
|
<div class="tip-content">
|
|
<p class="tipMsg">此操作将打印所选公文库数据</p>
|
|
</div>
|
|
<el-radio-group v-model="printType" style="padding-left: 36px;">
|
|
<el-radio :label="0">套打</el-radio>
|
|
<el-radio :label="1">彩打</el-radio>
|
|
</el-radio-group>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click.native="printVisible = false">取消</el-button>
|
|
<el-button type="primary" @click.native="handlePrint">确定</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import CRUD, { presenter, header } from '@crud/crud'
|
|
import { miodLibraryCrud } from './mixins/index'
|
|
import crudDocumentArchives, { FetchDelArchives } from '@/api/system/documentArchives'
|
|
import rrOperation from '@crud/RR.operation'
|
|
import crudOperation from '@crud/CRUD.operation'
|
|
import pagination from '@crud/Pagination'
|
|
import TreeList from './treeList'
|
|
import PreviewForm from '@/views/components/category/PreviewForm'
|
|
import detail from './module/detail'
|
|
import { exportFile } from '@/utils/index'
|
|
import qs from 'qs'
|
|
import { mapGetters } from 'vuex'
|
|
|
|
export default {
|
|
name: 'MiodLibrary',
|
|
components: { TreeList, PreviewForm, detail, rrOperation, crudOperation, pagination },
|
|
cruds() {
|
|
return [
|
|
CRUD({
|
|
title: '收发文', url: 'api/documentArchives/initPreDocument',
|
|
crudMethod: { ...crudDocumentArchives },
|
|
optShow: {
|
|
add: false,
|
|
edit: false,
|
|
del: false,
|
|
download: false,
|
|
group: false,
|
|
reset: false
|
|
},
|
|
queryOnPresenterCreated: false
|
|
})
|
|
]
|
|
},
|
|
provide() {
|
|
return {
|
|
parentsData: this
|
|
}
|
|
},
|
|
mixins: [presenter(), header(), miodLibraryCrud],
|
|
props: {
|
|
isRecycle: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
isdel: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
archivesBtnLoading: false,
|
|
bindSaveLoading: false,
|
|
permission: {
|
|
add: ['admin', 'prearchiveLibrary:add'],
|
|
edit: ['admin', 'prearchiveLibrary:edit'],
|
|
del: ['admin', 'prearchiveLibrary:del'],
|
|
sort: ['admin', 'prearchiveLibrary:sort']
|
|
},
|
|
tableDisplayFields: [], // table-list-title字段
|
|
arrySort: [],
|
|
selectedDocument: {},
|
|
form: {},
|
|
formVisible: false,
|
|
formTitle: '新增文件',
|
|
formPreviewData: [],
|
|
selectedCategory: null,
|
|
parentsId: null,
|
|
arcId: null,
|
|
isDesFormType: 'miodLibrary',
|
|
isDisabled: false,
|
|
isHasCode: false,
|
|
printVisible: false,
|
|
printType: 0
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters([
|
|
'baseApi'
|
|
])
|
|
},
|
|
watch: {
|
|
isdel: function(newValue, oldValue) {
|
|
},
|
|
isRecycle: function(newValue, oldValue) {
|
|
}
|
|
},
|
|
created() {
|
|
},
|
|
methods: {
|
|
refreshTreeList() {
|
|
this.$refs.treeList.refreshData()
|
|
},
|
|
resetQuery() {
|
|
if (this.selectedDocument.isType === 3) {
|
|
this.crud.query.docDepartment = this.selectedDocument.label
|
|
this.crud.query.archiveYear = null
|
|
this.crud.query.search = null
|
|
} else if (this.selectedDocument.isType === 4) {
|
|
this.crud.query.docDepartment = null
|
|
this.crud.query.archiveYear = this.selectedDocument.label
|
|
this.crud.query.search = null
|
|
} else {
|
|
this.crud.query.search = null
|
|
this.crud.query.docDepartment = null
|
|
this.crud.query.archiveYear = null
|
|
}
|
|
this.crud.toQuery()
|
|
},
|
|
[CRUD.HOOK.beforeRefresh]() {
|
|
if (this.selectedDocument.isType === 2) {
|
|
this.crud.query.documentId = this.selectedDocument.id
|
|
} else {
|
|
this.crud.query.documentId = this.selectedDocument.documentId
|
|
}
|
|
this.crud.query.isdel = this.isdel
|
|
// this.crud.query.ignore = false
|
|
this.crud.query.fondsAffiliation = this.selectedDocument.fondsId
|
|
this.crud.query.sort = this.arrySort
|
|
},
|
|
formLoadingShow(loadingType) {
|
|
this.archivesBtnLoading = loadingType
|
|
},
|
|
handleNodeClick(data) {
|
|
this.selectedDocument = data
|
|
let documentId = null
|
|
if (data.isType === 2) {
|
|
documentId = data.id
|
|
} else {
|
|
documentId = data.documentId
|
|
}
|
|
this.getInitDocumentsViewTable(documentId)
|
|
},
|
|
// table字段项
|
|
getInitDocumentsViewTable(documentId) {
|
|
crudDocumentArchives.FetchInitDocumentsViewTable({ documentId: documentId }).then(data => {
|
|
if (data) {
|
|
this.arrySort = []
|
|
this.tableDisplayFields = data
|
|
const orderSortArry = this.tableDisplayFields.filter(item => item.queue).sort((a, b) => a.queue - b.queue)
|
|
orderSortArry.forEach(item => {
|
|
if (item.displayOrderBy) {
|
|
this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
|
|
}
|
|
})
|
|
this.$nextTick(() => {
|
|
if (this.selectedDocument.isType === 3) {
|
|
this.crud.query.docDepartment = this.selectedDocument.label
|
|
this.crud.query.archiveYear = null
|
|
} else if (this.selectedDocument.isType === 4) {
|
|
this.crud.query.docDepartment = null
|
|
this.crud.query.archiveYear = this.selectedDocument.label
|
|
} else {
|
|
this.crud.query.search = null
|
|
this.crud.query.docDepartment = null
|
|
this.crud.query.archiveYear = null
|
|
}
|
|
this.crud.toQuery()
|
|
})
|
|
}
|
|
})
|
|
},
|
|
handleForm(type) {
|
|
const { selectedDocument, crud } = this
|
|
|
|
if (!selectedDocument) {
|
|
console.warn('selectedDocument 未定义,无法继续操作')
|
|
return
|
|
}
|
|
|
|
this.selectedCategory = selectedDocument
|
|
this.isDesFormType = 'miodLibrary'
|
|
|
|
let documentId
|
|
if (selectedDocument.isType === 2) {
|
|
documentId = selectedDocument.id
|
|
} else {
|
|
documentId = selectedDocument.documentId
|
|
}
|
|
|
|
const params = { documentId }
|
|
|
|
if (type === 'add') {
|
|
this.formTitle = '新增文件'
|
|
params.archivesId = null
|
|
} else if (type === 'edit') {
|
|
this.formTitle = '编辑文件'
|
|
const { id: archivesId } = crud.selections[0]
|
|
this.arcId = archivesId
|
|
params.archivesId = archivesId
|
|
}
|
|
|
|
this.getFormInfo(params, type)
|
|
},
|
|
|
|
getFormInfo(params, type) {
|
|
crudDocumentArchives.FetchDoeditDocument(params).then(data => {
|
|
console.log('data', data)
|
|
const showFiledAll = data.showFiled.filter(item => item.isSequence).sort((a, b) => a.isSequence - b.isSequence)
|
|
this.$nextTick(() => {
|
|
this.formPreviewData = showFiledAll
|
|
this.formVisible = true
|
|
this.$nextTick(() => {
|
|
this.$refs.previewForm.fileOriginal = null
|
|
this.$refs.previewForm.fileJsonString = null
|
|
if (type === 'edit') {
|
|
this.$refs.previewForm.archivesType = 'edit'
|
|
this.$refs.previewForm.addOrUpdateForm = data.echo
|
|
if (data.fileecho) {
|
|
const fileecho = []
|
|
fileecho.push(data.fileecho)
|
|
this.$refs.previewForm.fileOriginal = fileecho[0].file_name
|
|
this.$refs.previewForm.fileJsonString = JSON.stringify(fileecho)
|
|
} else {
|
|
this.$refs.previewForm.fileOriginal = ''
|
|
this.$refs.previewForm.fileJsonString = ''
|
|
}
|
|
} else {
|
|
this.$refs.previewForm.archivesType = 'add'
|
|
}
|
|
})
|
|
})
|
|
})
|
|
},
|
|
handlerArchivesSubmit() {
|
|
let documentId
|
|
if (this.selectedDocument.isType === 2) {
|
|
documentId = this.selectedDocument.id
|
|
} else {
|
|
documentId = this.selectedDocument.documentId
|
|
}
|
|
this.$refs.previewForm.submitForm('addOrUpdateForm', documentId)
|
|
},
|
|
clickRowHandler(row) {
|
|
this.$refs.table.clearSelection()
|
|
this.$refs.table.toggleRowSelection(row)
|
|
},
|
|
// 双击查看详情
|
|
tableDoubleClick(row) {
|
|
console.log('tableDoubleClick', row)
|
|
this.$refs.archivesInfo.archivesInfoVisible = true
|
|
this.$refs.archivesInfo.archivesTabIndex = 0
|
|
this.$refs.archivesInfo.parentInfo = row
|
|
this.$refs.archivesInfo.getDetial(row.id)
|
|
},
|
|
// 删除
|
|
toDelete(datas) {
|
|
this.$confirm('此操作将删除当前所选公文库数据' + '<span>你是否还要继续?</span>', '提示', {
|
|
confirmButtonText: '继续',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
dangerouslyUseHTMLString: true
|
|
}).then(() => {
|
|
this.crud.delAllLoading = true
|
|
const ids = []
|
|
datas.forEach(val => {
|
|
ids.push(val.id)
|
|
})
|
|
let documentId
|
|
if (this.selectedDocument.isType === 2) {
|
|
documentId = this.selectedDocument.id
|
|
} else {
|
|
documentId = this.selectedDocument.documentId
|
|
}
|
|
|
|
const params = {
|
|
'documentId': documentId,
|
|
'archivesIds': ids
|
|
}
|
|
|
|
FetchDelArchives(params).then((res) => {
|
|
console.log('res', res)
|
|
if (res.code !== 500) {
|
|
this.crud.notify('删除成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
this.crud.refresh()
|
|
} else {
|
|
this.crud.notify('删除失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
|
}
|
|
this.crud.delAllLoading = false
|
|
}).catch(err => {
|
|
this.crud.delAllLoading = false
|
|
console.log(err)
|
|
})
|
|
}).catch(() => {
|
|
})
|
|
},
|
|
// 导出
|
|
doExport(datas) {
|
|
this.crud.downloadLoading = true
|
|
this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', {
|
|
confirmButtonText: '继续',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
dangerouslyUseHTMLString: true
|
|
}).then(() => {
|
|
const ids = []
|
|
datas.forEach(val => {
|
|
ids.push(val.id)
|
|
})
|
|
const params = {
|
|
'documentId': this.selectedDocument.id,
|
|
'ids': ids
|
|
}
|
|
exportFile(this.baseApi + '/api/re-document/download?' + qs.stringify(params, { indices: false }))
|
|
this.crud.downloadLoading = false
|
|
}).catch(() => {
|
|
this.crud.downloadLoading = false
|
|
})
|
|
},
|
|
doPrint(datas) {
|
|
this.printVisible = true
|
|
},
|
|
handlePrint() {
|
|
this.printVisible = false
|
|
},
|
|
closeDialog() {
|
|
this.formVisible = false
|
|
if (this.$refs.previewForm.$refs['addOrUpdateForm']) {
|
|
this.$refs.previewForm.$refs['addOrUpdateForm'].clearValidate()
|
|
this.$refs.previewForm.$refs['addOrUpdateForm'].resetFields()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang='scss' scoped>
|
|
@import "~@/assets/styles/collect-reorganizi.scss";
|
|
@mixin management-fixed-style{
|
|
[data-theme="dark"] & {
|
|
background-color: #031435 !important;
|
|
-webkit-box-shadow: -5px 5px 10px 1px rgba(15,164,222,.16);
|
|
box-shadow: -5px 5px 10px 1px rgba(15,164,222,.16);
|
|
}
|
|
[data-theme="light"] & {
|
|
background-color: #fff;
|
|
}
|
|
}
|
|
.el-table {
|
|
::v-deep .el-table__fixed-right {
|
|
@include management-fixed-style;
|
|
}
|
|
}
|
|
.preview-dialog .el-dialog .preview-content {
|
|
height: calc(100vh - 264px) !important;
|
|
|
|
}
|
|
.elect-cont-right .container-right {
|
|
min-height: calc(100vh - 284px);
|
|
}
|
|
.dialog-footer .el-button.el-button--primary,
|
|
.el-message-box__btns .el-button.el-button--primary{
|
|
width: auto;
|
|
height: auto;
|
|
line-height:normal;
|
|
padding: 6px 20px;
|
|
}
|
|
|
|
.tip-dialog{
|
|
::v-deep .el-dialog{
|
|
width: 504px;
|
|
.setting-dialog{
|
|
padding: 10px 10px 0 10px;
|
|
}
|
|
.tip-content{
|
|
padding-left: 34px;
|
|
font-size: 14px;
|
|
line-height: 24px;
|
|
color: #0C0E1E;
|
|
background: url("~@/assets/images/icon/tip-icon.png") no-repeat left top;
|
|
background-size: 24px 24px;
|
|
padding-bottom: 20px;
|
|
span{
|
|
font-size: 12px;
|
|
color: #ED4A41;
|
|
}
|
|
}
|
|
}
|
|
.dialog-footer{
|
|
margin-top: 27px;
|
|
}
|
|
}
|
|
</style>
|