Files
laws_weilai/jero-web/src/views/documentManage/collection/index.vue
T
2022-03-02 14:06:09 +08:00

293 lines
9.1 KiB
Java

<template>
<div class="collection">
<a-card :bordered="false">
<div class="collection-search-wrapper">
<div class="collection-search-header">
<search :url="url" :flag="'1'"></search>
<!-- <a-form layout="inline" @keyup.enter.native="searchQuery(queryParams)">-->
<!-- <a-form-model-->
<!-- class="collection-content"-->
<!-- :model="queryParams"-->
<!-- ref="tagEditForm"-->
<!-- >-->
<!-- <a-row :gutter="24" type="flex" justify="start">-->
<!-- <a-col :md="6" :sm="8">-->
<!-- <a-form-model-item :label="'编号'">-->
<!-- <j-input :placeholder="'请输入编号'" v-model="queryParams.serialNumber"></j-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- <a-col :md="6" :sm="8">-->
<!-- <a-form-model-item :label="'标题'">-->
<!-- <j-input :placeholder="'请输入标题'" v-model="queryParams.title"></j-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- <a-col :md="6" :sm="8">-->
<!-- <a-form-model-item :label="'状态'">-->
<!-- <j-dict-select-tag type="list" v-model="queryParams.state" dictCode="file_type" :placeholder="'请选择状态'" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- <a-col :md="6" :sm="8">-->
<!-- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
<!-- <a-button type="primary" @click="searchQuery" icon="search">{{$t('query')}}</a-button>-->
<!-- <a-button @click="searchReset" icon="reload" style="margin-left: 8px">{{ $t('reset') }}</a-button>-->
<!-- </span>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- </a-form-model>-->
<!-- </a-form>-->
</div>
</div>
<div class="table-operator">
<div class="operator-text" @click="handleBatCancel">
<a-icon type="delete" />
{{ $t('BatchCancel') }}
</div>
</div>
<div class="colloction-table">
<tableData
:url="url"
:flag="'1'"
:OperationList="OperationList"
showAction
@titleClick="titleClick"
@onCancel="onCancel"
@onSelectChange="onSelectChange"
></tableData>
<!-- <a-table bordered :data-source="tableData" :columns="columns" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :pagination="false" :loading="loading" class="tag-con-table">-->
<!-- <a slot="serialNumber" slot-scope="text, record" @click="numberClick(record)">{{ text }}</a>-->
<!--&lt;!&ndash; <a slot="title" slot-scope="text, record" @click="titleClick(record)">{{ text }}</a>&ndash;&gt;-->
<!-- <template slot="action" slot-scope="text, record">-->
<!-- <a class="action-delete" href="javascript:;" @click="onCancel(record)">取消收藏</a>-->
<!-- </template>-->
<!-- </a-table>-->
<!-- <div class="page" v-if="tableData.length > 0">-->
<!-- <a-pagination-->
<!-- :show-total="total => `共 ${total} 条`"-->
<!-- show-quick-jumper-->
<!-- show-size-changer-->
<!-- :current="queryParams.pageNo"-->
<!-- :page-size.sync="queryParams.pageSize"-->
<!-- :total="total"-->
<!-- @change="onChangePage"-->
<!-- @showSizeChange="SizeChange"-->
<!-- />-->
<!-- </div>-->
</div>
</a-card>
</div>
</template>
<script>
import { getAction, postAction, deleteAction, putAction } from '@/api/manage'
import eventBUs from '../../../common/event'
import search from '@/components/search/index'
import tableData from '@/components/coTable/index'
export default {
name:'collection',
components:{
search,
tableData
},
data(){
return{
selectedRowKeys:[],
queryParams:{
pageNo:1,
pageSize:10
}, //搜索条件
total:0,
//列表表头
columns: [
{
title: '编号',
dataIndex: 'serialNumber',
key: 'serialNumber',
align: "center",
width: 100,
ellipsis: true,
},
{
title: '标题',
align: "center",
width: 100,
dataIndex: 'title',
ellipsis: true,
},
{
title: '状态',
align: "center",
width: 100,
dataIndex: 'state',
ellipsis: true,
},
{
title: '收藏时间',
align: "center",
width: 100,
dataIndex: 'createTime',
ellipsis: true,
},
{
title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: {customRender: 'action'},
align: "center",
width: 170
}
],
tableData:[], //列表数据
selecIds:'',
loading:false,
url:{
tableHeader: 'collection/onlCgformCollection/getHeader', //表格头部字段
seachList: 'collection/onlCgformCollection/queryCondition', //搜索字段
tableList: 'collection/onlCgformCollection/page', //表格数据
},
OperationList: [
{
text: this.$t('CancelCollection'),
ClickEvent: 'onCancel'
}
],
}
},
mounted() {
// this.loadData()
},
methods:{
//获取列表数据
loadData(){
let params={
...this.queryParams
}
this.loading=true
getAction(`collection/onlCgformCollection/page`,params).then(res=>{
if(res.success){
this.tableData= [ ...res.result.records ]
this.loading=false
}
})
},//搜索
searchQuery(){
this.loadData()
},
//批量取消收藏
handleBatCancel(){
let params={
ids:this.selecIds
}
if(this.selecIds){
this.$confirm({
title: '确认批量取消收藏?',
content: '',
onOk:
async () => {
deleteAction(`collection/onlCgformCollection/deleteBatch`,params).then(res=> {
if(res.success){
this.$message.success(res.message)
eventBUs.$emit('searchReset')
// this.selectedRowKeys = []
// this.loadData()
}else{
this.$message.warning(res.message)
}
})
},
onCancel() {},
});
}else{
this.$message.warning('请选择至少一条数据')
}
},
//取消收藏
onCancel(record){
let params={
id:record.id
}
this.$confirm({
title: '确认取消收藏?',
content: '',
onOk:
async () => {
deleteAction(`collection/onlCgformCollection/delete`,params).then(res=> {
if(res.success){
this.$message.success(res.message)
eventBUs.$emit('searchReset')
// this.loadData()
}else{
this.$message.warning(res.message)
}
})
},
onCancel() {},
});
},
//清空
searchReset(){
this.queryParams={
pageNo: 1,
pageSize: 10
}
this.loadData()
},
//点击页数
onChangePage(page,pageSize){
this.queryParams.pageNo = page
this.loadData()
},
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.loadData()
},
//选择框
onSelectChange(rows) {
console.log('rows',rows)
// this.selectedRowKeys = selectedRowKeys
// let ids=[]
// if(rows && rows.length>0){
// rows.forEach(item=>{
// ids.push(item.id)
// })
// }
this.selecIds=rows.join(',')
// console.log('selectedRowKeys changed: ', ids);
},
//点击编号
numberClick(records){
},
//点击名称
titleClick(records){
}
}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.collection{
.collection-search-wrapper{
margin-bottom: 20px;
}
.colloction-table{
.page{
margin-top: 20px;
}
}
}
</style>
<style lang="less">
.collection{
.collection-content{
.ant-form-item-control-wrapper{
min-width: 180px;
}
}
}
.collection-search-header{
.table-page-search-submitButtons{
float: none!important;
}
}
</style>