2025-03-21 08:52:08 +08:00

426 lines
13 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
功能功能描述 货位信息
作者Libra
邮箱mingxichen@163.com
时间2024年04月08日 15:46:01
版本v1.0
修改记录
修改内容
修改人员liwenhu
修改时间2024/04/15
-->
<template>
<div class="vue-element-page-wrap" ref="tableContainer">
<el-row class="page-search" justify="space-between" align="middle">
<el-form ref="queryFormRef" :model="queryParamsData" :inline="true" @submit.native.prevent>
<el-row :gutter="20">
<!-- <el-col :span="4">
<el-form-item label="组织" prop="params.RECEIVEREQUESTNAME">
<el-Input v-model="state.queryParams.params.ERPFACTORY" placeholder="组织" v-on:keyup.enter="queryInfo"
clearable />
</el-form-item>
</el-col> -->
<!-- <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 :span="4">
<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.DESCRIPTION">
<el-Input v-model="state.queryParams.params.DESCRIPTION" placeholder="货位名称查询"
v-on:keyup.enter="queryInfo" clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="page-search-btns">
<el-button type="primary" @click="queryInfo" :disabled="state.disableds" v-loadig="state.loadings">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
</el-row>
<div class="vue-element-page-table">
<div class="page-table-operate">
<div class="page-table-title">
<div class="page-table-title-left">
<span>货位信息列表</span>
</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">
<svg-icon icon-class="table_title" width="16px" height="16px" />
</el-button>
</template>
<ConfigTable :list="materialTableConfig.column" @updateList="updateList" />
</el-popover>
</div>
</div>
<el-table border :height="tableHeight" v-loading="materialTableConfig.loading" :data="state.wareHouseList" highlight-current-row
row-key="id" style="width: 100%">
<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">
<span>{{ scope.row[col.field] }}</span>
</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>
<!-- 新增或编辑 -->
<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">
export default {
name: "wareHouseLocation",
};
</script>
<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 { bTableHeight } from "../../../../composables/calcTableHeight";
import { getORG } from '@/api/auth'
import { createStorage, delStorage, editStorage } from '@/api/basics/storage/index'
const { tableContainer, tableHeight, updateTableHeight, handleResize } = bTableHeight(180);
const queryFormRef = ref(ElForm);
const formDataRef = ref(ElForm);
const { proxy }: any = getCurrentInstance();
const queryParamsData = ref({
MATERIALSPECNAME: ''
})
const formDataRefData = ref({
SITENAME: 'SDK',
F: [{ label: 'A', value: 'a' }],
S: [{ label: 'A', value: 'a' }],
Y: [{ label: 'A', value: 'a' }],
X: [{ label: 'A', value: 'a' }],
Z: [{ label: 'A', value: 'a' }],
STORAGEOPERATIONTYPE: [{ label: 'A', value: 'a' }],//库位操作类型
CAPACITY: '',//容量
USESTATE: '',//库位使用状态
RESOURCESTATE: '',//资源状态
RESPPERSON: '',//责任人
STORAGENAME: '',//库位名称
})
const materialTableConfig = ref({
loading: false,
column: [] as any,
data: [],
})
/***---------------------------------------------------------------------------
* -------------------------------------页面SQL语句配置------------------------------------------ */
const state = reactive({
ERPFactoryList: [] as any, // 组织
disableds : false,
loadings : false,
rsa: '',
DBProcessType: 'save',
queryParams: {
ERPFACTORY: '',
queryId: 'GetStorageList',
version: 'G5000',
params: {
SITENAME: 'SDK',
ERPFACTORY: '',
ERPLOCATION: '',
STORAGENAME: '',
STORAGEOPERATIONTYPE: 'Manual',
DESCRIPTION: '',
},
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: '',
LANGUAGE: 'Chinese',
},
body: {
ERPFACTORY: '',
ERPLOCATION: '',
SITENAME: 'SDK',
DESCRIPTION: '',
USESTATE: '',//库位使用状态
RESOURCESTATE: '',//资源状态
RESPPERSON: '',//责任人
STORAGENAME: '',//库位名称
}
},
wareHouseList: [] as any,
total: 0,
selectItem: undefined as any
})
const {
ERPFactoryList,
rsa,
queryParams,
total,
dialog,
formData,
rules,
selectItem
} = toRefs(state);
/***---------------------------------------------------------------------------
* -------------------------------------钩子函数区域------------------------------------------ */
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: "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();
window.addEventListener('resize', handleResize);
});
const queryInfo = () => {
state.queryParams.pageNum = 1
handleQuery()
}
const handleQuery = () => {
console.log(queryParamsData.value);
state.disableds = true;
state.loadings = true;
state.wareHouseList = [];
getQueryPageList(state.queryParams)
.then((res: any) => {
if(res.data.list.length == 0){
ElMessageBox.alert('查无数据', '提醒框', {
confirmButtonText: 'OK',
})
state.disableds = false;
state.loadings = false;
} else {
console.log(res.data);
state.wareHouseList = res.data.list;
state.total = res.data.total;
state.disableds = false;
state.loadings = false;
}
})
.catch(() => { });
}
const resetQuery = () => {
queryFormRef.value.resetFields();
// state.queryParams.params.ERPFACTORY = '';
// state.queryParams.params.ERPLOCATION = '';
state.queryParams.params.STORAGENAME = '';
state.queryParams.params.DESCRIPTION = '';
}
const updateList = (col: any) => {
materialTableConfig.value.column = col
}
const buildInfo = () => { state.DBProcessType = 'Insert' }
const editInfo = () => { state.DBProcessType = 'Update' }
/* 功能:保存修改/创建信息
参数ChangeParams
时间::2024-4-24
作者:李文虎
*/
const saveInfo = () => {
if (state.DBProcessType == 'Insert') {
state.ChangeParams.header.MESSAGENAME = 'CreateMaterialSpec'
} else if (state.DBProcessType == 'Update') {
state.ChangeParams.header.MESSAGENAME = 'ModifyMaterialSpec'
}
BpelEvent(state.ChangeParams).then((res: any) => {
})
.catch(() => { });
}
const exiteInfo = () => {
formDataRef.value.resetFields()
}
/**
* 新增货位 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 === "0") {
proxy.$ElMessage.success("修改成功");
cancel();
handleQuery();
} else {
proxy.$ElMessage.error(res.message);
}
})
} else {
createStorage(state.formData).then((res: any) => {
if (res.code === "0") {
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 === "0") {
proxy.$ElMessage.success("删除成功");
handleQuery();
} else {
proxy.$ElMessage.console.error("删除失败");
}
});
}
</script>
<style scoped></style>