bug修改

This commit is contained in:
caoyang
2022-03-10 14:41:42 +08:00
parent bf2e8cf916
commit 90a1ee53eb
16 changed files with 638 additions and 241 deletions
@@ -44,35 +44,38 @@
</div>
</div>
<div class="colloction-table">
<tableData
:url="url"
:flag="'1'"
:OperationList="OperationList"
showAction
@titleClick="titleClick"
@onCancel="onCancel"
@onSelectChange="onSelectChange"
@detailClick="detailClick"
></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>-->
<a-table
ref="table"
size="middle"
rowKey="id"
:columns="columns"
:dataSource="tableData"
:pagination="false"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
>
<span slot="serialNumber" slot-scope="text, record">
<a class="table-del" @click="onDetail(record)">{{record.serialNumber}}</a>
</span>
<span slot="serialtitle" slot-scope="text, record">
<a class="table-del" @click="onDetail(record)">{{record.title}}</a>
</span>
<span slot="action" slot-scope="text, record">
<a class="table-del" @click="onCancel(record)">{{$t('CancelCollection')}}</a>
</span>
</a-table>
<div class="page" v-if="tableData.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+ $t('strip')"
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>
@@ -81,12 +84,12 @@
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'
// import tableData from '@/components/coTable/index'
export default {
name:'collection',
components:{
search,
tableData
// tableData
},
data(){
return{
@@ -99,33 +102,31 @@
//列表表头
columns: [
{
title: '编号',
title: this.$t('standard'),
dataIndex: 'serialNumber',
key: 'serialNumber',
scopedSlots: {customRender: 'serialNumber'},
align: "center",
width: 100,
ellipsis: true,
},
{
title: '标题',
title: this.$t('title'),
align: "center",
scopedSlots: {customRender: 'serialtitle'},
width: 100,
dataIndex: 'title',
ellipsis: true,
},
{
title: '状态',
title: this.$t('status'),
align: "center",
width: 100,
dataIndex: 'state',
ellipsis: true,
},
{
title: '收藏时间',
title: this.$t('collectionTime'),
align: "center",
width: 100,
dataIndex: 'createTime',
ellipsis: true,
},
{
title: this.$t('operation'),
@@ -136,7 +137,7 @@
}
],
tableData:[], //列表数据
selecIds:'',
selecIds:[],
loading:false,
url:{
tableHeader: 'collection/onlCgformCollection/getHeader', //表格头部字段
@@ -152,7 +153,7 @@
}
},
mounted() {
// this.loadData()
this.loadData()
},
methods:{
//获取列表数据
@@ -161,7 +162,7 @@
...this.queryParams
}
this.loading=true
getAction(`collection/onlCgformCollection/page`,params).then(res=>{
postAction(`collection/onlCgformCollection/page`,params).then(res=>{
if(res.success){
this.tableData= [ ...res.result.records ]
this.loading=false
@@ -174,20 +175,21 @@
//批量取消收藏
handleBatCancel(){
let params={
ids:this.selecIds
ids:this.selecIds.join(',')
}
if(this.selecIds){
if(this.selecIds&&this.selecIds.length>0){
this.$confirm({
title: '确认批量取消收藏?',
title: this.$t('BatchCancelCollection'),
content: '',
onOk:
async () => {
deleteAction(`collection/onlCgformCollection/deleteBatch`,params).then(res=> {
if(res.success){
this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset')
// this.selectedRowKeys = []
// this.loadData()
if(this.selecIds.length==this.tableData.length&&this.queryParams.pageNo!==1){
this.queryParams.pageNo=this.queryParams.pageNo-1
}
this.loadData()
}else{
this.$message.warning(this.$t('operationFailed'))
}
@@ -196,7 +198,7 @@
onCancel() {},
});
}else{
this.$message.warning('请选择至少一条数据')
this.$message.warning(this.$t('selectLeastOne'))
}
},
//取消收藏
@@ -205,15 +207,17 @@
id:record.id
}
this.$confirm({
title: '确认取消收藏?',
title: this.$t('confirmCancelCollection'),
content: '',
onOk:
async () => {
deleteAction(`collection/onlCgformCollection/delete`,params).then(res=> {
if(res.success){
this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset')
// this.loadData()
if(this.tableData.length==1&&this.queryParams.pageNo!==1){
this.queryParams.pageNo=this.queryParams.pageNo-1
}
this.loadData()
}else{
this.$message.warning(this.$t('operationFailed'))
}
@@ -242,7 +246,7 @@
},
//选择框
onSelectChange(rows) {
console.log('rows',rows)
// console.log('rows',rows)
// this.selectedRowKeys = selectedRowKeys
// let ids=[]
// if(rows && rows.length>0){
@@ -250,7 +254,7 @@
// ids.push(item.id)
// })
// }
this.selecIds=rows.join(',')
this.selecIds=rows
// console.log('selectedRowKeys changed: ', ids);
},
//点击编号
@@ -261,7 +265,7 @@
titleClick(records){
},
detailClick(item) {
onDetail(item) {
let newUrl = this.$router.resolve({
path: '/docManage/library/detail',
query: item
@@ -280,6 +284,7 @@
.colloction-table{
.page{
margin-top: 20px;
text-align: right;
}
}
}
@@ -297,4 +302,5 @@
float: none!important;
}
}
</style>