<template>
	<view class="dmodel-table">
			<view class="search">
				<u-form :model="tableParams" labelAlign="right" class="tableForm">
					<u-form-item label="工作站" label-width="60px"  name="workstationName">
						<uni-easyinput type="text" v-model="tableParams.workstationName" placeholder="请输入工作站" />
					</u-form-item>
					<u-form-item label="工作单元编码" label-width="100px"  name="workunitCode">
						<uni-easyinput type="text" v-model="tableParams.workunitCode" placeholder="请输入工作单元编码" />
					</u-form-item>
					<u-form-item label="工作单元名称" label-width="100px"  name="workunitName">
						<uni-easyinput type="text" v-model="tableParams.workunitName" placeholder="请输入工作单元名称" />
					</u-form-item>
					<u-form-item>
						<u-button class="btn" @click="getList" type="primary" size="medium">搜索</u-button>
					</u-form-item>
				</u-form>
			</view>
	      <zb-table ref="zbTable" rowKey="workunitId"
             :columns="tableColumn" :data="tableData" :stripe="true"
			@toggleRowSelection="toggleRowSelection">
		</zb-table>
	</view>
</template>

<script>
	export default {
		props: {
		
		},
		data() {
			return {
				tableParams: {
          workunitCode: null,
					workunitName: null,
					workstationName: null
				},
				tableData: [],
				tableSelectData: [],
				tableColumn: [{
						type: 'radio',
						width: 40
					},
					{
						name: 'workstationName',
						label: '工作站名称',
						width: 160,
					},
					{
						name: 'workunitCode',
						label: '工作单元编码',
						width: 200,
					},

					{
						name: 'workunitName',
						label: '工作单元名称',
						width: 300,
					},
				
				],
			}
		},
		// computed: {
		// 	tableData() {
		// 		return this.data || []
		// 	}
		// },
		mounted() {
		  this.getList()
		  // this.data.workstationName
		},
		methods: {
			async getList() {
			  const res = await this.$u.api.getMesWorkunitList(this.tableParams)
			  console.log(res, 'res')
			  if (res.code == 200) {
			  	this.tableData=res.rows
			  }
			},
			toggleRowSelection(checked, arr) {
				this.tableSelectData = arr
			},
		}
	}
</script>

<style scoped>
	.dmodel-table {
		height: 500rpx;
		margin-top: 20rpx;
		padding: 0 20rpx;
	}
	.tableForm{
		display: flex;
		margin-bottom:20rpx;
	}
	.btn{
		margin-left:10px;
	}
</style>
