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
View File
@@ -13,6 +13,7 @@
"@antv/g6": "^4.3.6", "@antv/g6": "^4.3.6",
"@babel/polyfill": "^7.12.1", "@babel/polyfill": "^7.12.1",
"@better-scroll/core": "^2.5.1", "@better-scroll/core": "^2.5.1",
"@better-scroll/pull-down": "^2.5.1",
"@better-scroll/pull-up": "^2.5.1", "@better-scroll/pull-up": "^2.5.1",
"@better-scroll/scroll-bar": "^2.5.1", "@better-scroll/scroll-bar": "^2.5.1",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
@@ -1,17 +1,50 @@
<template> <template>
<div class="scroll-wrapper" ref="scroll" :style="{height: height}"> <div class="scroll-wrapper" ref="scroll" :style="{height: height}">
<div class="scroll-content" ref="content"> <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 <van-loading
v-if="loading" v-if="loading && !pullDownLoading && !pullUpLoading"
class="pageLoading"
type="spinner" type="spinner"
size="16px" size="16px"
text-size="12px" text-size="12px"
color="#3170A8" color="#3170A8"
style="text-align: center" style="text-align: center"
>加载中...</van-loading> >加载中...</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>
</div> </div>
</template> </template>
@@ -20,9 +53,11 @@
import BScroll from '@better-scroll/core' import BScroll from '@better-scroll/core'
import ScrollBar from '@better-scroll/scroll-bar' import ScrollBar from '@better-scroll/scroll-bar'
import Pullup from '@better-scroll/pull-up' import Pullup from '@better-scroll/pull-up'
import PullDown from '@better-scroll/pull-down'
BScroll.use(ScrollBar) BScroll.use(ScrollBar)
BScroll.use(Pullup) BScroll.use(Pullup)
BScroll.use(PullDown)
export default { export default {
name: "PhoneScroll", name: "PhoneScroll",
@@ -37,10 +72,12 @@ export default {
default: () => [], default: () => [],
required: true required: true
}, },
// 是否加载中 page: {
loading: { type: Number,
type: Boolean, required: true
default: false, },
pageSize: {
type: Number,
required: true required: true
}, },
// 总数 // 总数
@@ -48,18 +85,46 @@ export default {
type: Number, type: Number,
required: true required: true
}, },
// 上拉加载回调 // 上拉和下拉之外的loading
pullingUpHandler: { loading: {
type: Boolean,
default: false
},
// 是否开启上拉加载
pullUpLoad: {
type: Boolean,
default: false
},
// 是否开启下拉刷新
pullDownRefresh: {
type: Boolean,
default: false
},
// 获取数据回调 返回值必须是Promise
getDataHandler: {
type: Function, type: Function,
default: () => { default: (page) => {
console.log('请传入上拉加载回调函数参数pullingUpHandler') console.log('请传入获取数据回调函数参数getDataHandler', page)
return Promise.resolve()
} }
}, },
}, },
data () { data () {
return { return {
bs: null, bs: null,
toEnd: false
// 下拉刷新
pullDown: false,
isEnterThreshold: false,
isLeaveThreshold: false,
pullDownLoading: false,
// 上拉加载
pullUpLoading: false,
isShowAll: false,
isEmpty: false,
} }
}, },
watch: { watch: {
@@ -71,19 +136,36 @@ export default {
refreshScroll () { refreshScroll () {
this.$nextTick(() => { this.$nextTick(() => {
if (!this.bs) { 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, { this.bs = new BScroll(this.$refs.scroll, {
probeType: 3, probeType: 3,
scrollbar: true, scrollbar: true,
pullUpLoad: { pullUpLoad,
threshold: 50 pullDownRefresh,
},
click: true click: true
}) })
this.bs && this.bs.on('pullingUp', () => {
this.pullingUpHandler() if (this.pullUpLoad) {
// 结束上拉加载 this.bs.on('pullingUp', this.pullingUpHandler)
this.bs.finishPullUp() }
})
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}) => { }) 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) { scrollTo (x, y ,time, easing) {
if (this.bs) { if (this.bs) {
this.bs.scrollTo(x, y, time, easing) this.bs.scrollTo(x, y, time, easing)
@@ -107,4 +239,24 @@ export default {
overflow: hidden; overflow: hidden;
position: relative; 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> </style>
+26 -21
View File
@@ -27,9 +27,13 @@
ref="scroll" ref="scroll"
height="calc(100vh - 100px)" height="calc(100vh - 100px)"
:data="list" :data="list"
:page="searchQuery.page"
:pageSize="searchQuery.pageSize"
:total="total" :total="total"
:loading="loading" :loading="loading"
:pullingUpHandler="pullingUpHandler"> pullUpLoad
pullDownRefresh
:getDataHandler="getData">
<div style="padding-top: 10px"> <div style="padding-top: 10px">
<div class="card-content" <div class="card-content"
v-for="item in list" v-for="item in list"
@@ -177,12 +181,6 @@ export default {
// this.getData() // this.getData()
}, },
methods: { methods: {
pullingUpHandler () {
if (this.searchQuery.page * this.searchQuery.pageSize <= this.total) {
this.searchQuery.page = this.searchQuery.page + 1
this.getData()
}
},
onSearch () { onSearch () {
this.list = [] this.list = []
this.searchQuery.page = 1 this.searchQuery.page = 1
@@ -190,7 +188,7 @@ export default {
this.$refs.scroll.scrollTo(0, 0) this.$refs.scroll.scrollTo(0, 0)
this.getData() this.getData()
}, },
getData () { getData (page) {
switch (this.$route.query.standType) { switch (this.$route.query.standType) {
case 'INLAND': case 'INLAND':
this.searchQuery.selectIndex = 'stand' this.searchQuery.selectIndex = 'stand'
@@ -209,20 +207,27 @@ export default {
this.searchQuery.standType = 'laws' this.searchQuery.standType = 'laws'
break break
} }
const config = { return new Promise((resolve, reject) => {
_this: this, const config = {
loading: 'loading' _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]
}
} }
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 () { onChoose () {
@@ -6,9 +6,13 @@
<PhoneScroll <PhoneScroll
height="calc(100vh - 131px)" height="calc(100vh - 131px)"
:data="list" :data="list"
:page="searchQuery.page"
:pageSize="searchQuery.pageSize"
:total="total" :total="total"
:loading="loading" :loading="loading"
:pullingUpHandler="pullingUpHandler"> pullUpLoad
pullDownRefresh
:getDataHandler="getData">
<div style="padding-top: 10px"> <div style="padding-top: 10px">
<div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)"> <div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)">
<div class="standTitle"> <div class="standTitle">
@@ -57,12 +61,6 @@ export default {
this.getData() this.getData()
}, },
methods: { methods: {
pullingUpHandler () {
if (this.searchQuery.page * this.searchQuery.pageSize <= this.total) {
this.searchQuery.page = this.searchQuery.page + 1
this.getData()
}
},
onOpen () { onOpen () {
this.$refs.folderPopupRef.open(this.searchQuery.treeId || null) this.$refs.folderPopupRef.open(this.searchQuery.treeId || null)
}, },
@@ -72,20 +70,27 @@ export default {
this.searchQuery.page = 1 this.searchQuery.page = 1
this.getData() this.getData()
}, },
getData () { getData (page) {
const config = { return new Promise((resolve, reject) => {
_this: this, const config = {
loading: 'loading' _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]
}
} }
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) { jumpDetails(item) {
@@ -2,9 +2,13 @@
<PhoneScroll <PhoneScroll
height="calc(100vh - 101px)" height="calc(100vh - 101px)"
:data="list" :data="list"
:page="searchQuery.page"
:pageSize="searchQuery.pageSize"
:total="total" :total="total"
:loading="loading" :loading="loading"
:pullingUpHandler="pullingUpHandler"> pullUpLoad
pullDownRefresh
:getDataHandler="getData">
<div style="padding-top: 10px"> <div style="padding-top: 10px">
<div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)"> <div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)">
<div class="standTitle"> <div class="standTitle">
@@ -55,27 +59,28 @@ export default {
this.getData() this.getData()
}, },
methods: { methods: {
pullingUpHandler () { getData (page) {
if (this.searchQuery.page * this.searchQuery.pageSize <= this.total) { return new Promise((resolve, reject) => {
this.searchQuery.page = this.searchQuery.page + 1 const config = {
this.getData() _this: this,
} loading: 'loading'
},
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]
}
} }
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 () { getDicTypeListCode () {
@@ -2,9 +2,13 @@
<PhoneScroll <PhoneScroll
height="calc(100vh - 101px)" height="calc(100vh - 101px)"
:data="list" :data="list"
:page="searchQuery.page"
:pageSize="searchQuery.pageSize"
:total="total" :total="total"
:loading="loading" :loading="loading"
:pullingUpHandler="pullingUpHandler"> pullUpLoad
pullDownRefresh
:getDataHandler="getData">
<div style="padding-top: 10px"> <div style="padding-top: 10px">
<div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)"> <div class="card-content" v-for="item in list" :key="item.id" @click="jumpDetails(item)">
<div class="standTitle"> <div class="standTitle">
@@ -54,27 +58,28 @@ export default {
this.getData() this.getData()
}, },
methods: { methods: {
pullingUpHandler () { getData (page) {
if (this.searchQuery.page * this.searchQuery.pageSize <= this.total) { return new Promise((resolve, reject) => {
this.searchQuery.page = this.searchQuery.page + 1 const config = {
this.getData() _this: this,
} loading: 'loading'
},
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]
}
} }
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 () { getDicTypeListCode () {
+3 -3
View File
@@ -8,13 +8,13 @@
</div> </div>
<van-tabs v-model="active"> <van-tabs v-model="active">
<van-tab name="ZYBZFG" title="在研标准入库"> <van-tab name="ZYBZFG" title="在研标准入库">
<UnderResearchStandards v-if="active==='ZYBZFG'"></UnderResearchStandards> <UnderResearchStandards></UnderResearchStandards>
</van-tab> </van-tab>
<van-tab name="GNWBZFG" title="标准法规入库"> <van-tab name="GNWBZFG" title="标准法规入库">
<StandardRegulations v-if="active==='GNWBZFG'"></StandardRegulations> <StandardRegulations></StandardRegulations>
</van-tab> </van-tab>
<van-tab name="ZLZX" title="资料中心"> <van-tab name="ZLZX" title="资料中心">
<DataCenter v-if="active==='ZLZX'"></DataCenter> <DataCenter></DataCenter>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
</div> </div>
@@ -7,7 +7,7 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="企标类别" prop="standSort" class="add-form-item form-item-disabled"> <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 <el-option
v-for="item in standSortOptions" v-for="item in standSortOptions"
placeholder="请选择企标类别" placeholder="请选择企标类别"
@@ -7,7 +7,7 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="企标类别" prop="standSort" class="add-form-item form-item-disabled"> <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 <el-option
v-for="item in standSortOptions" v-for="item in standSortOptions"
placeholder="请选择企标类别" placeholder="请选择企标类别"