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/XJ/List.vue | 253 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 225 insertions(+), 28 deletions(-)
diff --git a/pages/QC/XJ/List.vue b/pages/QC/XJ/List.vue
index 4a165a2..081e9bb 100644
--- a/pages/QC/XJ/List.vue
+++ b/pages/QC/XJ/List.vue
@@ -17,10 +17,40 @@
</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="璇疯緭鍏ユ楠屽崟鍙锋垨鐗╂枡缂栫爜"
+ <input v-model="searchValue" class="search-input" :placeholder="'璇疯緭鍏�'+options[optionsIndex]"
@confirm="handleSearch"/>
<button class="search-button" @click="handleSearch">鎼滅储</button>
+ </view>
+ </view>
+
+ <!-- 鏈彁浜ら〉闈㈡樉绀烘椂闂存棩鏈熸枃鏈紝宸叉彁浜ら〉闈㈡樉绀虹姸鎬佺瓫閫� -->
+ <view class="filter-controls" style="margin-bottom: 5px;">
+ <!-- 鏈彁浜ら〉闈細鏄剧ず鏃堕棿鏃ユ湡鏂囨湰 -->
+ <view v-if="current === 0" class="dropdown-filter">
+ <view class="picker">鏃堕棿鏃ユ湡</view>
+ </view>
+ <!-- 宸叉彁浜ら〉闈細鏄剧ず鐘舵�佷笅鎷夋 -->
+ <view v-if="current === 1" 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>
@@ -31,6 +61,7 @@
<view v-for="item in data" :key="item.id" class="inspection-card"
@click="navigateToDetail(item)">
<view class="card-header">
+ <text class="badge urgent" v-if="item.isTimeout">瓒呮椂</text>
<view class="card-title">妫�楠屽崟鍙�: {{ item.releaseNo }}</view>
<view :class="{'status-pending': current === 0, 'status-pass': current === 1 && item.fcheckResu === '鍚堟牸', 'status-fail': current === 1 && item.fcheckResu === '涓嶅悎鏍�'}"
class="status">
@@ -48,8 +79,19 @@
<view class="info-row">
<view class="info-item">
- <view class="info-label">浜х嚎</view>
+ <view class="info-label">椤圭洰</view>
+ <view class="info-content">{{ item.projecT_CODE }}</view>
+ </view>
+ <view class="info-item">
+ <view class="info-label">绾垮埆</view>
<view class="info-content">{{ item.daa020 }}</view>
+ </view>
+ </view>
+
+ <view class="info-row">
+ <view class="info-item">
+ <view class="info-label">宸ュ崟鍙�</view>
+ <view class="info-content">{{ item.billNo }}</view>
</view>
<view class="info-item">
<view class="info-label">宸ュ崟鏁伴噺</view>
@@ -105,7 +147,14 @@
tipShow: false, // 鏄惁鏄剧ず椤堕儴鎻愮ず妗�
searchValue: '',
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)
};
},
onLoad() {
@@ -117,6 +166,64 @@
this.pageIndex = 1;
this.data = [];
this.init();
+ },
+
+ // 鏂板锛氭悳绱㈤�夐」鏀瑰彉浜嬩欢
+ 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;
+ this.pageIndex = 1;
+ this.data = [];
+ console.log("寮�濮嬫棩鏈熸敼鍙�:", this.startDate);
+ this.init();
+ },
+
+ // 鏂板锛氱粨鏉熸棩鏈熸敼鍙樹簨浠�
+ bindEndDate(e) {
+ this.endDate = e.detail.value;
+ this.pageIndex = 1;
+ this.data = [];
+ console.log("缁撴潫鏃ユ湡鏀瑰彉:", this.endDate);
+ this.init();
+ },
+ // 璁$畻鏄惁瓒呮椂鐨勬柟娉�
+ checkIfTimeout(createDate) {
+ if (!createDate) return false;
+
+ // 灏� createDate 杞崲涓� Date 瀵硅薄
+ let createTime = new Date(createDate);
+ let currentTime = new Date();
+
+ // 璁$畻鏃堕棿宸紙姣锛�
+ let timeDiff = currentTime.getTime() - createTime.getTime();
+
+ // 杞崲涓哄皬鏃�
+ let hoursDiff = timeDiff / (1000 * 60 * 60);
+
+ // 濡傛灉澶т簬1灏忔椂锛岃繑鍥瀟rue琛ㄧず瓒呮椂
+ return hoursDiff > 1;
+ },
+
+ // 澶勭悊鏁版嵁骞舵坊鍔犺秴鏃舵爣璇�
+ processDataWithTimeoutCheck(dataList) {
+ return dataList.map(item => {
+ // 娣诲姞瓒呮椂鏍囪瘑
+ item.isTimeout = this.checkIfTimeout(item.createDate);
+ return item;
+ });
},
init() {
let result = "鏈畬鎴�";
@@ -139,16 +246,67 @@
limit: this.limit,
createUser: userName,
result: result,
- searchValue: this.searchValue
+ searchValue: this.searchValue,
+ selectedIndex: this.optionsIndex // 鏂板锛氫紶閫掓悳绱㈤�夐」绱㈠紩
}
}).then(res => {
+ // 澶勭悊鏁版嵁骞舵坊鍔犺秴鏃舵爣璇�
+ let processedData = this.processDataWithTimeoutCheck(res.data.tbBillList);
+
+ // 瀵规墍鏈夐〉闈㈣繘琛屽墠绔瓫閫夛紙鏈彁浜ゅ拰宸叉彁浜わ級
+ // 鐘舵�佺瓫閫�
+ if (this.stateIndex > 0) {
+ const selectedState = this.state[this.stateIndex];
+ console.log("鍓嶇鐘舵�佺瓫閫�:", selectedState);
+ if (selectedState === '鍚堟牸') {
+ processedData = processedData.filter(item => item.fcheckResu === '鍚堟牸');
+ } else if (selectedState === '涓嶅悎鏍�') {
+ processedData = processedData.filter(item => item.fcheckResu === '涓嶅悎鏍�');
+ }
+ }
+
+ // 鏃ユ湡鑼冨洿绛涢��
+ 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);
+ }
+
+ processedData = processedData.filter(item => {
+ if (item.createDate) {
+ const itemDate = new Date(item.createDate);
+ 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 = res.data.tbBillList;
+ this.data = processedData;
} else {
- if (res.data.tbBillList.length > 0) {
+ if (processedData.length > 0) {
// 濡傛灉鏄笅涓�椤碉紝杩藉姞鏂版暟鎹�
- this.data = [...this.data, ...res.data.tbBillList];
+ this.data = [...this.data, ...processedData];
}
}
this.totalCount = res.totalCount;
@@ -169,7 +327,7 @@
},
handleFabClick() {
uni.navigateTo({
- url: 'Add?id'
+ url: 'Add?current=A'
});
},
onClickItem(index) {
@@ -177,13 +335,27 @@
this.current = index.currentIndex;
this.data = [];
this.pageIndex = 1;
+ // 閲嶇疆绛涢�夋潯浠�
+ this.searchValue = '';
+ this.optionsIndex = 0;
+ this.stateIndex = 0;
+ this.startDate = new Date().toISOString().slice(0, 10);
+ this.endDate = new Date().toISOString().slice(0, 10);
this.init();
}
},
navigateToDetail(item) {
+ if (this.current === 1) {
uni.navigateTo({
- url: 'Add?id=' + item.id + '&releaseNo=' + item.releaseNo
+ url: 'Add?id=' + item.id + '&releaseNo=' + item.releaseNo+
+ '¤t=B'
});
+ }else{
+ uni.navigateTo({
+ url: 'Add?id=' + item.id + '&releaseNo=' + item.releaseNo+
+ '¤t=A'
+ });
+ }
}
},
/**
@@ -276,6 +448,19 @@
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 {
display: flex;
border-radius: 4px;
@@ -338,6 +523,18 @@
flex: 1;
margin: 0 8px;
color: #2c3e50;
+}
+
+.badge {
+ font-size: 12px;
+ padding: 2px 6px;
+ border-radius: 10px;
+ margin-right: 8px;
+}
+
+.badge.urgent {
+ background-color: #e74c3c;
+ color: white;
}
.status {
@@ -474,6 +671,25 @@
transform: translateY(0);
}
+/* 鍒锋柊鎻愮ず鏍峰紡 */
+.tips {
+ color: #67c23a;
+ font-size: 14px;
+ line-height: 40px;
+ text-align: center;
+ background-color: #f0f9eb;
+ height: 0;
+ opacity: 0;
+ transform: translateY(-100%);
+ transition: all 0.3s;
+}
+
+.tips-ani {
+ transform: translateY(0);
+ height: 40px;
+ opacity: 1;
+}
+
/* 鍝嶅簲寮忚璁� */
@media (min-width: 768px) {
.inspection-list {
@@ -495,24 +711,5 @@
.info-row {
flex-direction: row;
}
-}
-
-/* 鍒锋柊鎻愮ず鏍峰紡 */
-.tips {
- color: #67c23a;
- font-size: 14px;
- line-height: 40px;
- text-align: center;
- background-color: #f0f9eb;
- height: 0;
- opacity: 0;
- transform: translateY(-100%);
- transition: all 0.3s;
-}
-
-.tips-ani {
- transform: translateY(0);
- height: 40px;
- opacity: 1;
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3