新增物料BOM修改删除
This commit is contained in:
parent
5fe0a6eda7
commit
4216632a6d
@ -32,7 +32,7 @@
|
|||||||
iconOpen: 'vxe-icon-square-minus-fill',
|
iconOpen: 'vxe-icon-square-minus-fill',
|
||||||
iconClose: 'vxe-icon-square-plus-fill'
|
iconClose: 'vxe-icon-square-plus-fill'
|
||||||
}" :data="dataList" @checkbox-change="handleSelectionChange" @checkbox-all="handleSelectAll">
|
}" :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="seq" width="60"></vxe-column>
|
||||||
<vxe-column type="expand" width="80">
|
<vxe-column type="expand" width="80">
|
||||||
<template #content="{ row }">
|
<template #content="{ row }">
|
||||||
@ -56,12 +56,12 @@
|
|||||||
<vxe-column field="invCode" title="母件编码"></vxe-column>
|
<vxe-column field="invCode" title="母件编码"></vxe-column>
|
||||||
<vxe-column field="invName" title="母件名称"></vxe-column>
|
<vxe-column field="invName" title="母件名称"></vxe-column>
|
||||||
<vxe-column field="bomVersion" title="bom版本"></vxe-column>
|
<vxe-column field="bomVersion" title="bom版本"></vxe-column>
|
||||||
<vxe-column field="iusequantity" title="操作">
|
<!-- <vxe-column field="iusequantity" title="操作">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="success" size="small" icon="edit" title="编辑" @click="handleEdit(row)"></el-button>
|
<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>
|
<el-button type="danger" size="small" icon="delete" title="删除" @click="handleDelete(row)"></el-button>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column> -->
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||||
@pagination="getList" />
|
@pagination="getList" />
|
||||||
@ -137,7 +137,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="BaseMaterialBOM">
|
<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 { addBaseMaterialBom, updateBaseMaterialBom as updateMainBom } from '@/api/baseManagement/basematerialBOM.js'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
@ -289,14 +289,28 @@ function handleSubEdit(row) {
|
|||||||
subDialog.visible = true
|
subDialog.visible = true
|
||||||
subDialog.isEdit = 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() {
|
function submitForm() {
|
||||||
editFormRef.value.validate(valid => {
|
editFormRef.value.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
let data={
|
||||||
|
...formData.value,
|
||||||
|
updatedBy: userName,
|
||||||
|
updatedTime: formatDateTime(new Date())
|
||||||
|
}
|
||||||
if (dialog.isEdit) {
|
if (dialog.isEdit) {
|
||||||
// 更新现有记录
|
// 更新现有记录
|
||||||
updateBaseMaterialBom(formData.value).then(res => {
|
updateBaseMaterialBom(data).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess('修改成功')
|
proxy.$modal.msgSuccess('修改成功')
|
||||||
dialog.visible = false
|
dialog.visible = false
|
||||||
@ -306,7 +320,7 @@ function submitForm() {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 添加新记录
|
// 添加新记录
|
||||||
addBaseMaterialBom(formData.value).then(res => {
|
addBaseMaterialBom(data).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess('新增成功')
|
proxy.$modal.msgSuccess('新增成功')
|
||||||
dialog.visible = false
|
dialog.visible = false
|
||||||
@ -369,7 +383,7 @@ function handleSubDelete(row) {
|
|||||||
// 实现删除逻辑
|
// 实现删除逻辑
|
||||||
console.log('删除子件数据:', row.id)
|
console.log('删除子件数据:', row.id)
|
||||||
// 示例API调用
|
// 示例API调用
|
||||||
// return deleteById(row.id)
|
return delBaseMaterialBom(row.id)
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
proxy.$modal.msgSuccess('删除成功')
|
proxy.$modal.msgSuccess('删除成功')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user