<template>
	<view class="container">
		<view class="content">
			<view class="list">
				<view class="item" v-for="(item,index) in list" :key="index" @click="itemClick(item)">
					<image class="item_img" :src="iconUrl.home_back"></image>
					<view class="item_val">{{item.SubjectTitle}}</view>
				</view>
				<view v-if="list.length == 0" class="noData">
					<noData value="暂无数据"></noData>
				</view>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { reactive, ref } from 'vue';
	import { useOnLoad } from '@/hook';
	import { useDomain } from '@kasite/uni-app-base';
	import { mapGetters } from '@kasite/uni-app-base/store/hook';
	import {
		QuerySubjectListToChannelTask_V3
	} from '../../service';
	import icon from '@/utils/icon';
	import { common, throttle } from '@/utils';
	import fn from './fn';

	const app = getApp();

	const list = ref([])
	const iconUrl = ref(icon)
	const objType = ref("")
	const cardNo = ref("")
	const cardType = ref("")
	const type = ref("")


	useOnLoad((options) => {
		console.log("options===",options,app.globalData)
		main(options);
	});
	const main = async (options) => {
		let queryData = {
			OrgId: app.globalData.hosId,
			State: 1,
			SubjectWay: 'smallpro',
			// 1=面向所有患者、2=面向医院职工、3=面向门诊患者、4=面向住院患者、5=面向体检患者
			GroupType: options.objType || "3"
		}
		let resp = await QuerySubjectListToChannelTask_V3(queryData);
		
		if(!common.isEmpty(resp)) {
			objType.value = options.objType || '3'
			list.value = resp || []
			cardNo.value = options.cardNo
			cardType.value = options.cardType
			type.value = options.type
		}

	};
	/**
	 * 满意度点击
	 */
	const itemClick = (item) => {
		common.goToUrl(`/pagesAdmin/satisfaction/business/satisfactionQuestions/satisfactionQuestions?subjectId=${item.SubjectId}&taskId=${item.TaskId}&cardNo=${cardNo.value}&cardType=${cardType.value}&type=${type.value}`)
	}
</script>

<style lang="scss" scoped>
	.list {
		padding: 30upx;
	}

	.item {
		margin-bottom: 30upx;
		background: rgba(255, 255, 255, 1);
		border-radius: 20upx;
		overflow: hidden;
	}

	.item_img {
		width: 100%;
		height: 340upx;
	}

	.item_val {
		font-size: 32upx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: rgba(0, 0, 0, 1);
		height: 100upx;
		display: flex;
		align-items: center;
		padding: 0 30upx;
		line-height: 1.4em;
	}
</style>