完善单位物料功能

main
ljh 2024-07-03 15:12:30 +08:00
parent 79838b71c8
commit c6906b43a6
4 changed files with 32 additions and 10 deletions

View File

@ -6,7 +6,8 @@ enum Api {
PageMaterials = '/api/materials/page',
DetailMaterials = '/api/materials/detail',
ListMaterials = '/api/materials/list',
MtListBySourceId = '/api/materialList/listBySourceId'
MtListBySourceId = '/api/materialList/listBySourceId',
CheckMaterials = '/api/materials/CheckById',
}
// 增加物料
@ -48,6 +49,13 @@ export const detailMaterials = (id: any) =>
method: 'get',
data: { id },
});
// 校验物料是否存在
export const checkMaterials = (classifyId: any) =>
request({
url: Api.CheckMaterials,
method: 'get',
data: { classifyId },
});
// 物料列表
export const listMaterials = () =>

View File

@ -6,7 +6,7 @@
<el-row>
<el-col :span="24">
<el-form-item label="物料类型" :rules="[{ required: true, message: '物料类型不能为空', trigger: 'blur' }]">
<el-input v-model="ruleForm.name" placeholder="请输入名称" clearable />
<el-input v-model="ruleForm.name" placeholder="请输入名称" clearable maxlength="32" />
</el-form-item>
</el-col>
</el-row>

View File

@ -89,7 +89,6 @@
highlight-current-row
@current-change="radioChangeEvent"
>
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="name" label="名称" show-overflow-tooltip="" />
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')" >
<template #default="scope">
@ -170,7 +169,7 @@
import editDialog from '/@/views/basics-date/matter/component/editOpenAccess.vue'
import editClassifyDialog from '/@/views/basics-date/matter/component/editClassifyOpenAccess.vue'
import { pageMaterials, deleteMaterials } from '/@/api/main/materials';
import {pageMaterials, deleteMaterials, detailMaterials, checkMaterials} from '/@/api/main/materials';
import {
deleteMaterialsClassify,
listMaterialsClassify,
@ -277,7 +276,11 @@
};
//
const delMaterialsClassify = (row: any) => {
const delMaterialsClassify = async (row: any) => {
const materResult = await checkMaterials(row.id);
if(materResult.data.result) {
return ElMessage.error("存在物料数据,不允许删除")
}
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",

View File

@ -86,7 +86,7 @@
{{ scope.row.isBaseUnit ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column label="操作"align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')">
<el-table-column width="200" label="操作"align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')">
<template #default="scope">
<vxe-button type="text" @click="editUnit(scope.row)" icon="vxe-icon-edit">修改</vxe-button>
<vxe-button type="text" @click="deleteUnit(scope.row)" icon="vxe-icon-delete" style="color: rgb(223, 65, 65)">删除</vxe-button>
@ -348,7 +348,7 @@ const handleCurrentChange = (val: number) => {
const addUnit= ()=>{
unitFrom.value.codeNum = 'DW'+ getCurrentDate();
dialogTableVisible.value=true;
mTitle.value='新增'
}
@ -386,6 +386,17 @@ const unitSubmit = async () => {
}
}
const getCurrentDate = () => {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
return `${year}${month}${day}${hours}${minutes}${seconds}`;
}
const editUnit=async(row:any)=>{
unitFrom.value=row;
mTitle.value='编辑'