完善单位物料功能
parent
79838b71c8
commit
c6906b43a6
|
@ -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 = () =>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
|
||||
<el-form-item label="分类">
|
||||
<el-input v-model="queryParams.classify" clearable="" placeholder="请输入分类"/>
|
||||
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
|
||||
|
@ -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: "取消",
|
||||
|
|
|
@ -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,9 +348,9 @@ const handleCurrentChange = (val: number) => {
|
|||
|
||||
|
||||
const addUnit= ()=>{
|
||||
|
||||
dialogTableVisible.value=true;
|
||||
mTitle.value='新增'
|
||||
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='编辑'
|
||||
|
|
Loading…
Reference in New Issue