<template>
	<view class="djTaskDetail">
		<!-- 代煎作业质控标题 -->
		<view class="djTaskDetail_progress">
			<text class="djTaskDetail_progress_title">任务进度：<text
					class="djTaskDetail_progress_text">{{props.djWcCount+'/'+props.djCyCount}}</text></text>
			<!-- <text class="djTaskDetail_progress_title">不合格数<text class="djTaskDetail_progress_text">{{bhgNumber()}}</text></text> -->
		</view>
		<!-- 代煎数 -->
		<!-- 代煎表格 -->
		<view v-if="props.djTaskList.length!=0">
			<uni-table class="djDetail_table">
				<!-- 表头行 -->
				<uni-tr>
					<uni-th align="center" width="155rpx">处方编号</uni-th>
					<uni-th align="center" width="150rpx">贴数(贴)</uni-th>
					<uni-th align="center" width="150rpx">检查项</uni-th>
					<uni-th align="center" width="155rpx">不合格项</uni-th>
					<uni-th align="center" width="155rpx">待检项</uni-th>
				</uni-tr>
				<!-- 表格数据行 -->
				<uni-tr v-for="(item, index) in props.djTaskList" :key="index" @click="toDetail(item)">
					<uni-td align="center">{{item.yncfbh}}</uni-td>
					<uni-td align="center">{{item.ts}}</uni-td>
					<uni-td align="center">{{item.jcx}}</uni-td>
					<uni-td align="center" :style="changeColor(item.bhgx,'red')">{{item.bhgx}}</uni-td>
					<uni-td align="center" :style="changeColor(item.djCount,'blue')">{{item.djCount}}
						<uni-icons type="right"></uni-icons>
					</uni-td>
				</uni-tr>
			</uni-table>
		</view>
		<view v-else>
			<dataEmpty></dataEmpty>
		</view>
		<!-- 开始质控 -->
		<view class="finish_button"
			v-if="props.taskStatus!='7004' && props.taskStatus!='7007' && props.taskStatus!='7008' && props.taskStatus!='7009' && props.taskStatus!='7010'">
			<button class="button" @click="startTask()">开始质控</button>
		</view>
	</view>
</template>

<script setup>
	import {
		reactive
	} from "vue";
	import {
		onLoad,
		onShow,
		onUnload,
		onPullDownRefresh
	} from "@dcloudio/uni-app";
	import http from '@/utils/request';
	import dataEmpty from "@/pages/ypczk/zkTask/zkTaskDetail/noStartTaskDetail.vue";

	const props = defineProps({
		// 代煎质控详情列表
		djTaskList: Array,
		// 代煎不合格数
		djbhg: Number,
		// 任务状态
		taskStatus: String,
		// 代煎抽样数量
		djCyCount: Number,
		// 代煎完成数量
		djWcCount: Number,
	});

	// 开始质控
	const startTask = () => {
		uni.$emit("startTaskInfo")
	}

	// 跳转详情界面
	const toDetail = (e) => {
		uni.navigateTo({
			url: "/pages/ypczk/zkTask/djTask?status=get" + '&ptwybh=' + e.ptwybm + '&fyfslx=3' + '&cfbh=' + e
				.cfbh + '&id=' + e.id + '&taskStatus=' + props.taskStatus
		})
	}
	
	const changeColor = (name,color) => {
		// 根据状态值返回不同的样式对象
		return {
			color: name > 0 ? color : 'black'
		};
	}
</script>

<style lang="scss" scoped>
	@import './index.scss'
</style>
