<template>
	<view style="width: 100%">
		<view class="u-page">
			<u-loading-page :loading="loading" bg-color="#e8e8e8"></u-loading-page>

			<u-row customStyle="margin: 5px">
				<u-col span="9">
					<u-search style="z-index: 999" :disabled="true" bgColor="rgb(255 255 255)" placeholder="搜索"
						shape="round" @click="handle_SearchBox_click" :showAction="false" :animation="true"></u-search>
				</u-col>
				<u-col span="3">
					<u-button type="primary" @click="handel_plus_click" size="small" shape="circle" class="custom-style"
						plain text="创建">
					</u-button>
				</u-col>

			</u-row>

			<u-row customStyle="margin-bottom: 10px ">
				<u-col span="12">
					<u-empty v-if="DataList.length == 0" mode="list"></u-empty>
					<u-cell-group customStyle="background-color: white;" v-else>
						<u-cell v-for="item in DataList" :key="item.id" size="large" isLink clickable
							:title="item.templateName" :name="item.elderQuestionnairePaperId"
							@click="handel_cell_click(item)">
						</u-cell>
					</u-cell-group>
					<uni-load-more :status="status" :contentText="loadText" @clickLoadMore="MyonLoad" />
				</u-col>
			</u-row>
		</view>
	</view>
</template>
<script setup>
	import {
		listFwzypgmb,
	} from '@/api/elder/pensionAssessment/fwzypgmb/index';

	import {
		listAssign,
		getAssign,
		delAssign,
		addAssign,
		updateAssign,
	} from "@/api/elder/questionnaire/assign";
	import {
		onLoad,
		onShow,
		onHide,
		onReady
	} from '@dcloudio/uni-app'
	import {
		computed,
		ref,
		reactive,
		onMounted,
	} from 'vue';



	const show = ref(false);
	const columns = reactive([

	]);
	// 老人性名
	let elderName = ref('')
	const form1 = ref(null)
	// import myLoadMore from "@/pages/mixins/myLoadMore";
	// mixins: [myLoadMore],
	// 遮罩层
	let loading = ref(true)
	// 选中数组
	let ids = ref([])
	// 子表选中数据
	let checkedElderQuestionnaireAssignDetail = ref([])
	// 非单个禁用
	let single = ref(true)
	// 非多个禁用
	let multiple = ref(true)
	// 显示搜索条件
	let showSearch = ref(true)
	// 总条数
	let total = ref(0)
	// 发起问卷表格数据
	let DataList = ref([])
	// 发起问卷明细表格数据
	let elderQuestionnaireAssignDetailList = ref([])
	// 弹出层标题
	let title = ref('')
	// 是否显示弹出层
	let open = ref(false)
	// 查询参数

	let queryParams = reactive({
		pageNum: null,
		pageSize: null,
		assignName: null,
		assignType: null,
		answererId: null,
		answererName: null,
		assignStatus: null,
		autoRating: null,
		ruleId: null,
		value: null,
		level: null,
		status: 1,
	})

	// 表单参数
	let form = reactive({})
	// 表单校验
	let rules = reactive({})

	onShow(() => {
		getList()
	})

	/** 查询发起问卷列表 */
	function getList() {
		loading.value = true;


		listFwzypgmb(queryParams).then((response) => {

			DataList.value = response.rows || [];
			total.value = response.total;
			loading.value = false;
		});
	}




	//跳转问卷考卷页面
	function handel_cell_click(item) {
   const filteredDataList = DataList.value.filter(data => data.elderQuestionnairePaperId === item.name);
       const dataListString = JSON.stringify(filteredDataList);
       console.log(dataListString, 789);
	console.log('11111',item)
      // 转义字符串以适应 URL
      uni.navigateTo({
          // url: `/pages_radioQustion/pages/index?name=${encodeURIComponent(item.name)}`
          url: `/pages_radioQustion/pages/index?item=${JSON.stringify(item)}`
      });

	}
</script>


<style scoped>
	.demo-uni-row {
		margin-bottom: 10px;
		/* QQ、字节小程序文档写有 :host，但实测不生效 */
		/* 百度小程序没有 :host，需要设置block */
		/* #ifdef MP-TOUTIAO || MP-QQ || MP-BAIDU */
		display: block;
		/* #endif */
	}

	/* 支付宝小程序没有 demo-uni-row 层级 */
	/* 微信小程序使用了虚拟化节点，没有 demo-uni-row 层级 */
	/* #ifdef MP-ALIPAY || MP-WEIXIN */
	/deep/ .uni-row {
		margin-bottom: 10px;
	}

	/* #endif */

	.demo-uni-col {
		height: 36px;
		border-radius: 4px;
	}

	.mypage-title {
		font-size: 20px;
		font-weight: 600;
		align-self: center;
	}

	.wrap {
		padding: 12px;
	}

	.demo-layout {
		height: 25px;
		border-radius: 4px;
	}

	.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: #323233;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
	}

	.custom-style {
		width: 90%;
		font-weight: bolder;
		font-size: 15px;
		height: 75rpx;
	}
</style>