From 48d5ab35c3fcdc6edca1278d1474a1b54a431191 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期三, 21 八月 2024 16:00:33 +0800 Subject: [PATCH] bug修改 --- src/views/hazardousChemicals/warehouseManage/components/printCode.vue | 101 +++++++++++++++++++++++++++++++++++++------------- 1 files changed, 74 insertions(+), 27 deletions(-) diff --git a/src/views/hazardousChemicals/warehouseManage/components/printCode.vue b/src/views/hazardousChemicals/warehouseManage/components/printCode.vue index 6c776a9..d52ee4f 100644 --- a/src/views/hazardousChemicals/warehouseManage/components/printCode.vue +++ b/src/views/hazardousChemicals/warehouseManage/components/printCode.vue @@ -3,11 +3,29 @@ <el-dialog v-model="dialogVisible" :title="title == 'pro' ? '成品二维码打印' : '危化品二维码打印'" - width="600px" + width="650px" :before-close="handleClose" :close-on-press-escape="false" :close-on-click-modal="false" > + <div style="display: flex;justify-content: space-between"> + <el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" > + <el-form-item label="条码编号:" > + <el-input v-model="state.queryParams.code" placeholder="请输入条码编号" ></el-input> + </el-form-item> + <el-form-item > + <el-button + type="primary" + @click="getList" + >查询</el-button> + <el-button + type="primary" + plain + @click="reset" + >重置</el-button> + </el-form-item> + </el-form> + </div> <el-table v-loading="state.loading" :data="state.dataList" :border="true" :show-header="false" height="550" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" align="center" /> <el-table-column align="center" > @@ -45,6 +63,8 @@ import {addWarehouse, checkName, editWarehouse} from "@/api/hazardousChemicals/warehouse"; import {verifyPhone} from "@/utils/validate"; import {checkBasicName} from "@/api/hazardousChemicals/basicInfo"; +import {getProDetail, getProductRecord, getWhProDetail} from "@/api/hazardousChemicals/productRecord"; +import {getRawDetail, getWhRawDetail} from "@/api/hazardousChemicals/rawRecord"; const dialogVisible = ref(false); const title = ref(""); @@ -58,7 +78,11 @@ total: 0, queryParams:{ pageNum: 1, - pageSize: 5 + pageSize: 5, + // warehouseId: null, + // basicId: null, + entryId: null, + code: '' }, chooseList: [] @@ -66,30 +90,12 @@ const originalList = ref([]) const openDialog = async (type,value) => { + // state.queryParams.warehouseId =value.warehouseId + // state.queryParams.basicId =value.basicId + state.queryParams.entryId = value.id 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 +121,48 @@ state.dataList = []; state.queryParams = { pageNum: 1, - pageSize: 5 + pageSize: 5, + entryId: null, + code: '' } 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 getWhProDetail(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 getWhRawDetail(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=() => { @@ -138,6 +179,7 @@ } const printContent=document.createElement('div') printContent.innerHTML=qrCodes + //创建一个新的隐藏的iframe元素 const printFrame =document.createElement('iframe') printFrame.style.display='none' @@ -162,6 +204,7 @@ `) printDocument.close() //在打印窗口中调用打印功能 + console.log('printFrame.contentWindow.document.body.style',printFrame.contentWindow.document.body.style) printFrame.contentWindow.print() //移除隐藏的iframe元素 document.body.removeChild(printFrame) @@ -180,6 +223,10 @@ :deep(.el-form .el-form-item__label) { font-size: 15px; } + :deep(.el-dialog__body) { + padding: 10px 20px 0 20px; + } + .file { display: flex; flex-direction: column; -- Gitblit v1.9.2