fcx
10 天以前 93b04dfa60b2128273cd070269d8eaaeb14e15e8
新加首检搜索框
已修改4个文件
206 ■■■■ 文件已修改
pages/QC/SJ/Add.vue 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/List.vue 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/ProductionLineSubmit.vue 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/yzxFrom.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/Add.vue
@@ -146,6 +146,7 @@
        statusUser: "",
        itemId: "",
        fSubmit: 0,
        yzxChecked: false, // 添加一致性核对状态字段
      },
      DAA020List: [],
@@ -252,6 +253,22 @@
    },
    submit() {
      // 检查是否已完成一致性核对
      if (this.current && !this.formData.yzxChecked) {
        uni.showModal({
          title: "提示",
          content: "请先完成一致性核对后再提交检验",
          confirmText: "去核对",
          cancelText: "取消",
          success: (res) => {
            if (res.confirm) {
              this.toYzxSubmitFrom(this.formData.billNo);
            }
          }
        });
        return;
      }
      this.$post({
        url: "/SJ/SJQaSubmit",
        data: {
@@ -269,12 +286,14 @@
        if (res.statusCode === 200 || res.status === 0 || res.data === true || res.data.tbBillList === true) {
          this.$showMessage("成功提交检验");
          // 提交成功后跳转到列表页面
          // 提交成功后刷新页面数据
          this.init();
          // 1.5秒后跳转到列表页面
          setTimeout(() => {
            uni.navigateTo({
              url: '/pages/QC/SJ/List'
            });
          }, 1500); // 1.5秒后跳转,让用户看到成功提示
          }, 1500);
        } else {
          this.$showMessage(res.data.message || res.message || "提交失败");
        }
@@ -296,7 +315,11 @@
        }).then(res => {
          let tbBillListElement = res.data.tbBillList[0];
          if (tbBillListElement) {
            // 保存当前的yzxChecked状态
            const currentYzxChecked = this.formData.yzxChecked;
            this.formData = tbBillListElement;
            // 恢复yzxChecked状态,避免被服务器数据覆盖
            this.formData.yzxChecked = currentYzxChecked;
            this.$post({
              url: "/SJ/getQSItems",
              data: {
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>
@@ -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();
      }
    },
pages/QC/SJ/ProductionLineSubmit.vue
@@ -30,6 +30,25 @@
          <button class="search-button" @click="handleSearch">搜索</button>
        </view>
      </view>
      <!-- 添加状态筛选和日期选择器(仅在已提交页面显示) -->
      <view class="filter-controls" style="margin-bottom: 5px;">
        <view class="dropdown-filter" v-if="currentTab === 1">
          <picker @change="onStateChange" :value="stateIndex" :range="state">
            <view class="picker">{{state[stateIndex]}}</view>
          </picker>
        </view>
        <view class="dropdown-filter" v-if="currentTab === 1">
          <picker mode="date" :value="startDate" :end="endDate" @change="bindStartDate">
            <view class="picker">{{startDate}}</view>
          </picker>
        </view>
        <view class="dropdown-filter" v-if="currentTab === 1">
          <picker mode="date" :value="endDate" :start="startDate" @change="bindEndDate">
            <view class="picker">{{endDate}}</view>
          </picker>
        </view>
      </view>
    </view>
    <!-- 头部信息 -->
@@ -140,7 +159,12 @@
      uncheckedCount: 0,
      checkedCount: 0,
      optionsIndex: 0, // 新增:下拉选项索引
      options: ['项目', '线体', '工单号', '物料号', '物料名'] // 新增:搜索选项
      options: ['项目', '线体', '工单号', '物料号', '物料名'], // 新增:搜索选项
      // 添加状态筛选和日期选择器相关变量
      stateIndex: 0,
      state: ['所有状态', '合格', '不合格'],
      startDate: new Date().toISOString().slice(0, 10),
      endDate: new Date().toISOString().slice(0, 10)
    };
  },
@@ -161,6 +185,27 @@
      this.optionsIndex = e.detail.value;
    },
    
    // 新增:状态筛选改变事件
    onStateChange(e) {
      this.pageIndex = 1;
      this.stateIndex = e.detail.value;
      this.data = [];
      console.log("状态筛选改变,选中状态:", this.state[this.stateIndex]);
      this.init();
    },
    // 新增:开始日期改变事件
    bindStartDate(e) {
      this.startDate = e.detail.value;
      console.log("开始日期改变:", this.startDate);
    },
    // 新增:结束日期改变事件
    bindEndDate(e) {
      this.endDate = e.detail.value;
      console.log("结束日期改变:", this.endDate);
    },
    // 新增:搜索按钮点击事件
    handleSearch() {
      this.pageIndex = 1;
@@ -174,6 +219,10 @@
        this.currentTab = tabIndex;
        this.data = [];
        this.pageIndex = 1;
        // 重置筛选条件
        this.stateIndex = 0;
        this.startDate = new Date().toISOString().slice(0, 10);
        this.endDate = new Date().toISOString().slice(0, 10);
        await this.init();
      }
    },
@@ -185,6 +234,19 @@
      const userName = this.$loginInfo.account;
      const result = this.currentTab === 1 ? "已完成" : "未完成";
      // 打印筛选参数
      console.log("筛选参数:", {
        pageIndex: this.pageIndex,
        limit: this.limit,
        statusUser: userName,
        status: this.currentTab,
        searchValue: this.searchValue,
        selectedIndex: this.optionsIndex,
        state: this.state[this.stateIndex],
        startDate: this.startDate,
        endDate: this.endDate
      });
      try {
        const res = await this.$post({
          url: "/ProductionLine/GetProductionLinePage",  // 产线提交接口
@@ -194,9 +256,15 @@
            statusUser: userName,
            status: this.currentTab,  // 0: 未提交, 1: 已提交
            searchValue: this.searchValue,
            selectedIndex: this.optionsIndex // 新增:传递搜索选项索引
            selectedIndex: this.optionsIndex, // 新增:传递搜索选项索引
            // 添加状态筛选和日期筛选参数
            state: this.state[this.stateIndex],
            startDate: this.startDate,
            endDate: this.endDate
          }
        });
        console.log("API返回数据:", res);
        let list = res.data.tbBillList || [];
        
@@ -208,6 +276,53 @@
          list = [...failedItems, ...otherItems];
        }
        
        // 如果是已提交页面,进行前端筛选
        if (this.currentTab === 1) {
          // 状态筛选
          if (this.stateIndex > 0) {
            const selectedState = this.state[this.stateIndex];
            console.log("前端状态筛选:", selectedState);
            if (selectedState === '合格') {
              list = list.filter(item => item.result === '合格');
            } else if (selectedState === '不合格') {
              list = list.filter(item => item.result === '不合格');
            }
          }
          // 日期范围筛选
          if (this.startDate || this.endDate) {
            console.log("前端日期筛选:", this.startDate, "到", this.endDate);
            const startDateObj = this.startDate ? new Date(this.startDate) : null;
            const endDateObj = this.endDate ? new Date(this.endDate) : null;
            // 设置开始日期的时间为当天的开始时间 (00:00:00)
            if (startDateObj) {
              startDateObj.setHours(0, 0, 0, 0);
            }
            // 设置结束日期的时间为当天的结束时间 (23:59:59)
            if (endDateObj) {
              endDateObj.setHours(23, 59, 59, 999);
            }
            list = list.filter(item => {
              if (item.createTime) {
                const itemDate = new Date(item.createTime);
                let isValid = true;
                if (startDateObj && itemDate < startDateObj) {
                  isValid = false;
                }
                if (endDateObj && itemDate > endDateObj) {
                  isValid = false;
                }
                return isValid;
              }
              return true;
            });
          }        }
        if (this.pageIndex === 1) {
          this.data = list;
        } else {
@@ -675,5 +790,4 @@
  transform: translateY(0);
  height: 40px;
  opacity: 1;
}
</style>
}</style>
pages/QC/SJ/yzxFrom.vue
@@ -159,6 +159,15 @@
                  icon: 'success',
                  duration: 2000
                })
                // 保存成功后更新父页面状态
                const pages = getCurrentPages();
                if (pages.length > 1) {
                  const prevPage = pages[pages.length - 2]; // 上一个页面
                  if (prevPage && prevPage.$vm) {
                    // 更新父页面的一致性核对状态
                    prevPage.$vm.formData.yzxChecked = true;
                  }
                }
            }else{
                uni.showModal({
                    title: "提示",