<template>
	<div class="political-outlook">
		<div class="content">
			<div class="table-one">
				<div class="tabList">
					<div>姓名</div>
					<div>整改总数</div>
					<div>超期整改数</div>
					<div>超期未整改数</div>
					<div>整改率</div>
					<div>及时整改率</div>
				</div>
				<el-scrollbar class="listBox" ref="refScrollbar">
					<div v-for="(item, index) in partyMemberList" class="listStyle" :key="item.id">
						<div>{{item.workerName}}</div>
						<div>{{item.rectifiedNum}}</div>
						<div>{{item.overTimeRectifiedNum}}</div>
						<div>{{item.overTimeNotRectifiedNum}}</div>
						<div>{{item.rectifiedNumRatio}}</div>
						<div>{{item.rectifiedNumRatioTimely}}</div>
					</div>
					<div class="notoDta" v-if="partyMemberList.length == 0">
						<img src="@/assets/images/noData.png" alt="" />
						<p>暂无数据</p>
					</div>
				</el-scrollbar>
			</div>
		</div>
	</div>
</template>

<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { GlobalStore } from "@/stores";
import { getMemberJobStatusApi } from "@/api/modules/agjtCommandApi";
const store = GlobalStore();
const props = defineProps(["tip"]);
let pageNo = ref(1 as any);
let moreScroll = ref(true as any);
const refScrollbar = ref(null as any); // 绑定到滚动的盒子上
const partyMemberList = ref({} as any);
//获取数据
const getMemberCountList = async (tip:any) => {
	let requestData:any = {
		projectSn: store.sn,
		pageSize: 100,
		pageNo: 1
	}
	const res: any = await getMemberJobStatusApi(requestData);
	console.log("获取人员信息列表", res);
	if(tip == 'more'){
		partyMemberList.value = partyMemberList.value.concat(res.result.records);
	} else {
		partyMemberList.value = res.result.records;
	}
	// 为图片拼接IP
	// partyMemberList.value.map((item:any) => {
	// 	item.fieldAcquisitionUrl = BASEURL + '/image/' + item.fieldAcquisitionUrl
	// })
	if (res.result.pages == pageNo.value) {
		moreScroll.value = false;
	} else {
		pageNo.value = pageNo.value + 1;
	}
};

onMounted(async () => {
	await getMemberCountList('search');
	refScrollbar.value.wrapRef.addEventListener("scroll", (e: any) => {
		// console.log("滚动容器", e);
		const scrollTop = e.target.scrollTop;
		const scrollHeight = e.target.scrollHeight;
		const clientHeight = e.target.clientHeight;
		// console.log("滚动容器", scrollTop, scrollHeight, clientHeight);
		// 向上加载更多
		if (scrollTop >= scrollHeight - clientHeight - 1) {
			// console.log("加载更多");
			if (moreScroll.value) {
				getMemberCountList("more");
			}
		}
	});
});
</script>

<style lang="scss" scoped>
@mixin flex {
	display: flex;
	align-items: center;
}
.political-outlook {
	height: 97%;
	margin: 0 60px;
	.content {
		height: 95%;
		width: 100%;
		margin-top: 10px;
		// background: url("@/assets/images/cardImg.png") no-repeat;
		background-size: 100% 100%;
		padding: 20px 15px;
		.table-one{
			height: 88%;
			.tabList {
				display: flex;
				// width: 100%;
				height: 8%;
				background: url("@/assets/images/vehicleManagement/ListTitleImg.png") no-repeat;
				background-size: 100% 100%;
				// position: absolute;
				left: 75.5%;
				top: 75%;
				color: #ccc;
				font-size: calc(100vw * 14 / 1920);
				line-height: 30px;
				align-items: center;
				margin-top: 2%;
				div {
					text-align: center;
					width: 17%;
				}
			}
			.listBox {
				height: 90%;
				.listStyle {
					display: flex;
					align-items: center;
					text-align: center;
					color: #fff;
					font-size: 12px;
					padding: 5px 0px;
					.list-img {
						.el-img {
							width: 30px;
							height: 30px;
							img {
								display: flex;
								align-items: center;
								width: 100%;
								height: 100%;
							}
						}
					}
					div {
						width: 17%;
						white-space: nowrap; //单行
						overflow: hidden;
						text-overflow: ellipsis;
					}
				}
				.listStyle:hover {
					background: #091f3f;
				}
			}
		}
		:deep(){
			.el-tabs__item{
				color: white;
			}
			.el-tabs__item.is-active{
				color: var(--el-color-primary)
			}
		}
	}
}
.notoDta {
	top: 35%;
	width: 20%;
	left: 40%;
	position: absolute;
	text-align: center;
	img {
		width: 40%;
		margin: 5% 30%;
	}
	p {
		color: #fff;
		font-size: calc(100vw * 14 / 1920);
		margin: -6% 37%;
	}
}
// element 组件样式
:deep() {
	.el-date-editor .el-range-input,
	.el-range-separator {
		color: #fff;
	}
	.el-input__wrapper {
		background: #112d59;
	}
	.el-input__inner {
		color: #fff;
	}
	.el-button {
		background-color: #2758c0;
		color: white;
		border-color: transparent;
	}
}
// ::v-deep .el-select .el-input .el-select__caret {
// 	color: #fff;
// }
</style>
