From 4dc0880780b52c0c35456666a4643a7866b454a7 Mon Sep 17 00:00:00 2001
From: fcx <2246384483@qq.com>
Date: 星期六, 20 十二月 2025 16:00:35 +0800
Subject: [PATCH] 1.产检提交增加日期选择器
---
pages/QC/SJ/ProductionLineSubmit.vue | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 150 insertions(+), 10 deletions(-)
diff --git a/pages/QC/SJ/ProductionLineSubmit.vue b/pages/QC/SJ/ProductionLineSubmit.vue
index f02b3c0..8c5b300 100644
--- a/pages/QC/SJ/ProductionLineSubmit.vue
+++ b/pages/QC/SJ/ProductionLineSubmit.vue
@@ -15,6 +15,40 @@
</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 class="search-input" v-model="searchValue" :placeholder="'璇疯緭鍏�'+options[optionsIndex]"
+ @confirm="handleSearch" />
+ <button class="search-button" @click="handleSearch">鎼滅储</button>
+ </view>
+ </view>
+
+ <!-- 娣诲姞鐘舵�佺瓫閫夊拰鏃ユ湡閫夋嫨鍣紙鏈彁浜ゅ拰宸叉彁浜ら〉闈㈤兘鏄剧ず锛� -->
+ <view class="filter-controls" style="margin-bottom: 5px;">
+ <view class="dropdown-filter">
+ <picker @change="onStateChange" :value="stateIndex" :range="state">
+ <view class="picker">{{state[stateIndex]}}</view>
+ </picker>
+ </view>
+ <view class="dropdown-filter">
+ <picker mode="date" :value="startDate" :end="endDate" @change="bindStartDate">
+ <view class="picker">{{startDate}}</view>
+ </picker>
+ </view>
+ <view class="dropdown-filter">
+ <picker mode="date" :value="endDate" :start="startDate" @change="bindEndDate">
+ <view class="picker">{{endDate}}</view>
+ </picker>
+ </view>
+ </view>
</view>
<!-- 澶撮儴淇℃伅 -->
@@ -89,12 +123,9 @@
<!-- 宸叉彁浜ょ姸鎬佷笅鏄剧ず妫�楠屼俊鎭� -->
<view v-if="currentTab === 1" class="meta-info">
<view class="meta-item">妫�楠屽崟鍙�: {{ item.billNo }}</view>
-
+ <view class="meta-item">妫�楠屼汉: {{ item.statusUser }}</view>
</view>
- <view class="meta-info">
-
- <view class="meta-item">妫�楠屼汉: {{ item.statusUser }}</view>
- </view>
+
<view v-if="currentTab === 1" class="meta-info">
<view class="meta-item">鍒涘缓鏃堕棿: {{ item.createTime }}</view>
<view v-if="item.result" class="meta-item">妫�楠岀姸鎬�: {{ item.result }}</view>
@@ -126,28 +157,72 @@
searchValue: '',
userId: "",
uncheckedCount: 0,
- checkedCount: 0
+ checkedCount: 0,
+ optionsIndex: 0, // 鏂板锛氫笅鎷夐�夐」绱㈠紩
+ options: ['椤圭洰', '绾夸綋', '宸ュ崟鍙�', '鐗╂枡鍙�', '鐗╂枡鍚�'], // 鏂板锛氭悳绱㈤�夐」
+ // 娣诲姞鐘舵�佺瓫閫夊拰鏃ユ湡閫夋嫨鍣ㄧ浉鍏冲彉閲�
+ stateIndex: 0,
+ state: ['鎵�鏈夌姸鎬�', '鍚堟牸', '涓嶅悎鏍�'],
+ startDate: new Date().toISOString().slice(0, 10),
+ endDate: new Date().toISOString().slice(0, 10)
};
},
// 椤甸潰鍔犺浇鏃跺彧鎵ц涓�娆�
async onLoad() {
-
const user = this.$loginInfo;
this.userId = user.account;
console.log("鐢ㄦ埛ID =", this.userId);
+
// 鍒濆鍖栧姞杞芥暟鎹�
await this.init();
},
methods: {
+ // 鏂板锛氭悳绱㈤�夐」鏀瑰彉浜嬩欢
+ onOptionsChange(e) {
+ 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;
+ this.data = [];
+ this.init();
+ },
+
// Tab鍒囨崲
async switchTab(tabIndex) {
if (this.currentTab !== tabIndex) {
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();
}
},
@@ -159,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", // 浜х嚎鎻愪氦鎺ュ彛
@@ -167,9 +255,16 @@
limit: this.limit,
statusUser: userName,
status: this.currentTab, // 0: 鏈彁浜�, 1: 宸叉彁浜�
- searchValue: this.searchValue
+ searchValue: this.searchValue,
+ selectedIndex: this.optionsIndex, // 鏂板锛氫紶閫掓悳绱㈤�夐」绱㈠紩
+ // 娣诲姞鐘舵�佺瓫閫夊拰鏃ユ湡绛涢�夊弬鏁�
+ state: this.state[this.stateIndex],
+ startDate: this.startDate,
+ endDate: this.endDate
}
});
+
+ console.log("API杩斿洖鏁版嵁:", res);
let list = res.data.tbBillList || [];
@@ -181,6 +276,52 @@
list = [...failedItems, ...otherItems];
}
+ // 瀵规墍鏈夐〉闈㈣繘琛屽墠绔瓫閫夛紙鏈彁浜ゅ拰宸叉彁浜わ級
+ // 鐘舵�佺瓫閫�
+ 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 {
@@ -648,5 +789,4 @@
transform: translateY(0);
height: 40px;
opacity: 1;
-}
-</style>
\ No newline at end of file
+}</style>
--
Gitblit v1.9.3