dl_uniapp/pages/notice/report-list.vue

445 lines
10 KiB
Vue
Raw Normal View History

2025-04-10 14:41:14 +08:00
<template>
<view class="container-box">
<navigation-bar-vue title="查看报名" style="width: 100%;" background-color="#ffffff"
title-color="#000000"></navigation-bar-vue>
<view class="content">
<!-- 操作按钮 -->
<view class="dl-opt-box">
<view class="dl-menu-box" v-for="(item,index) in menus">
<view @click="itemClick(index,item)" class="dl-menu"
:class="index==menuIndex?'dl-menu click':'dl-menu'">
2025-04-15 17:40:58 +08:00
{{item}}({{0==index?waitingTotal:checkedTotal}})
2025-04-10 14:41:14 +08:00
</view>
</view>
</view>
<!-- 待定的列表 -->
<view class="data-list-box" v-if="0==menuIndex">
<scroll-view style="height: 100%;" scroll-y="true" @scrolltolower="onReachBottomCus" refresher-enabled
@refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
2025-04-15 17:40:58 +08:00
<card-item status="0" :dataList="waitingList" ifChoose="true" @goIndex="goIndex()"
@chooseCardVal="chooseCardVal" @updateList="updateListWaiting"></card-item>
2025-04-10 14:41:14 +08:00
<view style="text-align: center" v-if="waitingList.length==0">
<image class="" src="@/static/images/nothing.png"></image>
</view>
</scroll-view>
</view>
<!-- 合适的列表 -->
<view class="data-list-box" v-if="1==menuIndex">
<scroll-view style="height: 100%;" scroll-y="true" @scrolltolower="onReachBottomCus" refresher-enabled
@refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
2025-04-15 17:40:58 +08:00
<card-item status="1" :dataList="checkedList" ifChoose="true" @goIndex="goIndex()"
@chooseCardVal="chooseCardVal" @updateList="updateListChecked"></card-item>
2025-04-10 14:41:14 +08:00
<view style="text-align: center" v-if="checkedList.length==0">
<image class="" src="@/static/images/nothing.png"></image>
</view>
</scroll-view>
</view>
</view>
<view class="footer-box">
<view class="left-radio">
<uni-data-checkbox v-if="0==menuIndex" @change="chooseAllFun()" multiple :localdata="chooseAll" />
2025-04-15 17:40:58 +08:00
2025-04-10 14:41:14 +08:00
</view>
<view class="right-button">
<text v-if="0==menuIndex" style="color: #929292;">可在合适列表导出名单</text>
<view v-if="0==menuIndex" class="button-dom" @click="chooseOk">划为合适</view>
<view v-if="1==menuIndex" class="button-dom" @click="exportList">导出名单</view>
</view>
</view>
</view>
</template>
<script>
import navigationBarVue from '@/components/navigation/navigationBar.vue';
import cardItem from '@/pages/notice/card-item.vue';
import {
toast,
hasRights
} from '@/utils/common.js'
2025-04-15 17:40:58 +08:00
import {
reportList,
chooseSign,
getSignNum
} from '@/api/business/notice';
import config from '@/config';
2025-04-10 14:41:14 +08:00
export default {
components: {
navigationBarVue,
cardItem
},
data() {
return {
2025-04-15 17:40:58 +08:00
baseUrl: config.baseUrl,
2025-04-10 14:41:14 +08:00
chooseAll: [{
text: '全选',
value: true
}],
globalConfig: getApp().globalData.config,
menus: ['待定', '合适'],
menuIndex: 0,
2025-04-15 17:40:58 +08:00
waitingParams: {
pageNum: 1,
pageSize: 10
},
checkedParams: {
2025-04-10 14:41:14 +08:00
pageNum: 1,
pageSize: 10
},
//待定的数组
2025-04-15 17:40:58 +08:00
waitingList: [],
2025-04-10 14:41:14 +08:00
// 合适的数组
2025-04-15 17:40:58 +08:00
checkedList: [],
2025-04-10 14:41:14 +08:00
//待定的总数
waitingTotal: 0,
//合适的总数
checkedTotal: 0,
//下来刷新状态
isTriggered: false,
2025-04-15 17:40:58 +08:00
noticeId: null
2025-04-10 14:41:14 +08:00
}
},
computed: {
getChooseNum() {
2025-04-15 17:40:58 +08:00
return this.checkedList.filter((item) => item.choosed && item.choosed.length > 0).length
2025-04-10 14:41:14 +08:00
}
},
2025-04-15 17:40:58 +08:00
onLoad(param) {
this.noticeId = param.noticeId
},
onShow() {
this.waitingList = []
this.checkedList = []
this.menuIndex = 0
this.waitingParams.pageNum = 1
this.checkedParams.pageNum = 1
this.selectDataList()
},
2025-04-10 14:41:14 +08:00
methods: {
2025-04-15 17:40:58 +08:00
updateListWaiting(list) {
this.waitingList = list
console.log(this.waitingList, "waitingList")
},
updateListChecked(list) {
this.checkedList = list
console.log(this.checkedList, "checkedList")
},
chooseOk() {
console.log(this.waitingList, 119);
let tempList = this.waitingList.filter((item) => item.choosed.length > 0)
if (tempList.length == 0) {
uni.showToast({
title: '请勾选合适的卡片',
icon: 'none',
duration: 800
})
return
}
let ids = []
tempList.forEach(it => {
ids.push(it.id)
})
chooseSign({
signIds: ids.join(",")
}).then(res => {
uni.showToast({
title: '成功',
icon: 'none',
duration: 800
})
this.selectDataList()
})
},
getNum() {
let queryData = {}
queryData.noticeId = this.noticeId
getSignNum(queryData).then(res => {
if (res.code == 200) {
this.waitingTotal = res.data.waitNum
this.checkedTotal = res.data.checkedNum
}
})
},
selectDataList() {
let queryData = {}
if (this.menuIndex == 0) {
queryData.status = '01'
queryData.pageNum = this.waitingParams.pageNum
queryData.pageSize = this.waitingParams.pageSize
} else if (this.menuIndex == 1) {
queryData.status = '02'
queryData.pageNum = this.checkedParams.pageNum
queryData.pageSize = this.checkedParams.pageSize
}
queryData.noticeId = this.noticeId
reportList(queryData).then(res => {
if (res.code == 200) {
this.isTriggered = false
res.data.records.map((item) => {
item.choosed = []
})
if (this.menuIndex == 0) {
if (queryData.pageNum == 1) {
this.waitingList = res.data.records
} else {
this.waitingList = this.waitingList.concat(res.data.records)
}
this.waitingTotal = res.data.total
} else if (this.menuIndex == 1) {
if (queryData.pageNum == 1) {
this.checkedList = res.data.records
} else {
this.checkedList = this.checkedList.concat(res.data.records)
}
this.checkedTotal = res.data.total
}
console.log(this.checkedTotal, this.waitingTotal, this.waitingList);
}
})
this.getNum()
},
2025-04-10 14:41:14 +08:00
/**
* 菜单点击
* @param {Object} index
* @param {Object} item
*/
itemClick(index, item) {
this.menuIndex = index
2025-04-15 17:40:58 +08:00
this.selectDataList()
2025-04-10 14:41:14 +08:00
},
/**
* 上滑加载数据
*/
onReachBottomCus() {
2025-04-15 17:40:58 +08:00
let quertData = {}
if (this.menuIndex == 0) {
queryData = this.waitingParams
} else if (this.menuIndex == 1) {
queryData = this.checkedParams
}
2025-04-10 14:41:14 +08:00
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
let total = (0 == this.menuIndex ? this.waitingTotal : this.checkedTotal)
2025-04-15 17:40:58 +08:00
if (queryData.pageNum * queryData.pageSize >= total) {
2025-04-10 14:41:14 +08:00
toast("没有更多数据了")
return
}
//页码+1,调用获取数据的方法获取第二页数据
2025-04-15 17:40:58 +08:00
queryData.pageNum++
this.selectDataList()
2025-04-10 14:41:14 +08:00
},
/**
* 下拉刷新数据
*/
onRefresherrefresh() {
2025-04-15 17:40:58 +08:00
let quertData = {}
if (this.menuIndex == 0) {
queryData = this.waitingParams
} else if (this.menuIndex == 1) {
queryData = this.checkedParams
}
2025-04-10 14:41:14 +08:00
this.isTriggered = true
2025-04-15 17:40:58 +08:00
quertData.pageNum = 1
2025-04-10 14:41:14 +08:00
if (0 == this.menuIndex) {
this.waitingTotal = 0
} else {
this.checkedTotal = 0
}
2025-04-15 17:40:58 +08:00
this.selectDataList()
2025-04-10 14:41:14 +08:00
},
/**
* 全选
* @param {Object} e
*/
chooseAllFun(e) {
if (e.detail.value.length > 0) {
if (0 == this.menuIndex) {
this.waitingList.map((item) => {
item.choosed = [true]
})
} else {
this.checkedList.map((item) => {
item.choosed = [true]
})
}
} else {
if (0 == this.menuIndex) {
this.waitingList.map((item) => {
item.choosed = []
})
} else {
this.checkedList.map((item) => {
item.choosed = []
})
}
}
},
/**
* 导出名单
*/
2025-04-15 17:40:58 +08:00
exportList() {
let exportUrl = this.baseUrl + "/busi/sign/export?noticeId=" + this.noticeId
uni.setClipboardData({
data: exportUrl,
success: function() {
uni.showToast({
title: '名单复制成功,请到浏览器下载',
icon: 'icon',
duration: 2000
});
},
fail: function() {
uni.showToast({
title: '复制失败',
icon: 'none',
duration: 2000
});
}
});
},
2025-04-10 14:41:14 +08:00
/**
* 去名片所有者主页
*/
2025-04-14 11:49:35 +08:00
goIndex(item) {
2025-04-15 17:40:58 +08:00
console.log(item);
},
2025-04-10 14:41:14 +08:00
/**
* 将名片置为合适或不合适
*/
2025-04-15 17:40:58 +08:00
chooseCardVal(value) {
chooseSign({
signIds: value
}).then(res => {
uni.showToast({
title: '成功',
icon: 'none',
duration: 800
})
this.selectDataList()
})
}
2025-04-10 14:41:14 +08:00
}
}
</script>
<style lang="scss">
.container-box {
padding-top: calc(90rpx + var(--status-bar-height));
border-top: 1rpx solid #F4F4F4;
background-color: white;
width: 100%;
color: #363636;
font-size: 30rpx;
height: 100%;
display: flex;
flex-direction: column;
align-items: self-start;
justify-content: center;
position: relative;
.content {
border-top: 1rpx solid #F4F4F4;
height: calc(100vh - var(--status-bar-height) - var(--window-bottom) - 195rpx);
overflow-y: scroll;
width: 100%;
background-color: #F2F2F2;
border-radius: 20rpx;
display: flex;
flex-direction: column;
align-items: self-start;
justify-content: start;
position: relative;
.dl-opt-box {
background-color: white;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
.dl-menu-box {
color: #929292;
display: flex;
flex: 1;
align-items: center;
justify-content: center;
width: 100%;
padding-top: 20rpx;
.dl-menu {
width: auto;
font-size: 30rpx;
margin: 0 20rpx;
padding-bottom: 15rpx;
text-align: center;
}
.click {
color: #FF434E;
font-weight: bold;
border-bottom: 2px solid #FF434E;
}
}
}
.data-list-box {
flex: 1;
padding: 20rpx 30rpx;
display: flex;
flex-direction: column;
align-items: self-start;
justify-content: start;
width: 100%;
}
}
.footer-box {
z-index: 999;
padding: 20rpx 30rpx;
background-color: white;
width: 100%;
display: flex;
align-items: center;
justify-content: start;
position: fixed;
bottom: var(--window-bottom);
.left-radio {
text-align: left;
2025-04-15 17:40:58 +08:00
2025-04-10 14:41:14 +08:00
}
.right-button {
flex: 1;
display: flex;
align-items: center;
justify-content: flex-end;
text {
margin-right: 15rpx;
font-size: 24rpx;
}
.button-dom {
display: flex;
align-items: center;
justify-content: center;
padding: 10rpx 40rpx;
background-color: #FC1F3E;
border-radius: 15rpx;
color: white;
}
}
}
}
2025-04-15 17:40:58 +08:00
.checklist-box {
margin-right: 5rpx !important;
}
</style>