ims-front/src/views/stock/report/materialReport-page.vue
my_ong 3cb34c8554
All checks were successful
Release / lint (push) Successful in 29s
Release / Release (push) Successful in 1m20s
art: 格式化代码
2024-12-13 21:42:28 +08:00

107 lines
2.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<page-container>
<!-- 页面操作栏 -->
<template #ops>
<a-row>
<a-col :span="18">
<a-input-search
v-model:value="searchKey"
:placeholder="`请输入物料名称`"
allow-clear
enter-button
@search="loadData()"
></a-input-search>
</a-col>
</a-row>
</template>
<!-- 页面表格内容 -->
<div style="min-height: calc(100vh - 305px)">
<!-- 表格行 -->
<a-table
:columns="columns"
:data-source="materialPage?.records"
bordered
:pagination="pagination"
:loading="loading"
row-key="key"
>
<!-- 操作按钮列 -->
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'assignRule'">
{{ record.assignRule === 1 ? '高价值工具类' : '低值易耗品' }}
<!-- 这里定义为0和10再回显的时候不展示-->
</template>
</template>
</a-table>
</div>
</page-container>
</template>
<script setup lang="ts">
import api from '@/api'
import { IPage } from '@/api/api'
const searchKey = ref('')
const materialPage = ref<IPage<material.Material>>()
const loading = ref(false)
// 加载数据的方法
const loadData = async (page = 1, size = 10) => {
loading.value = true
api.materialApi.material.materials(
{ page: page || materialPage.value?.current, size: size || materialPage.value?.size, key: searchKey.value },
(data) => {
loading.value = false
materialPage.value = data
},
)
}
//初始加载
loadData()
//表格列
const columns = [
{
title: '物料编码',
dataIndex: 'code',
},
{
title: '物料名称',
dataIndex: 'name',
},
{
title: '物料类型',
dataIndex: 'type',
},
{
title: '物料型号',
dataIndex: 'spec',
},
{
title: '赋码规则',
dataIndex: 'assignRule',
},
{
title: '库存数量',
dataIndex: 'stock',
},
{
title: '备注',
dataIndex: 'description',
},
]
//分页信息
const pagination = computed(() => {
return {
current: materialPage.value?.current,
pageSize: materialPage.value?.size,
total: materialPage.value?.total,
onChange: (page: number, pageSize: number) => {
loadData(page, pageSize)
},
}
})
</script>