spring
15 小时以前 fa4ea8dd99638f58da60ac283186113619cc7e6e
src/views/inventoryManagement/receiptManagement/Record.vue
@@ -15,6 +15,16 @@
                  style="width: 240px"
                  placeholder="请输入"
                  clearable/>
        <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">搜索
@@ -66,6 +76,13 @@
        <el-table-column label="入库人"
                         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"
                  :total="total"
@@ -85,13 +102,16 @@
  toRefs,
  onMounted,
  getCurrentInstance,
  nextTick,
} from "vue";
import {ElMessageBox} from "element-plus";
import {
  getStockInRecordListPage,
  batchDeleteStockInRecords,
} from "@/api/inventoryManagement/stockInRecord.js";
import {
  findAllQualifiedStockRecordTypeOptions,
  findAllUnqualifiedStockRecordTypeOptions
} from "@/api/basicData/enum.js";
const {proxy} = getCurrentInstance();
@@ -106,8 +126,8 @@
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
const activeTab = ref("production"); // 当前激活的 tab
// 来源类型选项
const stockRecordTypeOptions = ref([]);
const page = reactive({
  current: 1,
  size: 100,
@@ -118,6 +138,7 @@
  searchForm: {
    productName: "",
    timeStr: "",
    recordType: "",
  },
});
const {searchForm} = toRefs(data);
@@ -127,6 +148,10 @@
  page.current = 1;
  getList();
};
const getRecordType = (recordType) => {
  return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
}
const pageProductChange = obj => {
  page.current = obj.page;
@@ -147,6 +172,21 @@
  })
};
// 获取来源类型选项
const fetchStockRecordTypeOptions = () => {
  if (props.type === '0') {
    findAllQualifiedStockRecordTypeOptions()
        .then(res => {
          stockRecordTypeOptions.value = res.data;
        })
    return
  }
  findAllUnqualifiedStockRecordTypeOptions()
      .then(res => {
        stockRecordTypeOptions.value = res.data;
      })
}
// 表格选择数据
const handleSelectionChange = selection => {
  selectedRows.value = selection.filter(item => item.id);
@@ -164,9 +204,6 @@
      .then(() => {
        // 根据不同的 tab 类型调用不同的导出接口
        let exportUrl = "/stockin/export";
        if (activeTab.value === "production") {
          exportUrl = "/stockin/exportOne";
        }
        proxy.download(exportUrl, {}, "入库台账.xlsx");
      })
      .catch(() => {
@@ -204,6 +241,7 @@
onMounted(() => {
  getList();
  fetchStockRecordTypeOptions();
});
</script>