Commit 6d3a213c authored by xinzhedeai's avatar xinzhedeai

add:隐患检查列表 分页功能 重置

parent 615dbc43
......@@ -296,7 +296,7 @@
>
<p>{{item.title}} <van-icon name="arrow" /></p>
<p class="module-intro">{{item.remark}}</p>
<div class="new-badge"></div>
<div class="new-badge" v-if="item.msgFlag"></div>
</div>
</div>
</div>
......
......@@ -18,11 +18,11 @@
v-model="shanghuName"
show-action
placeholder="请输入商家关键词"
@search="onSearch"
@search="getList()"
v-show="showSearch"
>
<template #action>
<div @click="onSearch"></div>
<div @click="getList()"></div>
</template>
</van-search>
</div>
......@@ -43,7 +43,7 @@
</van-tabs>
<!-- 隐患列表 -->
<van-list>
<van-list v-model:loading="loading" :offset="10" :finished="finished" finished-text="没有更多了" @load="getList" :immediate-check="false">
<van-cell v-for="item in hazardList" :key="item.id" class="list-item">
<div style="width: 100%;">
<!-- 第一行:隐患描述 -->
......
......@@ -22,30 +22,14 @@ window.addEventListener('load', function () {
{ name: '1', title: '已整改' , msgNum:6,},
{ name: '3', title: '整改逾期' , msgNum:7,},
],
loading: false,
finished: false,
page: 0,
size: 6,
total: 0
}
},
computed: {
yhstatus(){ // tab值对应的隐患状态码装欢
if(this.activeTab === 0){
return ''
}else if(this.activeTab === 1){
return ~~'2'
}else if(this.activeTab === 2){
return ~~'0'
}else if(this.activeTab === 3){
return ~~'1'
}else if(this.activeTab === 4){
return ~~'3'
}
}
// filteredHazards() {
// const statusMap = ['全部', '待审核', '待整改', '已整改', '整改逾期']
// return this.hazardList.filter((item) =>
// this.activeTab === ''
// ? true
// : item.rectificationStatusName === statusMap[this.activeTab]
// )
// },
},
created() {
let merId = gemhoUtil.getParameter('merId')
......@@ -57,7 +41,7 @@ window.addEventListener('load', function () {
// 2025年6月7日 新增首页(信息统计跳转)类别区分逻辑。
let type = gemhoUtil.getParameter('type')
if(type === 'nopass'){
this.activeTab = 1
this.activeTab = 2
}else if(type === 'willExpire'){ // 即将超期待整改
this.activeTab = 2
}else if(type === 'expired'){ // 超期 整改逾期
......@@ -69,55 +53,34 @@ window.addEventListener('load', function () {
this.init()
},
methods: {
reset(){
this.page = 0
this.size = 6
this.hazardList = []
},
yhstatus(){ // tab值对应的隐患状态码装欢
if(this.activeTab === 0){
return ''
}else if(this.activeTab === 1){
return ~~'2'
}else if(this.activeTab === 2){
return ~~'0'
}else if(this.activeTab === 3){
return ~~'1'
}else if(this.activeTab === 4){
return ~~'3'
}
},
tabChange(title){
console.log('tab 切换', title)
this.onSearch()
this.reset()
this.getList()
},
init() {
this.getHazardList()
this.getList()
},
onSearch() {
// 这里添加搜索逻辑
// 这里添加获取数据的逻辑
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
})
setTimeout(() => {
http2.post(
{
serviceId: API_KEY_MAP['page']['id'],
interfacePublicKey: API_KEY_MAP['page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['page']['privateKey'],
reqParams: {
sign: 3,
// merId: this.merId ? this.merId : '',
merName: this.shanghuName,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
sort: 'lawId,desc',
status: this.yhstatus
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => {
// this.getList()
}, 0)
return
}
if (res) {
var result = JSON.parse(res)
this.hazardList = result.rows
console.log(result)
}
}
)
}, 0)
this.getList()
},
// 新增选择确认方法
onConfirmType(value) {
......@@ -146,13 +109,7 @@ window.addEventListener('load', function () {
// 这里添加跳转逻辑
},
//获取隐患列表数据
getHazardList() {
// http
// .get('/gq/hiddenDanger/list?merId=1&status=' + this.activeTab)
// .then((res) => {
// console.log(res)
// })
getList() {
// 这里添加获取数据的逻辑
vant.Toast.loading({
message: '正在加载...',
......@@ -168,10 +125,11 @@ window.addEventListener('load', function () {
reqParams: {
sign: 3,
// merId: this.merId ? this.merId : '',
status: this.activeTab,
merName: this.shanghuName,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
sort: 'lawId,desc',
status: this.yhstatus()
},
},
(res) => {
......@@ -186,9 +144,22 @@ window.addEventListener('load', function () {
}
if (res) {
var result = JSON.parse(res)
this.hazardList = result.rows
console.log(result)
console.log(result, 'result')
this.loading = false; // 加载状态结束
this.hazardList.push(...result.rows);
this.total = result.total
if (this.page * this.size >= this.total) {
this.finished = true; // 下滑不在刷新数据
}
}
this.loading = false
setTimeout(() => {
this.$nextTick(()=>{
vant.Toast.clear()
})
}, 0);
}
)
}, 0)
......
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