From 93b04dfa60b2128273cd070269d8eaaeb14e15e8 Mon Sep 17 00:00:00 2001
From: fcx <2246384483@qq.com>
Date: 星期六, 06 十二月 2025 11:47:35 +0800
Subject: [PATCH] 新加首检搜索框

---
 pages/QC/SJ/yzxFrom.vue              |    9 ++
 pages/QC/SJ/List.vue                 |   48 ++++++++---
 pages/QC/SJ/Add.vue                  |   27 ++++++
 pages/QC/SJ/ProductionLineSubmit.vue |  122 +++++++++++++++++++++++++++++-
 4 files changed, 185 insertions(+), 21 deletions(-)

diff --git a/pages/QC/SJ/Add.vue b/pages/QC/SJ/Add.vue
index c237ce7..f5ad192 100644
--- a/pages/QC/SJ/Add.vue
+++ b/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) {
+            // 淇濆瓨褰撳墠鐨剏zxChecked鐘舵��
+            const currentYzxChecked = this.formData.yzxChecked;
             this.formData = tbBillListElement;
+            // 鎭㈠yzxChecked鐘舵�侊紝閬垮厤琚湇鍔″櫒鏁版嵁瑕嗙洊
+            this.formData.yzxChecked = currentYzxChecked;
             this.$post({
               url: "/SJ/getQSItems",
               data: {
diff --git a/pages/QC/SJ/List.vue b/pages/QC/SJ/List.vue
index 9abec1a..00e0167 100644
--- a/pages/QC/SJ/List.vue
+++ b/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();
       }
     },
diff --git a/pages/QC/SJ/ProductionLineSubmit.vue b/pages/QC/SJ/ProductionLineSubmit.vue
index 34d5724..06cd0cb 100644
--- a/pages/QC/SJ/ProductionLineSubmit.vue
+++ b/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>
\ No newline at end of file
+}</style>
diff --git a/pages/QC/SJ/yzxFrom.vue b/pages/QC/SJ/yzxFrom.vue
index 4b0cd2e..285449f 100644
--- a/pages/QC/SJ/yzxFrom.vue
+++ b/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: "鎻愮ず",

--
Gitblit v1.9.3