feat 未入账更新

This commit is contained in:
Amjacks 2025-03-24 19:29:18 +08:00
parent 7b27b9cb63
commit dda67806f8
2 changed files with 259 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import request from '@/utils/request';
/**
*
* @param data
*/
export function updatePacking(data: any) {
return request({
url: '/api/packing/update',
method: 'post',
data: data
});
}

View File

@ -0,0 +1,246 @@
<template>
<div class="vue-element-page-wrap" ref="tableContainer">
<el-row class="page-search" justify="space-between" align="bottom">
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="80px" label-position="left">
<el-row :gutter="20">
<el-col :span="6" class="col_height">
<el-form-item label="组织" prop="params.ERPFACTORY" label-width="50px">
<el-select filterable v-model="queryParams.params.ERPFACTORY" placeholder="下拉选择组织" style="width: 240px" @change="getErpFactory">
<el-option v-for="item in ERPFactoryList" :key="item.ERPFACTORY" :label="item.DESCRIPTION" :value="item.ERPFACTORY"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6" class="col_height">
<el-form-item label="物料编号" prop="params.MATERIALSPECNAME" label-width="70px">
<el-Input v-model="queryParams.params.MATERIALSPECNAME" placeholder="输入物料编号" clearable/>
</el-form-item>
</el-col>
<el-col :span="6" class="col_height">
<el-form-item label="批次" prop="params.CHARGE" label-width="50px">
<el-Input v-model="queryParams.params.CHARGE" placeholder="输入批次" clearable/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="page-search-btns">
<el-button type="primary" @click="queryInfo">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
</el-row>
<!-- table 区域-->
<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-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="tableConfig.column" @updateList="updateList" />
</el-popover>
</div>
</div>
<el-table :height="tableHeight" border v-loading="loading" :default-sort="{ prop: 'MATERIALSPECNAME', order: 'descending' }"
:data="state.dataList" highlight-current-row row-key="id" style="width: 100%" @selection-change="handleSelection">
<el-table-column type="selection" width="55" />
<template v-for="(col, index) in tableConfig.column" :key="index">
<el-table-column v-if="!col.hide" :label="col.header" :prop="col.field" show-overflow-tooltip
:sort-orders="['descending', 'ascending']" :sortable="true"/>
</template>
</el-table>
<div>
<pagination v-if="total > 0" :total="total" v-model:pageNumTo="queryParams.pageNum"
v-model:pageSizeTo="queryParams.pageSize" @pagination="handleQuery" />
</div>
<div>
<el-form :model="state.updateParams" ref="formDataRef" label-position="top" :rules="rules">
<el-row :gutter="22">
<el-col :span="5">
<el-form-item prop="CHARGE">
<el-Input v-model="state.updateParams.CHARGE" placeholder="批次"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item prop="EXPIRNGDATE">
<el-date-picker v-model="state.updateParams.EXPIRNGDATE" type="datetime"
format="YYYY-MM-DD hh:mm:ss" value-format="YYYY-MM-DD hh:mm:ss"
placeholder="选择保质期" style="width: 100%"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item prop="MAKEDATE">
<el-date-picker v-model="state.updateParams.MAKEDATE" type="datetime"
format="YYYY-MM-DD hh:mm:ss" value-format="YYYY-MM-DD hh:mm:ss"
placeholder="选择制造日期" style="width: 100%"/>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button type="primary" @click="updateInfo" v-loading="state.loadings">更新</el-button>
</el-col>
</el-row>
</el-form>
</div>
</div>
</div>
</template>
<script lang="ts">
export default {
name: 'notPosted'
}
</script>
<script lang="ts" setup>
import { reactive, ref, onMounted, toRefs, getCurrentInstance } from 'vue'
import { ElForm, ElMessageBox, ElTable } from 'element-plus'
import { getQueryPageList } from '@/api/common'
import { localStorage } from '@/utils/storage'
import { updatePacking } from '@/api/material/notPosted'
import { bTableHeight } from '@/composables/calcTableHeight'
import { getORG } from '@/api/auth'
//
const { tableContainer, tableHeight, updateTableHeight, handleResize } = bTableHeight(310)
const { proxy }: any = getCurrentInstance()
const tableConfig = ref({
loading: false,
column: [] as any,
data: []
})
const queryFormRef = ref(ElForm)
const formDataRef = ref()
//
const state = reactive({
dataList: [] as any, //
total: 0, //
selection: [] as any, //
loadings: false, //
loading: true, //
//
ERPFactoryList: [] as any,
//
queryParams: {
queryId: 'NotPosted',
version: 'G5001',
params: {
SITENAME: localStorage.get('siteName') || 'SDK',
MATERIALSPECNAME: '', //
ERPFACTORY: '',
CHARGE: ''
},
pageNum: 1,
pageSize: 10
},
//
updateParams: {
CHARGE: '',
EXPIRNGDATE: '',
MAKEDATE: ''
},
//
rules: {
CHARGE: [{required: true, message: '请输入批次号', trigger: 'blur'}],
EXPIRNGDATE: [{required: true, message: '请选择保质期', trigger: 'blur'}],
MAKEDATE: [{required: true, message: '请选择制造日期', trigger: 'blur'}],
}
})
const { queryParams, total, loading, ERPFactoryList, rules } = toRefs(state)
//
onMounted(() => {
tableConfig.value.column = [
{ header: 'SITENAME', field: 'SITENAME', hide: true },
{ header: 'MATERIALPACKINGNAME', field: 'MATERIALPACKINGNAME', hide: true },
{ header: '组织(CN)', field: 'ERPFACTORYDESC', hide: false },
{ header: '货位名称', field: 'LOCATIONNAMEDESC', hide: false },
{ header: '物料编号', field: 'MATERIALSPECNAME', hide: false },
{ header: '品名', field: 'DESC_CN', hide: false },
{ header: '批次号', field: 'CHARGE', hide: false },
{ header: '阶段', field: 'PHASE', hide: false },
{ header: '系统规格', field: 'DESCRIPTION', hide: false },
{ header: 'SDK规格', field: 'SPECNAME', hide: false },
{ header: '是否良品', field: 'OQARESULT', hide: false },
{ header: '保质期', field: 'EXPIRINGDATE', hide: false },
{ header: '制造日期', field: 'MAKEDATE', hide: false }
]
handleQuery()
getErpFactory()
updateTableHeight()
window.addEventListener('resize', handleResize)
})
//
function queryInfo() {
state.queryParams.pageNum = 1
handleQuery()
}
//
const updateList = (col: any) => {
tableConfig.value.column = col
}
//
const handleSelection = (val: any) => {
state.selection = val
}
//
function updateInfo() {
if (state.selection.length == 0) {
ElMessageBox.alert('请选择条目', { confirmButtonText: 'OK' })
return
}
formDataRef.value.validate((valid: any) => {
if (!valid) {
return
}
updatePacking({
...state.updateParams,
dataList: state.selection,
}).then((res: any) => {
if (res.success) {
ElMessageBox.alert('更新成功', '提醒框', {
confirmButtonText: 'OK'
})
handleQuery()
} else {
proxy.$ElMessage.error(res.message)
}
})
});
}
//
async function handleQuery() {
state.loading = true
await getQueryPageList(state.queryParams).then((res: any) => {
if (res.data.list.length > 0) {
state.dataList = res.data.list
state.total = res.data.total
} else {
state.dataList = res.data.list
proxy.$ElMessage.success('查询结果为空')
}
state.loading = false
})
}
//
function getErpFactory() {
getORG({ orgNo: null }).then((res: any) => {
state.ERPFactoryList = res.resultObj
state.ERPFactoryList.unshift({
ERPFACTORY: ''
})
})
}
//
function resetQuery() {
queryFormRef.value.resetFields();
handleQuery();
}
</script>
<style>
.col_height {
padding-top: 3.5px;
padding-bottom: 3.5px;
}
</style>