新增物料BOM修改删除

This commit is contained in:
17630416519 2026-01-16 09:00:30 +08:00
parent 5fe0a6eda7
commit 4216632a6d

View File

@ -32,7 +32,7 @@
iconOpen: 'vxe-icon-square-minus-fill',
iconClose: 'vxe-icon-square-plus-fill'
}" :data="dataList" @checkbox-change="handleSelectionChange" @checkbox-all="handleSelectAll">
<vxe-column type="checkbox" width="60" fixed="left"></vxe-column>
<!-- <vxe-column type="checkbox" width="60" fixed="left"></vxe-column> -->
<vxe-column type="seq" width="60"></vxe-column>
<vxe-column type="expand" width="80">
<template #content="{ row }">
@ -56,12 +56,12 @@
<vxe-column field="invCode" title="母件编码"></vxe-column>
<vxe-column field="invName" title="母件名称"></vxe-column>
<vxe-column field="bomVersion" title="bom版本"></vxe-column>
<vxe-column field="iusequantity" title="操作">
<!-- <vxe-column field="iusequantity" title="操作">
<template #default="{ row }">
<el-button type="success" size="small" icon="edit" title="编辑" @click="handleEdit(row)"></el-button>
<el-button type="danger" size="small" icon="delete" title="删除" @click="handleDelete(row)"></el-button>
</template>
</vxe-column>
</vxe-column> -->
</vxe-table>
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
@pagination="getList" />
@ -137,7 +137,7 @@
</template>
<script setup name="BaseMaterialBOM">
import { listBaseMaterialBom, GetMonterInvList, GetSonInvList, updateBaseMaterialBom } from '@/api/baseManagement/basematerialBOM.js'
import { listBaseMaterialBom, GetMonterInvList, GetSonInvList, updateBaseMaterialBom,delBaseMaterialBom } from '@/api/baseManagement/basematerialBOM.js'
import { addBaseMaterialBom, updateBaseMaterialBom as updateMainBom } from '@/api/baseManagement/basematerialBOM.js'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
@ -289,14 +289,28 @@ function handleSubEdit(row) {
subDialog.visible = true
subDialog.isEdit = true
}
function formatDateTime(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
//
function submitForm() {
editFormRef.value.validate(valid => {
if (valid) {
let data={
...formData.value,
updatedBy: userName,
updatedTime: formatDateTime(new Date())
}
if (dialog.isEdit) {
//
updateBaseMaterialBom(formData.value).then(res => {
updateBaseMaterialBom(data).then(res => {
if (res.code === 200) {
proxy.$modal.msgSuccess('修改成功')
dialog.visible = false
@ -306,7 +320,7 @@ function submitForm() {
})
} else {
//
addBaseMaterialBom(formData.value).then(res => {
addBaseMaterialBom(data).then(res => {
if (res.code === 200) {
proxy.$modal.msgSuccess('新增成功')
dialog.visible = false
@ -369,7 +383,7 @@ function handleSubDelete(row) {
//
console.log('删除子件数据:', row.id)
// API
// return deleteById(row.id)
return delBaseMaterialBom(row.id)
})
.then(() => {
proxy.$modal.msgSuccess('删除成功')