xwt
2025-09-18 688505dded0a49ee685abcb980bd0dc521df4241
pages/QC/XJ/List.vue
@@ -15,8 +15,18 @@
      </view>
      
      <view class="filter-controls" style="margin-bottom: 5px;">
        <view class="dropdown-filter">
          <picker @change="onLineChange" :value="lineIndex" :range="lineOptions">
            <view class="picker">{{lineOptions[lineIndex]}}</view>
          </picker>
        </view>
        <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="请输入检验单号或物料编码"
          <input class="search-input" v-model="searchValue" :placeholder="'请输入'+options[optionsIndex]"
            @confirm="handleSearch" />
          <button class="search-button" @click="handleSearch">搜索</button>
        </view>
@@ -30,8 +40,8 @@
            @click="navigateToDetail(item)">
        <view class="card-header">
          <view class="card-title">检验单号: {{item.releaseNo}}</view>
          <view class="status" :class="{'status-pending': current === 0, 'status-pass': current === 1 && item.fcheckResu === '合格', 'status-fail': current === 1 && item.fcheckResu === '不合格'}">
            {{current === 0 ? '未提交' : (item.fcheckResu ? item.fcheckResu : '已提交')}}
          <view class="status" :class="{'status-pending': item.fsubmit === 0 || item.fsubmit == null, 'status-pass': item.fsubmit === 1 && item.fcheckResu === '合格', 'status-fail': item.fsubmit === 1 && item.fcheckResu === '不合格'}">
            {{(item.fsubmit === 0 || item.fsubmit == null) ? '未提交' : (item.fcheckResu ? item.fcheckResu : '已提交')}}
          </view>
        </view>
@@ -73,15 +83,12 @@
        </view>
        <view class="card-actions">
          <button class="primary">{{current === 0 ? '继续检验' : '查看详情'}}</button>
          <button class="primary">{{(item.fsubmit === 0 || item.fsubmit == null) ? '继续检验' : '查看详情'}}</button>
        </view>
      </view>
    </view>
    <!-- 添加按钮 -->
    <view class="plus-button" @click="handleFabClick" v-if="current === 0">
      <view class="plus-icon">+</view>
    </view>
    <!-- 添加按钮 - 已隐藏 -->
  </view>
</template>
@@ -102,46 +109,91 @@
      tipShow: false, // 是否显示顶部提示框
      searchValue: '',
      uncheckedCount: 0,
      checkedCount: 0
      checkedCount: '已完成',
      optionsIndex: 0,
      options: ['物料编号', '物料名称', '检验单号'],
      lineIndex: 0,
      lineOptions: ['全部产线'],
      lineData: []
    };
  },
  onLoad() {
    //页面加载时调用的事件
    this.loadLineData();
    this.init();
  },
  methods: {
    //加载产线数据
    loadLineData() {
      this.$post({
        url: "/XJ/getLineAll",
        data: {}
      }).then(res => {
        if (res.data && res.data.tbBillList) {
          this.lineData = res.data.tbBillList;
          this.lineOptions = ['全部产线', ...res.data.tbBillList.map(item => item.lineName)];
        }
      }).catch(error => {
        console.error('加载产线数据失败:', error);
      });
    },
    //产线选择变化
    onLineChange(e) {
      this.lineIndex = e.detail.value;
      this.pageIndex = 1;
      this.data = [];
      this.init();
    },
    //搜索选项变化
    onOptionsChange(e) {
      this.optionsIndex = e.detail.value;
      // 根据选择的选项设置搜索字段
      const fieldMap = {
        0: 'itemNo', // 物料编号
        1: 'itemName', // 物料名称
        2: 'releaseNo' // 检验单号
      };
      this.selectedField = fieldMap[this.optionsIndex];
    },
    handleSearch() {
      this.pageIndex = 1;
      this.data = [];
      this.init();
    },
    init() {
      let result = "未完成";
      if (this.current === 1) {
        result = "已完成";
      let fsubmit = null;
      if (this.current === 0) {
        fsubmit = 0; // 未提交
      } else if (this.current === 1) {
        fsubmit = 1; // 已提交
      }
      
      if (this.isLoading) return; // 如果正在加载则不继续执行
      
      this.isLoading = true;
      
      //获取当前登录的用户
      let userName = this.$loginInfo.account;
      //页面加载时调用的事件
      //页面加载时调用的事件 - 取消用户权限控制和产线过滤,所有人都可以看到所有表单
      this.$post({
        url: "/XJ/GetPage",
        data: {
          pageIndex: this.pageIndex,
          limit: this.limit,
          createUser: userName,
          result: result,
          searchValue: this.searchValue
          fsubmit: fsubmit,
          searchValue: this.searchValue,
          SelectedIndex: this.optionsIndex
        }
      }).then(res => {
        console.log('API响应数据:', res);
        console.log('当前标签页:', this.current, 'FSUBMIT参数:', fsubmit);
        if (this.pageIndex === 1) {
          // 如果是第一页,直接覆盖原数据
          this.data = res.data.tbBillList;
          console.log('加载的数据:', this.data);
          // 打印每条数据的FSUBMIT状态
          this.data.forEach((item, index) => {
            console.log(`数据${index}: ID=${item.id}, FSUBMIT=${item.fsubmit}, FcheckResu=${item.fcheckResu}`);
          });
        } else {
          if (res.data.tbBillList.length > 0) {
            // 如果是下一页,追加新数据
@@ -154,9 +206,9 @@
        this.noData = this.pageIndex >= this.totalPage;
        this.isLoading = false; // 结束加载
        
        // 更新计数
        // 更新计数 - 参考SJ的实现方式
        if (this.current === 1) {
          this.checkedCount = this.totalCount;
          this.checkedCount = '已完成(' + this.totalCount + ')';
        } else {
          this.uncheckedCount = this.totalCount;
        }
@@ -225,7 +277,7 @@
/* 顶部筛选区 */
.filter-section {
  /* margin-bottom: 24px; */
  margin-bottom: 0;
}
/* 搜索框样式 */
@@ -271,6 +323,19 @@
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.dropdown-filter {
  min-width: 70px;
}
.picker {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
  min-width: 120px;
}
.status-tabs {
@@ -443,33 +508,6 @@
  transform: translateY(0);
}
/* 添加按钮样式 */
.plus-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: #ffffff;
  text-align: center;
  line-height: 59px;
  font-size: 24px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
  transition: all 0.3s ease;
}
.plus-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(52, 152, 219, 0.5);
}
.plus-button:active {
  transform: translateY(0);
}
/* 响应式设计 */
@media (min-width: 768px) {