<template>
	<div class="system-user-container layout-padding">
		<el-card class="layout-padding-auto" shadow="hover">
			<avue-crud ref="crudRef" :data="state.data" :option="state.option" v-model:page="state.page">
				<template #menu>
          <div class="btnList">
            <el-button type="text" icon="el-icon-pie-chart" @click="toPurchaseDetails">查看详情</el-button>
            <el-button type="text" icon="el-icon-pie-chart" @click="state.selectedDataShow = true">查看单据</el-button>
          </div>
				</template>
			</avue-crud>
		</el-card>
    <selectedData :showes="state.selectedDataShow"/>
	</div>
</template>

<script lang="ts" setup>
import { reactive, onMounted } from 'vue';
import { useRouter } from 'vue-router'
import selectedData from './selectedData.vue'
const router = useRouter()

// 定义变量内容
const state = reactive({
	page: {
		total: 1000,
		currentPage: 1,
		pageSize: 10,
	},
	option: {
		index: false,
		menuWidth: 150,
		border: true,
		delBtn: false,
		editBtn: false,
		align: 'center',
    searchLabelWidth:100,
    searchMenuSpan:6,
    addBtn:false,
		column: [
			{ label: '单据编号', prop: 'FBillNo', width: 200,search: true },
			{ label: '供应商代码', prop: 'FSupplierId', width: 200,search: true },
			{ label: '供应商名称', prop: 'FSupplyName', width: 200,search: true },
			{ label: '采购员', prop: 'FPurchaserId', width: 200,search: true },
      { label: '收料组织', prop: 'FStockOrgId', width: 200,search: true },
      { label: '单据类型', prop: 'FBillTypeID', width: 200,search: true },
      { label: '制单人', prop: 'FCreatorId', width: 200,search: true },
      { label: '单据状态', prop: 'FDocumentStatus', width: 200,search: true },
      { label: '收料日期', prop: 'FDate', width: 200,search: true,type: 'datetime', searchSpan: 12,searchRange: true,},
			{ label: '备注', prop: 'FRemarks', width: 200 },
		],
	},
	data: [
		{
			FBillNo: '005828',
			FSupplierId: '005828',
			FSupplyName: '美塞斯',
			FPurchaserId: '采购甲',
      FStockOrgId: '不知道',
      FBillTypeID:'111',
      FCreatorId: '制单人甲',
      FDate: '2050/10/31',
      FDocumentStatus: '已验收',
			FRemarks: '数据是假的',
		},

	],
  selectedDataShow:false
});
const toPurchaseDetails = () => {
  router.push({
    path: '/materialReceiptNoticePurchaseDetails',
  })
}
// 页面加载时
onMounted(() => {
  for (let i = 0; i < 9; i++){
    state.data.push({
      FBillNo: '005828',
      FSupplierId: '005828',
      FSupplyName: '美塞斯',
      FPurchaserId: '采购甲',
      FStockOrgId: '不知道',
      FBillTypeID:'111',
      FCreatorId: '制单人甲',
      FDate: '2050/10/31',
      FDocumentStatus: '已验收',
      FRemarks: '数据是假的',
    },)
  }
});
</script>

<style lang="scss" scoped>
.system-user-container {
	:deep(.el-card__body) {
		display: flex;
		flex-direction: column;
		flex: 1;
		overflow: auto;

		.el-table {
			flex: 1;
		}
	}
}
:deep(.el-col){
  margin-bottom: 16px;
}
.btnList{
  :deep(.el-button){
    margin-left: 0!important;
  }
}
</style>
