| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="inspection-app"> |
| | | <!-- é¡¶é¨æç¤ºæ¡ --> |
| | | <view :class="{ 'tips-ani': tipShow }" class="tips">å·æ°æå</view> |
| | | |
| | | <!-- Tab忢 --> |
| | | <view class="filter-section"> |
| | | <view class="filter-controls" style="margin-bottom: 5px;"> |
| | | <view class="status-tabs"> |
| | | <button :class="['tab-button', currentTab === 0 ? 'active' : '']" |
| | | @click="switchTab(0)">æªæäº¤({{ uncheckedCount }}) |
| | | </button> |
| | | <button :class="['tab-button', currentTab === 1 ? 'active' : '']" |
| | | @click="switchTab(1)">å·²æäº¤({{ checkedCount }}) |
| | | </button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 头é¨ä¿¡æ¯ --> |
| | | <!-- <view class="header-section"> |
| | | <h1>产线æäº¤</h1> |
| | | </view> --> |
| | | |
| | | <!-- æ£éªåå表 --> |
| | | <view class="inspection-list"> |
| | | <!-- æ£éªåå¡ç --> |
| | | <view v-for="(item, index) in data" :key="item.id" class="inspection-card"> |
| | | <view class="card-header"> |
| | | <!-- æ·»å æ è¯badge --> |
| | | <view v-if="item.urgent == 1" class="badge urgent">æ¥æ</view> |
| | | <view v-if="item.isFirst == 1" class="badge normal">馿¬¡</view> |
| | | <view v-if="currentTab === 1" class="card-title">æ£éªåå·: {{ item.billNo }}</view> |
| | | <view v-if="currentTab === 0" class="card-title">å·¥åå·: {{ item.daA001 }}</view> |
| | | <!-- æªæäº¤é¡µé¢æ¾ç¤ºä¸åæ ¼ç¶æ --> |
| | | <view v-if="currentTab === 0 && item.result === 'ä¸åæ ¼'" class="status status-fail-alert"> |
| | | ä¸åæ ¼ |
| | | </view> |
| | | <!-- å·²æäº¤é¡µé¢æ¾ç¤ºæ£éªç¶æ --> |
| | | <view v-if="currentTab === 1" :class="{ |
| | | 'status-pass': item.result === 'åæ ¼', |
| | | 'status-fail': item.result === 'ä¸åæ ¼', |
| | | 'status-submitted': !item.result |
| | | }" |
| | | class="status"> |
| | | {{ item.result ? item.result : 'å·²æäº¤' }} |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="card-body"> |
| | | <view class="info-row"> |
| | | <view class="info-item"> |
| | | <view class="info-label">ç©æä¿¡æ¯</view> |
| | | <view class="info-content">{{ item.itemNo }} | {{ item.daA003 }}<br>{{ item.daA004 }}</view> |
| | | </view> |
| | | </view> |
| | | |
| | | <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">{{ 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> |
| | | |
| | | <!-- å·²æäº¤ç¶æä¸æ¾ç¤ºæ£éªä¿¡æ¯ --> |
| | | <view v-if="currentTab === 1" class="meta-info"> |
| | | <view class="meta-item">æ£éªåå·: {{ item.billNo }}</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> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="card-actions"> |
| | | <button v-if="currentTab === 0" class="primary" @click="submitInspection(item, userId)">æäº¤æ£éª</button> |
| | | <!-- <button v-if="currentTab === 1" class="secondary" @click="viewDetail(item)">æ¥ç详æ
</button> --> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | currentTab: 0, // 0: æªæäº¤, 1: å·²æäº¤ |
| | | data: [], |
| | | pageIndex: 1, |
| | | limit: 20, |
| | | totalPage: 0, |
| | | totalCount: 0, |
| | | noData: false, |
| | | isLoading: false, |
| | | tipShow: false, |
| | | searchValue: '', |
| | | userId: "", |
| | | uncheckedCount: 0, |
| | | checkedCount: 0 |
| | | }; |
| | | }, |
| | | |
| | | // 页é¢å è½½æ¶åªæ§è¡ä¸æ¬¡ |
| | | async onLoad() { |
| | | |
| | | const user = this.$loginInfo; |
| | | this.userId = user.account; |
| | | console.log("ç¨æ·ID =", this.userId); |
| | | |
| | | // åå§åå è½½æ°æ® |
| | | await this.init(); |
| | | }, |
| | | |
| | | methods: { |
| | | // Tab忢 |
| | | async switchTab(tabIndex) { |
| | | if (this.currentTab !== tabIndex) { |
| | | this.currentTab = tabIndex; |
| | | this.data = []; |
| | | this.pageIndex = 1; |
| | | await this.init(); |
| | | } |
| | | }, |
| | | |
| | | async init() { |
| | | if (this.isLoading) return; |
| | | |
| | | this.isLoading = true; |
| | | const userName = this.$loginInfo.account; |
| | | const result = this.currentTab === 1 ? "已宿" : "æªå®æ"; |
| | | |
| | | try { |
| | | const res = await this.$post({ |
| | | url: "/ProductionLine/GetProductionLinePage", // 产线æäº¤æ¥å£ |
| | | data: { |
| | | pageIndex: this.pageIndex, |
| | | limit: this.limit, |
| | | statusUser: userName, |
| | | status: this.currentTab, // 0: æªæäº¤, 1: å·²æäº¤ |
| | | searchValue: this.searchValue |
| | | } |
| | | }); |
| | | |
| | | let list = res.data.tbBillList || []; |
| | | |
| | | // å¦ææ¯æªæäº¤é¡µé¢ï¼å¯¹ä¸åæ ¼çæ°æ®è¿è¡æåºç½®é¡¶ |
| | | if (this.currentTab === 0 && list.length > 0) { |
| | | // å°ä¸åæ ¼çæ°æ®ç½®é¡¶ |
| | | const failedItems = list.filter(item => item.result === 'ä¸åæ ¼'); |
| | | const otherItems = list.filter(item => item.result !== 'ä¸åæ ¼'); |
| | | list = [...failedItems, ...otherItems]; |
| | | } |
| | | |
| | | 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.currentTab === 1) { |
| | | this.checkedCount = this.totalCount; |
| | | } else { |
| | | this.uncheckedCount = this.totalCount; |
| | | } |
| | | |
| | | } catch (e) { |
| | | console.error("å è½½æ£éªåæ°æ®å¤±è´¥:", e); |
| | | } finally { |
| | | this.isLoading = false; |
| | | } |
| | | }, |
| | | |
| | | // æäº¤æ£éª |
| | | async submitInspection(item, userId) { |
| | | console.log("æäº¤æ£éª - å·¥åID:", item.id, "ç¨æ·è´¦å·:", userId); |
| | | |
| | | if (!userId) { |
| | | this.$showMessage("ç¨æ·è´¦å·ä¸è½ä¸ºç©º"); |
| | | return; |
| | | } |
| | | |
| | | uni.showLoading({ |
| | | title: 'æäº¤ä¸...' |
| | | }); |
| | | |
| | | try { |
| | | const res = await this.$post({ |
| | | url: "/ProductionLine/SubmitInspection", |
| | | data: { |
| | | userNo: userId, |
| | | gid: item.id |
| | | } |
| | | }); |
| | | |
| | | // æ£æ¥å¤ç§æåæ¡ä»¶ |
| | | if (res.statusCode === 200 || res.status === 0 || res.data === true || res.data.tbBillList === true) { |
| | | this.$showMessage("æåæäº¤æ£éª"); |
| | | |
| | | // ä»å表ä¸ç§»é¤å·²æäº¤ç项 |
| | | this.data = this.data.filter(dataItem => dataItem.id !== item.id); |
| | | this.uncheckedCount--; |
| | | this.checkedCount++; |
| | | |
| | | // 妿å表为空ï¼å·æ°é¡µé¢ |
| | | if (this.data.length === 0) { |
| | | this.pageIndex = 1; |
| | | await this.init(); |
| | | } |
| | | } else { |
| | | this.$showMessage(res.data.message || res.message || "æäº¤å¤±è´¥"); |
| | | } |
| | | } catch (err) { |
| | | console.log("æäº¤åºé:", err); |
| | | this.$showMessage("æäº¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } finally { |
| | | uni.hideLoading(); |
| | | } |
| | | }, |
| | | |
| | | // æ¥ç详æ
|
| | | viewDetail(item) { |
| | | uni.navigateTo({ |
| | | url: `Add?id=${item.id}&billNo=${item.billNo}¤t=B` |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 䏿巿° |
| | | onPullDownRefresh() { |
| | | this.pageIndex = 1; |
| | | this.init().then(() => { |
| | | this.tipShow = true; |
| | | uni.stopPullDownRefresh(); |
| | | setTimeout(() => (this.tipShow = false), 3000); |
| | | }); |
| | | }, |
| | | |
| | | // 䏿å è½½æ´å¤ |
| | | onReachBottom() { |
| | | if (this.noData || this.isLoading) return; |
| | | this.pageIndex++; |
| | | this.init(); |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | /* åºç¡æ ·å¼éç½® */ |
| | | .inspection-app { |
| | | padding: 10px; |
| | | background-color: #f5f7fa; |
| | | min-height: 100vh; |
| | | } |
| | | |
| | | /* é¡¶é¨çéåº */ |
| | | .filter-section { |
| | | /* margin-bottom: 24px; */ |
| | | } |
| | | |
| | | .filter-section h1 { |
| | | font-size: 24px; |
| | | font-weight: 600; |
| | | color: #2c3e50; |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | /* æç´¢æ¡æ ·å¼ */ |
| | | .search-container { |
| | | display: flex; |
| | | flex: 1; |
| | | margin: 0 10px; |
| | | height: 36px; |
| | | } |
| | | |
| | | .search-input { |
| | | flex: 1; |
| | | padding: 8px 12px; |
| | | border: 1px solid #ddd; |
| | | border-radius: 4px 0 0 4px; |
| | | font-size: 14px; |
| | | background-color: white; |
| | | } |
| | | |
| | | .search-button { |
| | | padding: 0 12px; |
| | | border: 1px solid #3498db; |
| | | border-radius: 0 4px 4px 0; |
| | | background: linear-gradient(135deg, #3498db, #2980b9); |
| | | color: white; |
| | | font-size: 14px; |
| | | margin: 0; |
| | | cursor: pointer; |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | .search-button:hover { |
| | | background: linear-gradient(135deg, #2980b9, #1f618d); |
| | | transform: translateY(-1px); |
| | | box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3); |
| | | } |
| | | |
| | | .search-button:active { |
| | | transform: translateY(0); |
| | | } |
| | | |
| | | .filter-controls { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 5px; |
| | | } |
| | | |
| | | .dropdown-filter { |
| | | min-width: 70px; |
| | | } |
| | | |
| | | .badge { |
| | | font-size: 12px; |
| | | padding: 4px 8px; |
| | | border-radius: 12px; |
| | | margin-right: 8px; |
| | | font-weight: 500; |
| | | letter-spacing: 0.5px; |
| | | } |
| | | |
| | | .badge.urgent { |
| | | background: linear-gradient(135deg, #e74c3c, #c0392b); |
| | | color: white; |
| | | box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3); |
| | | } |
| | | |
| | | .badge.normal { |
| | | background: linear-gradient(135deg, #f39c12, #e67e22); |
| | | color: white; |
| | | box-shadow: 0 2px 4px rgba(243, 156, 18, 0.3); |
| | | } |
| | | |
| | | .meta-info { |
| | | display: flex; |
| | | gap: 16px; |
| | | font-size: 12px; |
| | | color: #95a5a6; |
| | | margin-top: 12px; |
| | | } |
| | | |
| | | .meta-item { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 4px; |
| | | } |
| | | |
| | | .picker { |
| | | padding: 8px 12px; |
| | | border: 1px solid #ddd; |
| | | border-radius: 4px; |
| | | background-color: white; |
| | | font-size: 14px; |
| | | min-width: 120px; |
| | | } |
| | | |
| | | .filter-label { |
| | | font-size: 14px; |
| | | color: #7f8c8d; |
| | | } |
| | | |
| | | .status-tabs { |
| | | display: flex; |
| | | border-radius: 4px; |
| | | overflow: hidden; |
| | | background-color: #ecf0f1; |
| | | flex: 1; |
| | | min-width: 200px; |
| | | } |
| | | |
| | | .tab-button { |
| | | padding: 0px 16px; |
| | | border: none; |
| | | background: none; |
| | | font-size: 14px; |
| | | transition: all 0.3s; |
| | | margin: 0; |
| | | height: 35px; |
| | | } |
| | | |
| | | .tab-button.active { |
| | | background: linear-gradient(135deg, #3498db, #2980b9); |
| | | color: white; |
| | | box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3); |
| | | } |
| | | |
| | | /* æ£éªåå表 */ |
| | | .inspection-list { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20px; |
| | | } |
| | | |
| | | /* æ£éªåå¡ç */ |
| | | .inspection-card { |
| | | background-color: white; |
| | | border-radius: 8px; |
| | | box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); |
| | | overflow: hidden; |
| | | transition: all 0.3s ease; |
| | | border: 1px solid rgba(52, 152, 219, 0.1); |
| | | } |
| | | |
| | | .inspection-card:hover { |
| | | transform: translateY(-2px); |
| | | box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); |
| | | border-color: rgba(52, 152, 219, 0.3); |
| | | } |
| | | |
| | | .card-header { |
| | | padding: 16px; |
| | | border-bottom: 1px solid #eee; |
| | | display: flex; |
| | | align-items: center; |
| | | background: linear-gradient(135deg, #f8f9fa, #e9ecef); |
| | | } |
| | | |
| | | .card-title { |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | flex: 1; |
| | | margin: 0 8px; |
| | | color: #2c3e50; |
| | | } |
| | | |
| | | .status { |
| | | font-size: 12px; |
| | | padding: 4px 8px; |
| | | border-radius: 6px; |
| | | font-weight: 500; |
| | | letter-spacing: 0.3px; |
| | | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .status-pending { |
| | | background: linear-gradient(135deg, #f39c12, #e67e22); |
| | | color: white; |
| | | } |
| | | |
| | | .status-assigned { |
| | | background: linear-gradient(135deg, #3498db, #2980b9); |
| | | color: white; |
| | | } |
| | | |
| | | .status-pass { |
| | | background: linear-gradient(135deg, #27ae60, #229954); |
| | | color: white; |
| | | } |
| | | |
| | | .status-fail { |
| | | background: linear-gradient(135deg, #3498db, #2980b9); |
| | | color: white; |
| | | } |
| | | |
| | | .status-submitted { |
| | | background: linear-gradient(135deg, #95a5a6, #7f8c8d); |
| | | color: white; |
| | | } |
| | | |
| | | .status-fail-alert { |
| | | background: linear-gradient(135deg, #e74c3c, #c0392b); |
| | | color: white; |
| | | animation: pulse 2s infinite; |
| | | } |
| | | |
| | | @keyframes pulse { |
| | | 0% { |
| | | box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); |
| | | } |
| | | 50% { |
| | | box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); |
| | | } |
| | | 100% { |
| | | box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); |
| | | } |
| | | } |
| | | |
| | | .card-body { |
| | | padding: 16px; |
| | | } |
| | | |
| | | .info-row { |
| | | display: flex; |
| | | margin-bottom: 12px; |
| | | gap: 16px; |
| | | } |
| | | |
| | | .info-item { |
| | | flex: 1; |
| | | } |
| | | |
| | | .info-label { |
| | | display: block; |
| | | font-size: 12px; |
| | | color: #7f8c8d; |
| | | margin-bottom: 4px; |
| | | } |
| | | |
| | | .info-content { |
| | | font-size: 14px; |
| | | color: #2c3e50; |
| | | line-height: 1.5; |
| | | } |
| | | |
| | | .highlight { |
| | | font-weight: 600; |
| | | color: #e74c3c; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .card-actions { |
| | | padding: 12px 16px; |
| | | border-top: 1px solid #eee; |
| | | display: flex; |
| | | gap: 8px; |
| | | } |
| | | |
| | | button { |
| | | padding: 8px 16px; |
| | | border: 1px solid #ddd; |
| | | border-radius: 4px; |
| | | background-color: white; |
| | | font-size: 14px; |
| | | transition: all 0.2s; |
| | | flex: 1; |
| | | } |
| | | |
| | | button.primary { |
| | | background: linear-gradient(135deg, #3498db, #2980b9); |
| | | color: white; |
| | | border-color: #2980b9; |
| | | box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3); |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | button.primary:hover { |
| | | background: linear-gradient(135deg, #2980b9, #1f618d); |
| | | transform: translateY(-1px); |
| | | box-shadow: 0 4px 8px rgba(52, 152, 219, 0.4); |
| | | } |
| | | |
| | | button.primary:active { |
| | | transform: translateY(0); |
| | | } |
| | | |
| | | button.secondary { |
| | | background: linear-gradient(135deg, #95a5a6, #7f8c8d); |
| | | color: white; |
| | | border-color: #7f8c8d; |
| | | box-shadow: 0 2px 4px rgba(149, 165, 166, 0.3); |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | button.secondary:hover { |
| | | background: linear-gradient(135deg, #7f8c8d, #6c7b7d); |
| | | transform: translateY(-1px); |
| | | box-shadow: 0 4px 8px rgba(149, 165, 166, 0.4); |
| | | } |
| | | |
| | | button.secondary:active { |
| | | transform: translateY(0); |
| | | } |
| | | |
| | | /* ååºå¼è®¾è®¡ */ |
| | | @media (min-width: 768px) { |
| | | .inspection-list { |
| | | display: grid; |
| | | grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); |
| | | } |
| | | |
| | | .info-row { |
| | | flex-direction: row; |
| | | } |
| | | } |
| | | |
| | | /* ååºå¼è®¾è®¡ */ |
| | | @media (min-width: 300px) { |
| | | .inspection-list { |
| | | display: grid; |
| | | grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); |
| | | } |
| | | |
| | | .info-row { |
| | | flex-direction: row; |
| | | } |
| | | |
| | | .picker { |
| | | padding: 8px 12px; |
| | | border: 1px solid #ddd; |
| | | border-radius: 4px; |
| | | background-color: white; |
| | | font-size: 14px; |
| | | min-width: 10px; |
| | | } |
| | | } |
| | | |
| | | /* å·æ°æç¤ºæ ·å¼ */ |
| | | .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> |