	<!-- 计划进度查询 -->
<template>
	<div>
		<a-space class="header">
			<div class="inputBox">
				<span class="title-box">{{ '库区名称' }}</span>
				<a-input class="select-box" style="width: 220px" v-model:value="informationData.orgName" placeholder="请输入" />
			</div>
			<div class="btnBox">
				<a-button style="margin-right: 16px" @click="searchData">查询</a-button>
				<a-button style="margin-right: 16px" @click="reset">重置</a-button>
			</div>
		</a-space>
		<a-table :dataSource="dataSource" @change="onChangePage" :row-key="(record) => record.id"
			:pagination="informationData" :columns="columns">
			<template #bodyCell="{ column, record }">
				<template v-if="column.key === 'planType'">
					<span>{{ record.planType === 1 ? '销售计划' : '收购计划' }}</span>
				</template>
			</template>
		</a-table>
	</div>
</template>
<script setup name="planQuery">
import reserveQuantityApi from '@/api/reserve.info/reserveQuantityApi.js'
const columns = [
	{
		title: '序号',
		dataIndex: 'Index',
		align: 'center',
		customRender: ({ text, record, index }) => {
			return `${index + 1}`
		}
	},
	{
		title: '库区名称',
		dataIndex: 'orgName',
		align: 'center',
		key: 'orgName',
		width: '340px'
	},
	{
		title: '计划数量',
		dataIndex: 'planNum',
		align: 'center',
		key: 'planNum'
	},
	{
		title: '计划类型',
		dataIndex: 'planType',
		align: 'center',
		key: 'planType'
	},
	{
		title: '完成数量',
		dataIndex: 'wcsl',
		align: 'center',
		key: 'wcsl'
	},
	{
		title: '计划完成百分比',
		dataIndex: 'percentage',
		align: 'center',
		key: 'percentage'
	}
]
const dataSource = ref([])
const informationData = ref({
	orgName: '',
	current: 1,
	size: 10
})
// 表格分页
const onChangePage = (ev) => {
	informationData.value = { ...ev }
	if (isShowName.value == '1') {
		informationData.value.orgName = ''
	}
	onSearch()
}
// 列表分页
const onSearch = () => {
	const fd = { ...informationData.value }
	reserveQuantityApi.plannedProgress(fd).then((res) => {
		dataSource.value = []
		dataSource.value = res.records
		informationData.value.total = res.total
	})
}
// 查询
const isShowName = ref('1')
const searchData = () => {
	informationData.value.current = 1
	if (informationData.value.total > 10) {
		isShowName.value = '2'
	} else {
		isShowName.value = '1'
	}
	onSearch()
}
// 重置
const reset = () => {
	informationData.value = {
		orgName: '',
		current: 1,
		size: 10
	}
	onSearch()
}

onMounted(() => {
	onSearch()
})
</script>
<style scoped>
.header {
	display: flex;
	padding: 20px;
	width: 100%;
}

.inputBox {
	display: flex;
}

.input-box-sle {
	width: 92%;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-right: 24px;
}

.select-box {
	margin-left: 12px;
}

.title-box {
	margin-left: 20px;
	line-height: 30px;
}

.inputBoxContent {
	width: 400px;
}

.silt-title {
	width: 280px;
	display: flex;
	align-items: center;
	margin-right: 32px;
}

.btnBox {
	width: 260px;
	margin-left: 20px;
	justify-content: start;
	display: flex;
}

.ant-input-group-addon {
	border: 0;
}

.ant-input,
.ant-btn {
	border-radius: 5px;
}

.ant-pagination {
	margin-top: 12px;
	float: right;
	margin-right: 16px;
}

.add-btn {
	background-color: rgba(112, 125, 233);
}

.check {
	background-color: rgba(112, 125, 233);
	color: #fff;
	margin-left: 8px;
}

.edit {
	background-color: rgba(222, 186, 80);
	color: #fff;
	margin-left: 8px;
}

.flow {
	background-color: #22ce8d;
	color: #fff;
	margin-left: 8px;
}

.delete {
	background-color: rgba(255, 70, 70);
	color: #fff;
	margin-left: 8px;
}

.audit {
	background-color: rgba(83, 184, 36);
	color: #fff;
	margin-left: 8px;
}

.ant-table-thead>tr>th {
	text-align: center;
}

.ant-table-tbody>tr>td {
	text-align: center;
}

::v-deep .ant-pagination-options {
	display: none !important;
}

::v-deep .ant-table-selection {
	display: none !important;
}
</style>
	
