Commit 6d3a213c authored by xinzhedeai's avatar xinzhedeai

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

parent 615dbc43
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
> >
<p>{{item.title}} <van-icon name="arrow" /></p> <p>{{item.title}} <van-icon name="arrow" /></p>
<p class="module-intro">{{item.remark}}</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> </div>
</div> </div>
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
v-model="shanghuName" v-model="shanghuName"
show-action show-action
placeholder="请输入商家关键词" placeholder="请输入商家关键词"
@search="onSearch" @search="getList()"
v-show="showSearch" v-show="showSearch"
> >
<template #action> <template #action>
<div @click="onSearch"></div> <div @click="getList()"></div>
</template> </template>
</van-search> </van-search>
</div> </div>
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</van-tabs> </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"> <van-cell v-for="item in hazardList" :key="item.id" class="list-item">
<div style="width: 100%;"> <div style="width: 100%;">
<!-- 第一行:隐患描述 --> <!-- 第一行:隐患描述 -->
......
...@@ -22,30 +22,14 @@ window.addEventListener('load', function () { ...@@ -22,30 +22,14 @@ window.addEventListener('load', function () {
{ name: '1', title: '已整改' , msgNum:6,}, { name: '1', title: '已整改' , msgNum:6,},
{ name: '3', title: '整改逾期' , msgNum:7,}, { name: '3', title: '整改逾期' , msgNum:7,},
], ],
loading: false,
finished: false,
page: 0,
size: 6,
total: 0
} }
}, },
computed: { 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() { created() {
let merId = gemhoUtil.getParameter('merId') let merId = gemhoUtil.getParameter('merId')
...@@ -57,7 +41,7 @@ window.addEventListener('load', function () { ...@@ -57,7 +41,7 @@ window.addEventListener('load', function () {
// 2025年6月7日 新增首页(信息统计跳转)类别区分逻辑。 // 2025年6月7日 新增首页(信息统计跳转)类别区分逻辑。
let type = gemhoUtil.getParameter('type') let type = gemhoUtil.getParameter('type')
if(type === 'nopass'){ if(type === 'nopass'){
this.activeTab = 1 this.activeTab = 2
}else if(type === 'willExpire'){ // 即将超期待整改 }else if(type === 'willExpire'){ // 即将超期待整改
this.activeTab = 2 this.activeTab = 2
}else if(type === 'expired'){ // 超期 整改逾期 }else if(type === 'expired'){ // 超期 整改逾期
...@@ -69,55 +53,34 @@ window.addEventListener('load', function () { ...@@ -69,55 +53,34 @@ window.addEventListener('load', function () {
this.init() this.init()
}, },
methods: { 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){ tabChange(title){
console.log('tab 切换', title) console.log('tab 切换', title)
this.onSearch() this.reset()
this.getList()
}, },
init() { init() {
this.getHazardList() this.getList()
}, },
onSearch() { onSearch() {
// 这里添加搜索逻辑 this.getList()
// 这里添加获取数据的逻辑
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)
}, },
// 新增选择确认方法 // 新增选择确认方法
onConfirmType(value) { onConfirmType(value) {
...@@ -146,13 +109,7 @@ window.addEventListener('load', function () { ...@@ -146,13 +109,7 @@ window.addEventListener('load', function () {
// 这里添加跳转逻辑 // 这里添加跳转逻辑
}, },
//获取隐患列表数据 //获取隐患列表数据
getHazardList() { getList() {
// http
// .get('/gq/hiddenDanger/list?merId=1&status=' + this.activeTab)
// .then((res) => {
// console.log(res)
// })
// 这里添加获取数据的逻辑 // 这里添加获取数据的逻辑
vant.Toast.loading({ vant.Toast.loading({
message: '正在加载...', message: '正在加载...',
...@@ -166,12 +123,13 @@ window.addEventListener('load', function () { ...@@ -166,12 +123,13 @@ window.addEventListener('load', function () {
interfacePublicKey: API_KEY_MAP['page']['publicKey'], interfacePublicKey: API_KEY_MAP['page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['page']['privateKey'], interfacePrivateKey: API_KEY_MAP['page']['privateKey'],
reqParams: { reqParams: {
sign: 3, sign: 3,
// merId: this.merId ? this.merId : '', // merId: this.merId ? this.merId : '',
status: this.activeTab, merName: this.shanghuName,
pageNum: this.page++, // 每次请求增加下一页 pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size, pageSize: this.size,
sort: 'lawId,desc', sort: 'lawId,desc',
status: this.yhstatus()
}, },
}, },
(res) => { (res) => {
...@@ -185,10 +143,23 @@ window.addEventListener('load', function () { ...@@ -185,10 +143,23 @@ window.addEventListener('load', function () {
return return
} }
if (res) { if (res) {
var result = JSON.parse(res) var result = JSON.parse(res)
this.hazardList = result.rows console.log(result, 'result')
console.log(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) }, 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