Merge remote-tracking branch 'origin/dev_test' into dev_test

This commit is contained in:
zhoulingpo
2023-11-29 15:56:47 +08:00
9 changed files with 282 additions and 109 deletions
@@ -1,17 +1,50 @@
<template>
<div class="scroll-wrapper" ref="scroll" :style="{height: height}">
<div class="scroll-content" ref="content">
<slot></slot>
<!-- 下拉刷新 -->
<template v-if="pullDownRefresh">
<div v-if="pullDown" class="pullDownText">
<span v-if="isEnterThreshold">下拉刷新</span>
<span v-if="isLeaveThreshold">松开刷新</span>
<van-loading
v-if="pullDownLoading"
type="spinner"
size="16px"
text-size="12px"
color="#3170A8"
style="text-align: center"
>加载中...</van-loading>
</div>
</template>
<!-- 除上拉和下拉之外的loading -->
<van-loading
v-if="loading"
v-if="loading && !pullDownLoading && !pullUpLoading"
class="pageLoading"
type="spinner"
size="16px"
text-size="12px"
color="#3170A8"
style="text-align: center"
>加载中...</van-loading>
<div v-if="data.length > 0 && data.length >= total" style="font-size: 12px;text-align: center;color: #999">已加载全部数据</div>
<van-empty v-if="!loading && data.length === 0" description="暂无数据" />
<slot></slot>
<!-- 上拉加载 -->
<template v-if="pullUpLoad">
<van-loading
v-if="pullUpLoading"
type="spinner"
size="16px"
text-size="12px"
color="#3170A8"
style="text-align: center"
>加载中...</van-loading>
<template v-else>
<div v-if="isShowAll" style="font-size: 12px;text-align: center;color: #999">已加载全部数据</div>
<van-empty v-if="isEmpty" description="暂无数据" />
</template>
</template>
</div>
</div>
</template>
@@ -20,9 +53,11 @@
import BScroll from '@better-scroll/core'
import ScrollBar from '@better-scroll/scroll-bar'
import Pullup from '@better-scroll/pull-up'
import PullDown from '@better-scroll/pull-down'
BScroll.use(ScrollBar)
BScroll.use(Pullup)
BScroll.use(PullDown)
export default {
name: "PhoneScroll",
@@ -37,10 +72,12 @@ export default {
default: () => [],
required: true
},
// 是否加载中
loading: {
type: Boolean,
default: false,
page: {
type: Number,
required: true
},
pageSize: {
type: Number,
required: true
},
// 总数
@@ -48,18 +85,46 @@ export default {
type: Number,
required: true
},
// 上拉加载回调
pullingUpHandler: {
// 上拉和下拉之外的loading
loading: {
type: Boolean,
default: false
},
// 是否开启上拉加载
pullUpLoad: {
type: Boolean,
default: false
},
// 是否开启下拉刷新
pullDownRefresh: {
type: Boolean,
default: false
},
// 获取数据回调 返回值必须是Promise
getDataHandler: {
type: Function,
default: () => {
console.log('请传入上拉加载回调函数参数pullingUpHandler')
default: (page) => {
console.log('请传入获取数据回调函数参数getDataHandler', page)
return Promise.resolve()
}
},
},
data () {
return {
bs: null,
toEnd: false
// 下拉刷新
pullDown: false,
isEnterThreshold: false,
isLeaveThreshold: false,
pullDownLoading: false,
// 上拉加载
pullUpLoading: false,
isShowAll: false,
isEmpty: false,
}
},
watch: {
@@ -71,19 +136,36 @@ export default {
refreshScroll () {
this.$nextTick(() => {
if (!this.bs) {
const pullUpLoad = this.pullUpLoad ? {
threshold: 200
} : false
const pullDownRefresh = this.pullDownRefresh ? {
threshold: 50,
stop: 40
} : false
this.bs = new BScroll(this.$refs.scroll, {
probeType: 3,
scrollbar: true,
pullUpLoad: {
threshold: 50
},
pullUpLoad,
pullDownRefresh,
click: true
})
this.bs && this.bs.on('pullingUp', () => {
this.pullingUpHandler()
// 结束上拉加载
this.bs.finishPullUp()
})
if (this.pullUpLoad) {
this.bs.on('pullingUp', this.pullingUpHandler)
}
if (this.pullDownRefresh) {
this.bs.on('pullingDown', this.pullingDownHandler)
this.bs.on('enterThreshold', () => {
this.showPullDownText('isEnterThreshold')
})
this.bs.on('leaveThreshold', () => {
this.showPullDownText('isLeaveThreshold')
})
}
this.bs.on('scroll', ({x, y}) => { })
@@ -92,6 +174,56 @@ export default {
}
})
},
// 上拉加载回调
async pullingUpHandler () {
if (this.page * this.pageSize <= this.total) {
this.pullUpLoading = true
// 从下一页获取数据
await this.getDataHandler(this.page + 1)
this.pullUpLoading = false
}
this.showPullUpText()
// 结束上拉加载
this.bs.finishPullUp()
},
// 下拉刷新回调
async pullingDownHandler () {
this.showPullDownText('pullDownLoading')
// 从第一页获取数据
await this.getDataHandler(1)
this.hidePullDownText()
// 结束下拉刷新
this.bs.finishPullDown()
},
showPullUpText () {
this.isEmpty = false
this.isShowAll = false
if (this.data.length === 0) {
this.isEmpty = true
} else {
if (this.data.length >= this.total) {
this.isShowAll = true
}
}
},
showPullDownText (key) {
this.isEnterThreshold = false
this.isLeaveThreshold = false
this.pullDownLoading = false
this[key] = true
this.pullDown = true
},
hidePullDownText () {
this.isEnterThreshold = false
this.isLeaveThreshold = false
this.pullDownLoading = false
this.pullDown = false
},
scrollTo (x, y ,time, easing) {
if (this.bs) {
this.bs.scrollTo(x, y, time, easing)
@@ -107,4 +239,24 @@ export default {
overflow: hidden;
position: relative;
}
.pageLoading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.pullDownText {
position: absolute;
text-align: center;
pointer-events: auto;
height: 40px;
line-height: 40px;
top: -40px;
width: 100%;
left: 0;
font-size: 12px;
color: #3170A8;
}
</style>
+26 -21
View File
@@ -27,9 +27,13 @@
ref="scroll"
height="calc(100vh - 100px)"
:data="list"
:page="searchQuery.page"
:pageSize="searchQuery.pageSize"
:total="total"
:loading="loading"
:pullingUpHandler="pullingUpHandler">
pullUpLoad
pullDownRefresh
:getDataHandler="getData">
<div style="padding-top: 10px">
<div class="card-content"
v-for="item in list"
@@ -177,12 +181,6 @@ export default {
// this.getData()
},
methods: {
pullingUpHandler () {
if (this.searchQuery.page * this.searchQuery.pageSize <= this.total) {
this.searchQuery.page = this.searchQuery.page + 1
this.getData()
}
},
onSearch () {
this.list = []
this.searchQuery.page = 1
@@ -190,7 +188,7 @@ export default {
this.$refs.scroll.scrollTo(0, 0)
this.getData()
},
getData () {
getData (page) {
switch (this.$route.query.standType) {
case 'INLAND':
this.searchQuery.selectIndex = 'stand'
@@ -209,20 +207,27 @@ export default {
this.searchQuery.standType = 'laws'
break
}
const config = {
_this: this,
loading: 'loading'
}
this.$http._postData("search/searchCenter/searchSarBykey", this.searchQuery, config).then(res => {
if (res.ok) {
this.total = res.data.count
if (this.searchQuery.page === 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list]
}
return new Promise((resolve, reject) => {
const config = {
_this: this,
loading: 'loading'
}
if (page) {
this.searchQuery.page = page
}
this.$http._postData("search/searchCenter/searchSarBykey", this.searchQuery, config).then(res => {
if (res.ok) {
this.total = res.data.count
if (this.searchQuery.page === 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list]
}
}
}).finally(() => {
resolve()
})
})
},
onChoose () {
@@ -6,9 +6,13 @@
<PhoneScroll
height="calc(100vh - 131px)"
:data="list"
:page="searchQuery.page"
:pageSize="searchQuery.pageSize"
:total="total"
:loading="loading"
:pullingUpHandler="pullingUpHandler">
pullUpLoad
pullDownRefresh
:getDataHandler="getData">
<div style="padding-top: 10px">
<div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)">
<div class="standTitle">
@@ -57,12 +61,6 @@ export default {
this.getData()
},
methods: {
pullingUpHandler () {
if (this.searchQuery.page * this.searchQuery.pageSize <= this.total) {
this.searchQuery.page = this.searchQuery.page + 1
this.getData()
}
},
onOpen () {
this.$refs.folderPopupRef.open(this.searchQuery.treeId || null)
},
@@ -72,20 +70,27 @@ export default {
this.searchQuery.page = 1
this.getData()
},
getData () {
const config = {
_this: this,
loading: 'loading'
}
this.$http._getData('fileMaterialCenter/file-material', this.searchQuery, config).then(res => {
if (res.ok) {
this.total = res.data.total
if (this.searchQuery.page === 1) {
this.list = res.data.records
} else {
this.list = [...this.list, ...res.data.records]
}
getData (page) {
return new Promise((resolve, reject) => {
const config = {
_this: this,
loading: 'loading'
}
if (page) {
this.searchQuery.page = page
}
this.$http._getData('fileMaterialCenter/file-material', this.searchQuery, config).then(res => {
if (res.ok) {
this.total = res.data.total
if (this.searchQuery.page === 1) {
this.list = res.data.records
} else {
this.list = [...this.list, ...res.data.records]
}
}
}).finally(() => {
resolve()
})
})
},
jumpDetails(item) {
@@ -2,9 +2,13 @@
<PhoneScroll
height="calc(100vh - 101px)"
:data="list"
:page="searchQuery.page"
:pageSize="searchQuery.pageSize"
:total="total"
:loading="loading"
:pullingUpHandler="pullingUpHandler">
pullUpLoad
pullDownRefresh
:getDataHandler="getData">
<div style="padding-top: 10px">
<div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)">
<div class="standTitle">
@@ -55,27 +59,28 @@ export default {
this.getData()
},
methods: {
pullingUpHandler () {
if (this.searchQuery.page * this.searchQuery.pageSize <= this.total) {
this.searchQuery.page = this.searchQuery.page + 1
this.getData()
}
},
getData () {
const config = {
_this: this,
loading: 'loading'
}
this.$http._getData("lawss/NewsFeed/getNewsFeed", this.searchQuery, config).then(res => {
if (res.ok) {
this.total = res.data.total
if (this.searchQuery.page === 1) {
this.list = res.data.records
} else {
this.list = [...this.list, ...res.data.records]
}
getData (page) {
return new Promise((resolve, reject) => {
const config = {
_this: this,
loading: 'loading'
}
if (page) {
this.searchQuery.page = page
}
this.$http._getData("lawss/NewsFeed/getNewsFeed", this.searchQuery, config).then(res => {
if (res.ok) {
this.total = res.data.total
if (this.searchQuery.page === 1) {
this.list = res.data.records
} else {
this.list = [...this.list, ...res.data.records]
}
}
}).finally(() => {
resolve()
})
})
},
getDicTypeListCode () {
@@ -2,9 +2,13 @@
<PhoneScroll
height="calc(100vh - 101px)"
:data="list"
:page="searchQuery.page"
:pageSize="searchQuery.pageSize"
:total="total"
:loading="loading"
:pullingUpHandler="pullingUpHandler">
pullUpLoad
pullDownRefresh
:getDataHandler="getData">
<div style="padding-top: 10px">
<div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)">
<div class="standTitle">
@@ -54,27 +58,28 @@ export default {
this.getData()
},
methods: {
pullingUpHandler () {
if (this.searchQuery.page * this.searchQuery.pageSize <= this.total) {
this.searchQuery.page = this.searchQuery.page + 1
this.getData()
}
},
getData () {
const config = {
_this: this,
loading: 'loading'
}
this.$http._getData("lawss/NewsFeed/getNewsFeed", this.searchQuery, config).then(res => {
if (res.ok) {
this.total = res.data.total
if (this.searchQuery.page === 1) {
this.list = res.data.records
} else {
this.list = [...this.list, ...res.data.records]
}
getData (page) {
return new Promise((resolve, reject) => {
const config = {
_this: this,
loading: 'loading'
}
if (page) {
this.searchQuery.page = page
}
this.$http._getData("lawss/NewsFeed/getNewsFeed", this.searchQuery, config).then(res => {
if (res.ok) {
this.total = res.data.total
if (this.searchQuery.page === 1) {
this.list = res.data.records
} else {
this.list = [...this.list, ...res.data.records]
}
}
}).finally(() => {
resolve()
})
})
},
getDicTypeListCode () {
+3 -3
View File
@@ -8,13 +8,13 @@
</div>
<van-tabs v-model="active">
<van-tab name="ZYBZFG" title="在研标准入库">
<UnderResearchStandards v-if="active==='ZYBZFG'"></UnderResearchStandards>
<UnderResearchStandards></UnderResearchStandards>
</van-tab>
<van-tab name="GNWBZFG" title="标准法规入库">
<StandardRegulations v-if="active==='GNWBZFG'"></StandardRegulations>
<StandardRegulations></StandardRegulations>
</van-tab>
<van-tab name="ZLZX" title="资料中心">
<DataCenter v-if="active==='ZLZX'"></DataCenter>
<DataCenter></DataCenter>
</van-tab>
</van-tabs>
</div>
@@ -7,7 +7,7 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="企标类别" prop="standSort" class="add-form-item form-item-disabled">
<el-select v-model="form.standSort" filterable clearable>
<el-select v-model="form.standSort" filterable clearable disabled>
<el-option
v-for="item in standSortOptions"
placeholder="请选择企标类别"
@@ -7,7 +7,7 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="企标类别" prop="standSort" class="add-form-item form-item-disabled">
<el-select v-model="form.standSort" filterable clearable @change="standSortChange" :disabled="form.reviseStatus === '3'">
<el-select v-model="form.standSort" filterable clearable @change="standSortChange" disabled>
<el-option
v-for="item in standSortOptions"
placeholder="请选择企标类别"