Compare commits

...

2 Commits

Author SHA1 Message Date
d31791c8ee feat 货位打印 2025-03-21 17:27:59 +08:00
4b94c31f91 feat 打印请求 2025-03-21 14:55:00 +08:00
2 changed files with 106 additions and 7 deletions

View File

@ -120,4 +120,15 @@ export function checkMaterialPack(data: any) {
method: 'post', method: 'post',
data: data, data: data,
}); });
}
/**
*
* */
export function printStorage(data: any) {
return request({
url: '/api/api/label/storagePrint',
method: 'post',
data: data,
});
} }

View File

@ -71,7 +71,8 @@
</div> </div>
</div> </div>
<el-table border :height="tableHeight" v-loading="materialTableConfig.loading" :data="state.wareHouseList" highlight-current-row <el-table border :height="tableHeight" v-loading="materialTableConfig.loading" :data="state.wareHouseList" highlight-current-row
row-key="id" style="width: 100%"> row-key="id" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<template v-for="(col, index) in materialTableConfig.column" :key="index"> <template v-for="(col, index) in materialTableConfig.column" :key="index">
<el-table-column v-if="!col.hide" :label="col.header" show-overflow-tooltip> <el-table-column v-if="!col.hide" :label="col.header" show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
@ -93,6 +94,25 @@
<pagination v-if="total > 0" :total="total" v-model:pageNumTo="queryParams.pageNum" <pagination v-if="total > 0" :total="total" v-model:pageNumTo="queryParams.pageNum"
v-model:pageSizeTo="queryParams.pageSize" @pagination="handleQuery" /> v-model:pageSizeTo="queryParams.pageSize" @pagination="handleQuery" />
</div> </div>
<!-- 打印机 -->
<div class="vue-element-page-table">
<el-row class="page-search" justify="space-between" align="middle">
<el-form ref="operateFormRef" :model="operateParams" :inline="true">
<el-row :gutter="20">
<el-col :span="4">
<el-form-item label="选择打印机" v-model="state.PRINTNAME">
<el-select v-model="state.PRINTNAME" placeholder="请选择打印机" style="width: 240px">
<el-option v-for="item in state.PRINTLIST" :key="item.VALUE" :label="item.LABEL" :value="item.VALUE" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="1">
<el-button type="primary" @click="print" :disabled="state.button_print" v-loading="state.loadings">打印</el-button>
</el-col>
</el-row>
</el-form>
</el-row>
</div>
<!-- 新增或编辑 --> <!-- 新增或编辑 -->
<el-drawer :title="dialog.title" v-model="dialog.visible" @close="cancel" @opened="dialogOpend"> <el-drawer :title="dialog.title" v-model="dialog.visible" @close="cancel" @opened="dialogOpend">
@ -119,12 +139,14 @@ export default {
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, onMounted, toRefs, getCurrentInstance, nextTick } from "vue"; import { reactive, ref, onMounted, toRefs, getCurrentInstance, nextTick } from "vue";
import { ElForm, ElMessageBox, ElTable } from "element-plus"; import { ElForm, ElMessageBox, ElTable } from "element-plus";
import { getQueryPageList, BpelEvent } from '@/api/common'; import { getQueryPageList, BpelEvent, getQueryList } from '@/api/common'
import { bTableHeight } from "../../../../composables/calcTableHeight"; import { bTableHeight } from "../../../../composables/calcTableHeight";
import { getORG } from '@/api/auth' import { getORG } from '@/api/auth'
import { createStorage, delStorage, editStorage } from '@/api/basics/storage/index' import { createStorage, delStorage, editStorage } from '@/api/basics/storage/index'
import { localStorage as ls } from "@/utils/storage";
import { printStorage } from '@/api/label'
const { tableContainer, tableHeight, updateTableHeight, handleResize } = bTableHeight(180); const { tableContainer, tableHeight, updateTableHeight, handleResize } = bTableHeight(300);
const queryFormRef = ref(ElForm); const queryFormRef = ref(ElForm);
const formDataRef = ref(ElForm); const formDataRef = ref(ElForm);
const { proxy }: any = getCurrentInstance(); const { proxy }: any = getCurrentInstance();
@ -211,14 +233,27 @@ const state = reactive({
STORAGENAME: '',// STORAGENAME: '',//
} }
}, },
// start
operateParams: {
date: new Date()
},
PRINTNAME: '',
PRINTLIST: [] as any,//
button_print:false,
// end
wareHouseList: [] as any, wareHouseList: [] as any,
total: 0, total: 0,
selectItem: undefined as any selectItem: undefined as any,
multipleSelection: [] as any
}) })
const { const {
ERPFactoryList, ERPFactoryList,
rsa, rsa,
// start
operateParams,
button_print,
// end
queryParams, queryParams,
total, total,
dialog, dialog,
@ -244,6 +279,8 @@ onMounted(() => {
handleQuery(); handleQuery();
updateTableHeight(); updateTableHeight();
ERPFactoryQuery(); ERPFactoryQuery();
//
getPRINTLIST();
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
}); });
const queryInfo = () => { const queryInfo = () => {
@ -382,7 +419,7 @@ function submitForm() {
SITENAME: 'SDK' SITENAME: 'SDK'
}; };
editStorage(params).then((res: any) => { editStorage(params).then((res: any) => {
if (res.code === "0") { if (res.code === "200") {
proxy.$ElMessage.success("修改成功"); proxy.$ElMessage.success("修改成功");
cancel(); cancel();
handleQuery(); handleQuery();
@ -392,7 +429,7 @@ function submitForm() {
}) })
} else { } else {
createStorage(state.formData).then((res: any) => { createStorage(state.formData).then((res: any) => {
if (res.code === "0") { if (res.code === "200") {
proxy.$ElMessage.success("新增成功"); proxy.$ElMessage.success("新增成功");
cancel(); cancel();
handleQuery(); handleQuery();
@ -413,7 +450,7 @@ function handleDelete(row: any) {
SITENAME: 'SDK', SITENAME: 'SDK',
}; };
delStorage(params).then((res: any) => { delStorage(params).then((res: any) => {
if (res.code === "0") { if (res.code === "200") {
proxy.$ElMessage.success("删除成功"); proxy.$ElMessage.success("删除成功");
handleQuery(); handleQuery();
} else { } else {
@ -421,5 +458,56 @@ function handleDelete(row: any) {
} }
}); });
} }
/**
* 打印机
*/
function print() {
if (state.PRINTNAME == null || state.PRINTNAME == "") {
ElMessageBox.alert('请选择打印机', {
confirmButtonText: 'OK',
})
return
}
if (state.multipleSelection.length == 0) {
ElMessageBox.alert('打印清单为空', {
confirmButtonText: 'OK',
})
return
}
let PRINT = {
LIST: state.multipleSelection,
PRINTNAME: state.PRINTNAME,
USER: ls.get('userId')
}
state.button_print = true;
state.loadings = true;
printStorage(PRINT).then((res: any) => {
console.log('PRINT',res)
}).catch(() => {
state.button_print = false;
state.loadings = false;
});
state.button_print = false;
state.loadings = false;
ElMessageBox.alert('标签打印成功', {
confirmButtonText: 'OK',
})
}
function getPRINTLIST() {
getQueryList({
queryId: "getPRINTLIST",
version: "00001",
params: {
},
}).then((res: any) => {
state.PRINTLIST = res.data
})
}
const handleSelectionChange = (val: any) => {
state.multipleSelection = val;
}
</script> </script>
<style scoped></style> <style scoped></style>