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/List.vue | 400 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 281 insertions(+), 119 deletions(-)
diff --git a/pages/QC/SJ/List.vue b/pages/QC/SJ/List.vue
index 6a25c8b..c6feaed 100644
--- a/pages/QC/SJ/List.vue
+++ b/pages/QC/SJ/List.vue
@@ -11,16 +11,47 @@
@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>
+
+ <!-- 鏈彁浜ら〉闈㈡樉绀烘椂闂存棩鏈熸枃鏈紝宸叉彁浜ら〉闈㈡樉绀虹姸鎬佺瓫閫� -->
+ <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>
@@ -38,12 +69,12 @@
<view :class="{
'status-pending': !item.result && current === 0,
'status-assigned': current === 0 && item.statusUser && !item.result,
- 'status-pass': item.result === '鍚堟牸',
- 'status-fail': item.result === '涓嶅悎鏍�',
+ 'status-pass': item.result === '鍚堟牸'&& current === 1,
+ 'status-fail': item.result === '涓嶅悎鏍�'&& current === 1,
'status-submitted': !item.result && current === 1
}"
class="status">
- {{ current === 0 ? (item.result ? item.result : '鏈彁浜�') : (item.result ? item.result : '宸叉彁浜�') }}
+ {{ current === 0 ? ('' ? item.result : '鏈彁浜�') : (item.result ? item.result : '宸叉彁浜�') }}
</view>
</view>
@@ -57,31 +88,53 @@
<view class="info-row">
<view class="info-item">
+ <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.daa018 }}</view>
+ </view>
+ <view class="info-item">
+ <view class="info-label">榻愬鐘舵��</view>
+ <view class="info-content">{{ item.daA019 }}</view>
+ </view>
+ </view>
+ <view class="info-row">
+ <view class="info-item">
<view class="info-label">浜х嚎</view>
<view class="info-content">{{ item.line }}</view>
</view>
<view class="info-item">
- <view class="info-label">宸ュ崟鏁伴噺</view>
- <view class="info-content highlight">{{ item.daa008 }}</view>
+ <view class="info-label">宸ュ崟鍙�</view>
+ <view class="info-content">{{ item.daa001 }}</view>
</view>
+ <view class="info-item">
+ <view class="info-label">宸ュ崟鏁�</view>
+ <view class="info-content highlight">{{ item.daa008 }}</view>
+ </view>
</view>
-
<view class="info-row">
- <view class="info-item">
- <view class="info-label">鍒涘缓浜�</view>
+ <!-- <view class="info-item">
+ <view class="info-label">鍒涘缓浜�1</view>
<view class="info-content">{{ item.fName }}</view>
- </view>
- <view v-if="item.statusUser" class="info-item">
+ </view> -->
+ <!-- <view v-if="item.statusUser" class="info-item">
<view class="info-label">妫�楠屼汉</view>
<view class="info-content">{{ item.statusUser }}</view>
- </view>
+ </view> -->
</view>
<!-- 鍦ㄦ湭瀹屾垚鐘舵�佷笅鏄剧ず鍒涘缓鏃堕棿锛屽凡瀹屾垚鐘舵�佷笅鏄剧ず妫�娴嬬粨鏋� -->
<view v-if="current === 0" class="meta-info">
- <view class="meta-item">{{ item.statusDate }}</view>
+
<view class="meta-item">鍒涘缓浜�: {{ item.fName }}</view>
+ <view class="meta-item">妫�楠屼汉: {{ item.statusUser }}</view>
</view>
+
+ <view v-if="current === 0" class="meta-info">
+ <view class="meta-item">鍒涘缓鏃堕棿: {{ item.createTime }}</view>
+ </view>
<view v-if="current === 1" class="meta-info">
<view class="meta-item">{{ item.statusDate }}</view>
@@ -90,7 +143,9 @@
</view>
<view class="card-actions">
- <button class="primary">{{ current === 0 ? '缁х画妫�楠�' : '鏌ョ湅璇︽儏' }}</button>
+ <button v-if="current === 0 && IQCJL==1"
+ @click.stop="assignTask(item)">{{item.statusUser == null ? '鍒嗛厤' : '閲嶆柊鍒嗛厤'}}</button>
+ <button class="primary">{{ current === 0 ? '寮�濮嬫楠�' : '鏌ョ湅璇︽儏' }}</button>
</view>
</view>
</view>
@@ -104,7 +159,6 @@
<script>
export default {
- components: {},
data() {
return {
items: ['鏈畬鎴�', '宸插畬鎴�'],
@@ -114,133 +168,241 @@
limit: 20,
totalPage: 0,
totalCount: 0,
- noData: false, // 娌℃湁鏇村鏁版嵁浜�
- isLoading: false, // 鏄惁姝e湪鍔犺浇
- tipShow: false, // 鏄惁鏄剧ず椤堕儴鎻愮ず妗�
+ noData: false,
+ isLoading: false,
+ tipShow: false,
searchValue: '',
uncheckedCount: 0,
- checkedCount: '宸插畬鎴�'
+ checkedCount: 0,
+ IQCJL: 0, // IQC 妫�楠屽憳鏍囪瘑
+ userId:"",
+ optionsIndex: 0, // 鏂板锛氫笅鎷夐�夐」绱㈠紩
+ options: ['椤圭洰', '绾夸綋', '宸ュ崟鍙�', '鐗╂枡鍙�', '鐗╂枡鍚�'], // 鏂板锛氭悳绱㈤�夐」
+ // 娣诲姞鐘舵�佺瓫閫夊拰鏃ユ湡閫夋嫨鍣ㄧ浉鍏冲彉閲�
+ stateIndex: 0,
+ state: ['鎵�鏈夌姸鎬�', '鍚堟牸', '涓嶅悎鏍�'],
+ startDate: new Date().toISOString().slice(0, 10),
+ endDate: new Date().toISOString().slice(0, 10)
};
},
- onLoad() {
- //椤甸潰鍔犺浇鏃惰皟鐢ㄧ殑浜嬩欢
- this.init();
+
+ // 椤甸潰鍔犺浇鏃跺彧鎵ц涓�娆�
+ async onLoad() {
+ // 鍒ゆ柇褰撳墠鐧诲綍浜烘槸鍚︿负IQC妫�楠屽憳鎴栫壒瀹氳处鍙�
+ const user = this.$loginInfo;
+ this.userId=user.account;
+ if (user.roleid && user.roleid.indexOf("90134") !== -1 || user.account === "PL017") {
+ this.IQCJL = 1;
+ } else {
+ this.IQCJL = 0;
+ }
+
+ console.log("IQC妫�楠屽憳鏍囪瘑 IQCJL =", this.IQCJL);
+
+ // 鍒濆鍖栧姞杞芥暟鎹�
+ await this.init();
},
+
+ // 姣忔椤甸潰閲嶆柊鏄剧ず鏃惰Е鍙戯紙杩斿洖椤甸潰涔熶細瑙﹀彂锛�
+ onShow() {
+ console.log("onShow 瑙﹀彂锛孖QCJL =", this.IQCJL);
+ // 閬垮厤閲嶅鍔犺浇锛氬彧鍦ㄧ涓�娆℃垨鏁版嵁涓虹┖鏃堕噸鏂板姞杞�
+ if (this.data.length === 0) {
+ this.pageIndex = 1;
+ this.init();
+ }
+ },
+
methods: {
- init() {
- let result = "鏈畬鎴�";
- if (this.current === 1) {
- result = "宸插畬鎴�";
- }
-
- if (this.isLoading) return; // 濡傛灉姝e湪鍔犺浇鍒欎笉缁х画鎵ц
-
- this.isLoading = true;
-
- //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴�
- let userName = this.$loginInfo.account;
-
- //椤甸潰鍔犺浇鏃惰皟鐢ㄧ殑浜嬩欢
- this.$post({
- url: "/SJ/GetPage",
- data: {
- pageIndex: this.pageIndex,
- limit: this.limit,
- statusUser: userName,
- result: result,
- searchValue: this.searchValue
- }
- }).then(res => {
- if (this.pageIndex === 1) {
- // 濡傛灉鏄涓�椤碉紝鐩存帴瑕嗙洊鍘熸暟鎹�
- this.data = res.data.tbBillList;
- } else {
- if (res.data.tbBillList.length > 0) {
- // 濡傛灉鏄笅涓�椤碉紝杩藉姞鏂版暟鎹�
- this.data = [...this.data, ...res.data.tbBillList];
- }
- }
- this.totalCount = res.totalCount;
- this.totalPage = Math.ceil(this.totalCount / this.limit);
-
- this.noData = this.pageIndex >= this.totalPage;
- this.isLoading = false; // 缁撴潫鍔犺浇
-
- // 鏇存柊璁℃暟
- if (this.current === 1) {
- this.checkedCount = '宸插畬鎴愶紙' + this.totalCount + '锛�';
- } else {
- this.uncheckedCount = this.totalCount;
- }
- }).catch(() => {
- this.isLoading = false; // 鍑虹幇閿欒鏃剁粨鏉熷姞杞�
- });
+ // 鏂板锛氭悳绱㈤�夐」鏀瑰彉浜嬩欢
+ onOptionsChange(e) {
+ this.optionsIndex = e.detail.value;
},
- handleFabClick() {
- uni.navigateTo({
- url: 'Add?id'
- });
+
+ // 鏂板锛氱姸鎬佺瓫閫夋敼鍙樹簨浠�
+ onStateChange(e) {
+ this.pageIndex = 1;
+ this.stateIndex = e.detail.value;
+ this.data = [];
+ console.log("鐘舵�佺瓫閫夋敼鍙橈紝閫変腑鐘舵��:", this.state[this.stateIndex]);
+ this.init();
},
- onClickItem(index) {
- if (this.current !== index.currentIndex) {
- this.current = index.currentIndex;
- this.data = [];
- this.pageIndex = 1;
- 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();
+ },
+
+ // 鏂板锛氭悳绱㈡寜閽偣鍑讳簨浠�
handleSearch() {
this.pageIndex = 1;
this.data = [];
this.init();
},
+
+ async init() {
+ let result = this.current === 1 ? "宸插畬鎴�" : "鏈畬鎴�";
+ if (this.isLoading) return;
+
+ this.isLoading = true;
+ const userName = this.$loginInfo.account;
+
+ try {
+ const res = await this.$post({
+ url: "/SJ/GetPage",
+ data: {
+ pageIndex: this.pageIndex,
+ limit: this.limit,
+ statusUser: userName,
+ result: result,
+ searchValue: this.searchValue,
+ selectedIndex: this.optionsIndex // 鏂板锛氫紶閫掓悳绱㈤�夐」绱㈠紩
+ }
+ });
+
+ let list = res.data.tbBillList || [];
+
+ // 瀵规墍鏈夐〉闈㈣繘琛屽墠绔瓫閫夛紙鏈畬鎴愬拰宸叉彁浜わ級
+ // 鐘舵�佺瓫閫�
+ 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 {
+ this.data.push(...list);
+ }
+
+ this.totalCount = res.totalCount;
+ this.totalPage = Math.ceil(this.totalCount / this.limit);
+ this.noData = this.pageIndex >= this.totalPage;
+
+ if (this.current === 1) {
+ this.checkedCount = this.totalCount;
+ } else {
+ this.uncheckedCount = this.totalCount;
+ }
+
+ } catch (e) {
+ console.error("鍔犺浇妫�楠屽崟鏁版嵁澶辫触:", e);
+ } finally {
+ this.isLoading = false;
+ }
+ },
+
+ // Tab 鍒囨崲
+ onClickItem(index) {
+ if (this.current !== index.currentIndex) {
+ this.current = index.currentIndex;
+ this.data = [];
+ this.pageIndex = 1;
+ // 閲嶇疆绛涢�夋潯浠�
+ this.optionsIndex = 0;
+ this.searchValue = '';
+ 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 + '&billNo=' + item.billNo+
- '¤t=B'
- });
- }else{
- uni.navigateTo({
- url: 'Add?id=' + item.id + '&billNo=' + item.billNo+
- '¤t=A'
- });
- }
-
+ const type = this.current === 1 ? "B" : "A";
+ uni.navigateTo({
+ url: `Add?id=${item.id}&billNo=${item.billNo}¤t=${type}`
+ });
+ },
+ assignTask(item) {
+ console.log(item);
+ // 杩欓噷鍙互娣诲姞鍒嗛厤浠诲姟鐨勯�昏緫
+ uni.navigateTo({
+ url: 'UpdateCheckBy?releaseNo=' + item.billNo + '&userID=' + this.userId +
+ '&staffName=' + item.statusUser
+ });
+ },
+ // 娣诲姞鎸夐挳
+ handleFabClick() {
+ uni.navigateTo({
+ url: 'Add?id'
+ });
}
},
- /**
- * 涓嬫媺鍒锋柊鍥炶皟鍑芥暟
- */
+
+ // 涓嬫媺鍒锋柊
onPullDownRefresh() {
this.pageIndex = 1;
- //閲嶆柊鎵ц涓�閬嶆煡璇�
- this.init();
- this.tipShow = true;
- //鍏抽棴鍔ㄧ敾
- uni.stopPullDownRefresh();
-
- setTimeout(() => {
- this.tipShow = false;
- }, 3000);
+ this.init().then(() => {
+ this.tipShow = true;
+ uni.stopPullDownRefresh();
+ setTimeout(() => (this.tipShow = false), 3000);
+ });
},
- /**
- * 涓婃媺鍔犺浇鍥炶皟鍑芥暟
- */
+
+ // 涓婃媺鍔犺浇鏇村
onReachBottom() {
if (this.noData || this.isLoading) return;
this.pageIndex++;
- this.init(); // 鍔犺浇鏇村鏁版嵁
- },
- onShow() {
- //姣忔杩涘叆椤甸潰閮戒細鎵ц鐨勬柟娉�
- this.pageIndex = 1;
- this.data = [];
- //this.current = 0
this.init();
}
};
</script>
+
<style scoped>
/* 鍩虹鏍峰紡閲嶇疆 */
@@ -475,7 +637,7 @@
}
.status-fail {
- background: linear-gradient(135deg, #3498db, #2980b9);
+ background: linear-gradient(135deg, #ff0000, #ff0000);
color: white;
}
--
Gitblit v1.9.3