src/views/inventoryManagement/dispatchLog/Record.vue
@@ -12,6 +12,16 @@
               clearable
               @change="handleQuery"
            />
        <span class="search_title ml10">来源:</span>
        <el-select v-model="searchForm.recordType"
                   style="width: 240px"
                   placeholder="请选择"
                   clearable>
          <el-option v-for="item in stockRecordTypeOptions"
                     :key="item.value"
                     :label="item.label"
                     :value="item.value"/>
        </el-select>
            <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
            >搜索</el-button
            >
@@ -71,6 +81,13 @@
               prop="createBy"
               show-overflow-tooltip
            />
        <el-table-column label="来源"
                         prop="recordType"
                         show-overflow-tooltip>
          <template #default="scope">
            {{ getRecordType(scope.row.recordType) }}
          </template>
        </el-table-column>
         </el-table>
         <pagination
            v-show="total > 0"
@@ -94,12 +111,17 @@
   getStockOutPage,
   delStockOut,
} from "@/api/inventoryManagement/stockOut.js";
import {
  findAllQualifiedStockOutRecordTypeOptions, findAllUnQualifiedStockOutRecordTypeOptions,
} from "@/api/basicData/enum.js";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
// 来源类型选项
const stockRecordTypeOptions = ref([]);
const page = reactive({
   current: 1,
   size: 100,
@@ -107,10 +129,9 @@
const total = ref(0);
const props = defineProps({
  type: {
    type: String,
    required: true,
    default: '0'
  productId: {
    type: [String, Number],
    default: ''
  }
})
@@ -123,26 +144,8 @@
   searchForm: {
      supplierName: "",
      timeStr: "",
   },
   form: {
      supplierId: null,
      supplierName: '',
      productId: null,
      productName: '',
      userId: userStore.userId,
      nickName: '',
      model: '',
      productModelId: null,
      unit: '',
      productrecordId: null,
      taxInclusiveUnitPrice: '',
      taxInclusiveTotalPrice: '',
      taxRate: '',
      taxExclusiveTotalPrice: '',
      inboundTime: '',
      inboundBatch: '',
      inboundQuantity: ''
   },
    recordType: "",
   }
});
const { searchForm } = toRefs(data);
@@ -159,7 +162,7 @@
};
const getList = () => {
   tableLoading.value = true;
   getStockOutPage({ ...searchForm.value, ...page, type: props.type })
   getStockOutPage({ ...searchForm.value, ...page, topParentProductId: props.productId })
      .then((res) => {
         tableLoading.value = false;
         tableData.value = res.data.records;
@@ -172,6 +175,28 @@
         tableLoading.value = false;
      });
};
const getRecordType = (recordType) => {
  return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
}
// 获取来源类型选项
const fetchStockRecordTypeOptions = () => {
  // 同时获取合格和不合格的来源类型选项
  Promise.all([
    findAllQualifiedStockOutRecordTypeOptions(),
    findAllUnQualifiedStockOutRecordTypeOptions()
  ]).then(([qualifiedRes, unQualifiedRes]) => {
    const qualified = qualifiedRes.data || [];
    const unQualified = unQualifiedRes.data || [];
    // 合并并去重
    const allOptions = [...qualified, ...unQualified];
    const uniqueOptions = allOptions.filter((item, index, self) =>
      index === self.findIndex((t) => t.value === item.value)
    );
    stockRecordTypeOptions.value = uniqueOptions;
  });
}
// 表格选择数据
const handleSelectionChange = (selection) => {
@@ -189,7 +214,7 @@
      type: "warning",
   })
      .then(() => {
         proxy.download("/stockmanagement/export", {}, "出库台账.xlsx");
         proxy.download("/stockOutRecord/exportStockOutRecord", { topParentProductId: props.productId }, "出库台账.xlsx");
      })
      .catch(() => {
         proxy.$modal.msg("已取消");
@@ -382,7 +407,6 @@
      <div class="print-page">
        <div class="delivery-note">
          <div class="header">
            <div class="company-name">鼎诚瑞实业有限责任公司</div>
            <div class="document-title">零售发货单</div>
          </div>
          
@@ -394,7 +418,7 @@
              </div>
              <div>
                <span class="label">客户名称:</span>
                <span class="value">${item.supplierName || '张爱有'}</span>
                <span class="value">${item.supplierName}</span>
              </div>
            </div>
            <div class="info-row">
@@ -512,6 +536,7 @@
};
onMounted(() => {
   getList();
  fetchStockRecordTypeOptions();
});
</script>