From 0c3ea5f8246b22ad945e4086a9507c30d6245a8b Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期三, 03 九月 2025 14:57:14 +0800 Subject: [PATCH] 来料检排序,巡检FTP附件 --- pages/QC/LLJ/List.vue | 183 ++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 163 insertions(+), 20 deletions(-) diff --git a/pages/QC/LLJ/List.vue b/pages/QC/LLJ/List.vue index 41f45ce..b4ad25c 100644 --- a/pages/QC/LLJ/List.vue +++ b/pages/QC/LLJ/List.vue @@ -16,7 +16,7 @@ </view> <!-- 鏂板鎼滅储妗嗗拰鎸夐挳 --> <view class="search-container"> - <input class="search-input" v-model="searchValue" :placeholder="'璇疯緭鍏�'+options[optionsIndex]" + <input class="search-input" v-model="searchValue" :placeholder="optionsIndex === 0 ? '閫夋嫨椤圭洰鏃舵樉绀哄叏閮ㄦ暟鎹�' : '璇疯緭鍏�'+options[optionsIndex]" @confirm="handleSearch" /> <button class="search-button" @click="handleSearch">鎼滅储</button> </view> @@ -30,7 +30,6 @@ </view> </view> - <!-- 妫�楠屽崟鍒楄〃 --> <view class="inspection-list"> <!-- 妫�楠屽崟鍗$墖1 --> @@ -38,10 +37,19 @@ <view class="card-header"> <text class="badge urgent" v-if="item.urgentFlag == 1">鎬ユ枡</text> <text class="badge urgent" v-if="item.jycs == 1">瓒呮椂</text> + <text class="badge normal" v-if="item.ftype == 1">濮斿</text> <text class="badge normal" v-if="item.first == 1">棣栨鏉ユ枡</text> <text class="card-title">妫�楠屽崟鍙�: {{item.releaseNo}}</text> - <text class="status pending" v-if="item.userName==null && item.activeTab==0">寰呭垎閰�</text> + <view v-if="item.userName == null && item.activeTab == 0"> + <text class="status pending" :class="{ + 'emergency-pending': item.lotNo1 === '绱ф�ユ斁琛岋紝璇峰嬁楠岄��!', + 'unmaintained-not-emergency': isUnmaintainedAndNotEmergency(item) + }"> + {{ item.lotNo1 === '绱ф�ユ斁琛岋紝璇峰嬁楠岄��!' ? '绱ф�ユ斁琛�/' + getStatusText(item) : getStatusText(item) }} + </text> + + </view> <text class="status assigned" v-if="item.userName!=null && item.activeTab==0">宸插垎閰�</text> <text class="status pass" v-if="item.fcheckResu=='鍚堟牸' && item.activeTab==1">鍚堟牸</text> <text class="status Unqualified" v-if="item.fcheckResu=='涓嶅悎鏍�' && item.activeTab==1">涓嶅悎鏍�</text> @@ -60,7 +68,7 @@ <view class="info-row"> <view class="info-item"> <text class="info-label">椤圭洰</text> - <text class="info-content">{{item.projectCodes}}</text> + <text class="info-content">{{item.DEPARTMENTNAME}}</text> </view> <view class="info-item" v-if="item.extendNo1!=null"> <text class="info-label">鎶�鏀圭姸鎬�</text> @@ -70,6 +78,10 @@ <text class="info-label">鏁伴噺</text> <text class="info-content highlight">{{item.fcovertQty}}</text> </view> + <view class="info-item" v-if="item.jyxm !== null && item.jyxm !== undefined"> + <text class="info-label">妫�楠岄」鐩�</text> + <text class="info-content">{{item.jyxm}}</text> + </view> </view> <view class="info-row"> <view class="info-item"> @@ -78,10 +90,7 @@ </view> </view> <view class="info-row"> - <view class="info-item" v-if="item.newFngDesc!=null"> - <text class="info-label">涓婃涓嶈壇鎻忚堪</text> - <text class="info-content">{{item.newFngDesc}}</text> - </view> + <view class="info-item" v-if="item.fngDesc!=null"> <text class="info-label">涓嶈壇鎻忚堪</text> <text class="info-content">{{item.fngDesc}}</text> @@ -112,7 +121,7 @@ data() { return { projectIndex: 0, - optionsIndex: 0, + optionsIndex: 1, // 榛樿閫夋嫨鐗╂枡缂栧彿 projects: ['褰撳墠', '鍏ㄩ儴'], activeTab: 0, // 0-鏈楠�, 1-宸叉楠� uncheckedCount: 0, @@ -121,31 +130,52 @@ pageIndex: 1, limit: 20, IQCJL: 0, - options: ['椤圭洰', '鐗╂枡缂栧彿', '鐗╂枡鍚嶇О', '渚涘簲鍟�', '閲囪喘鍛�'], + options: ['椤圭洰', '鐗╂枡缂栧彿', '鐗╂枡鍚嶇О', '渚涘簲鍟�', '鍒拌揣鍗曞彿','妫�楠屽崟鍙�','鐗╂枡瑙勬牸'], searchValue: '' } }, onLoad() { //椤甸潰鍔犺浇鏃惰皟鐢ㄧ殑浜嬩欢 + // 鍒濆鍖杝electedField锛屽洜涓洪粯璁ら�夋嫨鐗╂枡缂栧彿 + const fieldMap = { + 0: 'DEPARTMENTNAME', // 椤圭洰 + 1: 'itemNo', // 鐗╂枡缂栧彿 + 2: 'itemName', // 鐗╂枡鍚嶇О + 3: 'suppName', // 渚涘簲鍟� + 4: 'lotNo' ,// 鍒拌揣鍗曞彿 + 5: 'releaseNo' ,// 妫�楠屽崟鍙� + 6: 'itemModel',//鐗╂枡瑙勬牸 + }; + this.selectedField = fieldMap[this.optionsIndex]; this.init(); }, methods: { //鎼滅储 onOptionsChange(e) { this.optionsIndex = e.detail.value; + // 褰撻�夋嫨椤圭洰鏃讹紝娓呯┖鎼滅储鍊� + if (this.optionsIndex === 0) { + this.searchValue = ''; + } // 鏍规嵁閫夋嫨鐨勯�夐」璁剧疆鎼滅储瀛楁 const fieldMap = { - 0: 'projectCodes', // 椤圭洰 + 0: 'DEPARTMENTNAME', // 椤圭洰 1: 'itemNo', // 鐗╂枡缂栧彿 2: 'itemName', // 鐗╂枡鍚嶇О 3: 'suppName', // 渚涘簲鍟� - 4: 'purchaser' // 閲囪喘鍛� + 4: 'lotNo' ,// 鍒拌揣鍗曞彿 + 5: 'releaseNo' ,// 妫�楠屽崟鍙� + 6: 'itemModel',//鐗╂枡瑙勬牸 }; this.selectedField = fieldMap[this.optionsIndex]; }, //鎼滅储鎸夐挳鐐瑰嚮浜嬩欢 handleSearch() { + // 褰撻�夋嫨椤圭洰鏃讹紝娓呯┖鎼滅储鍊� + if (this.optionsIndex === 0) { + this.searchValue = ''; + } this.init(); }, init() { @@ -173,26 +203,35 @@ result: result, SearchValue: this.searchValue, selectedIndex: this.optionsIndex, //涓嬫媺妗嗙瓫閫夋潯浠� - userIndex: this.projectIndex + userIndex: this.projectIndex, + emergency:this.meergency, } }).then(res => { + // 鍘婚噸澶勭悊 - 鏍规嵁 releaseNo 鍘婚噸 + const uniqueList = this.removeDuplicatesByReleaseNo(res.data.tbBillList); + + // 瀵规暟鎹繘琛屾帓搴忓鐞� + const sortedList = this.sortInspectionList(uniqueList); + if (this.pageIndex === 1) { // 濡傛灉鏄涓�椤碉紝鐩存帴瑕嗙洊鍘熸暟鎹� - this.inspectionList = res.data.tbBillList; + this.inspectionList = sortedList; //娣诲姞Tab淇℃伅锛屽垽鏂槸宸叉杩樻槸鏈鏁版嵁 this.inspectionList.forEach((item, index) => { this.$set(item, 'activeTab', this.activeTab); this.$set(item, 'IQCJL', this.IQCJL); + this.$set(item, 'EMERGENCY', item.emergency || null); }); } else { - if (res.data.tbBillList.length > 0) { + if (sortedList.length > 0) { // 濡傛灉鏄笅涓�椤碉紝杩藉姞鏂版暟鎹� - this.inspectionList = [...this.inspectionList, ...res.data.tbBillList]; + this.inspectionList = [...this.inspectionList, ...sortedList]; //娣诲姞Tab淇℃伅锛屽垽鏂槸宸叉杩樻槸鏈鏁版嵁 this.inspectionList.forEach((item, index) => { this.$set(item, 'activeTab', this.activeTab); this.$set(item, 'IQCJL', this.IQCJL); + this.$set(item, 'EMERGENCY', item.emergency || null); }); } @@ -290,10 +329,19 @@ }, onShow() { //姣忔杩涘叆椤甸潰閮戒細鎵ц鐨勬柟娉� - // this.pageIndex = 1; - // this.data = []; - // //this.current = 0 + // 妫�鏌ユ槸鍚﹂渶瑕佸埛鏂版暟鎹� + const app = getApp(); + if (app.globalData && app.globalData.needRefreshList) { + // 娓呴櫎鏍囪 + app.globalData.needRefreshList = false; + // 寮哄埗鍒锋柊鏁版嵁 + this.pageIndex = 1; // 閲嶇疆椤电爜 + this.inspectionList = []; // 娓呯┖鍒楄〃鏁版嵁 + this.init(); // 閲嶆柊鍔犺浇鏁版嵁 + } else { + // 姝e父鍒锋柊 this.init(); + } }, async onLoad() { if (this.$loginInfo.roleid.indexOf("90134") != -1 || this.$loginInfo.account == "PL017") { @@ -303,6 +351,78 @@ } await this.init(); // 鑷畾涔夌殑鍒锋柊鍑芥暟 + }, + + // 鏍规嵁 releaseNo 鍘婚噸鐨勬柟娉� + removeDuplicatesByReleaseNo(array) { + const seen = new Set(); + return array.filter(item => { + const releaseNo = item.releaseNo; + if (seen.has(releaseNo)) { + return false; + } + seen.add(releaseNo); + return true; + }); + }, + + // 鏍规嵁妫�楠岄」鐩暟閲忚幏鍙栫姸鎬佹枃鏈� + getStatusText(item) { + // 濡傛灉娌℃湁妫�楠岄」鐩紝鏄剧ず"鏈淮鎶�" + if (!item.inspectionItemCount || item.inspectionItemCount === 0) { + return '鏈淮鎶�'; + } + // 濡傛灉鏈夋楠岄」鐩紝鏄剧ず"寰呮楠�" + return '寰呮楠�'; + }, + + // 鍒ゆ柇鏄惁涓烘湭缁存姢涓旈潪绱ф�ユ斁琛� + isUnmaintainedAndNotEmergency(item) { + // 妫�鏌ユ槸鍚︿负鏈淮鎶わ紙娌℃湁妫�楠岄」鐩級 + const isUnmaintained = !item.inspectionItemCount || item.inspectionItemCount === 0; + // 妫�鏌ユ槸鍚︿负闈炵揣鎬ユ斁琛� + const isNotEmergency = item.lotNo1 !== '绱ф�ユ斁琛岋紝璇峰嬁楠岄��!'; + return isUnmaintained && isNotEmergency; + }, + + // 鍒ゆ柇鏄惁涓哄緟鍒嗛厤鐘舵�侊紙鐗╂枡娌℃湁缁存姢妫�楠屽憳鎴栬�呰鐗╂枡鏈湪V_LLJ_USER閲岋級 + isUnmaintainedItem(item) { + // 妫�鏌ョ墿鏂欐槸鍚﹀湪V_LLJ_USER瑙嗗浘涓紙鍗虫槸鍚︽湁缁存姢妫�楠屽憳锛� + // 濡傛灉item.fcode涓簄ull鎴杣ndefined锛岃鏄庤鐗╂枡鏈湪V_LLJ_USER瑙嗗浘涓� + // 鎴栬�呰鐗╂枡娌℃湁缁存姢妫�楠屽憳 + return !item.fcode || item.fcode === null || item.fcode === ''; + }, + + // 瀵规楠屽崟鍒楄〃杩涜鎺掑簭 + sortInspectionList(list) { + return list.sort((a, b) => { + // 绗竴浼樺厛绾э細鏈彁浜ゆ牎楠岀殑绱ф�ユ斁琛� + const aIsEmergencyPending = a.lotNo1 === '绱ф�ユ斁琛岋紝璇峰嬁楠岄��!' && this.activeTab === 0; + const bIsEmergencyPending = b.lotNo1 === '绱ф�ユ斁琛岋紝璇峰嬁楠岄��!' && this.activeTab === 0; + + if (aIsEmergencyPending && !bIsEmergencyPending) return -1; + if (!aIsEmergencyPending && bIsEmergencyPending) return 1; + + // 绗簩浼樺厛绾э細鏈淮鎶ゆ楠岄」鐩紙闈炵揣鎬ユ斁琛岋級 + const aIsUnmaintained = this.isUnmaintainedAndNotEmergency(a); + const bIsUnmaintained = this.isUnmaintainedAndNotEmergency(b); + + if (aIsUnmaintained && !bIsUnmaintained) return -1; + if (!aIsUnmaintained && bIsUnmaintained) return 1; + + // 绗笁浼樺厛绾э細鍒涘缓鏃堕棿锛堟湭鎻愪氦鐨勬寜鍒涘缓鏃堕棿鍗囧簭锛屽凡鎻愪氦鐨勬寜鎻愪氦鏃堕棿闄嶅簭锛� + if (this.activeTab === 0) { + // 鏈楠岋細鎸夊垱寤烘椂闂村崌搴忥紙瓒婃棭瓒婇潬鍓嶏級 + const aCreateTime = new Date(a.createDate || 0); + const bCreateTime = new Date(b.createDate || 0); + return aCreateTime - bCreateTime; + } else { + // 宸叉楠岋細鎸夋彁浜ゆ椂闂撮檷搴忥紙瓒婃櫄瓒婇潬鍓嶏級 + const aIqcTime = new Date(a.iqcDate || 0); + const bIqcTime = new Date(b.iqcDate || 0); + return bIqcTime - aIqcTime; + } + }); } } } @@ -331,7 +451,7 @@ /* 鏂板鎼滅储妗嗘牱寮� */ .search-container { display: flex; - flex: 1; + width: 300px; /* 鍥哄畾瀹藉害 */ margin: 0 10px; height: 36px; /* 涓庡叾浠栨帶浠堕珮搴︿竴鑷� */ @@ -344,6 +464,8 @@ border-radius: 4px 0 0 4px; font-size: 14px; background-color: white; + min-width: 200px; /* 鏈�灏忓搴� */ + max-width: 250px; /* 鏈�澶у搴� */ } .search-button { @@ -465,6 +587,17 @@ .badge.normal { background-color: #ffaa00; color: white; + } + + .badge.unmaintained { + background-color: #1e8449; + color: white; + } + + .badge.emergency { + background-color: #ff4d4f; + color: white; + margin-right: 5px; } .status { @@ -607,5 +740,15 @@ order: 4; width: 100%; } */ + .status.emergency-pending { + background-color: #ff0000; /* 绾㈣壊鑳屾櫙 */ + color: white; + } + + .status.unmaintained-not-emergency { + background-color: #9c27b0; /* 绱壊鑳屾櫙 */ + color: white; + box-shadow: 0 0 8px rgba(156, 39, 176, 0.3); + } } </style> \ No newline at end of file -- Gitblit v1.9.3