<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-12-06 15:15:40
 * @Description:
-->
<template>
	<base-table
		:table-props="tableProps"
		:page="listQuery.pageNo"
		:limit="listQuery.pageSize"
		:height="300"
		:table-data="tableData"
		v-if="tableData.length" />
	<!-- 没有数据 -->
	<div class="no-data-bg" v-else></div>
</template>

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

const tableProps = [
	{
		prop: 'name',
		label: '物品名称',
	},
	{
		prop: 'code',
		label: '物品编码',
	},
	{
		prop: 'spec',
		label: '物品规格',
	},
	{
		prop: 'goodsBatch',
		label: '物品批次',
	},
	{
		prop: 'num',
		label: '数量',
    width: 50
	},
	{
		prop: 'allowTime',
		label: '允许留存时长(天)',
    width: 130
	},
	{
		prop: 'inTime',
		label: '入库时间',
		filter: parseTime,
    width: 150
	},
	{
		prop: 'leftTime',
		label: '剩余留存时长(天)',
    width: 130
	},
	{
		prop: 'remark',
		label: '备注',
	},
];
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>
