Merge remote-tracking branch 'origin/dev_长治_健齿齿科器材' into dev_长治_健齿齿科器材
| | |
| | | }); |
| | | }; |
| | | |
| | | export function getMaterials() { |
| | | return request({ |
| | | url: "/stockInventory/getMaterials", |
| | | method: "get", |
| | | }); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | //根据订单的bomId查询库存原材料 |
| | | export function getByBomId(query) { |
| | | return request({ |
| | | url: "/productOrder/getByBomId", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | //保存生产订单领料 |
| | | export function drawMaterials(data) { |
| | | return request({ |
| | |
| | | <el-table-column type="index" label="序号" width="60" /> |
| | | <el-table-column prop="productName" label="产品大类" min-width="160" /> |
| | | <el-table-column prop="model" label="型号名称" min-width="200" /> |
| | | <el-table-column prop="uidNo" label="UID码" min-width="200" /> |
| | | <el-table-column prop="unit" label="单位" min-width="160" /> |
| | | </el-table> |
| | | |
| | |
| | | prop="model" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="UID码" |
| | | prop="uidNO" |
| | | prop="uidNo" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="单位" |
| | | prop="unit" |
| | |
| | | /> |
| | | <el-table-column |
| | | label="UID码" |
| | | prop="uid码" |
| | | prop="uidNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | |
| | | <el-table-column label="单位" |
| | | prop="unit" |
| | | width="70" /> |
| | | <el-table-column label="UID码" prop="uidNo" /> |
| | | <el-table-column label="数量" |
| | | prop="quantity" |
| | | width="70" /> |
| | |
| | | :label="item.model" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="UID码:" |
| | | prop="uidNo"> |
| | | <el-input v-model="productForm.uidNo" |
| | | placeholder="请输入" |
| | | disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | productId: "", |
| | | productCategory: "", |
| | | productModelId: "", |
| | | uidNo: "", |
| | | specificationModel: "", |
| | | unit: "", |
| | | quantity: "", |
| | |
| | | if (index !== -1) { |
| | | productForm.value.specificationModel = modelOptions.value[index].model; |
| | | productForm.value.unit = modelOptions.value[index].unit; |
| | | productForm.value.uidNo = modelOptions.value[index].uidNo || ""; |
| | | } else { |
| | | productForm.value.specificationModel = null; |
| | | productForm.value.unit = null; |
| | | productForm.value.uidNo = ""; |
| | | } |
| | | }; |
| | | const findNodeById = (nodes, productId) => { |
| | |
| | | }, |
| | | { |
| | | label: "UID码", |
| | | prop: "uid码", |
| | | prop: "uidNo", |
| | | }, |
| | | { |
| | | label: "BOM编号", |
| | |
| | | processRouteCode: row.processRouteCode || '', |
| | | productName: row.productName || '', |
| | | model: row.model || '', |
| | | uidNo: row.uidNo || '', |
| | | bomNo: row.bomNo || '', |
| | | description: row.description || '', |
| | | type: 'route', |
| | |
| | | </div> |
| | | <div class="info-item"> |
| | | <div class="info-label-wrapper"> |
| | | <span class="info-label">UID码</span> |
| | | </div> |
| | | <div class="info-value-wrapper"> |
| | | <span class="info-value">{{ routeInfo.uidNo || '-' }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="info-item"> |
| | | <div class="info-label-wrapper"> |
| | | <span class="info-label">BOM编号</span> |
| | | </div> |
| | | <div class="info-value-wrapper"> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="产品名称" prop="productName" min-width="160" /> |
| | | <el-table-column label="规格名称" prop="model" min-width="140" /> |
| | | <el-table-column label="UID码" prop="uidNo"/> |
| | | <el-table-column label="单位" prop="unit" width="100" /> |
| | | <el-table-column label="是否质检" prop="isQuality" width="100"> |
| | | <template #default="scope"> |
| | |
| | | : '选择产品' }} |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item label="UID码" prop="uidNo"> |
| | | <el-input |
| | | v-model="form.uidNo" |
| | | :placeholder="form.productModelId ? '根据选择的产品自动带出' : '请先选择产品'" |
| | | clearable |
| | | :disabled="true" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="单位" prop="unit"> |
| | | <el-input |
| | |
| | | productModelId: undefined, |
| | | productName: "", |
| | | model: "", |
| | | uidNo: "", |
| | | unit: "", |
| | | isQuality: false, |
| | | }); |
| | |
| | | processRouteCode: route.query.processRouteCode || '', |
| | | productName: route.query.productName || '', |
| | | model: route.query.model || '', |
| | | uidNo: route.query.uidNo || '', |
| | | bomNo: route.query.bomNo || '', |
| | | description: route.query.description || '' |
| | | }; |
| | |
| | | routeId: routeId.value, |
| | | processId: row.processId, |
| | | productModelId: row.productModelId, |
| | | uidNo: row.uidNo || "", |
| | | productName: row.productName || "", |
| | | model: row.model || "", |
| | | unit: row.unit || "", |
| | |
| | | form.value.productModelId = product.id; |
| | | form.value.productName = product.productName; |
| | | form.value.model = product.model; |
| | | form.value.uidNo = product.uidNo; |
| | | form.value.unit = product.unit || ""; |
| | | showProductSelectDialog.value = false; |
| | | // 触发表单验证 |
| | |
| | | routeId: routeId.value, |
| | | processId: undefined, |
| | | productModelId: undefined, |
| | | uidNo: "", |
| | | productName: "", |
| | | model: "", |
| | | unit: "", |
| | |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="uidNo" |
| | | label="UID码" /> |
| | | <el-table-column prop="processName" |
| | | label="消耗工序"> |
| | | <template #default="{ row, $index }"> |
| | |
| | | prop="productName" /> |
| | | <el-table-column label="规格型号" |
| | | prop="model" /> |
| | | <el-table-column label="UID码" |
| | | prop="uidNo" /> |
| | | </el-table> |
| | | <product-select-dialog v-if="dataValue.showProductDialog" |
| | | v-model:model-value="dataValue.showProductDialog" |
| | |
| | | const routeProductModelName = computed( |
| | | () => route.query.productModelName || "" |
| | | ); |
| | | const routeUidNo = computed(() => route.query.uidNo || ""); |
| | | const routeOrderId = computed(() => route.query.orderId); |
| | | const pageType = computed(() => route.query.type); |
| | | const isOrderPage = computed( |
| | |
| | | { |
| | | productName: "", |
| | | model: "", |
| | | uidNo: "", |
| | | bomNo: "", |
| | | }, |
| | | ]); |
| | |
| | | item => |
| | | (item as any).tempId !== dataValue.currentRowName && |
| | | (item as any).productName === tableData[0].productName && |
| | | (item as any).model === tableData[0].model |
| | | (item as any).model === tableData[0].model && |
| | | (item as any).uidNo === tableData[0].uidNo |
| | | ); |
| | | if (hasOther) { |
| | | ElMessage.warning("最外层和当前产品一样的一级只能有一个"); |
| | |
| | | if (item.tempId === dataValue.currentRowName) { |
| | | item.productName = productData.productName; |
| | | item.model = productData.model; |
| | | item.uidNo = productData.uidNo; |
| | | item.productModelId = productData.id; |
| | | item.unit = productData.unit || ""; |
| | | return; |
| | |
| | | if (item.tempId === tempId) { |
| | | item.productName = productData.productName; |
| | | item.model = productData.model; |
| | | item.uidNo = productData.uidNo; |
| | | item.productModelId = productData.id; |
| | | item.unit = productData.unit || ""; |
| | | return true; |
| | |
| | | // 从路由参数回显数据 |
| | | tableData[0].productName = routeProductName.value as string; |
| | | tableData[0].model = routeProductModelName.value as string; |
| | | tableData[0].uidNo = routeUidNo.value as string; |
| | | tableData[0].bomNo = routeBomNo.value as string; |
| | | |
| | | // 订单情况下禁用编辑 |
| | |
| | | prop: "productModelName", |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | label: "UID码", |
| | | prop: "uidNo", |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | label: "单位", |
| | | prop: "unit", |
| | |
| | | <table class="info-table"> |
| | | <tr> |
| | | <td class="label">产品名称</td> |
| | | <td class="value" colspan="3">{{ formData.productName }}</td> |
| | | <td class="value" colspan="5">{{ formData.productName }}</td> |
| | | <td class="label">生产日期</td> |
| | | <td class="value">{{ formData.productionDate }}</td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label">规格</td> |
| | | <td class="value">{{ formData.spec }}</td> |
| | | <td class="label">UID码</td> |
| | | <td class="value">{{ formData.uidNo }}</td> |
| | | <td class="label">批号</td> |
| | | <td class="value">{{ formData.batchNo }}</td> |
| | | <td class="label">生产车间</td> |
| | |
| | | productName: '', |
| | | productionDate: '', |
| | | spec: '', |
| | | uidNo: '', |
| | | batchNo: '', |
| | | workshop: '', |
| | | checkItems: JSON.parse(JSON.stringify(defaultCheckItems)), |
| | |
| | | formData.productName = record.productName || order.productCategory || ''; |
| | | formData.productionDate = record.productionDate || (order.startTime ? dayjs(order.startTime).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD')); |
| | | formData.spec = record.spec || order.specificationModel || ''; |
| | | formData.batchNo = record.batchNo || order.batchNo || order.uidNo || ''; |
| | | formData.uidNo = record.uidNo || order.uidNo || ''; |
| | | formData.batchNo = record.batchNo || order.batchNo || ''; |
| | | formData.workshop = record.workshop || order.workshop || order.manufacturingTeam || ''; |
| | | |
| | | // 加载检查项目,保持默认结构但更新结果 |
| | |
| | | formData.productName = order.productCategory || ''; |
| | | formData.productionDate = order.startTime ? dayjs(order.startTime).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD'); |
| | | formData.spec = order.specificationModel || ''; |
| | | formData.batchNo = order.batchNo || order.uidNo || ''; |
| | | formData.uidNo = order.uidNo || ''; |
| | | formData.batchNo = order.batchNo || ''; |
| | | formData.workshop = order.workshop || order.manufacturingTeam || ''; |
| | | |
| | | // 清场人和检查人默认为空,日期默认为当前时间 |
| | |
| | | const saveData = { |
| | | orderId: formData.orderId, |
| | | productName: formData.productName, |
| | | uidNo: formData.uidNo, |
| | | productionDate: formData.productionDate, |
| | | spec: formData.spec, |
| | | batchNo: formData.batchNo, |
| | |
| | | class="material-requisition-dialog" |
| | | > |
| | | <div class="material-requisition-form"> |
| | | <!-- 原材料列表 --> |
| | | <el-table :data="materialList" border style="width: 100%" height="65vh"> |
| | | <!-- 原材料 Tab --> |
| | | |
| | | <div class="operation-bar"> |
| | | <el-button type="primary" @click="handleAdd">新增</el-button> |
| | | </div> |
| | | <el-table :data="materialList" border style="width: 100%" height="50vh"> |
| | | <el-table-column type="index" label="序号" width="60" align="center" /> |
| | | <el-table-column prop="productName" label="产品名称" min-width="150" /> |
| | | <el-table-column prop="model" label="型号" min-width="150" /> |
| | | <!-- <el-table-column prop="batchNo" label="批号" min-width="150"> |
| | | <template #default="{ row }"> |
| | | <el-select |
| | | v-model="row.batchNo" |
| | | placeholder="请选择批号" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="item in row.batchOptions || []" |
| | | :key="item.batchNo" |
| | | :label="item.batchNo" |
| | | :value="item.batchNo" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-table-column prop="unit" label="单位" width="80" align="center" /> |
| | | <el-table-column prop="qualitity" label="数量" width="100" align="center"> |
| | | <!-- <el-table-column prop="qualitity" label="可领用数量" width="100" align="center"> |
| | | <template #default="{ row }"> |
| | | {{ row.qualitity || 0 }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | <el-table-column prop="requisitionQty" label="领用数量" width="120" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-input-number |
| | | v-model="row.requisitionQty" |
| | | :min="0" |
| | | :max="row.qualitity || 0" |
| | | :precision="2" |
| | | :controls="false" |
| | | :disabled="!row.qualitity || hasDrawMaterials" |
| | | :disabled="!row.qualitity" |
| | | style="width: 100%" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="备注" min-width="150"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.remark" placeholder="请输入备注" clearable /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="80" align="center"> |
| | | <template #default="{ $index }"> |
| | | <el-button type="danger" link @click="handleDelete($index)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | |
| | | <el-button @click="handleCancel">取 消</el-button> |
| | | </span> |
| | | </template> |
| | | |
| | | <!-- 新增原材料弹窗 --> |
| | | <el-dialog |
| | | v-model="addDialogVisible" |
| | | title="选择原材料" |
| | | width="800px" |
| | | top="5vh" |
| | | :close-on-click-modal="false" |
| | | append-to-body |
| | | > |
| | | <el-table |
| | | :data="availableMaterials" |
| | | border |
| | | style="width: 100%" |
| | | height="50vh" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column type="index" label="序号" width="60" align="center" /> |
| | | <el-table-column prop="productName" label="产品名称" min-width="150" /> |
| | | <el-table-column prop="model" label="型号" min-width="150" /> |
| | | <el-table-column prop="unit" label="单位" width="80" align="center" /> |
| | | <!-- <el-table-column prop="qualitity" label="可领用数量" width="100" align="center"> |
| | | <template #default="{ row }"> |
| | | {{ row.qualitity || 0 }} |
| | | </template> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" @click="handleAddConfirm">确 定</el-button> |
| | | <el-button @click="addDialogVisible = false">取 消</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, watch } from 'vue'; |
| | | import { ref, computed, watch } from 'vue'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { getByBomId, drawMaterials } from '@/api/productionManagement/productionOrder.js'; |
| | | import { drawMaterials } from '@/api/productionManagement/productionOrder.js'; |
| | | import { getMaterials } from '@/api/inventoryManagement/stockInventory.js'; |
| | | |
| | | const props = defineProps({ |
| | | modelValue: { |
| | |
| | | |
| | | const loading = ref(false); |
| | | const saving = ref(false); |
| | | const activeTab = ref('material'); |
| | | const materialList = ref([]); |
| | | const hasDrawMaterials = ref(false); |
| | | |
| | | // 新增弹窗相关 |
| | | const addDialogVisible = ref(false); |
| | | const availableMaterials = ref([]); |
| | | const selectedMaterials = ref([]); |
| | | |
| | | // 监听弹框打开,加载数据 |
| | | watch(() => props.modelValue, (val) => { |
| | |
| | | const loadMaterialList = async () => { |
| | | const order = props.orderData; |
| | | const drawMaterialsData = order.drawMaterials; |
| | | const bomId = order?.bomId; |
| | | |
| | | // 如果已有领料数据,直接使用 |
| | | // 先获取getMaterials的最新数据 |
| | | let materialsFromApi = []; |
| | | if (bomId) { |
| | | try { |
| | | const res = await getMaterials({ bomId }); |
| | | materialsFromApi = res.data || []; |
| | | } catch (error) { |
| | | console.error('查询原材料列表失败:', error); |
| | | } |
| | | } |
| | | |
| | | // 加载已保存的领料数据 |
| | | if (drawMaterialsData) { |
| | | hasDrawMaterials.value = true; |
| | | try { |
| | | const list = typeof drawMaterialsData === 'string' |
| | | ? JSON.parse(drawMaterialsData) |
| | | : drawMaterialsData; |
| | | materialList.value = list.map(item => ({ |
| | | ...item, |
| | | requisitionQty: item.requisitionQty || 0 |
| | | })); |
| | | return; |
| | | // 合并数据:使用API的qualitity,使用保存的requisitionQty和remark |
| | | materialList.value = list.map(savedItem => { |
| | | const apiItem = materialsFromApi.find(m => m.id === savedItem.id || m.productModelId === savedItem.productModelId); |
| | | return { |
| | | ...savedItem, |
| | | qualitity: apiItem?.qualitity ?? savedItem.qualitity ?? 0, |
| | | requisitionQty: savedItem.requisitionQty || 0 |
| | | }; |
| | | }); |
| | | } catch (e) { |
| | | console.error('解析领料数据失败:', e); |
| | | materialList.value = []; |
| | | } |
| | | } else { |
| | | materialList.value = []; |
| | | } |
| | | }; |
| | | |
| | | // 没有领料数据,调用接口查询 |
| | | hasDrawMaterials.value = false; |
| | | // 打开新增弹窗 |
| | | const handleAdd = async () => { |
| | | const order = props.orderData; |
| | | const bomId = order?.bomId; |
| | | if (!bomId) { |
| | | ElMessage.warning('当前订单缺少BOM信息'); |
| | |
| | | |
| | | loading.value = true; |
| | | try { |
| | | const res = await getByBomId({ bomId }); |
| | | const data = res.data || []; |
| | | // 处理数据,添加领用数量字段和批号选项 |
| | | materialList.value = data.map(item => ({ |
| | | ...item, |
| | | requisitionQty: item.qualitity ? 0 : 0, |
| | | batchNo: item.batchNo || '', |
| | | remark: item.remark || '', |
| | | // 批号选项,从库存原材料信息中获取 |
| | | batchOptions: item.inventoryList || [] |
| | | })); |
| | | const res = await getMaterials({ bomId }); |
| | | console.log('getMaterials返回数据:', res.data); |
| | | // 直接展示所有数据,不过滤 |
| | | availableMaterials.value = res.data || []; |
| | | selectedMaterials.value = []; |
| | | addDialogVisible.value = true; |
| | | } catch (error) { |
| | | console.error('查询原材料列表失败:', error); |
| | | ElMessage.error('查询原材料列表失败'); |
| | | materialList.value = []; |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // 选择变化 |
| | | const handleSelectionChange = (selection) => { |
| | | selectedMaterials.value = selection; |
| | | }; |
| | | |
| | | // 确认添加 |
| | | const handleAddConfirm = () => { |
| | | if (selectedMaterials.value.length === 0) { |
| | | ElMessage.warning('请选择至少一条记录'); |
| | | return; |
| | | } |
| | | |
| | | // 过滤掉已存在的(通过id和productModelId判断) |
| | | const existingIds = materialList.value.map(item => item.id); |
| | | const existingProductModelIds = materialList.value.map(item => item.productModelId); |
| | | |
| | | const newItems = selectedMaterials.value |
| | | .filter(item => !existingIds.includes(item.id) && !existingProductModelIds.includes(item.productModelId)) |
| | | .map(item => ({ |
| | | ...item, |
| | | requisitionQty: 0, |
| | | remark: '' |
| | | })); |
| | | |
| | | if (newItems.length === 0) { |
| | | ElMessage.warning('所选数据已存在,无需重复添加'); |
| | | return; |
| | | } |
| | | |
| | | materialList.value = [...materialList.value, ...newItems]; |
| | | addDialogVisible.value = false; |
| | | ElMessage.success(`成功添加 ${newItems.length} 条记录`); |
| | | }; |
| | | |
| | | // 删除 |
| | | const handleDelete = (index) => { |
| | | materialList.value.splice(index, 1); |
| | | }; |
| | | |
| | | const handleCancel = () => { |
| | | visible.value = false; |
| | | materialList.value = []; |
| | | hasDrawMaterials.value = false; |
| | | activeTab.value = 'material'; |
| | | }; |
| | | |
| | | const handleConfirm = async () => { |
| | |
| | | ElMessage.success('领料保存成功'); |
| | | visible.value = false; |
| | | materialList.value = []; |
| | | hasDrawMaterials.value = false; |
| | | activeTab.value = 'material'; |
| | | } catch (error) { |
| | | console.error('保存领料失败:', error); |
| | | ElMessage.error('保存领料失败'); |
| | |
| | | |
| | | <style scoped lang="scss"> |
| | | .material-requisition-form { |
| | | .operation-bar { |
| | | margin-bottom: 15px; |
| | | } |
| | | |
| | | .el-tabs { |
| | | height: 100%; |
| | | } |
| | | |
| | | .el-table { |
| | | margin-top: 10px; |
| | | } |
| | |
| | | padding: 15px 20px; |
| | | border-top: 1px solid #e4e7ed; |
| | | } |
| | | |
| | | :deep(.el-tabs__content) { |
| | | height: calc(100% - 55px); |
| | | } |
| | | |
| | | :deep(.el-tab-pane) { |
| | | height: 100%; |
| | | } |
| | | </style> |
| | |
| | | processRouteCode: data.processRouteCode || "", |
| | | productName: data.productName || "", |
| | | model: data.model || "", |
| | | uidNo: data.uidNo || "", |
| | | bomNo: data.bomNo || "", |
| | | description: data.description || "", |
| | | orderId, |
| | |
| | | bomNo: row.bomNo || "", |
| | | productName: row.productCategory || "", |
| | | productModelName: row.specificationModel || "", |
| | | uidNo: row.uidNo || "", |
| | | orderId: row.id, |
| | | type: "order", |
| | | }, |
| | |
| | | prop: 'model', |
| | | }, |
| | | { |
| | | label: 'UID吗', |
| | | prop: 'uid_no', |
| | | label: 'UID码', |
| | | prop: 'uidNo', |
| | | }, |
| | | { |
| | | label: '投入数量', |
| | |
| | | label: '单位', |
| | | prop: 'unit', |
| | | }, |
| | | { |
| | | label: '备注', |
| | | prop: 'remark', |
| | | }, |
| | | ] |
| | | |
| | | const isShow = computed({ |
| | |
| | | <script setup lang="ts"> |
| | | import {computed, reactive, ref, watch} from "vue"; |
| | | import {computed, reactive, ref, watch, withDefaults} from "vue"; |
| | | |
| | | defineOptions({ |
| | | name: "ProductionRecordForm" |
| | | }); |
| | | |
| | | const props = defineProps({ |
| | | list: { |
| | | type: Array, |
| | | default() { |
| | | return []; |
| | | type DeviceOption = { |
| | | id: string | number; |
| | | deviceName: string; |
| | | deviceCode?: string | number | null; |
| | | rpm?: string | number | null; |
| | | }; |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | list: any[]; |
| | | labelWidth: number; |
| | | deviceOptions: DeviceOption[]; |
| | | selectedDeviceId: string | number | null; |
| | | }>(), |
| | | { |
| | | list: () => [], |
| | | labelWidth: 120, |
| | | deviceOptions: () => [], |
| | | selectedDeviceId: null, |
| | | } |
| | | }, |
| | | labelWidth: { |
| | | type: Number, |
| | | default: 120 |
| | | } |
| | | }); |
| | | ); |
| | | |
| | | const formRef = ref(); |
| | | const formData = reactive({ |
| | |
| | | |
| | | const getType = (item: any) => item.type || "文本格式"; |
| | | |
| | | const machineSelectItem = computed(() => { |
| | | return formData.list.find(item => getType(item) === '机台选择') || null; |
| | | }); |
| | | |
| | | const selectedDevice = computed(() => { |
| | | const machineValue = machineSelectItem.value?.value; |
| | | if (machineValue === null || machineValue === undefined || machineValue === '') return null; |
| | | return props.deviceOptions.find(device => String(device.id) === String(machineValue)) || null; |
| | | }); |
| | | |
| | | const AUTO_DEVICE_CODE_ID = "__auto_deviceCode__"; |
| | | const AUTO_RPM_ID = "__auto_rpm__"; |
| | | |
| | | let isSyncingAutoFields = false; |
| | | |
| | | const syncAutoDeviceFields = () => { |
| | | if (isSyncingAutoFields) return; |
| | | isSyncingAutoFields = true; |
| | | |
| | | try { |
| | | const machineIndex = formData.list.findIndex(item => getType(item) === "机台选择"); |
| | | if (machineIndex === -1) return; |
| | | |
| | | const removeById = (id: string) => { |
| | | const idx = formData.list.findIndex(x => x?.id === id); |
| | | if (idx !== -1) formData.list.splice(idx, 1); |
| | | }; |
| | | |
| | | removeById(AUTO_DEVICE_CODE_ID); |
| | | removeById(AUTO_RPM_ID); |
| | | |
| | | const dev = selectedDevice.value as any; |
| | | let insertPos = machineIndex + 1; |
| | | |
| | | const hasCode = |
| | | dev && |
| | | dev.deviceCode !== null && |
| | | dev.deviceCode !== undefined && |
| | | String(dev.deviceCode) !== ""; |
| | | |
| | | const hasRpm = dev && dev.rpm !== null && dev.rpm !== undefined; |
| | | |
| | | if (hasCode) { |
| | | formData.list.splice(insertPos, 0, { |
| | | id: AUTO_DEVICE_CODE_ID, |
| | | parameterItem: "设备编号", |
| | | value: dev.deviceCode, |
| | | // 只读展示:避免影响后端参数结构(submitData 会过滤) |
| | | readonly: true, |
| | | isRequired: "0", |
| | | __autoExtra: true, |
| | | }); |
| | | insertPos++; |
| | | } |
| | | |
| | | if (hasRpm) { |
| | | formData.list.splice(insertPos, 0, { |
| | | id: AUTO_RPM_ID, |
| | | parameterItem: "转数", |
| | | value: dev.rpm, |
| | | readonly: true, |
| | | isRequired: "0", |
| | | __autoExtra: true, |
| | | }); |
| | | } |
| | | } finally { |
| | | isSyncingAutoFields = false; |
| | | } |
| | | }; |
| | | |
| | | const rules = computed(() => { |
| | | const result: Record<string, any[]> = {}; |
| | | formData.list.forEach((item, index) => { |
| | |
| | | }); |
| | | |
| | | const initData = () => { |
| | | formData.list = props.list || []; |
| | | // 重要:不要直接复用 props.list 的引用,否则后续 splice formData.list 会触发 props watch,导致递归更新 |
| | | formData.list = (props.list || []).map(item => ({ ...item })); |
| | | formData.list.forEach(item => { |
| | | if (item.value === undefined) { |
| | | item.value = null; |
| | | } |
| | | // 如果参数中存在“机台选择”,则使用父组件传入的默认机台回填 |
| | | if (getType(item) === '机台选择' && (item.value === null || item.value === undefined || item.value === '')) { |
| | | item.value = props.selectedDeviceId ?? item.value; |
| | | } |
| | | }); |
| | | }; |
| | |
| | | const valid = await formRef.value.validate().catch(() => false) |
| | | |
| | | if (valid) { |
| | | return formData.list |
| | | // 自动插入的只读字段不参与提交,避免后端参数结构变化 |
| | | return formData.list.filter(item => !item.__autoExtra) |
| | | } else { |
| | | return null |
| | | } |
| | |
| | | () => props.list, |
| | | () => { |
| | | initData(); |
| | | // 初始化后再同步自动插入字段 |
| | | syncAutoDeviceFields(); |
| | | }, |
| | | {immediate: true, deep: true} |
| | | ); |
| | | |
| | | watch( |
| | | () => selectedDevice.value, |
| | | () => { |
| | | syncAutoDeviceFields(); |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | |
| | | defineExpose({ |
| | |
| | | |
| | | <template> |
| | | <el-form ref="formRef" :model="formData" :rules="rules" :label-width="`${labelWidth}px`"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12" v-for="(item, index) in formData.list" |
| | | :key="item.id"> |
| | | <el-form-item |
| | | v-for="(item, index) in formData.list" |
| | | :key="item.id" |
| | | |
| | | :label="fieldLabel(item)" |
| | | :prop="`list.${index}.value`" |
| | | > |
| | |
| | | <el-option label="是" value="是"/> |
| | | <el-option label="否" value="否"/> |
| | | </el-select> |
| | | <el-select |
| | | v-else-if="getType(item) === '机台选择'" |
| | | v-model="item.value" |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="device in props.deviceOptions" |
| | | :key="device.id" |
| | | :label="device.deviceName" |
| | | :value="device.id" |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-else |
| | | v-model="item.value" |
| | | placeholder="请输入" |
| | | clearable |
| | | :disabled="item.readonly" |
| | | :clearable="!item.readonly" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </template> |
| | |
| | | </el-dialog> |
| | | <el-dialog v-model="reportDialogVisible" |
| | | title="报工" |
| | | width="500px"> |
| | | width="1400px"> |
| | | <el-form ref="reportFormRef" |
| | | :model="reportForm" |
| | | :rules="reportFormRules" |
| | | label-width="120px"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="待生产数量"> |
| | | <el-input v-model="reportForm.planQuantity" |
| | | readonly |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="投入总量(kg)" |
| | | prop="totalInvestment"> |
| | | <el-input v-model.number="reportForm.totalInvestment" |
| | |
| | | placeholder="请输入投入总量" |
| | | @input="handleTotalInvestmentInput" /> |
| | | </el-form-item> |
| | | <el-form-item label="本次生产数量" |
| | | </el-col> |
| | | <el-col :span="12"><el-form-item label="本次生产数量" |
| | | prop="quantity"> |
| | | <el-input v-model.number="reportForm.quantity" |
| | | type="number" |
| | |
| | | style="width: 300px" |
| | | placeholder="请输入本次生产数量" |
| | | @input="handleQuantityInput" /> |
| | | </el-form-item> |
| | | <el-form-item label="报废数量" |
| | | </el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="报废数量" |
| | | prop="scrapQty"> |
| | | <el-input v-model.number="reportForm.scrapQty" |
| | | type="number" |
| | |
| | | style="width: 300px" |
| | | placeholder="请输入报废数量" |
| | | @input="handleScrapQtyInput" /> |
| | | </el-form-item> |
| | | </el-form-item></el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检品数量" |
| | | prop="inspectedQuantity"> |
| | | <el-input v-model.number="reportForm.inspectedQuantity" |
| | |
| | | placeholder="请输入检品数量" |
| | | @input="handleInspectedQuantity"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="班组信息"> |
| | | <el-select v-model="reportForm.userId" |
| | | style="width: 300px" |
| | |
| | | :value="user.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="设备选择"> |
| | | <el-select v-model="reportForm.deviceId" |
| | | style="width: 300px" |
| | | placeholder="请选择设备" |
| | | clearable |
| | | filterable |
| | | @change="handleDeviceChange"> |
| | | <el-option v-for="device in deviceOptions" |
| | | :key="device.id" |
| | | :label="device.deviceName" |
| | | :value="device.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="currentDevice" label="设备编号"> |
| | | <el-input v-model="currentDevice.deviceCode" |
| | | disabled |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="currentDevice" label="转数"> |
| | | <el-input v-model="currentDevice.rpm" |
| | | disabled |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <ProductionRecordForm ref="productionRecordFormRef" :list="processParamList"/> |
| | | </el-col> |
| | | </el-row> |
| | | <ProductionRecordForm |
| | | ref="productionRecordFormRef" |
| | | :list="processParamList" |
| | | :device-options="deviceOptions" |
| | | :selected-device-id="reportForm.deviceId" |
| | | /> |
| | | |
| | | <div style="margin-top: 20px"> |
| | | <div style="display: flex; justify-content: flex-end; margin-bottom: 10px"> |
| | | <el-button type="primary" @click="openAddMaterialDialog">新增原材料</el-button> |
| | | </div> |
| | | |
| | | <el-table |
| | | :data="reportForm.drawMaterialList" |
| | | border |
| | | style="width: 100%" |
| | | height="220px" |
| | | empty-text="暂无原材料领用明细" |
| | | > |
| | | <el-table-column type="index" label="序号" width="60" align="center" /> |
| | | <el-table-column prop="productName" label="产品名称" min-width="160" /> |
| | | <el-table-column prop="model" label="型号" min-width="150" /> |
| | | <el-table-column prop="unit" label="单位" width="90" align="center" /> |
| | | <el-table-column prop="reportQty" label="领用数量" width="160" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-input-number |
| | | v-model.number="row.reportQty" |
| | | :min="0" |
| | | :precision="2" |
| | | :controls="false" |
| | | :max="row.qualitity || 0" |
| | | :disabled="!row.qualitity" |
| | | style="width: 100%" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="备注" min-width="160"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.remark" placeholder="请输入备注" clearable /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="80" align="center"> |
| | | <template #default="{ $index }"> |
| | | <el-button type="danger" link @click="removeDrawMaterialRow($index)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <el-dialog |
| | | v-model="addMaterialDialogVisible" |
| | | title="选择原材料" |
| | | width="1000px" |
| | | top="5vh" |
| | | :close-on-click-modal="false" |
| | | append-to-body |
| | | destroy-on-close |
| | | > |
| | | <div> |
| | | <el-table |
| | | :data="availableMaterials" |
| | | border |
| | | style="width: 100%" |
| | | height="45vh" |
| | | row-key="id" |
| | | @selection-change="handleAddMaterialSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column type="index" label="序号" width="60" align="center" /> |
| | | <el-table-column prop="productName" label="产品名称" min-width="160" /> |
| | | <el-table-column prop="model" label="型号" min-width="150" /> |
| | | <el-table-column prop="unit" label="单位" width="90" align="center" /> |
| | | <el-table-column prop="qualitity" label="可领用数量" width="140" align="center" /> |
| | | </el-table> |
| | | |
| | | <!-- 已选择明细展示放在报工弹框下方的 reportForm.drawMaterialList 表格里 --> |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="addMaterialDialogVisible = false">取消</el-button> |
| | | <el-button type="primary" @click="handleConfirmAddMaterial">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <FilesDia ref="workOrderFilesRef" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, nextTick, computed } from "vue"; |
| | | import { onMounted, ref, nextTick } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | |
| | | userId: "", |
| | | productMainId: null, |
| | | deviceId: null, |
| | | // 报工时选择的原材料领用明细 |
| | | drawMaterialList: [], |
| | | otherData: { |
| | | rows: [] |
| | | }, |
| | | }); |
| | | const productionRecordFormRef = ref(); |
| | | |
| | | const currentDevice = computed(() => { |
| | | if (!reportForm.deviceId) return null; |
| | | return deviceOptions.value.find(device => device.id === reportForm.deviceId) || null; |
| | | }); |
| | | // 原材料领用(新增/选择弹框) |
| | | const availableMaterials = ref([]); // 来自当前行的 drawMaterials(json解析成list) |
| | | const addMaterialDialogVisible = ref(false); |
| | | const selectedAddMaterials = ref([]); // 弹框里用户选中的条目(可编辑 reportQty) |
| | | |
| | | // 投入总量验证规则 |
| | | const validateTotalInvestment = (rule, value, callback) => { |
| | |
| | | const handleQuantityInput = value => { |
| | | if (value === "" || value === null || value === undefined) { |
| | | reportForm.quantity = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | |
| | | } |
| | | if (num < 1) { |
| | | reportForm.quantity = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | if (!Number.isInteger(num)) { |
| | | const intValue = Math.floor(num); |
| | | if (intValue < 1) { |
| | | reportForm.quantity = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | reportForm.quantity = intValue; |
| | | } else { |
| | | reportForm.quantity = num; |
| | | } |
| | | // 如果 totalInvestment 有值,自动计算 scrapQty = totalInvestment - quantity |
| | | if (reportForm.totalInvestment !== null && reportForm.totalInvestment !== undefined && reportForm.totalInvestment !== "") { |
| | | const total = Number(reportForm.totalInvestment); |
| | | const qty = Number(reportForm.quantity); |
| | | if (total > qty) { |
| | | reportForm.scrapQty = total - qty; |
| | | } else { |
| | | reportForm.scrapQty = null; |
| | | } |
| | | } |
| | | }; |
| | | |
| | |
| | | return res.data.records |
| | | }; |
| | | |
| | | // 原材料领用:drawMaterials(json -> list)与 drawMaterialList(最终提交) |
| | | const parseMaybeJsonList = (val) => { |
| | | if (!val) return []; |
| | | if (Array.isArray(val)) return val; |
| | | if (typeof val === 'string') { |
| | | try { |
| | | const parsed = JSON.parse(val); |
| | | return Array.isArray(parsed) ? parsed : []; |
| | | } catch (e) { |
| | | return []; |
| | | } |
| | | } |
| | | return []; |
| | | }; |
| | | |
| | | const normalizeDrawMaterialItem = (item) => { |
| | | if (!item) return null; |
| | | return { |
| | | ...item, |
| | | reportQty: item.reportQty ?? item.requisitionQty ?? 0, |
| | | remark: item.remark ?? '', |
| | | }; |
| | | }; |
| | | |
| | | const materialKey = (item) => String(item?.id ?? item?.productModelId ?? ''); |
| | | |
| | | const openAddMaterialDialog = () => { |
| | | if (!availableMaterials.value || availableMaterials.value.length === 0) { |
| | | proxy.$modal.msgWarning("当前工单没有可领用的原材料"); |
| | | return; |
| | | } |
| | | selectedAddMaterials.value = []; |
| | | addMaterialDialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleAddMaterialSelectionChange = (selection) => { |
| | | selectedAddMaterials.value = (selection || []).map((x) => normalizeDrawMaterialItem({ ...x })); |
| | | }; |
| | | |
| | | const handleConfirmAddMaterial = () => { |
| | | if (!selectedAddMaterials.value || selectedAddMaterials.value.length === 0) { |
| | | proxy.$modal.msgWarning("请先选择原材料"); |
| | | return; |
| | | } |
| | | |
| | | const existingKeys = new Set((reportForm.drawMaterialList || []).map(materialKey)); |
| | | const newItems = selectedAddMaterials.value |
| | | .filter((it) => !existingKeys.has(materialKey(it))) |
| | | .map(normalizeDrawMaterialItem) |
| | | .filter(Boolean); |
| | | |
| | | if (newItems.length === 0) { |
| | | proxy.$modal.msgWarning("所选原材料已存在,无需重复添加"); |
| | | addMaterialDialogVisible.value = false; |
| | | return; |
| | | } |
| | | |
| | | reportForm.drawMaterialList = [...(reportForm.drawMaterialList || []), ...newItems]; |
| | | addMaterialDialogVisible.value = false; |
| | | }; |
| | | |
| | | const removeDrawMaterialRow = (index) => { |
| | | if (!Array.isArray(reportForm.drawMaterialList)) return; |
| | | reportForm.drawMaterialList.splice(index, 1); |
| | | }; |
| | | |
| | | const processParamList = ref([]) |
| | | const showReportDialog = async row => { |
| | | currentReportRowData.value = row; |
| | |
| | | |
| | | // 获取工序绑定设备列表 |
| | | getDeviceList(row.processId); |
| | | |
| | | // 原材料:可选项来自当前行 drawMaterials(json -> list) |
| | | availableMaterials.value = parseMaybeJsonList(row.drawMaterials); |
| | | |
| | | // 最终领用清单:优先回显 drawMaterialList(若后端已返回);否则为空 |
| | | const existingDrawList = parseMaybeJsonList(row.drawMaterialList); |
| | | reportForm.drawMaterialList = (existingDrawList || []).map(normalizeDrawMaterialItem).filter(Boolean); |
| | | selectedAddMaterials.value = []; |
| | | addMaterialDialogVisible.value = false; |
| | | |
| | | nextTick(() => { |
| | | reportFormRef.value?.clearValidate(); |
| | |
| | | const data = await productionRecordFormRef.value.submitData(); |
| | | console.log("生产记录表单数据:", data); |
| | | reportForm.otherData.rows = data || []; |
| | | // 机台选择由 ProductionRecordForm 的“机台选择”参数决定 |
| | | reportForm.deviceId = getDeviceFromRecordParams(data) ?? reportForm.deviceId; |
| | | } catch (error) { |
| | | console.error("获取生产记录表单数据失败", error); |
| | | return; |
| | |
| | | ...reportForm, |
| | | quantity: quantity, |
| | | scrapQty: scrapQty, |
| | | // drawMaterialList 直接传数组(不做 JSON.stringify) |
| | | drawMaterialList: reportForm.drawMaterialList || [], |
| | | otherData: JSON.stringify(reportForm.otherData) |
| | | }; |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | // 设备选择变化时更新 deviceId |
| | | const handleDeviceChange = deviceId => { |
| | | reportForm.deviceId = deviceId; |
| | | const getDeviceFromRecordParams = (rows) => { |
| | | if (!Array.isArray(rows)) return null; |
| | | const machineRow = rows.find(r => r?.type === '机台选择'); |
| | | return machineRow?.value ?? null; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="UID码:" prop="uidNo"> |
| | | <el-input v-model="form.uidNo" placeholder="请输入" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | |
| | | model: "", |
| | | testStandardId: "", |
| | | unit: "", |
| | | uidNo: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | |
| | | if (selectedModel) { |
| | | form.value.model = selectedModel.model || ''; |
| | | form.value.unit = selectedModel.unit || ''; |
| | | form.value.uidNo = selectedModel.uidNo || ''; |
| | | } |
| | | } |
| | | |
| | |
| | | const getModels = (value) => { |
| | | form.value.productModelId = undefined; |
| | | form.value.unit = undefined; |
| | | form.value.uidNo = undefined; |
| | | modelOptions.value = []; |
| | | currentProductId.value = value |
| | | form.value.productName = findNodeById(productOptions.value, value); |
| | |
| | | const handleChangeModel = (value) => { |
| | | form.value.model = modelOptions.value.find(item => item.id == value)?.model || ''; |
| | | form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || ''; |
| | | form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || ''; |
| | | } |
| | | |
| | | const findNodeById = (nodes, productId) => { |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="UID码:" prop="uidNo"> |
| | | <el-input v-model="form.uidNo" placeholder="请输入" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="单位:" prop="unit"> |
| | | <el-input v-model="form.unit" placeholder="请输入" clearable/> |
| | | <el-input v-model="form.unit" placeholder="请输入" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="请输入" clearable :precision="2"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检验员:" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="请选择" clearable style="width: 100%"> |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="不合格现象:" prop="defectivePhenomena"> |
| | | <el-input v-model="form.defectivePhenomena" placeholder="请输入" clearable/> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="处理人:" prop="dealName"> |
| | | <el-select v-model="form.dealName" placeholder="请选择" clearable style="width: 100%"> |
| | |
| | | productName: "", |
| | | productId: "", |
| | | model: "", |
| | | uidNo: "", |
| | | unit: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | |
| | | checkTime: '', |
| | | productId: '', |
| | | model: '', |
| | | uidNo: '', |
| | | unit: '', |
| | | quantity: '', |
| | | productName: '', |
| | |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const handleChangeModel = (value) => { |
| | | form.value.model = modelOptions.value.find(item => item.id == value)?.model || ''; |
| | | form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || ''; |
| | | form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || ''; |
| | | } |
| | | |
| | | const getProductOptions = () => { |
| | | productTreeList().then((res) => { |
| | | productOptions.value = convertIdToValue(res); |
| | | }); |
| | | }; |
| | | |
| | | const getModels = (value) => { |
| | | form.value.model = undefined; |
| | | form.value.unit = undefined; |
| | | form.value.uidNo = undefined; |
| | | modelOptions.value = []; |
| | | form.value.productName = findNodeById(productOptions.value, value); |
| | | modelList({ id: value }).then((res) => { |
| | | modelOptions.value = res; |
| | | }) |
| | | }; |
| | | |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="UID码:" prop="uidNo"> |
| | | <el-input v-model="form.uidNo" placeholder="请输入" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测单位:" prop="checkCompany"> |
| | | <el-input v-model="form.checkCompany" placeholder="请输入" clearable/> |
| | | </el-form-item> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检验员:" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="请选择" clearable> |
| | |
| | | productId: "", |
| | | productModelId: "", |
| | | model: "", |
| | | uidNo: "", |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | |
| | | model: "", |
| | | testStandardId: "", |
| | | unit: "", |
| | | uidNo: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | |
| | | const getModels = (value) => { |
| | | form.value.productModelId = undefined; |
| | | form.value.unit = undefined; |
| | | form.value.uidNo = undefined; |
| | | modelOptions.value = []; |
| | | currentProductId.value = value |
| | | form.value.productName = findNodeById(productOptions.value, value); |
| | |
| | | const handleChangeModel = (value) => { |
| | | form.value.model = modelOptions.value.find(item => item.id == value)?.model || ''; |
| | | form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || ''; |
| | | form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || ''; |
| | | } |
| | | |
| | | const findNodeById = (nodes, productId) => { |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="UID码:" prop="uidNo"> |
| | | <el-input v-model="form.uidNo" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测单位:" prop="checkCompany"> |
| | | <el-input v-model="form.checkCompany" placeholder="请输入" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测结果:" prop="checkResult"> |
| | | <el-select v-model="form.checkResult"> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检验员:" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="请选择" clearable style="width: 100%"> |
| | |
| | | productId: "", |
| | | productModelId: "", |
| | | model: "", |
| | | uidNo: "", |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | |
| | | productId: "", |
| | | productModelId: "", |
| | | model: "", |
| | | uidNo: "", |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | |
| | | const getModels = (value) => { |
| | | form.value.productModelId = undefined; |
| | | form.value.unit = undefined; |
| | | form.value.uidNo = undefined; |
| | | modelOptions.value = []; |
| | | currentProductId.value = value |
| | | form.value.productName = findNodeById(productOptions.value, value); |
| | |
| | | const handleChangeModel = (value) => { |
| | | form.value.model = modelOptions.value.find(item => item.id == value)?.model || ''; |
| | | form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || ''; |
| | | form.value.uidNo = modelOptions.value.find(item => item.id == value)?.uidNo || ''; |
| | | } |
| | | |
| | | const findNodeById = (nodes, productId) => { |
| | |
| | | }, |
| | | { |
| | | label: "UID码", |
| | | prop: "uidNO", |
| | | prop: "uidNo", |
| | | }, |
| | | { |
| | | label: "单位", |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="UID码:" prop="uidNo"> |
| | | <el-input v-model="productForm.uidNo" placeholder="请输入" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="批号:" prop="batchNo"> |
| | | <el-select v-model="productForm.batchNo" placeholder="请选择" clearable filterable> |
| | | <el-option v-for="item in batchNoOptions" :key="item.value" :label="item.label" :value="item.value" /> |
| | |
| | | productForm: { |
| | | productCategory: "", |
| | | specificationModel: "", |
| | | uidNo: "", |
| | | unit: "", |
| | | quantity: "", |
| | | taxInclusiveUnitPrice: "", |
| | |
| | | if (index !== -1) { |
| | | productForm.value.specificationModel = modelOptions.value[index].model; |
| | | productForm.value.unit = modelOptions.value[index].unit; |
| | | productForm.value.uidNo = modelOptions.value[index].uidNo || ""; |
| | | } else { |
| | | productForm.value.specificationModel = null; |
| | | productForm.value.unit = null; |
| | | productForm.value.uidNo = null; |
| | | } |
| | | }; |
| | | const findNodeById = (nodes, productId) => { |
| | |
| | | // 台账字段 |
| | | productCategory: p.product || p.productName || "", |
| | | specificationModel: p.specification || "", |
| | | uidNo: p.uidNo || "", |
| | | unit: p.unit || "", |
| | | quantity: quantity, |
| | | taxRate: taxRate, |