xwt
2025-10-30 4a9c0f7ddb5eae77b1f833bd2223e33fe6bb2918
pages/QC/XJ/List.vue
@@ -6,13 +6,26 @@
    <!-- 顶部筛选区 -->
    <view class="filter-section">
      <view class="filter-controls">
        <!-- 查询条件选择器 -->
        <view class="dropdown-filter">
          <picker @change="onOptionsChange" :value="optionsIndex" :range="options">
            <view class="picker">{{options[optionsIndex]}}</view>
          </picker>
        </view>
        <!-- 搜索框 -->
        <view class="search-container">
          <input class="search-input" v-model="searchValue" :placeholder="'请输入'+options[optionsIndex]" @confirm="btnclicked" />
          <button class="search-button" @click="btnclicked">搜索</button>
        </view>
        <!-- 状态切换标签 -->
        <view class="status-tabs">
          <button :class="['tab-button', current === 0 ? 'active' : '']" @click="onClickItem({currentIndex: 0})">
            {{items[0]}}
            未提交({{unsubmittedCount}})
          </button>
          <button :class="['tab-button', current === 1 ? 'active' : '']" @click="onClickItem({currentIndex: 1})">
            {{items[1]}}
            已提交({{submittedCount}})
          </button>
        </view>
      </view>
@@ -98,7 +111,15 @@
      items: ['未提交', '已提交'],
      current: 0,
      data: [],
      tipShow: false // 是否显示顶部提示框
      tipShow: false, // 是否显示顶部提示框
      searchValue: '',
      // ===== 新增搜索功能相关数据 =====
      optionsIndex: 0, // 当前选择的查询条件索引
      options: ['工单', '检验单号', '产线', '物料编码', '物料名称'], // 查询条件选项
      selectedField: 'billNo', // 当前选择的查询字段,默认为工单
      // ===== 新增数量统计变量 =====
      unsubmittedCount: 0, // 未提交数量
      submittedCount: 0 // 已提交数量
    };
  },
  onLoad() {
@@ -106,12 +127,37 @@
    this.init();
  },
  methods: {
    // ===== 新增查询条件选择方法 =====
    onOptionsChange(e) {
      this.optionsIndex = e.detail.value;
      // 根据选择的选项设置搜索字段
      const fieldMap = {
        0: 'billNo',     // 工单
        1: 'releaseNo',  // 检验单号
        2: 'daa020',     // 产线
        3: 'itemNo',     // 物料编码
        4: 'itemName'    // 物料名称
      };
      this.selectedField = fieldMap[this.optionsIndex];
    },
    //搜索框点击事件
    btnclicked() {
      this.init();
    },
    init() {
      //获取搜索条件内容
      let SearchValue = this.searchValue;
      let result = "未完成";
      if (this.current === 1) {
        result = "已完成";
      }
      // 获取车间和线体筛选条件
      const departmentId = uni.getStorageSync('qc_filter_departmentId') || '';
      const lineId = uni.getStorageSync('qc_filter_lineId') || '';
      //页面加载时调用的事件
      this.$post({
@@ -120,10 +166,21 @@
          pageIndex: 1,
          limit: 20,
          createUser: this.$loginInfo.account,
          result: result
          result: result,
          SearchValue: SearchValue,
          selectedIndex: this.optionsIndex, // 新增:搜索条件索引
          searchField: this.selectedField,  // 新增:搜索字段名
          departmentId: departmentId,       // 新增:车间ID
          lineId: lineId                     // 新增:线体ID
        }
      }).then(res => {
        this.data = res.data.tbBillList;
        // 设置数量统计
        if (this.current === 1) {
          this.submittedCount = res.totalCount;
        } else {
          this.unsubmittedCount = res.totalCount;
        }
      })
    },
    handleFabClick() {
@@ -142,6 +199,7 @@
        url: 'Add?id=' + item.id + '&releaseNo=' + item.releaseNo
      });
    },
  },
  /**
   * 下拉刷新回调函数
@@ -185,8 +243,51 @@
.filter-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
/* 查询条件选择器 */
.dropdown-filter {
  min-width: 80px;
  margin-right: 10px;
}
.picker {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
  min-width: 80px;
}
/* 搜索框样式 */
.search-container {
  display: flex;
  flex: 1;
  margin-right: 10px;
  height: 36px;
  min-width: 200px;
}
.search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  font-size: 14px;
  background-color: white;
}
.search-button {
  padding: 0 12px;
  border: 1px solid #3498db;
  border-radius: 0 4px 4px 0;
  background-color: #3498db;
  color: white;
  font-size: 14px;
  margin: 0;
}
.status-tabs {
@@ -194,7 +295,8 @@
  border-radius: 4px;
  overflow: hidden;
  background-color: #ecf0f1;
  width: 300px;
  flex: 1;
  min-width: 200px;
}
.tab-button {
@@ -335,6 +437,11 @@
  border-color: #2980b9;
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.plus-button {
  position: fixed;
  bottom: 20px;