“3bb48060d12876fa851c2624653010ad91ce1148”上不存在“...git@gitcode.net:openanolis/dragonwell8_jdk.git”
提交 73b4be4c 编写于 作者: Q qq_38870145

Fri Jan 5 21:53:00 CST 2024 inscode

上级 dfeb4e36
......@@ -4,7 +4,7 @@ import ExportBtn from './ExportBtn.vue';
import EchartBar from './EchartBar.vue';
import { tableColumns } from './const';
import { getRemoteCsdnGrade } from '../service/csdnApi';
import { onMounted, reactive, onUnmounted } from 'vue';
import { onMounted, reactive, onUnmounted, computed } from 'vue';
const state = reactive({
title: 'csdn用户根据id快速查分数改文章',
......@@ -24,7 +24,8 @@ const state = reactive({
},
onShowSizeChange: changePageSize, // 改变每页数量时更新显示
onChange: changePage,//点击页码事件
}
},
selectedRows: []
})
// storage
......@@ -47,7 +48,7 @@ const getCsdnData = (uId) => {
state.pagination.total = state.dataSource.length
state.loading = false
saveStorege(state.dataSource)
}).catch((r) => {
state.pagination.total = 0
console.log(r)
......@@ -57,8 +58,8 @@ const getCsdnData = (uId) => {
})
}
async function saveStorege(val){
return new Promise(resolve=>{
async function saveStorege(val) {
return new Promise(resolve => {
window.localStorage.setItem('csdnUidData', JSON.stringify(val))
resolve(true)
})
......@@ -72,6 +73,24 @@ const onSearch = () => {
getCsdnData(state.searchValue)
}
const rowSelection = {
onChange: (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
state.selectedRows = selectedRows
},
getCheckboxProps: (record) => ({
disabled: record.name === 'Disabled User', // Column configuration not to be checked
name: record.name,
})
}
const exportTableData = computed(() => {
if (state.selectedRows?.length) {
return state.selectedRows
}
return state.dataSource
})
......@@ -109,7 +128,7 @@ onUnmounted(() => {
<a style="font-size: 24px;font-weight:bolder;">{{ state.title }}</a>
</div>
<div>
</div>
<br>
<div style="display:flex">
......@@ -118,9 +137,10 @@ onUnmounted(() => {
</div>
<div>
<ExportBtn :table-data="state.dataSource" :user-id="state.searchValue" />
<a-table :scroll="{ x: 800, y: 600 }" :columns="state.columns" :data-source="state.dataSource"
:loading="state.loading" :pagination="state.pagination" bordered style="border-bottom:1px solid #f0f0f0;">
<ExportBtn :table-data="exportTableData" :user-id="state.searchValue" />
<a-table :scroll="{ x: 800, y: 600 }" :columns="state.columns" :row-selection="rowSelection"
:data-source="state.dataSource" :loading="state.loading" :pagination="state.pagination" bordered
style="border-bottom:1px solid #f0f0f0;">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'url'">
<a :href="record.url" target="_blank">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册