Merge remote-tracking branch 'origin/main'

This commit is contained in:
李兴辉 2025-03-21 18:33:18 +08:00
commit 6776d1bfd1
3 changed files with 323 additions and 16 deletions

View File

@ -31,3 +31,36 @@ export function deleteStorage(data: any) {
data: data,
});
}
/**
*
* */
export function createStorage(data: any) {
return request({
url: '/api/api/storage/addStorage',
method: 'post',
data: data,
});
}
/**
*
* */
export function editStorage(data: any) {
return request({
url: '/api/api/storage/editStorage',
method: 'post',
data: data,
});
}
/**
*
* */
export function delStorage(data: any) {
return request({
url: '/api/api/storage/delStorage',
method: 'post',
data: data,
});
}

View File

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

View File

@ -20,20 +20,20 @@
clearable />
</el-form-item>
</el-col> -->
<el-col :span="4">
<!-- <el-col :span="4">
<el-form-item label="仓库" prop="params.RECEIVEREQUESTNAME">
<el-Input v-model="state.queryParams.params.ERPLOCATION" placeholder="仓库" v-on:keyup.enter="queryInfo"
clearable />
</el-form-item>
</el-col>
</el-col>-->
<el-col :span="4">
<el-form-item label="货位查询" prop="params.RECEIVEREQUESTNAME">
<el-form-item label="货位查询" prop="params.STORAGENAME">
<el-Input v-model="state.queryParams.params.STORAGENAME" placeholder="货位查询" v-on:keyup.enter="queryInfo"
clearable />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="货位名称查询" prop="params.RECEIVEREQUESTNAME">
<el-form-item label="货位名称查询" prop="params.DESCRIPTION">
<el-Input v-model="state.queryParams.params.DESCRIPTION" placeholder="货位名称查询"
v-on:keyup.enter="queryInfo" clearable />
</el-form-item>
@ -54,6 +54,12 @@
</div>
</div>
<div class="page-table-operateBtns">
<el-button type="primary" @click="handleAdd">
<el-icon>
<Plus />
</el-icon>
创建
</el-button>
<el-popover :persistent="false" placement="right" popper-class="config-table-wrap" trigger="click">
<template #reference>
<el-button class="operateBtns-setting">
@ -65,7 +71,8 @@
</div>
</div>
<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">
<el-table-column v-if="!col.hide" :label="col.header" show-overflow-tooltip>
<template #default="scope">
@ -73,10 +80,55 @@
</template>
</el-table-column>
</template>
<el-table-column width="300" label="操作" align="center" class-name="table-operation" fixed="right">
<template #default="scope">
<el-button type="primary" link @click.stop="handleUpdate(scope.row)" v-if="!scope.row.status"> 编辑
</el-button>
<div class="splitLine" v-if="!scope.row.status"></div>
<el-button type="danger" link @click.stop="delConfirm(scope.row)" v-if="!scope.row.status"> 删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-if="total > 0" :total="total" v-model:pageNumTo="queryParams.pageNum"
v-model:pageSizeTo="queryParams.pageSize" @pagination="handleQuery" />
</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-form ref="formDataRef" :model="formData" :rules="rules" label-position="top">
<el-form-item label="货位编码" prop="STORAGENAME" v-if="dialog.type === 'add'">
<el-input v-model="formData.STORAGENAME" placeholder="请输入货位编码" />
</el-form-item>
<el-form-item label="货位描述" prop="DESCRIPTION">
<el-input v-model="formData.DESCRIPTION" placeholder="请输入货位描述" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</template>
</el-drawer>
</div>
</template>
<script lang="ts">
@ -87,12 +139,18 @@ export default {
<script lang="ts" setup>
import { reactive, ref, onMounted, toRefs, getCurrentInstance, nextTick } from "vue";
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 { getORG } from '@/api/auth'
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 formDataRef = ref(ElForm);
const { proxy }: any = getCurrentInstance();
const queryParamsData = ref({
MATERIALSPECNAME: ''
})
@ -124,13 +182,15 @@ const materialTableConfig = ref({
/***---------------------------------------------------------------------------
* -------------------------------------页面SQL语句配置------------------------------------------ */
const state = reactive({
ERPFactoryList: [] as any, //
disableds : false,
loadings : false,
rsa: '',
DBProcessType: 'save',
queryParams: {
queryId: 'GetSTORAGEList',
version: '00001',
ERPFACTORY: '',
queryId: 'GetStorageList',
version: 'G5000',
params: {
SITENAME: 'SDK',
ERPFACTORY: '',
@ -142,6 +202,21 @@ const state = reactive({
pageNum: 1,
pageSize: 10
},
formData: {
ERPFACTORY: '',
SITENAME: 'SDK',
STORAGENAME: "",
DESCRIPTION: ""
} as any,
dialog: {
title: "新增货位",
type: 'add',
visible: false,
},
rules: {
STORAGENAME: [{ required: true, message: "请输入货位编码", trigger: "blur" }],
DESCRIPTION: [{ required: true, message: "请输入货位描述", trigger: "blur" }],
},
ChangeParams: {
header: {
MESSAGENAME: '',
@ -158,15 +233,33 @@ const state = reactive({
STORAGENAME: '',//
}
},
// start
operateParams: {
date: new Date()
},
PRINTNAME: '',
PRINTLIST: [] as any,//
button_print:false,
// end
wareHouseList: [] as any,
total: 0
total: 0,
selectItem: undefined as any,
multipleSelection: [] as any
})
const {
ERPFactoryList,
rsa,
// start
operateParams,
button_print,
// end
queryParams,
total,
dialog,
formData,
rules,
selectItem
} = toRefs(state);
/***---------------------------------------------------------------------------
@ -175,15 +268,19 @@ onMounted(() => {
materialTableConfig.value.column = [
{ header: "组织", field: "ERPFACTORY", hide: false },
{ header: "组织(CN)", field: "ORGNAME", hide: false },
{ header: "仓库", field: "ERPLOCATION", hide: false },
{ header: "仓库(CN)", field: "ERPLOCATIONNAME", hide: false },
// { header: "", field: "ERPLOCATION", hide: false },
// { header: "(CN)", field: "ERPLOCATIONNAME", hide: false },
{ header: "货位编码", field: "STORAGENAME", hide: false },
{ header: "货位描述", field: "DESCRIPTION", hide: false },
]
let pwd: any = localStorage.getItem('remeberPwd');
state.queryParams.params.ERPFACTORY = JSON.parse(localStorage.getItem('orgNo')) || '';
state.formData.ERPFACTORY = JSON.parse(localStorage.getItem('orgNo')) || '';
handleQuery();
updateTableHeight();
ERPFactoryQuery();
//
getPRINTLIST();
window.addEventListener('resize', handleResize);
});
const queryInfo = () => {
@ -216,8 +313,8 @@ const handleQuery = () => {
const resetQuery = () => {
queryFormRef.value.resetFields();
state.queryParams.params.ERPFACTORY = '';
state.queryParams.params.ERPLOCATION = '';
// state.queryParams.params.ERPFACTORY = '';
// state.queryParams.params.ERPLOCATION = '';
state.queryParams.params.STORAGENAME = '';
state.queryParams.params.DESCRIPTION = '';
}
@ -245,6 +342,172 @@ const saveInfo = () => {
const exiteInfo = () => {
formDataRef.value.resetFields()
}
</script>
/**
* 新增货位 dialog
*/
function handleAdd() {
selectItem.value = undefined;
dialog.value = {
title: "新增货位",
visible: true,
type: 'add'
};
}
/**
* 编辑货位 dialog
*/
function handleUpdate(row: any) {
state.dialog = {
title: "编辑货位",
visible: true,
type: 'edit'
};
state.selectItem = row;
}
//
function delConfirm(row: any) {
ElMessageBox.confirm('确认删除?',
'提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
distinguishCancelAndClose: true,
type: 'warning',
}).then(() => {
handleDelete(row);
})
.catch(() => { });
}
function dialogOpend() {
formDataRef.value.resetFields();
state.formData.STORAGENAME = ''
state.formData.DESCRIPTION = ''
if (state.selectItem && state.dialog.type === 'edit') {
state.formData = {
STORAGENAME: state.selectItem.STORAGENAME,
DESCRIPTION: state.selectItem.DESCRIPTION
};
}
}
// ERP
function ERPFactoryQuery() {
getORG({ orgNo: null })
.then((res: any) => {
state.ERPFactoryList = res.resultObj
})
.catch(() => {})
}
/**
* 取消关闭弹窗
*/
function cancel() {
state.dialog.visible = false;
}
/**
* 保存
*/
function submitForm() {
formDataRef.value.validate((isValid: boolean) => {
if (isValid) {
if (state.selectItem) {
//
let params = {
...state.formData,
SITENAME: 'SDK'
};
editStorage(params).then((res: any) => {
if (res.code === "200") {
proxy.$ElMessage.success("修改成功");
cancel();
handleQuery();
} else {
proxy.$ElMessage.error(res.message);
}
})
} else {
createStorage(state.formData).then((res: any) => {
if (res.code === "200") {
proxy.$ElMessage.success("新增成功");
cancel();
handleQuery();
} else {
proxy.$ElMessage.error(res.message);
}
})
}
}
});
}
/**
* 删除
* */
function handleDelete(row: any) {
const params = {
STORAGENAME: row.STORAGENAME,
SITENAME: 'SDK',
};
delStorage(params).then((res: any) => {
if (res.code === "200") {
proxy.$ElMessage.success("删除成功");
handleQuery();
} else {
proxy.$ElMessage.console.error("删除失败");
}
});
}
/**
* 打印机
*/
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>
<style scoped></style>