pan
6 天以前 a7b15461d3dc6d07c18e065fa3a6acd234c2d7c8
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue
@@ -38,6 +38,53 @@
          </el-row>
        </el-alert>
      </div>
      <!-- æ–°å¢žç­›é€‰åŒºåŸŸ -->
      <div class="filter-area" style="margin: 10px 0; padding: 10px; background: #f8f9fa; border-radius: 4px;">
        <el-form :model="filterForm" inline @submit.prevent>
          <el-form-item label="物料编号:">
            <el-input
              v-model="filterForm.materielCode"
              placeholder="模糊筛选物料编号"
              clearable
              style="width: 180px"
              @input="filterTable"
            ></el-input>
          </el-form-item>
          <el-form-item label="物料条码:">
            <el-input
              v-model="filterForm.barcode"
              placeholder="模糊筛选物料条码"
              clearable
              style="width: 180px"
              @input="filterTable"
            ></el-input>
          </el-form-item>
          <el-form-item label="托盘编号:">
            <el-input
              v-model="filterForm.palletCode"
              placeholder="模糊筛选托盘编号"
              clearable
              style="width: 180px"
              @input="filterTable"
            ></el-input>
          </el-form-item>
          <el-form-item label="货位编号:">
            <el-input
              v-model="filterForm.locationCode"
              placeholder="模糊筛选货位编号"
              clearable
              style="width: 180px"
              @input="filterTable"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="filterTable">搜索</el-button>
            <el-button @click="resetFilter">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="box-table" style="margin-top: 1%">
        <el-table
          ref="singleTable"
@@ -134,6 +181,7 @@
      row: null,
      showDetialBox: false, 
      tableData: [],
      originalTableData: [], // æ–°å¢žï¼šå­˜å‚¨åŽŸå§‹æ•°æ®ï¼Œç”¨äºŽç­›é€‰
      tableColumns: [
        { prop: "materielCode", title: "物料编号", type: "string", width: 150 },
        { prop: "barcode", title: "物料条码", type: "string", width: 150 },
@@ -145,6 +193,14 @@
      selectionSum: 0,
      selectionClass: "less-style",
      originalQuantity: 0,
      // æ–°å¢žï¼šç­›é€‰è¡¨å•数据
      filterForm: {
        materielCode: "",
        barcode: "",
        palletCode: "",
        locationCode: ""
      },
      // å‡ºåº“弹窗相关数据
      showOutboundDialog: false,
@@ -201,7 +257,6 @@
      this.$refs.outboundFormRef.validate((valid) => {
        if (!valid) return;
     if (this.selection.length <= 0) {
        return this.$message.error("请勾选");
      }
@@ -233,11 +288,14 @@
        )
        .then((x) => {
          this.tableData = x;
          this.originalTableData = x; // æ–°å¢žï¼šä¿å­˜åŽŸå§‹æ•°æ®
          // åˆ·æ–°åŽæ¸…空之前的选择和计数
          this.clearSelection();
          this.selectionSum = 0;
          this.originalQuantity = 0;
          this.updateSelectionClass();
          // åˆ·æ–°åŽé‡ç½®ç­›é€‰æ¡ä»¶
          this.resetFilter();
        });
    },
@@ -271,9 +329,10 @@
    // æ›´æ–°å·²é€‰æ•°é‡æ ·å¼
    updateSelectionClass() {
      if (!this.row) return;
      if (this.selectionSum === this.row.orderQuantity) {
      // ä¿®å¤ï¼šrow.orderQuantity æ”¹ä¸º row.qty(模板里显示的是row.qty)
      if (this.selectionSum === this.row.qty) {
        this.selectionClass = "equle-style";
      } else if (this.selectionSum < this.row.orderQuantity) {
      } else if (this.selectionSum < this.row.qty) {
        this.selectionClass = "less-style";
      } else {
        this.selectionClass = "more-style";
@@ -298,6 +357,55 @@
    tableButtonClick(row, item) {
      console.log("图标按钮点击:", item.title, row);
    },
    // æ–°å¢žï¼šç­›é€‰è¡¨æ ¼æ•°æ®
    filterTable() {
      if (!this.originalTableData.length) return;
      // è§£æž„筛选条件并转为小写(忽略大小写)
      const { materielCode, barcode, palletCode, locationCode } = this.filterForm;
      const mc = materielCode.toLowerCase().trim();
      const bc = barcode.toLowerCase().trim();
      const pc = palletCode.toLowerCase().trim();
      const lc = locationCode.toLowerCase().trim();
      // æ¨¡ç³Šç­›é€‰é€»è¾‘
      this.tableData = this.originalTableData.filter(item => {
        // æ¯ä¸ªå­—段都做空值处理和小写转换,支持模糊匹配
        const itemMc = (item.materielCode || "").toLowerCase();
        const itemBc = (item.barcode || "").toLowerCase();
        const itemPc = (item.palletCode || "").toLowerCase();
        const itemLc = (item.locationCode || "").toLowerCase();
        return (
          itemMc.includes(mc) &&
          itemBc.includes(bc) &&
          itemPc.includes(pc) &&
          itemLc.includes(lc)
        );
      });
      // ç­›é€‰åŽæ¸…空选择状态
      this.clearSelection();
      this.selectionSum = 0;
      this.updateSelectionClass();
    },
    // æ–°å¢žï¼šé‡ç½®ç­›é€‰æ¡ä»¶
    resetFilter() {
      this.filterForm = {
        materielCode: "",
        barcode: "",
        palletCode: "",
        locationCode: ""
      };
      // æ¢å¤åŽŸå§‹æ•°æ®
      this.tableData = [...this.originalTableData];
      // é‡ç½®é€‰æ‹©çŠ¶æ€
      this.clearSelection();
      this.selectionSum = 0;
      this.updateSelectionClass();
    }
  },
};
</script>
@@ -314,6 +422,12 @@
.more-style {
  color: red;
}
/* ç­›é€‰åŒºåŸŸæ ·å¼ä¼˜åŒ– */
.filter-area :deep(.el-form-item) {
  margin-bottom: 0;
  margin-right: 10px;
}
</style>
<style>