From 4a9c0f7ddb5eae77b1f833bd2223e33fe6bb2918 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期四, 30 十月 2025 12:41:24 +0800
Subject: [PATCH] XJ,SJ,RKJ序号排序,LLJ单个检验项目FTP附件

---
 pages/BasePages/main.vue |  363 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 360 insertions(+), 3 deletions(-)

diff --git a/pages/BasePages/main.vue b/pages/BasePages/main.vue
index 1557079..d8eaf1a 100644
--- a/pages/BasePages/main.vue
+++ b/pages/BasePages/main.vue
@@ -1,7 +1,7 @@
 <template>
 	<uni-base-page :footer="false">
 		<view slot="page">
-			<view v-if="loginInfo.hasLogin">
+			<view v-if="loginInfo.hasLogin" class="main-container">
 				<!-- 鏁欏瑙嗛銆佸叕鍙稿唴閮ㄥ浼犲浘鐗囩瓑 -->
 				<!--        <swiper indicator-dots="true" :autoplay="true" :interval="3000">-->
 				<!--          <swiper-item v-for="(img,key) in imgUrls" :key="key">-->
@@ -10,6 +10,51 @@
 				<!--        </swiper>-->
 				<!-- 閫氭姤鎵硅瘎銆佹秷鎭璀︺�佸叕鍛娿�佹姤鍛� -->
 				<uni-notice-bar :show-icon="true" :scrollable="true" :speed="30" :single="true" :text="msg" />
+				
+				<!-- 绛涢�夋寜閽� -->
+				<view class="filter-btn" @click="toggleFilter">
+					<uni-icons type="funnel-fill" size="20" color="#fff"></uni-icons>
+					<text class="filter-btn-text">绛涢��</text>
+					<view v-if="selectedDepartmentId || selectedLineId" class="filter-badge"></view>
+				</view>
+				
+				<!-- 绛涢�夊脊鍑哄眰 -->
+				<view v-if="showFilter" class="filter-overlay" @click="closeFilter">
+					<view class="filter-panel" @click.stop>
+						<view class="filter-header">
+							<text class="filter-title">绛涢�夋潯浠�</text>
+							<view class="close-icon" @click="closeFilter">
+								<uni-icons type="close" size="20" color="#666"></uni-icons>
+							</view>
+						</view>
+						
+						<view class="filter-content">
+							<view class="filter-row">
+								<text class="filter-label">杞﹂棿</text>
+								<picker @change="onDepartmentChange" :value="departmentIndex" :range="departments" range-key="departmentname" class="filter-picker">
+									<view class="picker-text">
+										{{departmentIndex >= 0 ? departments[departmentIndex].departmentname : '璇烽�夋嫨杞﹂棿'}}
+									</view>
+								</picker>
+							</view>
+							
+							<view class="filter-row">
+								<text class="filter-label">绾夸綋</text>
+								<picker @change="onLineChange" :value="lineIndex" :range="lines" range-key="lineName" :disabled="!selectedDepartmentId" class="filter-picker">
+									<view class="picker-text" :class="{'disabled': !selectedDepartmentId}">
+										{{lineIndex >= 0 ? lines[lineIndex].lineName : selectedDepartmentId ? '璇烽�夋嫨绾夸綋' : '璇峰厛閫夋嫨杞﹂棿'}}
+									</view>
+								</picker>
+							</view>
+						</view>
+						
+						<view class="filter-footer">
+							<button class="reset-btn" @click="clearFilters">娓呯┖</button>
+							<button class="confirm-btn" @click="closeFilter">纭畾</button>
+						</view>
+					</view>
+				</view>
+				
 				<!-- 鐢ㄦ埛绯荤粺鑿滃崟妯″潡 -->
 				<view class="example-body">
 					<uni-grid :column="col" :showBorder="false">
@@ -54,11 +99,153 @@
 				],
 				col: 4, //鑿滃崟鍒楁暟
 				msg: "瀹佹尝骞挎繁绉戞妧鏈夐檺鍏徃",
-				updateChecked: false
-
+				updateChecked: false,
+				// 杞﹂棿鍜岀嚎浣撶瓫閫夌浉鍏虫暟鎹�
+				departments: [],
+				departmentIndex: -1,
+				selectedDepartmentId: '',
+				lines: [],
+				lineIndex: -1,
+				selectedLineId: '',
+				showFilter: false // 鎺у埗绛涢�夐潰鏉挎樉绀�
 			};
 		},
 		methods: {
+			// 鍒囨崲绛涢�夐潰鏉挎樉绀�
+			toggleFilter() {
+				this.showFilter = !this.showFilter;
+			},
+			
+			// 鍏抽棴绛涢�夐潰鏉�
+			closeFilter() {
+				this.showFilter = false;
+			},
+			
+			// 鑾峰彇杞﹂棿鍒楄〃
+			getDepartments() {
+				this.$post({
+					url: "/Base/GetQCDepartments",
+					data: {}
+				}).then(res => {
+					this.departments = res.data || [];
+					// 浠庣紦瀛樹腑鎭㈠閫夋嫨
+					const cachedDeptId = uni.getStorageSync('qc_filter_departmentId');
+					if (cachedDeptId && this.departments.length > 0) {
+						const index = this.departments.findIndex(d => d.departmentid == cachedDeptId);
+						if (index >= 0) {
+							this.departmentIndex = index;
+							this.selectedDepartmentId = cachedDeptId;
+							this.getLines();
+						}
+					}
+				}).catch(err => {
+					console.error('鑾峰彇杞﹂棿鍒楄〃澶辫触:', err);
+				});
+			},
+			
+			// 鑾峰彇绾夸綋鍒楄〃锛堟牴鎹溅闂磋繃婊わ級
+			getLines() {
+				if (!this.selectedDepartmentId) {
+					this.lines = [];
+					return;
+				}
+				
+				this.$post({
+					url: "/Base/GetQCLines",
+					data: {
+						departmentId: this.selectedDepartmentId
+					}
+				}).then(res => {
+					this.lines = res.data || [];
+					// 浠庣紦瀛樹腑鎭㈠閫夋嫨
+					const cachedLineId = uni.getStorageSync('qc_filter_lineId');
+					if (cachedLineId && this.lines.length > 0) {
+						const index = this.lines.findIndex(l => l.lineNo == cachedLineId);
+						if (index >= 0) {
+							this.lineIndex = index;
+							this.selectedLineId = cachedLineId;
+						} else {
+							// 濡傛灉缂撳瓨鐨勭嚎浣撲笉鍦ㄥ綋鍓嶈溅闂翠笅锛屾竻闄ょ嚎浣撻�夋嫨
+							this.lineIndex = -1;
+							this.selectedLineId = '';
+							uni.removeStorageSync('qc_filter_lineId');
+							uni.removeStorageSync('qc_filter_lineName');
+						}
+					}
+				}).catch(err => {
+					console.error('鑾峰彇绾夸綋鍒楄〃澶辫触:', err);
+				});
+			},
+			
+			// 杞﹂棿閫夋嫨鏀瑰彉
+			onDepartmentChange(e) {
+				const index = parseInt(e.detail.value);
+				this.departmentIndex = index;
+				
+				if (index >= 0 && this.departments[index]) {
+					this.selectedDepartmentId = this.departments[index].departmentid;
+					const departmentName = this.departments[index].departmentname;
+					
+					// 淇濆瓨鍒扮紦瀛�
+					uni.setStorageSync('qc_filter_departmentId', this.selectedDepartmentId);
+					uni.setStorageSync('qc_filter_departmentName', departmentName);
+					
+					// 娓呴櫎绾夸綋閫夋嫨
+					this.lineIndex = -1;
+					this.selectedLineId = '';
+					uni.removeStorageSync('qc_filter_lineId');
+					uni.removeStorageSync('qc_filter_lineName');
+					
+					// 鍔犺浇璇ヨ溅闂翠笅鐨勭嚎浣�
+					this.getLines();
+					
+					uni.showToast({
+						title: `宸查�夋嫨杞﹂棿锛�${departmentName}`,
+						icon: 'none'
+					});
+				}
+			},
+			
+			// 绾夸綋閫夋嫨鏀瑰彉
+			onLineChange(e) {
+				const index = parseInt(e.detail.value);
+				this.lineIndex = index;
+				
+				if (index >= 0 && this.lines[index]) {
+					this.selectedLineId = this.lines[index].lineNo;
+					const lineName = this.lines[index].lineName;
+					
+					// 淇濆瓨鍒扮紦瀛�
+					uni.setStorageSync('qc_filter_lineId', this.selectedLineId);
+					uni.setStorageSync('qc_filter_lineName', lineName);
+					
+					uni.showToast({
+						title: `宸查�夋嫨绾夸綋锛�${lineName}`,
+						icon: 'none'
+					});
+				}
+			},
+			
+			// 娓呯┖绛涢�夋潯浠�
+			clearFilters() {
+				this.departmentIndex = -1;
+				this.selectedDepartmentId = '';
+				this.lineIndex = -1;
+				this.selectedLineId = '';
+				this.lines = [];
+				
+				// 娓呴櫎缂撳瓨
+				uni.removeStorageSync('qc_filter_departmentId');
+				uni.removeStorageSync('qc_filter_departmentName');
+				uni.removeStorageSync('qc_filter_lineId');
+				uni.removeStorageSync('qc_filter_lineName');
+				
+				uni.showToast({
+					title: '宸叉竻绌虹瓫閫夋潯浠�',
+					icon: 'success'
+				});
+			},
+			
 			getMenu(isShowMask) {
 				if (isShowMask) uni.showLoading({
 					mask: true,
@@ -199,12 +386,26 @@
 				
 				this.getMenu(true);
 				this.checkForUpdate();
+				this.getDepartments(); // 鍔犺浇杞﹂棿鍒楄〃
 			}
 
 
 		},
 		onShow() {
 			// this.getIsMsg();
+			// 姣忔鏄剧ず椤甸潰鏃舵仮澶嶇瓫閫夋潯浠舵樉绀�
+			if (this.loginInfo.hasLogin && this.departments.length === 0) {
+				this.getDepartments();
+			}
+			// 妫�鏌ョ紦瀛樼殑绛涢�夋潯浠讹紝濡傛灉涓嶅瓨鍦ㄥ垯閲嶇疆UI鐘舵��
+			const cachedDeptId = uni.getStorageSync('qc_filter_departmentId');
+			if (!cachedDeptId) {
+				this.departmentIndex = -1;
+				this.selectedDepartmentId = '';
+				this.lineIndex = -1;
+				this.selectedLineId = '';
+				this.lines = [];
+			}
 		},
 		onPullDownRefresh() {
 			if (this.loginInfo.hasLogin)
@@ -268,4 +469,160 @@
 		flex-direction: row;
 		justify-content: flex-start;
 	}
+	
+	.main-container {
+		position: relative;
+	}
+	
+	/* 绛涢�夋寜閽牱寮� */
+	.filter-btn {
+		position: fixed;
+		top: 20rpx;
+		right: 20rpx;
+		z-index: 1000;
+		display: flex;
+		align-items: center;
+		gap: 8rpx;
+		padding: 12rpx 24rpx;
+		background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+		border-radius: 50rpx;
+		box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.4);
+	}
+	
+	.filter-btn-text {
+		font-size: 24rpx;
+		color: #fff;
+		font-weight: 600;
+	}
+	
+	.filter-badge {
+		position: absolute;
+		top: 4rpx;
+		right: 4rpx;
+		width: 16rpx;
+		height: 16rpx;
+		background-color: #ff4757;
+		border-radius: 50%;
+		border: 2rpx solid #fff;
+	}
+	
+	/* 绛涢�夊脊鍑哄眰 */
+	.filter-overlay {
+		position: fixed;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+		background-color: rgba(0, 0, 0, 0.5);
+		z-index: 999;
+		display: flex;
+		align-items: flex-start;
+		justify-content: flex-end;
+		padding: 80rpx 20rpx 20rpx 20rpx;
+	}
+	
+	.filter-panel {
+		width: 500rpx;
+		max-width: 90%;
+		background-color: #fff;
+		border-radius: 16rpx;
+		box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.2);
+		animation: slideIn 0.3s ease-out;
+	}
+	
+	@keyframes slideIn {
+		from {
+			transform: translateX(100%);
+			opacity: 0;
+		}
+		to {
+			transform: translateX(0);
+			opacity: 1;
+		}
+	}
+	
+	.filter-header {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		padding: 24rpx 28rpx;
+		border-bottom: 1rpx solid #f0f0f0;
+	}
+	
+	.filter-title {
+		font-size: 32rpx;
+		font-weight: 700;
+		color: #333;
+	}
+	
+	.close-icon {
+		padding: 8rpx;
+	}
+	
+	.filter-content {
+		padding: 32rpx 28rpx;
+	}
+	
+	.filter-row {
+		margin-bottom: 32rpx;
+	}
+	
+	.filter-row:last-child {
+		margin-bottom: 0;
+	}
+	
+	.filter-label {
+		display: block;
+		font-size: 28rpx;
+		color: #666;
+		margin-bottom: 16rpx;
+		font-weight: 600;
+	}
+	
+	.filter-picker {
+		width: 100%;
+	}
+	
+	.picker-text {
+		padding: 20rpx 24rpx;
+		background-color: #f8f9ff;
+		border-radius: 12rpx;
+		border: 2rpx solid #e0e5ff;
+		font-size: 28rpx;
+		color: #333;
+		text-align: left;
+	}
+	
+	.picker-text.disabled {
+		background-color: #f5f5f5;
+		color: #999;
+		border-color: #e5e5e5;
+	}
+	
+	.filter-footer {
+		display: flex;
+		gap: 16rpx;
+		padding: 24rpx 28rpx;
+		border-top: 1rpx solid #f0f0f0;
+	}
+	
+	.reset-btn,
+	.confirm-btn {
+		flex: 1;
+		padding: 20rpx;
+		border-radius: 12rpx;
+		font-size: 28rpx;
+		font-weight: 600;
+		border: none;
+	}
+	
+	.reset-btn {
+		background-color: #f5f5f5;
+		color: #666;
+	}
+	
+	.confirm-btn {
+		background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+		color: #fff;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3