fcx
2025-12-06 93b04dfa60b2128273cd070269d8eaaeb14e15e8
pages/QC/SJ/List.vue
@@ -11,15 +11,22 @@
                  @click="onClickItem({currentIndex: 0})">未完成({{ uncheckedCount }})
          </button>
          <button :class="['tab-button', current === 1 ? 'active' : '']"
                  @click="onClickItem({currentIndex: 1})">{{ checkedCount }}
                  @click="onClickItem({currentIndex: 1})">已提交({{ checkedCount }})
          </button>
        </view>
      </view>
      <!-- 添加搜索筛选区域 -->
      <view class="filter-controls" style="margin-bottom: 5px;">
        <view class="dropdown-filter">
          <picker @change="onOptionsChange" :value="optionsIndex" :range="options">
            <view class="picker">{{options[optionsIndex]}}</view>
          </picker>
        </view>
        <!-- 搜索框和按钮 -->
        <view class="search-container">
          <input v-model="searchValue" class="search-input" placeholder="请输入检验单号或物料编码"
                 @confirm="handleSearch"/>
          <input class="search-input" v-model="searchValue" :placeholder="'请输入'+options[optionsIndex]"
                 @confirm="handleSearch" />
          <button class="search-button" @click="handleSearch">搜索</button>
        </view>
      </view>
@@ -38,12 +45,12 @@
          <view :class="{
                  'status-pending': !item.result && current === 0,
                  'status-assigned': current === 0 && item.statusUser && !item.result,
                  'status-pass': item.result === '合格',
                  'status-fail': item.result === '不合格',
                  'status-pass': item.result === '合格'&& current === 1,
                  'status-fail': item.result === '不合格'&& current === 1,
                  'status-submitted': !item.result && current === 1
                }"
                class="status">
            {{ current === 0 ? (item.result ? item.result : '未提交') : (item.result ? item.result : '已提交') }}
            {{ current === 0 ? ('' ? item.result : '未提交') : (item.result ? item.result : '已提交') }}
          </view>
        </view>
@@ -142,9 +149,11 @@
      tipShow: false,
      searchValue: '',
      uncheckedCount: 0,
      checkedCount: '已完成',
      checkedCount: 0,
      IQCJL: 0, // IQC 检验员标识
     userId:""
     userId:"",
      optionsIndex: 0, // 新增:下拉选项索引
      options: ['项目', '线体', '工单号', '物料号', '物料名'] // 新增:搜索选项
    };
  },
@@ -176,6 +185,18 @@
  },
  methods: {
    // 新增:搜索选项改变事件
    onOptionsChange(e) {
      this.optionsIndex = e.detail.value;
    },
    // 新增:搜索按钮点击事件
    handleSearch() {
      this.pageIndex = 1;
      this.data = [];
      this.init();
    },
    async init() {
      let result = this.current === 1 ? "已完成" : "未完成";
      if (this.isLoading) return;
@@ -191,7 +212,8 @@
            limit: this.limit,
            statusUser: userName,
            result: result,
            searchValue: this.searchValue
            searchValue: this.searchValue,
            selectedIndex: this.optionsIndex // 新增:传递搜索选项索引
          }
        });
@@ -207,7 +229,7 @@
        this.noData = this.pageIndex >= this.totalPage;
        if (this.current === 1) {
          this.checkedCount = '已完成(' + this.totalCount + ')';
          this.checkedCount = this.totalCount;
        } else {
          this.uncheckedCount = this.totalCount;
        }
@@ -219,19 +241,15 @@
      }
    },
    // 搜索
    handleSearch() {
      this.pageIndex = 1;
      this.data = [];
      this.init();
    },
    // Tab 切换
    onClickItem(index) {
      if (this.current !== index.currentIndex) {
        this.current = index.currentIndex;
        this.data = [];
        this.pageIndex = 1;
        // 重置筛选条件
        this.optionsIndex = 0;
        this.searchValue = '';
        this.init();
      }
    },
@@ -512,7 +530,7 @@
}
.status-fail {
  background: linear-gradient(135deg, #3498db, #2980b9);
  background: linear-gradient(135deg, #ff0000, #ff0000);
  color: white;
}