fix: 库存报表页面未做页码分页(仓储物流的入库管理也没有分页)
| | |
| | | <el-dialog v-model="visible" title="选择产品" width="900px" destroy-on-close :close-on-click-modal="false"> |
| | | <el-form :inline="true" :model="query" class="mb-2"> |
| | | <el-form-item label="产品大类"> |
| | | <el-input v-model="query.productName" placeholder="输入产品大类" clearable @keyup.enter="onSearch" /> |
| | | <el-input |
| | | v-model="query.productName" |
| | | placeholder="输入产品大类" |
| | | clearable |
| | | :disabled="Boolean(props.fixedProductName)" |
| | | @keyup.enter="onSearch" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="型号名称"> |
| | |
| | | <script setup lang="ts"> |
| | | import { computed, onMounted, reactive, ref, watch, nextTick } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | import { productModelList } from '@/api/basicData/productModel' |
| | | import { productModelList } from "../../../api/basicData/productModel.js"; |
| | | |
| | | export type ProductRow = { |
| | | id: number; |
| | |
| | | const props = defineProps<{ |
| | | modelValue: boolean; |
| | | single?: boolean; // 是否只能选择一个,默认false(可选择多个) |
| | | fixedProductName?: string; // 固定“产品大类”筛选(例如:耗材),传入后不可编辑且重置不清空 |
| | | excludeParentNames?: string[]; // 排除“类型”(parentName),例如:['耗材'](仅传入时生效) |
| | | }>(); |
| | | |
| | | const emit = defineEmits(['update:modelValue', 'confirm']); |
| | |
| | | } |
| | | |
| | | function onReset() { |
| | | query.productName = ""; |
| | | query.productName = props.fixedProductName ? props.fixedProductName : ""; |
| | | query.model = ""; |
| | | page.pageNum = 1; |
| | | loadData(); |
| | |
| | | current: page.pageNum, |
| | | size: page.pageSize, |
| | | }); |
| | | tableData.value = res.records; |
| | | total.value = res.total; |
| | | const records = (res?.records || []) as any[]; |
| | | const exclude = (props.excludeParentNames || []).filter(Boolean); |
| | | const filtered = exclude.length |
| | | ? records.filter((r) => !exclude.includes(String(r?.parentName ?? ""))) |
| | | : records; |
| | | tableData.value = filtered; |
| | | total.value = exclude.length ? filtered.length : res.total; |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | |
| | | watch(() => props.modelValue, (visible) => { |
| | | if (visible) { |
| | | multipleSelection.value = []; |
| | | // 只有传了 fixedProductName 才启用“固定大类筛选”的特殊逻辑,其它场景保持原行为不变 |
| | | if (props.fixedProductName) { |
| | | query.productName = props.fixedProductName; |
| | | page.pageNum = 1; |
| | | loadData(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | <!-- 产品选择弹窗 --> |
| | | <ProductSelectDialog |
| | | v-model="showProductSelectDialog" |
| | | fixedProductName="耗材" |
| | | @confirm="handleProductSelect" |
| | | single |
| | | /> |
| | |
| | | return props.record.parentName === '原材料'; |
| | | }) |
| | | |
| | | const ledgerNetWeight = computed(() => { |
| | | const n = Number(props.record?.netWeight ?? 0); |
| | | return Number.isFinite(n) ? n : 0; |
| | | }); |
| | | |
| | | const initFormData = () => { |
| | | if (props.record) { |
| | | formState.value = { |
| | |
| | | if (grossWeight != null && tareWeight != null) { |
| | | const net = Number(grossWeight) - Number(tareWeight); |
| | | const safeNet = Number(net.toFixed(2)); |
| | | formState.value.netWeight = safeNet > 0 ? safeNet : 0; |
| | | const computedNet = safeNet > 0 ? safeNet : 0; |
| | | const maxNet = ledgerNetWeight.value; |
| | | if (Number.isFinite(maxNet) && maxNet > 0 && computedNet > maxNet) { |
| | | formState.value.netWeight = Number(maxNet.toFixed(2)); |
| | | proxy?.$modal?.msgWarning?.(`领用净重不能超过台账净重(${maxNet.toFixed(2)} 吨)`); |
| | | return; |
| | | } |
| | | formState.value.netWeight = computedNet; |
| | | } else { |
| | | formState.value.netWeight = undefined; |
| | | } |
| | |
| | | proxy.$modal.msgError("请选择规格"); |
| | | return; |
| | | } |
| | | const maxNet = ledgerNetWeight.value; |
| | | const usedNet = Number(formState.value.netWeight ?? 0); |
| | | if (Number.isFinite(maxNet) && maxNet > 0 && Number.isFinite(usedNet) && usedNet > maxNet) { |
| | | proxy.$modal.msgError(`领用净重不能超过台账净重(${maxNet.toFixed(2)} 吨)`); |
| | | return; |
| | | } |
| | | if (props.type === 'qualified') { |
| | | subtractConsumablesIn(formState.value).then(res => { |
| | | // 关闭模态框 |
| | |
| | | show-overflow-tooltip |
| | | /> |
| | | </el-table> |
| | | |
| | | <div style="margin-top: 12px; display: flex; justify-content: flex-end;"> |
| | | <el-pagination |
| | | background |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="page.total" |
| | | v-model:page-size="page.size" |
| | | v-model:current-page="page.current" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | @size-change="handlePageChange" |
| | | @current-change="handlePageChange" |
| | | /> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | |
| | | tableData: [] |
| | | }) |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }) |
| | | |
| | | const handlePageChange = () => { |
| | | fetchList() |
| | | } |
| | | |
| | | const stockRecordTypeOptions = ref([]) |
| | | |
| | | const getRecordType = (recordType) => { |
| | |
| | | } |
| | | |
| | | // 查询数据 |
| | | const handleQuery = async () => { |
| | | const fetchList = async () => { |
| | | if (!validateSearchForm()) { |
| | | return |
| | | } |
| | |
| | | } |
| | | if (response.code === 200) { |
| | | reportData.value.tableData = response.data.records |
| | | page.total = Number(response.data.total ?? 0) || 0 |
| | | // reportData.value.summary = response.data.summary |
| | | // reportData.value.chartData = response.data.chartData |
| | | // nextTick(() => { |
| | |
| | | } finally { |
| | | tableLoading.value = false |
| | | } |
| | | } |
| | | |
| | | // 查询数据(按钮触发:回到第一页) |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | fetchList() |
| | | } |
| | | // // 生成假数据 |
| | | // const generateMockData = () => { |
| | |
| | | startMonth: "", |
| | | endMonth: "", |
| | | startDate: "", |
| | | endDate: "" |
| | | endDate: "", |
| | | current: page.current, |
| | | size: page.size, |
| | | } |
| | | |
| | | if (searchForm.reportType === 'daily') { |
| | |
| | | searchForm.singleDate = '' |
| | | searchForm.dateRange = [] |
| | | searchForm.monthRange = [] |
| | | page.current = 1 |
| | | page.size = 10 |
| | | page.total = 0 |
| | | reportData.value = { |
| | | summary: null, |
| | | chartData: null, |
| | |
| | | <el-input v-model="formState.unit" disabled /> |
| | | </el-form-item> |
| | | |
| | | <!-- productType === 1:半成品(允许手动填写数量入库) --> |
| | | <!-- 半成品:允许手动填写数量入库 --> |
| | | <el-form-item |
| | | v-if="type === 'qualified' && formState.productType === 1" |
| | | v-if="type === 'qualified' && (formState.parentName === '半成品' || formState.productType === 1)" |
| | | label="数量" |
| | | prop="qualitity" |
| | | :rules="[ |
| | |
| | | <!-- 产品选择弹窗 --> |
| | | <ProductSelectDialog |
| | | v-model="showProductSelectDialog" |
| | | :excludeParentNames="['耗材']" |
| | | @confirm="handleProductSelect" |
| | | single |
| | | /> |
| | |
| | | productModelName: "", |
| | | unit: "", |
| | | productType: undefined, |
| | | parentName: "", |
| | | // 库存数量(半成品合格入库可手动填写) |
| | | qualitity: undefined, |
| | | // 过磅相关字段(仅原材料合格品使用) |
| | |
| | | productModelName: "", |
| | | unit: "", |
| | | productType: undefined, |
| | | parentName: "", |
| | | qualitity: undefined, |
| | | licensePlateNo: "", |
| | | grossWeight: undefined, |
| | |
| | | formState.value.productModelId = product.id; |
| | | formState.value.unit = product.unit; |
| | | formState.value.productType = product.productType; |
| | | formState.value.parentName = product.parentName || ""; |
| | | showProductSelectDialog.value = false; |
| | | // 触发表单验证更新 |
| | | proxy.$refs["formRef"]?.validateField('productModelId'); |
| | |
| | | return props.record.parentName === '原材料'; |
| | | }) |
| | | |
| | | const ledgerNetWeight = computed(() => { |
| | | const n = Number(props.record?.netWeight ?? 0); |
| | | return Number.isFinite(n) ? n : 0; |
| | | }); |
| | | |
| | | const initFormData = () => { |
| | | if (props.record) { |
| | | formState.value = { |
| | |
| | | if (grossWeight != null && tareWeight != null) { |
| | | const net = Number(grossWeight) - Number(tareWeight); |
| | | const safeNet = Number(net.toFixed(2)); |
| | | formState.value.netWeight = safeNet > 0 ? safeNet : 0; |
| | | const computedNet = safeNet > 0 ? safeNet : 0; |
| | | const maxNet = ledgerNetWeight.value; |
| | | if (Number.isFinite(maxNet) && maxNet > 0 && computedNet > maxNet) { |
| | | formState.value.netWeight = Number(maxNet.toFixed(2)); |
| | | proxy?.$modal?.msgWarning?.(`领用净重不能超过台账净重(${maxNet.toFixed(2)} 吨)`); |
| | | return; |
| | | } |
| | | formState.value.netWeight = computedNet; |
| | | } else { |
| | | formState.value.netWeight = undefined; |
| | | } |
| | |
| | | proxy.$modal.msgError("请选择规格"); |
| | | return; |
| | | } |
| | | const maxNet = ledgerNetWeight.value; |
| | | const usedNet = Number(formState.value.netWeight ?? 0); |
| | | if (Number.isFinite(maxNet) && maxNet > 0 && Number.isFinite(usedNet) && usedNet > maxNet) { |
| | | proxy.$modal.msgError(`领用净重不能超过台账净重(${maxNet.toFixed(2)} 吨)`); |
| | | return; |
| | | } |
| | | if (props.type === 'qualified') { |
| | | subtractStockInventory(formState.value).then(res => { |
| | | // 关闭模态框 |
| | |
| | | show-overflow-tooltip |
| | | /> |
| | | </el-table> |
| | | |
| | | <div style="margin-top: 12px; display: flex; justify-content: flex-end;"> |
| | | <el-pagination |
| | | background |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="page.total" |
| | | v-model:page-size="page.size" |
| | | v-model:current-page="page.current" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | @size-change="handlePageChange" |
| | | @current-change="handlePageChange" |
| | | /> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, nextTick } from 'vue' |
| | | import { ref, reactive, onMounted, nextTick, getCurrentInstance } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import * as echarts from 'echarts' |
| | | import { |
| | |
| | | chartData: null, |
| | | tableData: [] |
| | | }) |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }) |
| | | |
| | | const handlePageChange = () => { |
| | | fetchList() |
| | | } |
| | | |
| | | const stockRecordTypeOptions = ref([]) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 查询数据 |
| | | const handleQuery = async () => { |
| | | const fetchList = async () => { |
| | | if (!validateSearchForm()) { |
| | | return |
| | | } |
| | |
| | | } |
| | | if (response.code === 200) { |
| | | reportData.value.tableData = response.data.records |
| | | page.total = Number(response.data.total ?? 0) || 0 |
| | | // reportData.value.summary = response.data.summary |
| | | // reportData.value.chartData = response.data.chartData |
| | | // nextTick(() => { |
| | |
| | | } finally { |
| | | tableLoading.value = false |
| | | } |
| | | } |
| | | |
| | | // 查询数据(按钮触发:回到第一页) |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | fetchList() |
| | | } |
| | | // // 生成假数据 |
| | | // const generateMockData = () => { |
| | |
| | | startMonth: "", |
| | | endMonth: "", |
| | | startDate: "", |
| | | endDate: "" |
| | | endDate: "", |
| | | current: page.current, |
| | | size: page.size, |
| | | } |
| | | |
| | | if (searchForm.reportType === 'daily') { |
| | |
| | | searchForm.singleDate = '' |
| | | searchForm.dateRange = [] |
| | | searchForm.monthRange = [] |
| | | page.current = 1 |
| | | page.size = 10 |
| | | page.total = 0 |
| | | reportData.value = { |
| | | summary: null, |
| | | chartData: null, |