<template>
	<view class="dmodel-table">
	      <zb-table ref="zbTable" rowKey="id"
             :columns="tableColumn" :data="tableData" :stripe="true"
			@toggleRowSelection="toggleRowSelection">
			<template slot="slot" slot-scope="scope">
        <dict-tag
					:options="dict.type.sys_report_type"
					:value="scope.row.reportType"
				/>
      </template>
		</zb-table>
	</view>
</template>

<script>
import i18n from '../../../../lang/index'

	export default {
    dicts: ["sys_report_type"],
		props: {
			data: {
				type: Object,
				default: () => {}
			}
		},
		data() {
			return {
				tableData: [],
				tableSelectData: [],
				tableColumn: [{
						type: 'radio',
						width: 80
					},
					{
						name: 'name',
						label: i18n.t('模版名称'),
						width: 160,
					},
					{
						type: 'slot',
						name: 'reportType',
						label: i18n.t('模版类型'),
						width: 200,
					},
					{
						name: 'remark',
						label: i18n.t('备注'),
						width: 100,
					}
				],
			}
		},
		// computed: {
		// 	tableData() {
		// 		return this.data || []
		// 	}
		// },
		mounted() {
		  this.getList()
		  // this.data.workstationName
		},
		methods: {
			async getList() {
			  let params = {
			  	pageNum: 1,
			  	pageSize: 10000,
				  reportType: 'package_label'
			  }
			  const res = await this.$u.api.getPrintTemplateList(params)
			  console.log(res, 'res')
			  if (res.code == 200) {
			  	this.tableData=res.rows.map(item => {
					return {
						...item,
						workstationName: this.data.workstationName
					}
				})
			  }	
			},
			toggleRowSelection(checked, arr) {
				console.log(arr, 'arrs')
				this.tableSelectData = arr
			},
		}
	}
</script>

<style scoped>
	.dmodel-table {
		height: 500rpx;
		margin-top: 20rpx;
		padding: 0 20rpx;
	}
	.search{
		display: flex;
		margin-bottom:20rpx;
		align-items: center;
		.u-search{
			width: 400rpx !important;
			margin-right:20rpx !important;
		}
	}
</style>
