<template>
	<view class="risk-record-page">
		<view class="main-page">
			<scroll-view scroll-x="true" scroll-y="true">
				<uni-table  ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据" @selection-change="selectionChange">
					<uni-tr>
						<uni-th width="30px" align="center" style="padding: 0;">序号</uni-th>
						<uni-th width="60px" align="center">检查区域</uni-th>
						<uni-th align="center">内容</uni-th>
						<!-- <uni-th width="60px" align="center">检查依据</uni-th>
						<uni-th width="60px" align="center">判定标准</uni-th> -->
					</uni-tr>
					<uni-tr v-for="(item, index) in tableData" :key="index">
						<uni-td align="center" style="padding: 0;">{{ index+1 }}</uni-td>
						<uni-td align="center" class="td-modal">
							<view class="name">{{ item.AREA_NAME }}</view>
						</uni-td>
						<uni-td class="td-modal">
							<view><text style="font-weight: bold;">检查内容</text>  :  {{ item.CHECK_CONTENT }}</view>
							<view><text style="font-weight: bold;">检查依据</text>  :  {{ item.Nav_DetailBasicsName }}</view>
							<view><text style="font-weight: bold;">判定标准</text>  :  {{ item.CHECK_STANDARD }}</view>
						</uni-td>
	<!-- 					<uni-td align="center" class="td-modal">{{ item.CHECK_CONTENT }}</uni-td>
						<uni-td align="center" class="td-modal">{{ item.CHECK_BASIC }}</uni-td>
						<uni-td align="center" class="td-modal">{{ item.CHECK_STANDARD }}</uni-td> -->
					</uni-tr>
				</uni-table>
				<!-- <view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total" @change="change" /></view> -->
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			tableData: {
				type: Array,
				default () {
					return []
				}
			},
		},
		data() {
			return {
				searchVal: '',
				// 每页数据量
				pageSize: 10,
				// 当前页
				pageCurrent: 1,
				// 数据总量
				total: 0,
				loading: false,
				Nav_DetailBasicsName:''
			}
		},
		created() {
			this.selectedIndexs = []
			this.tableData.map(item=>{
				if (item.Nav_DetailBasics.length > 0) {
					let areaShow = ''
					item.Nav_DetailBasics.map(o => {
						if (o.Nav_Law && o.Nav_Law.NAME) {
							areaShow += o.Nav_Law.NAME + ' 、'
						}
				
					})
					item['Nav_DetailBasicsName'] = areaShow
				} else {
					item['Nav_DetailBasicsName'] = ''
				}
			})
		},
		methods: {
			// 多选处理
			selectedItems() {
				return this.selectedIndexs.map(i => this.tableData[i])
			},
			// 多选
			selectionChange(e) {
				this.$emit('transmit', e.detail.index)
				this.selectedIndexs = e.detail.index
			},
			// 分页触发
		}
	}
</script>

<style>
	/* #ifndef H5 */
	/* page {
	padding-top: 85px;
} */
	/* #endif */
	.uni-group {
		display: flex;
		align-items: center;
	}

	.uni-container {
		padding-bottom: 80px;
		overflow-y: scroll;
		overflow-x: scroll;
		max-height: 400px;
		width: 100%;
	}

	.table-two>>>.uni-table {
		min-width: 400px !important;
	}

	.td-modal {
		white-space: normal;
		/* 允许文本换行 */
		word-wrap: break-word;
		/* 当单词太长时进行换行 */
		word-break: break-all
	}
	.risk-record-page {
		width: 100%;
		max-height: 400px;
		overflow-y: scroll;
	}
	
	.main-page {
		padding: 0px 5px;
		max-height: 400px;
	}
</style>