zjh
2025-05-13 9e263d85631bb44574ca6750a101ad9ce96cab98
pages/QC/LLJ/List.vue
@@ -2,13 +2,23 @@
   <view class="inspection-app">
      <!-- 顶部筛选区 -->
      <view class="filter-section">
         <view class="filter-controls">
            <view class="dropdown-filter">
               <picker @change="onProjectChange" :value="projectIndex" :range="projects">
                  <view class="picker">{{projects[projectIndex]}}</view>
               </picker>
            </view>
         <view class="filter-controls" style="margin-bottom: 5px;">
         <view class="status-tabs">
            <button :class="['tab-button', activeTab === 0 ? 'active' : '']"
               @click="switchTab(0)">未检验({{uncheckedCount}})</button>
            <button :class="['tab-button', activeTab === 1 ? 'active' : '']"
               @click="switchTab(1)">{{checkedCount}}</button>
         </view>
         </view>
         <view class="filter-controls" style="margin-bottom: 5px;">
         <view class="dropdown-filter">
            <picker @change="onProjectChange" :value="projectIndex" :range="projects">
               <view class="picker">{{projects[projectIndex]}}</view>
            </picker>
         </view>
            <view class="dropdown-filter">
               <picker @change="onOptionsChange" :value="optionsIndex" :range="options">
                  <view class="picker">{{options[optionsIndex]}}</view>
@@ -21,14 +31,31 @@
               <button class="search-button" @click="handleSearch">搜索</button>
            </view>
            <view class="status-tabs">
               <button :class="['tab-button', activeTab === 0 ? 'active' : '']"
                  @click="switchTab(0)">未检验({{uncheckedCount}})</button>
               <button :class="['tab-button', activeTab === 1 ? 'active' : '']"
                  @click="switchTab(1)">{{checkedCount}}</button>
            </view>
         </view>
      </view>
      <view class="filter-controls" style="margin-bottom: 5px;">
         <view class="dropdown-filter" v-if="activeTab==1">
            <picker @change="onStateChange" :value="stateIndex" :range="state">
               <view class="picker">{{state[stateIndex]}}</view>
            </picker>
         </view>
         <view class="dropdown-filter" v-if="activeTab==1">
            <picker mode="date" :value="startDate" :end="endDate" @change="bindStartDate">
               <view class="picker">{{startDate}}</view>
            </picker>
         </view>
         <view class="dropdown-filter" v-if="activeTab==1">
            <picker mode="date" :value="endDate" :start="startDate" @change="bindEndDate">
               <view class="picker">{{endDate}}</view>
            </picker>
         </view>
      </view>
      <!-- 检验单列表 -->
@@ -88,11 +115,18 @@
                  </view>
               </view>
               <view class="meta-info">
               <view class="meta-info" v-if="item.activeTab==0">
                  <text class="meta-item"><uni-icons type="calendar" size="14" color="#95a5a6"></uni-icons>
                     {{item.createDate}}</text>
                  <text class="meta-item"><uni-icons type="person" size="14" color="#95a5a6"></uni-icons>
                     {{item.userName}}</text>
               </view>
               <!-- 查看时显示检验完成的数据 -->
               <view class="meta-info" v-if="item.activeTab==1">
                  <text class="meta-item"><uni-icons type="calendar" size="14" color="#95a5a6"></uni-icons>
                     {{item.date01}}</text>
                  <text class="meta-item"><uni-icons type="person" size="14" color="#95a5a6"></uni-icons>
                     {{item.fcheckBy}}</text>
               </view>
            </view>
@@ -113,7 +147,9 @@
         return {
            projectIndex: 0,
            optionsIndex: 0,
            stateIndex: 0,
            projects: ['当前', '全部'],
            state:['所有状态','合格','不合格'],
            activeTab: 0, // 0-未检验, 1-已检验
            uncheckedCount: 0,
            checkedCount: '已检验',
@@ -122,13 +158,18 @@
            limit: 20,
            IQCJL: 0,
            options: ['项目', '物料编号', '物料名称', '供应商', '采购员'],
            searchValue: ''
            searchValue: '',
            startDate:new Date().toISOString().slice(0, 10),
            endDate:new Date().toISOString().slice(0, 10),
         }
      },
      onLoad() {
         //页面加载时调用的事件
         this.init();
      },
      methods: {
         //搜索
@@ -144,8 +185,14 @@
            };
            this.selectedField = fieldMap[this.optionsIndex];
         },
         onStateChange(e) {
            this.pageIndex=1;
            this.stateIndex = e.detail.value;
            this.init();
         },
         //搜索按钮点击事件
         handleSearch() {
            this.pageIndex=1;
            this.init();
         },
         init() {
@@ -173,7 +220,10 @@
                  result: result,
                  SearchValue: this.searchValue,
                  selectedIndex: this.optionsIndex, //下拉框筛选条件
                  userIndex: this.projectIndex
                  userIndex: this.projectIndex,
                  startDate:this.startDate,
                  endDate:this.endDate,
                  state:this.state[this.stateIndex]
               }
            }).then(res => {
               if (this.pageIndex === 1) {
@@ -197,7 +247,7 @@
                  }
               }
               console.log(this.inspectionList)
               //console.log(this.inspectionList)
               this.totalCount = res.data.totalCount;
               this.totalPage = Math.ceil(this.totalCount / this.limit);
@@ -229,6 +279,13 @@
            //   icon: 'none'
            // })
         },
         bindEndDate(e){
            this.endDate=e.detail.value
            console.log(e.detail.value)
         },
         bindStartDate(e){
            this.startDate=e.detail.value
         },
         switchTab(index) {
            this.activeTab = index
@@ -318,7 +375,7 @@
   /* 顶部筛选区 */
   .filter-section {
      margin-bottom: 24px;
      /* margin-bottom: 24px; */
   }
   .filter-section h1 {
@@ -372,7 +429,7 @@
   .filter-controls {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      gap: 5px;
   }
   .dropdown-filter {