271 lines
7.8 KiB
Java
271 lines
7.8 KiB
Java
<template>
|
|
<a-card :bordered="false">
|
|
<div class="table-page-search-wrapper">
|
|
<search ref="searchRef" :flag="'1'" :url="url"/>
|
|
</div>
|
|
<div class="table-operator">
|
|
<div @click="handleDel" class="operator-text">
|
|
<a-icon type="delete"/>
|
|
批量删除
|
|
</div>
|
|
<div @click="handleExport" class="operator-text">
|
|
<a-icon type="export" :rotate="-90"/>
|
|
数据导出
|
|
</div>
|
|
<div @click="handleFileExport" class="operator-text">
|
|
<a-icon type="mail"/>
|
|
带文件导出
|
|
</div>
|
|
<div @click="handleCompare" class="operator-text">
|
|
<a-icon type="rocket" :rotate="45"/>
|
|
推送
|
|
</div>
|
|
<div @click="handleModule" class="operator-text">
|
|
<a-icon type="download"/>
|
|
模板下载
|
|
</div>
|
|
<div @click="handleImport" class="operator-text">
|
|
<a-icon type="import" :rotate="270"/>
|
|
导入
|
|
</div>
|
|
<div @click="handleAdd" class="operator-text">
|
|
<a-icon type="plus"/>
|
|
{{$t('add')}}
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<!--
|
|
showAction是否有操作按钮
|
|
OperationList操作列表的list
|
|
onSelectChange 选中的id值
|
|
editTable再传操作按钮的同时把事件定义名称也传过去
|
|
-->
|
|
<tableData
|
|
ref="tableDataRef"
|
|
:flag="'1'"
|
|
:OperationList="OperationList"
|
|
@editTable="editTable"
|
|
@deleteTable="deleteTable"
|
|
:url="url"
|
|
showAction
|
|
@Collection="Collection"
|
|
@subscribe="subscribe"
|
|
@onSelectChange="onSelectChange"
|
|
@detailClick="detailClick"
|
|
/>
|
|
</div>
|
|
<addForm
|
|
ref="addFormRef"
|
|
:url="url"
|
|
:flag="'1'"
|
|
/>
|
|
<libraryPush
|
|
:url="url"
|
|
ref="libraryPushRef"
|
|
/>
|
|
|
|
</a-card>
|
|
</template>
|
|
|
|
<script>
|
|
import search from '@/components/search/index'
|
|
import tableData from '@/components/tableDate/index'
|
|
import addForm from './modules/addForm'
|
|
import libraryPush from '@/components/libraryPush/index'
|
|
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
|
|
import eventBUs from '../../../common/event'
|
|
|
|
export default {
|
|
name: 'docLibrary',
|
|
components: {
|
|
search,
|
|
addForm,
|
|
tableData,
|
|
libraryPush
|
|
},
|
|
data() {
|
|
return {
|
|
OperationList: [
|
|
{
|
|
text: '取消收藏',
|
|
ClickEvent: 'Collection'
|
|
},
|
|
{
|
|
text: '取消订阅',
|
|
ClickEvent: 'subscribe'
|
|
},
|
|
{
|
|
text: '编辑',
|
|
ClickEvent: 'editTable'
|
|
},
|
|
{
|
|
text: '删除',
|
|
ClickEvent: 'deleteTable'
|
|
}
|
|
],
|
|
selectedRowKeys: [],
|
|
loading: false,
|
|
//url传参严格按照当前命名
|
|
url: {
|
|
tableHeader: 'document/bussDocumentLibraryEO/getHeader', //表格头部字段
|
|
seachList: 'document/bussDocumentLibraryEO/queryCondition', //搜索字段
|
|
tableList: 'document/bussDocumentLibraryEO/queryPageInfo', //表格数据
|
|
getAddForm: 'document/bussDocumentLibraryEO/getAddForm', // 表单的字段
|
|
addInfo: 'document/bussDocumentLibraryEO/addInfo', //新增
|
|
updateInfo: 'document/bussDocumentLibraryEO/updateInfo', //编辑
|
|
getDocumentInfo: 'document/bussDocumentLibraryEO/getDocumentInfoById', //查看
|
|
deleteBatch: 'document/bussDocumentLibraryEO/deleteBatch', //删除
|
|
pullMessage:'document/bussDocumentLibraryEO/pullMessage',//推送
|
|
},
|
|
idList: []
|
|
}
|
|
},
|
|
mounted() {
|
|
|
|
},
|
|
methods: {
|
|
//导出
|
|
handleExport() {
|
|
let query = {
|
|
...this.$refs.searchRef.queryParam,
|
|
id: this.idList.join(',')
|
|
}
|
|
downloadFile('document/bussDocumentLibraryEO/exportExcel', '文档库.xls', query,this.Deselect)
|
|
},
|
|
Deselect() {
|
|
this.$refs.tableDataRef.selectedRowKeys = []
|
|
this.idList = []
|
|
},
|
|
//带文件导出
|
|
handleFileExport() {
|
|
let query = {
|
|
...this.$refs.searchRef.queryParam,
|
|
id: this.idList.join(',')
|
|
}
|
|
downloadFile('document/bussDocumentLibraryEO/exportZip', '文档库.zip', query,this.Deselect)
|
|
},
|
|
//新增
|
|
handleAdd() {
|
|
this.$refs.addFormRef.add()
|
|
},
|
|
//下载模板
|
|
handleModule() {
|
|
downloadFile('document/bussDocumentLibraryEO/exportTemplate', '文档库.xls', {})
|
|
},
|
|
//批量删除
|
|
handleDel() {
|
|
if (this.idList.length > 0) {
|
|
let _this = this
|
|
this.$confirm({
|
|
content: '确认删除?',
|
|
onOk() {
|
|
deleteAction(_this.url.deleteBatch, { ids: _this.idList.join(',') }).then((res) => {
|
|
if (res.success) {
|
|
_this.$message.success(res.message)
|
|
_this.idList = []
|
|
eventBUs.$emit('searchReset')
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.warning('请选择需要删除的数据')
|
|
}
|
|
},
|
|
//推送
|
|
handleCompare() {
|
|
this.$nextTick(() => {
|
|
this.$refs.libraryPushRef.visible = true
|
|
})
|
|
},
|
|
//导入
|
|
handleImport() {
|
|
|
|
},
|
|
//编辑按钮
|
|
editTable(val) {
|
|
this.$refs.addFormRef.edit(val)
|
|
},
|
|
//删除按钮
|
|
deleteTable(val) {
|
|
let _this = this
|
|
this.$confirm({
|
|
content: '确认删除?',
|
|
onOk() {
|
|
deleteAction(_this.url.deleteBatch, { ids: val.id }).then((res) => {
|
|
if (res.success) {
|
|
_this.$message.success(res.message)
|
|
eventBUs.$emit('searchReset')
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//收藏按钮
|
|
Collection(val) {
|
|
let _this = this
|
|
this.$confirm({
|
|
content: val.collectFlag == 0 || !val.collectFlag ? '确认收藏?' : '确定取消收藏?',
|
|
onOk() {
|
|
let url = ''
|
|
if (val.collectFlag == 0 || !val.collectFlag) {
|
|
url = 'document/bussDocumentLibraryEO/addCollect'
|
|
} else {
|
|
url = 'document/bussDocumentLibraryEO/cancelCollect'
|
|
}
|
|
getAction(url, { id: val.id }).then((res) => {
|
|
if (res.success) {
|
|
_this.$message.success(res.message)
|
|
eventBUs.$emit('searchReset')
|
|
} else {
|
|
_this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//订阅按钮
|
|
subscribe(val) {
|
|
let _this = this
|
|
this.$confirm({
|
|
content: val.subscribeFlag == 0 || !val.subscribeFlag ? '确认订阅?' : '确定取消订阅?',
|
|
onOk() {
|
|
let url = ''
|
|
if (val.subscribeFlag == 0 || !val.subscribeFlag) {
|
|
url = 'document/bussDocumentLibraryEO/addSubscribe'
|
|
} else {
|
|
url = 'document/bussDocumentLibraryEO/cancelSubscribe'
|
|
}
|
|
getAction(url, { id: val.id }).then((res) => {
|
|
if (res.success) {
|
|
_this.$message.success(res.message)
|
|
eventBUs.$emit('searchReset')
|
|
} else {
|
|
_this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//选中的id
|
|
onSelectChange(value) {
|
|
this.idList = value
|
|
},
|
|
//处理列表中的点击事件
|
|
detailClick(item) {
|
|
this.$router.push({
|
|
path: '/docManage/library/detail',
|
|
query: item
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
@import '~@assets/less/common.less';
|
|
</style> |