Commit c2ab86b3 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化页面

parent 87cbea42
<template> <template>
<div class="page-turner" v-if="!hideOnSinglePage"> <div class="page-turner" v-if="!showHideOnSinglePage">
<div <div
:class="['btn-prev', { disabled: current == 1 }]" :class="['btn-prev', { disabled: current == 1 }]"
@click="changePage(-1)" @click="changePage(-1)"
...@@ -53,10 +53,14 @@ export default { ...@@ -53,10 +53,14 @@ export default {
data() { data() {
return {}; return {};
}, },
computed: { computed: {
sizeTotal() { sizeTotal() {
return Math.ceil(this.total / this.size); return Math.ceil(this.total / this.size);
}, },
showHideOnSinglePage() {
return !!this.hideOnSinglePage;
},
}, },
methods: { methods: {
changePage(cur) { changePage(cur) {
......
...@@ -365,6 +365,8 @@ export default { ...@@ -365,6 +365,8 @@ export default {
}, },
// 查看材料列表 // 查看材料列表
checkMatter(row) { checkMatter(row) {
let time = this.$moment().format("YYYY-MM-DD HH:mm:ss");
this.SET_operTime(time);
this.$router.push({ this.$router.push({
path: "/matterify", path: "/matterify",
query: { query: {
......
...@@ -84,17 +84,14 @@ ...@@ -84,17 +84,14 @@
<YEmpty v-else width="200" text="暂无数据"></YEmpty> <YEmpty v-else width="200" text="暂无数据"></YEmpty>
<!-- 分页 --> <!-- 分页 -->
<div class="tac"> <div class="tac">
<el-pagination <YPagination
prev-text="上一页"
next-text="下一页"
layout="prev,next"
:total="total" :total="total"
hide-on-single-page hide-on-single-page
:current-page="current" :current="current"
:page-size="size" :size="size"
@current-change="changePage" @change="changePage"
> >
</el-pagination> </YPagination>
</div> </div>
</div> </div>
</div> </div>
...@@ -112,6 +109,7 @@ import PageTop from "@/components/PageTop.vue"; ...@@ -112,6 +109,7 @@ import PageTop from "@/components/PageTop.vue";
import SearchBox from "@/components/SearchBox.vue"; import SearchBox from "@/components/SearchBox.vue";
import MateralsList from "@/components/MateralsList.vue"; import MateralsList from "@/components/MateralsList.vue";
import YEmpty from "@/components/YEmpty.vue"; import YEmpty from "@/components/YEmpty.vue";
import YPagination from "@/components/YPagination.vue";
import { getSampleformMatterList, getMatterForFlownum } from "@/api"; import { getSampleformMatterList, getMatterForFlownum } from "@/api";
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
export default { export default {
...@@ -121,6 +119,7 @@ export default { ...@@ -121,6 +119,7 @@ export default {
SearchBox, SearchBox,
MateralsList, MateralsList,
YEmpty, YEmpty,
YPagination,
}, },
data() { data() {
return { return {
...@@ -199,8 +198,12 @@ export default { ...@@ -199,8 +198,12 @@ export default {
handleCheck(row) { handleCheck(row) {
let time = this.$moment().format("YYYY-MM-DD HH:mm:ss"); let time = this.$moment().format("YYYY-MM-DD HH:mm:ss");
this.SET_operTime(time); this.SET_operTime(time);
this.matterInfo = row; this.$router.push({
this.visible = true; path: "/matterify",
query: {
matterId: row.id,
},
});
}, },
// 重置搜索 // 重置搜索
// handleClear() { // handleClear() {
...@@ -322,19 +325,4 @@ export default { ...@@ -322,19 +325,4 @@ export default {
} }
} }
} }
:deep(.btn-prev) {
margin-right: 80px;
}
:deep(.btn-prev),
:deep(.btn-next) {
width: 78px;
height: 25px;
font-family: Source Han Sans CN;
font-weight: 400;
color: var(--main-theme-color);
line-height: 28px;
span {
font-size: 28px;
}
}
</style> </style>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="main flex1 flex flexc"> <div class="main flex1 flex flexc">
<PageTop> <PageTop>
<div slot="count" class="count"> <div slot="count" class="count">
共计<span class="data-count">{{ total + 1 }}</span 共计<span class="data-count">{{ total }}</span
>个文件夹 >个文件夹
</div> </div>
<SearchBox <SearchBox
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
></SearchBox> ></SearchBox>
</PageTop> </PageTop>
<!-- 事项文件夹 --> <!-- 事项文件夹 -->
<div class="folder-box flex1"> <div class="folder-box">
<div class="folder-list"> <div class="folder-list" v-if="folderList.length || !isSearch">
<div class="folder-item" @click="handleCheck({})"> <div class="folder-item" @click="handleCheck({})" v-if="!isSearch">
<div class="folder-img-box flex aic jcc"> <div class="folder-img-box flex aic jcc">
<i class="iconfont icon-folder"></i> <i class="el-icon-more"></i>
</div> </div>
<p class="folder-name tac">所有</p> <p class="folder-name tac">全部</p>
</div> </div>
<div <div
class="folder-item" class="folder-item"
...@@ -40,20 +40,17 @@ ...@@ -40,20 +40,17 @@
</p> </p>
</div> </div>
</div> </div>
<!-- <YEmpty v-else width="200" text="暂无数据"></YEmpty> --> <YEmpty v-else width="200" text="暂无数据"></YEmpty>
<!-- 分页 --> <!-- 分页 -->
<div class="tac"> <div class="pagination">
<el-pagination <YPagination
prev-text="上一页"
next-text="下一页"
layout="prev,next"
:total="total" :total="total"
hide-on-single-page :hideOnSinglePage="true"
:current-page="current" :current="current"
:page-size="size" :size="size"
@current-change="changePage" @change="changePage"
> >
</el-pagination> </YPagination>
</div> </div>
</div> </div>
</div> </div>
...@@ -71,12 +68,12 @@ import PageTop from "@/components/PageTop.vue"; ...@@ -71,12 +68,12 @@ import PageTop from "@/components/PageTop.vue";
import SearchBox from "@/components/SearchBox.vue"; import SearchBox from "@/components/SearchBox.vue";
import MateralsList from "@/components/MateralsList.vue"; import MateralsList from "@/components/MateralsList.vue";
import YEmpty from "@/components/YEmpty.vue"; import YEmpty from "@/components/YEmpty.vue";
import YPagination from "@/components/YPagination.vue";
import { import {
getMatterFolderList, getMatterFolderList,
getMaterialsList, getMaterialsList,
getSampleformMatterInfo, getSampleformMatterInfo,
} from "@/api"; } from "@/api";
import { mapMutations } from "vuex";
export default { export default {
components: { components: {
Header, Header,
...@@ -84,14 +81,16 @@ export default { ...@@ -84,14 +81,16 @@ export default {
SearchBox, SearchBox,
MateralsList, MateralsList,
YEmpty, YEmpty,
YPagination,
}, },
data() { data() {
return { return {
row: 4, row: 4,
searchVal: "", searchVal: "",
isSearch: false,
total: 0, total: 0,
current: 1, current: 1,
size: 16, size: 18,
matterInfo: {}, matterInfo: {},
folderList: [], folderList: [],
visible: false, visible: false,
...@@ -105,11 +104,11 @@ export default { ...@@ -105,11 +104,11 @@ export default {
if (newVal === "") { if (newVal === "") {
this.current = 1; this.current = 1;
this.getMatterFolderList(); this.getMatterFolderList();
this.isSearch = false;
} }
}, },
}, },
methods: { methods: {
...mapMutations(["SET_operTime"]),
// 获取事项分类 // 获取事项分类
async getMatterFolderList() { async getMatterFolderList() {
let res = await getMatterFolderList({ let res = await getMatterFolderList({
...@@ -129,6 +128,9 @@ export default { ...@@ -129,6 +128,9 @@ export default {
handleSearch() { handleSearch() {
this.current = 1; this.current = 1;
this.getMatterFolderList(); this.getMatterFolderList();
if (this.searchVal) {
this.isSearch = true;
}
}, },
// 分页 // 分页
changePage(cur) { changePage(cur) {
...@@ -151,8 +153,6 @@ export default { ...@@ -151,8 +153,6 @@ export default {
if (result.data.code == 1) { if (result.data.code == 1) {
data.matterDatumList = result.data.data.data; data.matterDatumList = result.data.data.data;
this.matterInfo = data; this.matterInfo = data;
let time = this.$moment().format("YYYY-MM-DD HH:mm:ss");
this.SET_operTime(time);
this.matterInfo = data; this.matterInfo = data;
this.visible = true; this.visible = true;
} }
...@@ -227,19 +227,7 @@ export default { ...@@ -227,19 +227,7 @@ export default {
} }
} }
} }
:deep(.btn-prev) { .pagination {
margin-right: 80px; margin-top: 50px;
}
:deep(.btn-prev),
:deep(.btn-next) {
width: 78px;
height: 25px;
font-family: Source Han Sans CN;
font-weight: 400;
color: var(--main-theme-color);
line-height: 28px;
span {
font-size: 28px;
}
} }
</style> </style>
...@@ -59,17 +59,14 @@ ...@@ -59,17 +59,14 @@
<YEmpty v-else width="200" text="暂无数据"></YEmpty> <YEmpty v-else width="200" text="暂无数据"></YEmpty>
<!-- 分页 --> <!-- 分页 -->
<div class="tac"> <div class="tac">
<el-pagination <YPagination
prev-text="上一页"
next-text="下一页"
hide-on-single-page
layout="prev,next"
:total="matterTotal" :total="matterTotal"
:current-page="current" hideOnSinglePage
:page-size="size" :current="current"
@current-change="changePage" :size="size"
@change="changePage"
> >
</el-pagination> </YPagination>
</div> </div>
</div> </div>
</div> </div>
...@@ -158,10 +155,9 @@ export default { ...@@ -158,10 +155,9 @@ export default {
this.getDeviceMatterList(); this.getDeviceMatterList();
}, },
handleCheck(row) { handleCheck(row) {
// let time = this.$moment().format("YYYY-MM-DD HH:mm:ss"); let time = this.$moment().format("YYYY-MM-DD HH:mm:ss");
// this.SET_operTime(time); this.SET_operTime(time);
// this.matterInfo = row;
// this.visible = true;
this.$router.push({ this.$router.push({
path: "/matterify", path: "/matterify",
query: { query: {
...@@ -292,24 +288,6 @@ export default { ...@@ -292,24 +288,6 @@ export default {
} }
} }
} }
:deep(.btn-prev) {
margin-right: 80px;
}
}
}
:deep(.btn-prev),
:deep(.btn-next) {
width: 78px;
height: 25px;
font-family: Source Han Sans CN;
font-weight: 400;
color: var(--main-theme-color);
line-height: 28px;
span {
font-size: 28px;
} }
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment