spring
17 小时以前 5f94854ed49ce166eeb0a6651b2a421222bea367
fix: 生产过程中添加批号、供应商
已修改4个文件
138 ■■■■ 文件已修改
src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionReporting/Input.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrder/index.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue
@@ -2,7 +2,7 @@
  <el-dialog
    v-model="visible"
    title="领料"
    width="1000px"
    width="1400px"
    top="3vh"
    :close-on-click-modal="false"
    destroy-on-close
@@ -19,11 +19,8 @@
            <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-column prop="customer" label="供应商" min-width="160" show-overflow-tooltip />
            <el-table-column prop="batchNo" label="批号" min-width="180" show-overflow-tooltip />
            <el-table-column prop="requisitionQty" label="领用数量" width="120" align="center">
              <template #default="{ row }">
                <el-input-number
@@ -61,13 +58,43 @@
    <el-dialog
      v-model="addDialogVisible"
      title="选择原材料"
      width="800px"
      width="1000px"
      top="5vh"
      :close-on-click-modal="false"
      append-to-body
    >
      <div class="material-filter" style="margin-bottom: 20px;">
        <el-select
          v-model="filterSupplier"
          placeholder="供应商"
          clearable
          filterable
          style="width: 220px"
        >
          <el-option
            v-for="opt in supplierFilterOptions"
            :key="opt"
            :label="opt"
            :value="opt"
          />
        </el-select>
        <el-select
          v-model="filterBatchNo"
          placeholder="批号"
          clearable
          filterable
          style="width: 220px; margin-left: 12px"
        >
          <el-option
            v-for="opt in batchFilterOptions"
            :key="opt"
            :label="opt"
            :value="opt"
          />
        </el-select>
      </div>
      <el-table
        :data="availableMaterials"
        :data="filteredMaterials"
        border
        style="width: 100%"
        height="50vh"
@@ -78,6 +105,8 @@
        <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="customer" label="供应商" min-width="160" show-overflow-tooltip />
        <el-table-column prop="batchNo" label="批号" min-width="180" show-overflow-tooltip />
        <!-- <el-table-column prop="qualitity" label="可领用数量" width="100" align="center">
          <template #default="{ row }">
            {{ row.qualitity || 0 }}
@@ -129,6 +158,45 @@
const availableMaterials = ref([]);
const selectedMaterials = ref([]);
// 选择弹窗筛选条件(供应商/批号)
const filterSupplier = ref('');
const filterBatchNo = ref('');
// 将后端可能返回的字段做一下归一化:供应商/批号字段名可能不一致
const normalizeMaterial = (m) => {
  return {
    ...m,
    customer: m.customer ?? m.supplierName ?? '',
    batchNo: m.batchNo ?? m.batchNumber ?? m.batch_number ?? m.lotNo ?? '',
  };
};
const supplierFilterOptions = computed(() => {
  return Array.from(new Set(availableMaterials.value.map((m) => m.customer).filter(Boolean)));
});
const batchFilterOptions = computed(() => {
  const list = filterSupplier.value
    ? availableMaterials.value.filter((m) => m.customer === filterSupplier.value)
    : availableMaterials.value;
  return Array.from(new Set(list.map((m) => m.batchNo).filter(Boolean)));
});
const filteredMaterials = computed(() => {
  return availableMaterials.value.filter((m) => {
    if (filterSupplier.value && m.customer !== filterSupplier.value) return false;
    if (filterBatchNo.value && m.batchNo !== filterBatchNo.value) return false;
    return true;
  });
});
watch(filterSupplier, () => {
  // 如果当前“批号”不属于所选供应商,则清空
  if (filterBatchNo.value && !batchFilterOptions.value.includes(filterBatchNo.value)) {
    filterBatchNo.value = '';
  }
});
// 监听弹框打开,加载数据
watch(() => props.modelValue, (val) => {
  if (val && props.orderData) {
@@ -146,7 +214,7 @@
  if (bomId) {
    try {
      const res = await getMaterials({ bomId });
      materialsFromApi = res.data || [];
      materialsFromApi = (res.data || []).map(normalizeMaterial);
    } catch (error) {
      console.error('查询原材料列表失败:', error);
    }
@@ -164,7 +232,9 @@
        return {
          ...savedItem,
          qualitity: apiItem?.qualitity ?? savedItem.qualitity ?? 0,
          requisitionQty: savedItem.requisitionQty || 0
          requisitionQty: savedItem.requisitionQty || 0,
          customer: savedItem.customer ?? savedItem.supplierName ?? apiItem?.customer ?? '',
          batchNo: savedItem.batchNo ?? savedItem.batchNumber ?? apiItem?.batchNo ?? '',
        };
      });
    } catch (e) {
@@ -190,7 +260,9 @@
    const res = await getMaterials({ bomId });
    console.log('getMaterials返回数据:', res.data);
    // 直接展示所有数据,不过滤
    availableMaterials.value = res.data || [];
    availableMaterials.value = (res.data || []).map(normalizeMaterial);
    filterSupplier.value = '';
    filterBatchNo.value = '';
    selectedMaterials.value = [];
    addDialogVisible.value = true;
  } catch (error) {
@@ -222,7 +294,7 @@
    .map(item => ({
      ...item,
      requisitionQty: 0,
      remark: ''
      remark: '',
    }));
  if (newItems.length === 0) {
src/views/productionManagement/productionOrder/index.vue
@@ -159,6 +159,11 @@
    width: '120px',
  },
  {
    label: "批号",
    prop: "batchNo",
    width: '120px',
  },
  {
    label: "工艺路线编号",
    prop: "processRouteCode",
    width: '200px',
src/views/productionManagement/productionReporting/Input.vue
@@ -71,6 +71,14 @@
    prop: 'uidNo',
  },
  {
    label: '供应商',
    prop: 'customer',
  },
  {
    label: '批号',
    prop: 'batchNo',
  },
  {
    label: '投入数量',
    prop: 'quantity',
  },
src/views/productionManagement/workOrder/index.vue
@@ -173,6 +173,13 @@
               label-width="120px">
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="产品名称">
              <el-input v-model="reportForm.productName"
                        readonly
                        style="width: 300px" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="待生产数量">
              <el-input v-model="reportForm.planQuantity"
                        readonly
@@ -212,18 +219,6 @@
                    @input="handleScrapQtyInput" />
        </el-form-item></el-col>
        <el-col :span="12">
          <el-form-item label="检品数量"
                      prop="inspectedQuantity">
          <el-input v-model.number="reportForm.inspectedQuantity"
                    type="number"
                    min="0"
                    step="1"
                    style="width: 300px"
                    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"
@@ -262,6 +257,8 @@
            <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="customer" label="供应商" min-width="160" show-overflow-tooltip />
            <el-table-column prop="batchNo" label="批号" min-width="180" show-overflow-tooltip />
            <el-table-column prop="reportQty" label="领用数量" width="160" align="center">
              <template #default="{ row }">
                <el-input-number
@@ -300,7 +297,7 @@
    <el-dialog
      v-model="addMaterialDialogVisible"
      title="选择原材料"
      width="1000px"
      width="1400px"
      top="5vh"
      :close-on-click-modal="false"
      append-to-body
@@ -320,6 +317,8 @@
          <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="customer" label="供应商" min-width="160" show-overflow-tooltip />
          <el-table-column prop="batchNo" label="批号" min-width="180" show-overflow-tooltip />
          <el-table-column prop="requisitionQty" label="可领用数量" width="140" align="center" />
        </el-table>
@@ -488,6 +487,8 @@
  const userOptions = ref([]);
  const deviceOptions = ref([]);
  const reportForm = reactive({
    // 报工弹框里“产品名称”只读回显
    productName: "",
    planQuantity: 0,
    totalInvestment: 0,
    quantity: null,
@@ -901,6 +902,8 @@
  const showReportDialog = async row => {
    currentReportRowData.value = row;
    processParamList.value = await getProcessParamList(row)
    // 兼容后端/表格字段命名:优先 row.productName,其次 row.productCategory
    reportForm.productName = row.productName ?? row.productCategory ?? ''
    reportForm.planQuantity = row.planQuantity;
    reportForm.totalInvestment = row.totalInvestment;
    reportForm.quantity =