From 60e36c367ccfb6382b29f02df97bebca76351235 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Wed, 14 Aug 2024 17:30:08 +0800
Subject: [PATCH] 提交
---
src/views/hazardousChemicals/warehouseManage/components/printCode.vue | 72 +++++++++++++++++++++++-------------
1 files changed, 46 insertions(+), 26 deletions(-)
diff --git a/src/views/hazardousChemicals/warehouseManage/components/printCode.vue b/src/views/hazardousChemicals/warehouseManage/components/printCode.vue
index 6c776a9..b3ed378 100644
--- a/src/views/hazardousChemicals/warehouseManage/components/printCode.vue
+++ b/src/views/hazardousChemicals/warehouseManage/components/printCode.vue
@@ -45,6 +45,8 @@
import {addWarehouse, checkName, editWarehouse} from "@/api/hazardousChemicals/warehouse";
import {verifyPhone} from "@/utils/validate";
import {checkBasicName} from "@/api/hazardousChemicals/basicInfo";
+import {getProDetail, getProductRecord} from "@/api/hazardousChemicals/productRecord";
+import {getRawDetail} from "@/api/hazardousChemicals/rawRecord";
const dialogVisible = ref(false);
const title = ref("");
@@ -58,7 +60,9 @@
total: 0,
queryParams:{
pageNum: 1,
- pageSize: 5
+ pageSize: 5,
+ warehouseId: null,
+ basicId: null,
},
chooseList: []
@@ -66,30 +70,11 @@
const originalList = ref([])
const openDialog = async (type,value) => {
+ state.queryParams.warehouseId =value.warehouseId
+ state.queryParams.basicId =value.basicId
title.value = type;
- if(type == 'pro'){
- for(let i=value.startCode ; i<=value.endCode;i++){
- const obj = {
- name: value.productBasic.name,
- productSn: value.productBasic.productSn,
- code: value.codePrex+(i+"").padStart(4,'0')
- }
- state.dataList.push(obj)
- }
- }else {
+ await getList()
- for(let i=value.startCode ; i<=value.endCode;i++){
- const obj = {
- name: value.hazmatBasic.name,
- productSn: value.hazmatBasic.productSn,
- code: value.codePrex+(i+"").padStart(4,'0')
- }
- state.dataList.push(obj)
- }
- }
- state.total = state.dataList.length
- originalList.value = state.dataList
- getList()
console.log('state.dataList',state.dataList)
dialogVisible.value = true;
}
@@ -115,13 +100,48 @@
state.dataList = [];
state.queryParams = {
pageNum: 1,
- pageSize: 5
+ pageSize: 5,
+ warehouseId: null,
+ basicId: null,
}
state.total = 0
state.chooseList = []
}
-const getList = () => {
- state.dataList = originalList.value.slice((state.queryParams.pageNum-1) * state.queryParams.pageSize, state.queryParams.pageNum * state.queryParams.pageSize)
+const getList = async () => {
+ if(title.value == 'pro'){
+ const res = await getProDetail(state.queryParams)
+ if(res.code == 200){
+ state.dataList = res.data.list.map(item => {
+ return{
+ ...item,
+ name: item.productBasic.name,
+ productSn: item.productBasic.productSn
+ }
+ })
+ state.total = res.data.total
+ originalList.value = state.dataList
+ }else{
+ ElMessage.warning(res.message)
+ }
+ }else {
+ const res = await getRawDetail(state.queryParams)
+ if(res.code == 200){
+ state.dataList = res.data.list.map(item => {
+ return{
+ ...item,
+ name: item.hazmatBasic.name,
+ productSn: item.hazmatBasic.productSn
+ }
+ })
+ state.total = res.data.total
+ originalList.value = state.dataList
+ }else{
+ ElMessage.warning(res.message)
+ }
+ }
+
+
+
}
const printEvent=() => {
--
Gitblit v1.9.2