fix:模板库分页问题修复,隐藏学习时间字段

This commit is contained in:
wyx
2022-12-04 11:45:06 +08:00
parent 959b048915
commit ad9ce6c3e2

View File

@@ -37,8 +37,23 @@
</div> </div>
<div class="tmpl_body"> <div class="tmpl_body">
<div class="tmpl_tabbox"> <div class="tmpl_tabbox">
<a-table :columns="columns1" :data-source="tableData1" :loading="tableDataTotal === -1 ? true : false" <a-table :columns="columns1" :data-source="tableData1"
expandRowByClick="true" @expand="expandTable" :pagination="pagination" /> expandRowByClick="true" @expand="expandTable" :pagination="false"/>
<div class="tableBox" style="display:flex;justify-content:center;padding:20px;">
<div class="pa">
<a-pagination
v-if="tableDataTotal > 10"
showSizeChanger="true"
showQuickJumper="true"
hideOnSinglePage="true"
:pageSize="pageSize"
v-model:current="currentPage"
:total="tableDataTotal"
class="pagination"
@change="changePagination"
/>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -73,13 +88,13 @@ const columns1 = [
key: "creator", key: "creator",
align: "center", align: "center",
}, },
{ // {
title: "最近学习时间", // title: "最近学习时间",
width: "25%", // width: "25%",
dataIndex: "stutime", // dataIndex: "stutime",
key: "stutime", // key: "stutime",
align: "center", // align: "center",
}, // },
{ {
title: "操作", title: "操作",
width: "22%", width: "22%",
@@ -100,6 +115,7 @@ export default defineComponent({
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
total:50, total:50,
tableDataTotal:0,
tableData1: [ tableData1: [
{ {
key: "1", key: "1",
@@ -180,6 +196,12 @@ export default defineComponent({
getLibraryList(); getLibraryList();
}) })
// 翻页
const changePagination = (page) => {
pagination.current = page;
getLibraryList();
};
// 获取模板列表 // 获取模板列表
const getLibraryList = () => { const getLibraryList = () => {
let date = Math.ceil(new Date(state.time).getTime() / 1000); let date = Math.ceil(new Date(state.time).getTime() / 1000);
@@ -193,6 +215,7 @@ export default defineComponent({
} }
api.templateList(obj).then((res) => { api.templateList(obj).then((res) => {
state.tableData1 = [] state.tableData1 = []
state.tableDataTotal = res.data.data.total;
console.log(res); console.log(res);
let resData = res.data.data.rows let resData = res.data.data.rows
if (resData.length) { if (resData.length) {
@@ -253,6 +276,7 @@ export default defineComponent({
resetLevel, resetLevel,
pagination, pagination,
toLibraryAdd, toLibraryAdd,
changePagination
}; };
}, },
}); });