完善单位物料功能
parent
79838b71c8
commit
c6906b43a6
|
@ -6,7 +6,8 @@ enum Api {
|
||||||
PageMaterials = '/api/materials/page',
|
PageMaterials = '/api/materials/page',
|
||||||
DetailMaterials = '/api/materials/detail',
|
DetailMaterials = '/api/materials/detail',
|
||||||
ListMaterials = '/api/materials/list',
|
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',
|
method: 'get',
|
||||||
data: { id },
|
data: { id },
|
||||||
});
|
});
|
||||||
|
// 校验物料是否存在
|
||||||
|
export const checkMaterials = (classifyId: any) =>
|
||||||
|
request({
|
||||||
|
url: Api.CheckMaterials,
|
||||||
|
method: 'get',
|
||||||
|
data: { classifyId },
|
||||||
|
});
|
||||||
|
|
||||||
// 物料列表
|
// 物料列表
|
||||||
export const listMaterials = () =>
|
export const listMaterials = () =>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="物料类型" :rules="[{ required: true, message: '物料类型不能为空', trigger: 'blur' }]">
|
<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-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
|
@ -89,7 +89,6 @@
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
@current-change="radioChangeEvent"
|
@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 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')" >
|
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')" >
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
@ -170,7 +169,7 @@
|
||||||
|
|
||||||
import editDialog from '/@/views/basics-date/matter/component/editOpenAccess.vue'
|
import editDialog from '/@/views/basics-date/matter/component/editOpenAccess.vue'
|
||||||
import editClassifyDialog from '/@/views/basics-date/matter/component/editClassifyOpenAccess.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 {
|
import {
|
||||||
deleteMaterialsClassify,
|
deleteMaterialsClassify,
|
||||||
listMaterialsClassify,
|
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(`确定要删除吗?`, "提示", {
|
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
{{ scope.row.isBaseUnit ? '是' : '否' }}
|
{{ scope.row.isBaseUnit ? '是' : '否' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<template #default="scope">
|
||||||
<vxe-button type="text" @click="editUnit(scope.row)" icon="vxe-icon-edit">修改</vxe-button>
|
<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>
|
<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= ()=>{
|
const addUnit= ()=>{
|
||||||
|
unitFrom.value.codeNum = 'DW'+ getCurrentDate();
|
||||||
dialogTableVisible.value=true;
|
dialogTableVisible.value=true;
|
||||||
mTitle.value='新增'
|
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)=>{
|
const editUnit=async(row:any)=>{
|
||||||
unitFrom.value=row;
|
unitFrom.value=row;
|
||||||
mTitle.value='编辑'
|
mTitle.value='编辑'
|
||||||
|
|
Loading…
Reference in New Issue