<template>
	<view>
		<uni-list>
			<uni-list-item v-for="(item,index) in dataList" :key='item.taskId' :title="item.taskTitle"
				:note="item.taskCode" link :to="'/views/entRiskPointCheck/table?taskId='+item.taskId +'&riskPointId='+item.riskPointId"
				:rightText=" getStatus(item.status)">
				<view slot="header" class="slot-box">
					<text class="zhcx-iconfont zhcx-icon-caidan"></text>
				</view>
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import { getCheckTaskByPage } from '@/api/task.js';
	export default {
		data() {
			return {
				dataList: [],
				queryConditions: {
					page: 1,
					limit: 10,
					total: 0,
					keywords: '',
				}
			}
		},
		onLoad() {
			this.getData();
		},
		onShow() {
			this.getData();
		},
		methods: {
			getData() {
				console.log("初始化方法")
				getCheckTaskByPage(this.queryConditions).then((res) => {
					const { code, msg, data } = res;
					if (code === 0) {
						console.log("任务列表有数据！", data);
						this.dataList = data
					}
				}).catch((error) => {
					console.log(error)
				})
			},
			getStatus(status) {
				if (status == 1) {
					return "处理中"
				} else if (status == 2) {
					return "已取消"
				} else if (status == 3) {
					return "已完成"
				} else {
					return "未开始"
				}
			}

		},
	}
</script>

<style>
	.chat-custom-right {
		flex: 1;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: space-between;
		align-items: flex-end;
	}

	.chat-custom-text {
		font-size: 12px;
		color: #999;
	}

	.slot-box {
		display: flex;
		justify-content: center;
		align-items: center;
		padding-right: 10upx;
		color: #00A0FF;
	}
</style>
