update 选择添加BOM页面

master
yinq 6 days ago
parent dfd946de82
commit 1c42a94b4a

@ -0,0 +1,226 @@
<template>
<div class='p-2'>
<transition :enter-active-class='proxy?.animate.searchAnimate.enter'
:leave-active-class='proxy?.animate.searchAnimate.leave'>
<div v-show='showSearch' class='mb-[10px]'>
<el-card shadow='hover'>
<el-form ref='queryFormRef' :model='queryParams' :inline='true'>
<el-form-item label='物料名称' prop='materialName'>
<el-input v-model='queryParams.materialName' placeholder='请输入物料名称' clearable @keyup.enter='handleQuery' />
</el-form-item>
<!-- <el-form-item label='顶级标识' prop='topFlag'>-->
<!-- <el-input v-model='queryParams.topFlag' placeholder='请输入顶级标识' clearable-->
<!-- @keyup.enter='handleQuery' />-->
<!-- </el-form-item>-->
<!-- <el-form-item label='校验类型' prop='checkType'>-->
<!-- <el-select v-model='queryParams.checkType' placeholder='请选择校验类型' clearable>-->
<!-- <el-option v-for='dict in mes_check_type' :key='dict.value' :label='dict.label' :value='dict.value' />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label='激活标识' prop='activeFlag'>-->
<!-- <el-input v-model='queryParams.activeFlag' placeholder='请输入激活标识' clearable @keyup.enter='handleQuery' />-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type='primary' icon='Search' @click='handleQuery'>搜索</el-button>
<el-button icon='Refresh' @click='resetQuery'>重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow='never'>
<!-- <template #header>-->
<!-- <el-row :gutter='10' class='mb8'>-->
<!-- <el-col :span='1.5'>-->
<!-- <el-button type='primary' plain icon='Plus' @click='handleAdd()' v-hasPermi="['mes:materialBom:add']">-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span='1.5'>-->
<!-- <el-button type='info' plain icon='Sort' @click='handleToggleExpandAll'>展开/折叠</el-button>-->
<!-- </el-col>-->
<!-- <right-toolbar v-model:showSearch='showSearch' @queryTable='getList'></right-toolbar>-->
<!-- </el-row>-->
<!-- </template>-->
<el-table
v-loading='loading'
:data='materialBomList'
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
highlight-current-row
>
<!-- <el-table-column label='主键标识' align='center' prop='materialBomId' />-->
<!-- <el-table-column label='父级标识' align='center' prop='parentId' />-->
<el-table-column label='物料ID' align='center' prop='materialId' />
<el-table-column label='物料名称' align='center' prop='materialName' />
<el-table-column label='bom说明' align='center' prop='materialBomDesc' />
<el-table-column label='bom版本' align='center' prop='materialBomVersion' />
<!-- <el-table-column label='祖级列表' align='center' prop='ancestors' />-->
<el-table-column label='标准数量' align='center' prop='standardAmount' />
<el-table-column label='顶级标识' align='center' prop='topFlag'>
<template #default='scope'>
<dict-tag :options='active_flag' :value='scope.row.topFlag' />
</template>
</el-table-column>
<el-table-column label='校验类型' align='center' prop='checkType'>
<template #default='scope'>
<dict-tag :options='mes_check_type' :value='scope.row.checkType' />
</template>
</el-table-column>
<!-- <el-table-column label='项目ID' align='center' prop='projectId' />-->
<!-- <el-table-column label='装配时长(秒)' align='center' prop='assembleTime' />-->
<el-table-column label='物料分类' align='center' prop='materialClassfication'>
<template #default='scope'>
<dict-tag :options='material_classfication' :value='scope.row.materialClassfication' />
</template>
</el-table-column>
<!-- <el-table-column label='附件信息' align='center' prop='attachId' />-->
<el-table-column label='激活标识' align='center' prop='activeFlag'>
<template #default='scope'>
<dict-tag :options='active_flag' :value='scope.row.activeFlag' />
</template>
</el-table-column>
<el-table-column label='备注' align='center' prop='remark' />
<!-- <el-table-column label='创建部门' align='center' prop='createDept' />-->
<!-- <el-table-column label='创建人' align='center' prop='createBy' />-->
<!-- <el-table-column label='创建时间' align='center' prop='createTime' width='180'>-->
<!-- <template #default='scope'>-->
<!-- <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label='更新人' align='center' prop='updateBy' />-->
<!-- <el-table-column label='更新时间' align='center' prop='updateTime' width='180'>-->
<!-- <template #default='scope'>-->
<!-- <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</el-card>
</div>
</template>
<script setup name='MaterialBom' lang='ts'>
import {
listMaterialBom
} from '@/api/mes/materialBom';
import { MaterialBomVO, MaterialBomQuery, MaterialBomForm } from '@/api/mes/materialBom/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
;
const { mes_check_type, material_classfication, active_flag } = toRefs<any>(proxy?.useDict('mes_check_type', 'material_classfication', 'active_flag'));
const materialBomList = ref([]);
const selectedRow = ref({});
const buttonLoading = ref(false);
const showSearch = ref(true);
const isExpandAll = ref(true);
const loading = ref(false);
const queryFormRef = ref<ElFormInstance>();
const materialBomFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: MaterialBomForm = {
materialBomId: undefined,
parentId: undefined,
materialId: undefined,
materialName: undefined,
materialBomDesc: undefined,
materialBomVersion: undefined,
ancestors: undefined,
standardAmount: undefined,
topFlag: undefined,
checkType: '1',
projectId: undefined,
assembleTime: undefined,
materialClassfication: undefined,
attachId: undefined,
activeFlag: '1',
remark: undefined
};
const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
form: { ...initFormData },
queryParams: {
materialBomId: undefined,
parentId: undefined,
materialId: undefined,
materialName: undefined,
materialBomDesc: undefined,
materialBomVersion: undefined,
ancestors: undefined,
standardAmount: undefined,
topFlag: undefined,
checkType: undefined,
projectId: undefined,
assembleTime: undefined,
materialClassfication: undefined,
attachId: undefined,
activeFlag: undefined,
params: {}
},
rules: {
materialBomId: [
{ required: true, message: '主键标识不能为空', trigger: 'blur' }
],
parentId: [
{ required: true, message: '父级标识不能为空', trigger: 'blur' }
],
materialId: [
{ required: true, message: '物料ID不能为空', trigger: 'blur' }
]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询物料BOM信息列表 */
const getList = async () => {
loading.value = true;
const res = await listMaterialBom(queryParams.value);
materialBomList.value = res.data;
loading.value = false;
};
//
const cancel = () => {
reset();
dialog.visible = false;
};
//
const reset = () => {
form.value = { ...initFormData };
materialBomFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
//
const handleRowClick = (row) =>{
selectedRow.value = row
console.log(selectedRow.value);
};
onMounted(() => {
getList();
});
</script>

@ -164,26 +164,30 @@
<!-- 添加或修改生产工单信息对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="planInfoFormRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="生产订单ID" prop="productOrderId">
<el-input v-model="form.productOrderId" placeholder="请输入生产订单ID" />
</el-form-item>
<!-- <el-form-item label="生产订单ID" prop="productOrderId">-->
<!-- <el-input v-model="form.productOrderId" placeholder="请输入生产订单ID" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="销售订单ID" prop="saleOrderId">-->
<!-- <el-input v-model="form.saleOrderId" placeholder="请输入销售订单ID" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="销售订单编号" prop="saleorderCode">-->
<!-- <el-input v-model="form.saleorderCode" placeholder="请输入销售订单编号" />-->
<!-- </el-form-item>-->
<el-form-item label="计划编号" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入计划编号" />
</el-form-item>
<el-form-item label="派工单号" prop="dispatchCode">
<el-input v-model="form.dispatchCode" placeholder="请输入派工单号" />
</el-form-item>
<!-- <el-form-item label="计划编号" prop="planCode">-->
<!-- <el-input v-model="form.planCode" placeholder="请输入计划编号" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="派工单号" prop="dispatchCode">-->
<!-- <el-input v-model="form.dispatchCode" placeholder="请输入派工单号" />-->
<!-- </el-form-item>-->
<el-form-item label="物料名称" prop="materialId">
<el-input v-model="form.materialId" placeholder="请输入物料名称" />
</el-form-item>
<el-form-item label="物料BOM" prop="materialBomId">
<el-input v-model="form.materialBomId" placeholder="请输入物料BOM" />
<el-input v-model="form.materialBomId" placeholder="请点击右侧检索子BOM" @click="handleMaterialAdd" readonly>
<template #append>
<el-icon class="el-input__icon" ><search /></el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item label="工序名称" prop="processId">
<el-input v-model="form.processId" placeholder="请输入工序名称" />
@ -285,6 +289,16 @@
</div>
</template>
</el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" v-model="materialOpen" append-to-body>
<BomSelect @selection="handleSelection" ref="bomSelectRef" v-if="materialOpen"></BomSelect>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -293,6 +307,7 @@ import { listPlanInfo, getPlanInfo, delPlanInfo, addPlanInfo, updatePlanInfo } f
import { PlanInfoVO, PlanInfoQuery, PlanInfoForm } from '@/api/mes/planInfo/types';
import { getBaseShiftInfoList } from '@/api/mes/baseShiftInfo';
import { getBaseClassTeamInfoList } from '@/api/mes/baseClassTeamInfo';
import BomSelect from '@/views/mes/materialBom/addBom.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { mes_import_flag, active_flag, mes_plan_status, mes_release_type, mes_finish_flag, mes_model_code } = toRefs<any>(proxy?.useDict('mes_import_flag', 'active_flag', 'mes_plan_status', 'mes_release_type', 'mes_finish_flag', 'mes_model_code'));
@ -317,6 +332,9 @@ const dialog = reactive<DialogOption>({
const shiftList = ref([]);
const classTeamList = ref([]);
const materialOpen = ref(false);
const bomSelectRef = ref<InstanceType<typeof BomSelect>>();
/*获取班次下拉框*/
const getShiftSelect = async () => {
let res = await getBaseShiftInfoList(null);
@ -555,6 +573,24 @@ const handleExport = () => {
}, `planInfo_${new Date().getTime()}.xlsx`)
}
/** 新增按钮操作 */
const handleMaterialAdd = () => {
materialOpen.value = true;
bomSelectRef.value.open();
}
/** 提交物料信息按钮 */
const submitMaterialForm = () => {
console.log("bomSelectRef.value",bomSelectRef.value);
let selectedRow = bomSelectRef.value.selectedRow;
console.log(selectedRow,form.value);
form.value.materialName = selectedRow.materialName
// this.$set(form, "materialId", selectedRow.materialId);
// this.$set(form, "materialName", selectedRow.materialName);
// this.$set(form, "erpMaterialId", selectedRow.erpId);
materialOpen.value = false;
}
onMounted(() => {
getShiftSelect();
getClassTeamSelect();

Loading…
Cancel
Save