<template>
	<uni-list>
		<!-- <checkbox-group name="allpick"> -->
		<!-- <label> -->
		<view v-for="(item,index) in scaleList " :key="index">
			<uni-list-item :showArrow="false">
				<template v-if="ischeckbox" v-slot:header>
					<checkbox @tap="selchange(item)" style="margin-right: 10px;align-content: center;" value="item.id"
						:checked="item.ispick" />
				</template>
				<template @tap="showView(item)" v-slot:body>
					<div class="flex-1 flex">
						<image style="width: 130rpx;" mode="widthFix" :src="item.data.Picture"></image>
						<div class="flex-1 margin-left-sm">
								<div class="font-32">{{item.snCode}}</div>
							<div class="font-24">{{'指令号：'+item.data.manuNum}}</div>
							<div class="font-24">{{'PO号：'+item.data.poNum}}</div>
						</div>
					</div>
				</template>
				<template v-slot:footer>
					<div @tap="showView(item)" style="align-content: center;text-align: right;">
						<tui-button @click="deletebtn(item)" :size="20" width="74rpx" height="56rpx"  type="danger"  >删除</tui-button>
					</div>
				</template>
				<template></template>
			</uni-list-item>
		</view>
		<!-- </label> -->
		<!-- </checkbox-group> -->
	</uni-list>
</template>

<script>
	export default {
		name: 'scaleListCom',
		emits: ['click'],
		props: {
			scaleList: {
				type: Array,
				default: []
			},
			ischeckbox: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {
				select: null
			}
		},
		created() {
			if (this.ischeckbox) {
				this.setAssetsNOselect()
			}
		},
		methods: {
			setAssetsNOselect() {
				if (this.ischeckbox) {
					this.scaleList.map(v => {
						this.$set(v, 'ispick', false)
					})
				}
			},
			showView(item) {
				this.$tab.navigateTo('/pages/takestock/assetsView/index?id=' + item.id)
			},
			selchange(item) {
				if (!item.ispick) {
					this.setAssetsNOselect()
					item.ispick = true
					this.select = item

				} else {
					item.ispick = false
					this.select = null
				}
				this.$nextTick(() => {
					if (this.ischeckbox) {
						this.$emit('getselect', this.select)
					}
				})

			},
			deletebtn(item){
				this.$emit('delete',item)
			}
		},
	}
</script>

<style>
</style>