<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-11-03 14:51:33
 * @Description:
-->
<template>
	<base-table
		:table-props="tableProps"
		:page="listQuery.pageNo"
		:limit="listQuery.pageSize"
		:height="300"
		:table-data="tableData" />
</template>

<script>
import { parseTime } from '../../mixins/code-filter';
import { getWarehouseRealtimeLocation } from '@/api/warehouse/warehouseRealtimeLocation';

const tableProps = [
	{
		prop: 'name',
		label: '物品名称',
		align: 'center',
	},
	{
		prop: 'code',
		label: '物品编码',
		align: 'center',
	},
	{
		prop: 'spec',
		label: '物品规格',
		align: 'center',
	},
	{
		prop: 'goodsBatch',
		label: '物品批次',
		align: 'center',
	},
	{
		prop: 'num',
		label: '数量',
		align: 'center',
	},
	{
		prop: 'allowTime',
		label: '允许留存时长(天)',
		align: 'center',
	},
	{
		prop: 'inTime',
		label: '入库时间',
		align: 'center',
		filter: parseTime,
	},
	{
		prop: 'leftTime',
		label: '剩余留存时长(天)',
		align: 'center',
	},
	{
		prop: 'remark',
		label: '备注',
		align: 'center',
	},
];
export default {
	data() {
		return {
			tableData: [],
			tableProps,
			listQuery: {
				pageSize: 100,
				pageNo: 1,
				total: 1,
			},
			dataListLoading: false,
		};
	},
	methods: {
		// 获取数据列表
		init(id) {
			this.dataListLoading = true;
			getWarehouseRealtimeLocation(id).then((response) => {
				this.tableData = response.data;
				this.dataListLoading = false;
			});
		},
	},
};
</script>
