From 52c82b4f021814fc1cbe49b70871757a9001458a Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期三, 16 七月 2025 21:26:46 +0800 Subject: [PATCH] 添加实验室检测模块功能 --- MES_Laboratory_API_Documentation.md | 117 +++++ pages.json | 14 pages/QC/Laboratory/List.vue | 663 +++++++++++++++++++++++++++++++ pages/QC/Laboratory/Laboratory.vue | 438 ++++++++++++++++++++ 4 files changed, 1,232 insertions(+), 0 deletions(-) diff --git a/MES_Laboratory_API_Documentation.md b/MES_Laboratory_API_Documentation.md new file mode 100644 index 0000000..bdcf0ad --- /dev/null +++ b/MES_Laboratory_API_Documentation.md @@ -0,0 +1,117 @@ +# MES瀹為獙瀹ゆ娴嬫暟鎹瓵PI鎺ュ彛鏂囨。 + +## 1. 淇濆瓨瀹為獙瀹ゆ娴嬫暟鎹� + +**璇锋眰鍦板潃锛�** `POST /api/MesLaboratory/saveLaboratory` + +**璇锋眰鍙傛暟锛�** +```json +{ + "createUser": "string", // 鍒涘缓浜� + "orderNo": "string" // 宸ュ崟鍙� +} +``` + +**杩斿洖鏁版嵁锛�** +```json +{ + "status": 0, + "message": "OK", + "data": { + "result": true // 鎿嶄綔鏄惁鎴愬姛 + } +} +``` + +--- + +## 2. 鍒嗛〉鏌ヨ瀹為獙瀹ゆ娴嬫暟鎹� + +**璇锋眰鍦板潃锛�** `POST /api/MesLaboratory/GetPage` + +**璇锋眰鍙傛暟锛�** +```json +{ + "pageIndex": 1, // 椤电爜 + "limit": 10, // 姣忛〉璁板綍鏁� + "id": "string" // 璁板綍ID锛堝彲閫夛級 +} +``` + +**杩斿洖鏁版嵁锛�** +```json +{ + "status": 0, + "message": "OK", + "data": { + "tbBillList": [ + { + "billNo": "string", // 宸ュ崟鍙� + "lineNo": "string", // 鐢熶骇绾夸綋缂栫爜 + "itemId": 1001, // 鐗╂枡ID + "itemNo": "string", // 鐗╂枡缂栫爜 + "itemName": "string", // 鐗╂枡鍚嶇О + "itemModel": "string", // 鐗╂枡瑙勬牸 + "departmentId": 1, // 鐢熶骇杞﹂棿ID + "departmentCode": "string", // 鐢熶骇杞﹂棿缂栫爜 + "saleOrderNoc": "string", // 閿�鍞鍗曞彿 + "inspectionResult": "string", // 妫�楠岀粨鏋� + "createTime": "2024-01-01 12:00:00", // 鍒涘缓鏃堕棿 + "createUser": "string", // 鍒涘缓浜� + "inspectionTime": "2024-01-01 12:00:00", // 妫�楠屾椂闂� + "inspectionUser": "string" // 妫�楠屼汉 + } + ], + "totalCount": 100 // 鎬昏褰曟暟 + } +} +``` + +--- + +## 3. 褰曞叆妫�楠岀粨鏋� + +**璇锋眰鍦板潃锛�** `POST /api/MesLaboratory/UpdateInspectionResult` + +**璇锋眰鍙傛暟锛�** +```json +{ + "id": 1, // 璁板綍ID锛堝繀濉級 + "inspectionResult": "string", // 妫�楠岀粨鏋滐紙鍙�夛級 + "inspectionBy": "string" // 妫�楠屼汉锛堝彲閫夛級 +} +``` + +**杩斿洖鏁版嵁锛�** +```json +{ + "status": 0, + "message": "OK", + "data": { + "result": true // 鎿嶄綔鏄惁鎴愬姛 + } +} +``` + +--- + +## 閫氱敤璇存槑 + +### 鍝嶅簲鐘舵�佺爜 +- `status: 0` - 鎿嶄綔鎴愬姛 +- `status: 1` - 鎿嶄綔澶辫触 + +### 閿欒鍝嶅簲鏍煎紡 +```json +{ + "status": 1, + "message": "閿欒淇℃伅", + "data": null +} +``` + +### 娉ㄦ剰浜嬮」 +1. 鎵�鏈夋帴鍙e潎浣跨敤POST鏂规硶 +2. 璇锋眰澶撮渶璁剧疆 `Content-Type: application/json` +3. 鏃ユ湡鏃堕棿鏍煎紡涓� `yyyy-MM-dd HH:mm:ss` +4. UpdateInspectionResult鎺ュ彛浼氳嚜鍔ㄨ缃楠屾椂闂翠负褰撳墠鏃堕棿 \ No newline at end of file diff --git a/pages.json b/pages.json index ae02587..6965142 100644 --- a/pages.json +++ b/pages.json @@ -420,6 +420,20 @@ { "navigationBarTitleText" : "妫�楠岃鎯�" } + }, + { + "path" : "pages/QC/Laboratory/Laboratory", + "style" : + { + "navigationBarTitleText" : "瀹為獙瀹ら�佹" + } + }, + { + "path" : "pages/QC/Laboratory/List", + "style" : + { + "navigationBarTitleText" : "瀹為獙瀹ら�佹" + } } // { // "path": "pages/Device/Spotcheck", diff --git a/pages/QC/Laboratory/Laboratory.vue b/pages/QC/Laboratory/Laboratory.vue new file mode 100644 index 0000000..aa6c976 --- /dev/null +++ b/pages/QC/Laboratory/Laboratory.vue @@ -0,0 +1,438 @@ +<template> + <view class="container"> + <!-- 椤甸潰鏍囬 --> + <view class="page-header"> + <view class="header-title">瀹為獙瀹ゆ娴嬭鎯�</view> + </view> + + <!-- 鍔犺浇鐘舵�� --> + <view v-if="loading" class="loading-container"> + <uni-load-more status="loading" /> + </view> + + <!-- 鏁版嵁灞曠ず --> + <view v-else-if="data" class="content"> + <view class="card"> + <view class="card-header"> + <view class="header-info"> + <view class="info-item"> + <label class="info-label">宸ュ崟鍙�:</label> + <text class="info-value">{{ data.billNo }}</text> + </view> + </view> + </view> + + <view class="card-body"> + <view class="info-group"> + <view class="info-row"> + <view class="info-item"> + <label class="info-label">鍒涘缓鏃堕棿:</label> + <text class="info-value">{{ data.createTime }}</text> + </view> + <view class="info-item"> + <label class="info-label">鍒涘缓浜�:</label> + <text class="info-value">{{ data.createUser }}</text> + </view> + </view> + + <view class="info-row"> + <view class="info-item"> + <label class="info-label">鐢熶骇绾跨紪鐮�:</label> + <text class="info-value">{{ data.lineNo }}</text> + </view> + <view class="info-item"> + <label class="info-label">鐗╂枡缂栫爜:</label> + <text class="info-value">{{ data.itemNo }}</text> + </view> + </view> + + <view class="info-row full-width"> + <view class="info-item"> + <label class="info-label">鐗╂枡鍚嶇О:</label> + <text class="info-value">{{ data.itemName }}</text> + </view> + </view> + + <view class="info-row full-width"> + <view class="info-item"> + <label class="info-label">鐗╂枡瑙勬牸:</label> + <text class="info-value">{{ data.itemModel }}</text> + </view> + </view> + + <view class="info-row"> + <view class="info-item"> + <label class="info-label">鐢熶骇杞﹂棿缂栫爜:</label> + <text class="info-value">{{ data.departmentCode }}</text> + </view> + <view class="info-item"> + <label class="info-label">鐢熶骇杞﹂棿ID:</label> + <text class="info-value">{{ data.departmentId }}</text> + </view> + </view> + + <view class="info-row full-width"> + <view class="info-item"> + <label class="info-label">閿�鍞鍗曞彿:</label> + <text class="info-value">{{ data.saleOrderNoc }}</text> + </view> + </view> + + <view class="info-row"> + <view class="info-item"> + <label class="info-label">妫�楠屾椂闂�:</label> + <text class="info-value">{{ data.inspectionTime }}</text> + </view> + <view class="info-item"> + <label class="info-label">妫�楠屼汉:</label> + <text class="info-value">{{ data.inspectionUser }}</text> + </view> + </view> + + <view class="info-row"> + <view class="info-item status-item"> + <label class="info-label">妫�楠岀粨鏋�:</label> + <view class="result-container"> + <!-- 鏄剧ず褰撳墠妫�楠岀粨鏋� --> + <text v-if="data.inspectionResult" class="status-badge" :class="data.inspectionResult === '鍚堟牸' ? 'success' : 'danger'"> + {{ data.inspectionResult }} + </text> + <text v-else class="status-badge pending"> + 寰呮楠� + </text> + + <!-- 褰曞叆/閲嶆柊褰曞叆鎸夐挳 --> + <button v-if="!showResultInput" class="input-btn" @click="showResultInput = true"> + {{ data.inspectionResult ? '閲嶆柊褰曞叆' : '褰曞叆缁撴灉' }} + </button> + + <!-- 妫�楠岀粨鏋滈�夋嫨鎸夐挳 --> + <view v-if="showResultInput" class="result-input-container"> + <button class="result-btn qualified" @click="updateInspectionResult('鍚堟牸')" :disabled="updating"> + 鍚堟牸 + </button> + <button class="result-btn unqualified" @click="updateInspectionResult('涓嶅悎鏍�')" :disabled="updating"> + 涓嶅悎鏍� + </button> + <button class="result-btn cancel" @click="showResultInput = false" :disabled="updating"> + 鍙栨秷 + </button> + </view> + </view> + </view> + </view> + </view> + </view> + </view> + </view> + + <!-- 绌虹姸鎬� --> + <view v-else class="empty-state"> + <view class="empty-icon">馃搵</view> + <view class="empty-text">鏆傛棤鏁版嵁</view> + </view> + </view> +</template> + +<script> +export default { + data() { + return { + data: null, + loading: false, + itemId: null, + showResultInput: false, + updating: false + } + }, + + onLoad(options) { + this.itemId = options.id; + if (this.itemId) { + this.loadData(); + } + }, + + methods: { + loadData() { + this.loading = true; + + const requestData = { + pageIndex: 1, + limit: 1, + id: this.itemId + }; + + this.$post({ + url: "/MesLaboratory/GetPage", + data: requestData + }).then(res => { + if (res.data && res.data.tbBillList && res.data.tbBillList.length > 0) { + this.data = res.data.tbBillList[0]; + } else { + this.data = null; + this.$showMessage('鏈壘鍒扮浉鍏虫暟鎹�'); + } + }).catch(err => { + console.error('鑾峰彇瀹為獙瀹よ鎯呭け璐�:', err); + this.$showMessage('鑾峰彇鏁版嵁澶辫触锛岃閲嶈瘯'); + }).finally(() => { + this.loading = false; + }); + }, + + updateInspectionResult(result) { + this.updating = true; + + const requestData = { + id: this.itemId, + inspectionResult: result, + inspectionBy: this.$loginInfo.account + }; + + this.$post({ + url: "/MesLaboratory/UpdateInspectionResult", + data: requestData + }).then(res => { + if (res.status === 0 && res.data.result) { + this.$showMessage(`妫�楠岀粨鏋滃凡褰曞叆锛�${result}`); + this.showResultInput = false; + // 褰曞叆鎴愬姛鍚庡埛鏂伴〉闈㈡暟鎹� + this.loadData(); + } else { + this.$showMessage('褰曞叆澶辫触锛岃閲嶈瘯'); + } + }).catch(err => { + console.error('褰曞叆妫�楠岀粨鏋滃け璐�:', err); + this.$showMessage('褰曞叆澶辫触锛岃閲嶈瘯'); + }).finally(() => { + this.updating = false; + }); + } + } +} +</script> + +<style lang="scss"> +.container { + padding: 20px; + background-color: #f8f9fa; + min-height: 100vh; +} + +.page-header { + margin-bottom: 20px; + text-align: center; +} + +.header-title { + font-size: 20px; + font-weight: 600; + color: #303133; +} + +.loading-container { + display: flex; + justify-content: center; + align-items: center; + height: 200px; +} + +.content { + width: 100%; +} + +.card { + background-color: #fff; + border-radius: 12px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05); + overflow: hidden; +} + +.card-header { + background: linear-gradient(145deg, #f0f9ff, #e0f2fe); + border-left: 4px solid #409EFF; + padding: 20px; +} + +.header-info { + display: flex; + align-items: center; +} + +.card-body { + padding: 20px; +} + +.info-group { + display: flex; + flex-direction: column; + gap: 16px; +} + +.info-row { + display: flex; + gap: 20px; + + &.full-width { + flex-direction: column; + } +} + +.info-item { + display: flex; + align-items: center; + flex: 1; + min-width: 0; + + &.status-item { + align-items: center; + gap: 10px; + } +} + +.info-label { + font-size: 14px; + color: #606266; + font-weight: 500; + min-width: 100px; + flex-shrink: 0; +} + +.info-value { + font-size: 14px; + color: #303133; + flex: 1; + word-break: break-all; +} + +.status-badge { + display: inline-block; + padding: 6px 12px; + font-size: 14px; + border-radius: 20px; + font-weight: 500; + + &.success { + background-color: #e6f7ed; + color: #36b37e; + border: 1px solid #d1fae5; + } + + &.danger { + background-color: #ffefef; + color: #ff4d4f; + border: 1px solid #fee2e2; + } + + &.pending { + background-color: #f5f5f5; + color: #999; + border: 1px solid #e5e5e5; + } +} + +.result-container { + display: flex; + align-items: center; + gap: 12px; + flex-wrap: wrap; +} + +.input-btn { + padding: 6px 12px; + font-size: 14px; + border-radius: 6px; + border: 1px solid #409EFF; + background-color: #fff; + color: #409EFF; + cursor: pointer; + transition: all 0.2s; + + &:hover { + background-color: #409EFF; + color: #fff; + } + + &:active { + transform: scale(0.95); + } +} + +.result-input-container { + display: flex; + gap: 8px; + align-items: center; +} + +.result-btn { + padding: 6px 12px; + font-size: 14px; + border-radius: 6px; + border: 1px solid; + cursor: pointer; + transition: all 0.2s; + + &:disabled { + opacity: 0.6; + cursor: not-allowed; + } + + &.qualified { + background-color: #e6f7ed; + color: #36b37e; + border-color: #36b37e; + + &:hover:not(:disabled) { + background-color: #36b37e; + color: #fff; + } + } + + &.unqualified { + background-color: #ffefef; + color: #ff4d4f; + border-color: #ff4d4f; + + &:hover:not(:disabled) { + background-color: #ff4d4f; + color: #fff; + } + } + + &.cancel { + background-color: #f5f5f5; + color: #666; + border-color: #ccc; + + &:hover:not(:disabled) { + background-color: #ccc; + color: #fff; + } + } + + &:active:not(:disabled) { + transform: scale(0.95); + } +} + +.empty-state { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 60px 0; + color: #909399; +} + +.empty-icon { + font-size: 64px; + margin-bottom: 24px; + color: #c0c4cc; +} + +.empty-text { + font-size: 16px; + font-weight: 500; +} +</style> diff --git a/pages/QC/Laboratory/List.vue b/pages/QC/Laboratory/List.vue new file mode 100644 index 0000000..cef6f7d --- /dev/null +++ b/pages/QC/Laboratory/List.vue @@ -0,0 +1,663 @@ +<template> + <view class="container"> + <!-- 鍒锋柊椤甸潰鍚庣殑椤堕儴鎻愮ず妗� --> + <view class="tips" :class="{ 'tips-ani': tipShow }"> + <view class="tips-icon">鉁�</view> + <view class="tips-text">鍒锋柊鎴愬姛</view> + </view> + + <view class="newsTab"> + <uni-segmented-control + :current="current" + :values="items" + @clickItem="onClickItem" + style-type="button" + active-color="#409EFF" + class="segmented-control fixed-tabs" + ></uni-segmented-control> + + <view class="content"> + <view v-show="current===0"> + <!-- 鍩轰簬 uni-list 鐨勯〉闈㈠竷灞� --> + <view v-if="data.length === 0" class="empty-state"> + <view class="empty-icon">馃摑</view> + <view class="empty-text">鏆傛棤妫�楠岃褰�</view> + </view> + + <uni-list v-else> + <!-- 鍒楄〃椤� --> + <uni-list-item + style="margin-top: 15px;" + class="list-item enhanced-list" + direction="column" + v-for="item in data" + :key="item.billNo" + :to="'Laboratory?id=' + (item.id || '')" + > + <!-- 閫氳繃header鎻掓Ы瀹氫箟鍒楄〃鐨勬爣棰� --> + <template v-slot:header> + <view class="card-header pending-header"> + <view class="form-group"> + <label class="form-label">宸ュ崟鍙�:</label> + <input class="form-input order-no" disabled="true" type="text" v-model="item.billNo"/> + </view> + </view> + </template> + + <!-- 閫氳繃body鎻掓Ы瀹氫箟鍒楄〃鍐呭鏄剧ず --> + <template v-slot:body> + <view class="card-body pending-body"> + <view class="row"> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鍒涘缓鏃堕棿:</label> + <input class="form-input" disabled="true" type="text" v-model="item.createTime"/> + </view> + </view> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鍒涘缓浜�:</label> + <input class="form-input" disabled="true" type="text" v-model="item.createUser"/> + </view> + </view> + </view> + + <view class="row"> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鐢熶骇绾�:</label> + <input class="form-input" disabled="true" type="text" v-model="item.lineNo"/> + </view> + </view> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鐗╂枡缂栫爜:</label> + <input class="form-input" disabled="true" type="text" v-model="item.itemNo"/> + </view> + </view> + </view> + + <!-- 浜у搧鍚嶇О鍗曠嫭涓�琛� --> + <view class="form-group"> + <label class="form-label">浜у搧鍚嶇О:</label> + <input class="form-input" disabled="true" type="text" v-model="item.itemName"/> + </view> + + <!-- 浜у搧瑙勬牸鍗曠嫭涓�琛� --> + <view class="form-group"> + <label class="form-label">浜у搧瑙勬牸:</label> + <input class="form-input" disabled="true" type="text" v-model="item.itemModel"/> + </view> + + <view class="row"> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鐢熶骇杞﹂棿:</label> + <input class="form-input" disabled="true" type="text" v-model="item.departmentCode"/> + </view> + </view> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">閿�鍞鍗�:</label> + <input class="form-input" disabled="true" type="text" v-model="item.saleOrderNoc"/> + </view> + </view> + </view> + + <view class="row status-row"> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">妫�楠屾椂闂�:</label> + <input class="form-input" disabled="true" type="text" v-model="item.inspectionTime"/> + </view> + </view> + <view class="col-50"> + <view class="form-group status-group"> + <label class="form-label lab">妫�楠岀粨鏋�:</label> + <span class="status-tag" :class="item.inspectionResult === '鍚堟牸' ? 'success' : 'danger'"> + {{ item.inspectionResult || '寰呮楠�' }} + </span> + </view> + </view> + </view> + + <view class="row"> + <view class="col-100"> + <view class="form-group"> + <label class="form-label lab">妫�楠屼汉:</label> + <input class="form-input" disabled="true" type="text" v-model="item.inspectionUser"/> + </view> + </view> + </view> + </view> + </template> + </uni-list-item> + </uni-list> + </view> + + <view v-show="current===1"> + <view v-if="data.length === 0" class="empty-state"> + <view class="empty-icon">馃搧</view> + <view class="empty-text">鏆傛棤宸插畬鎴愮殑妫�楠岃褰�</view> + </view> + + <uni-list v-else> + <!-- 宸插畬鎴愬垪琛ㄩ」鏍峰紡 --> + <uni-list-item + style="margin-top: 15px;" + class="list-item enhanced-list" + direction="column" + v-for="item in data" + :key="item.billNo" + :to="'Laboratory?id=' + (item.id || '')" + > + <!-- 閫氳繃header鎻掓Ы瀹氫箟鍒楄〃鐨勬爣棰� --> + <template v-slot:header> + <view class="card-header submitted-header"> + <view class="form-group"> + <label class="form-label">宸ュ崟鍙�:</label> + <input class="form-input order-no" disabled="true" type="text" v-model="item.billNo"/> + </view> + </view> + </template> + + <!-- 閫氳繃body鎻掓Ы瀹氫箟鍒楄〃鍐呭鏄剧ず --> + <template v-slot:body> + <view class="card-body submitted-body"> + <view class="row"> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鍒涘缓鏃堕棿:</label> + <input class="form-input" disabled="true" type="text" v-model="item.createTime"/> + </view> + </view> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鍒涘缓浜�:</label> + <input class="form-input" disabled="true" type="text" v-model="item.createUser"/> + </view> + </view> + </view> + + <view class="row"> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鐢熶骇绾�:</label> + <input class="form-input" disabled="true" type="text" v-model="item.lineNo"/> + </view> + </view> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鐗╂枡缂栫爜:</label> + <input class="form-input" disabled="true" type="text" v-model="item.itemNo"/> + </view> + </view> + </view> + + <!-- 浜у搧鍚嶇О鍗曠嫭涓�琛� --> + <view class="form-group"> + <label class="form-label">浜у搧鍚嶇О:</label> + <input class="form-input" disabled="true" type="text" v-model="item.itemName"/> + </view> + + <!-- 浜у搧瑙勬牸鍗曠嫭涓�琛� --> + <view class="form-group"> + <label class="form-label">浜у搧瑙勬牸:</label> + <input class="form-input" disabled="true" type="text" v-model="item.itemModel"/> + </view> + + <view class="row"> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">鐢熶骇杞﹂棿:</label> + <input class="form-input" disabled="true" type="text" v-model="item.departmentCode"/> + </view> + </view> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">閿�鍞鍗�:</label> + <input class="form-input" disabled="true" type="text" v-model="item.saleOrderNoc"/> + </view> + </view> + </view> + + <view class="row status-row"> + <view class="col-50"> + <view class="form-group"> + <label class="form-label lab">妫�楠屾椂闂�:</label> + <input class="form-input" disabled="true" type="text" v-model="item.inspectionTime"/> + </view> + </view> + <view class="col-50"> + <view class="form-group status-group"> + <label class="form-label lab">妫�楠岀粨鏋�:</label> + <span class="status-tag submitted-tag" :class="item.inspectionResult === '鍚堟牸' ? 'success' : 'danger'"> + {{ item.inspectionResult || '寰呮楠�' }} + </span> + </view> + </view> + </view> + + <view class="row"> + <view class="col-100"> + <view class="form-group"> + <label class="form-label lab">妫�楠屼汉:</label> + <input class="form-input" disabled="true" type="text" v-model="item.inspectionUser"/> + </view> + </view> + </view> + </view> + </template> + </uni-list-item> + </uni-list> + </view> + </view> + </view> + + <!-- 鍔犺浇鏇村缁勪欢 --> + <view v-if="isLoading || noData" class="load-more-container"> + <uni-load-more :status="options.status" /> + </view> + </view> +</template> + +<script> +export default { + components: {}, + data() { + return { + items: ['妫�楠岃褰�'], + current: 0, + data: [], + tipShow: false, + + // 鍒嗛〉鍙傛暟 + pageIndex: 1, + limit: 20, + totalPage: 0, + totalCount: 0, + noData: false, + isLoading: false, + + // 鍔犺浇鏇村缁勪欢鐘舵�� + options: { + status: 'more' + } + }; + }, + onLoad() { + this.init(); + }, + methods: { + init() { + this.loadData(); + }, + + loadData() { + if (this.isLoading) return; + + this.isLoading = true; + let userName = this.$loginInfo.account; + + // 鏋勯�犺姹傚弬鏁� + let requestData = { + pageIndex: this.pageIndex, + limit: this.limit + }; + + // 鏍规嵁褰撳墠鏍囩椤垫坊鍔犵瓫閫夋潯浠� + if (this.current === 1) { + // 宸插畬鎴� - 鏈夋楠岀粨鏋滅殑璁板綍 + requestData.hasInspectionResult = true; + } + + this.$post({ + url: "/MesLaboratory/GetPage", + data: requestData + }).then(res => { + if (this.pageIndex === 1) { + // 濡傛灉鏄涓�椤碉紝鐩存帴瑕嗙洊鍘熸暟鎹� + this.data = res.data.tbBillList || []; + } else { + if (res.data.tbBillList && res.data.tbBillList.length > 0) { + // 濡傛灉鏄笅涓�椤碉紝杩藉姞鏂版暟鎹� + this.data = [...this.data, ...res.data.tbBillList]; + } + } + + this.totalCount = res.data.totalCount || 0; + this.totalPage = Math.ceil(this.totalCount / this.limit); + + this.noData = this.pageIndex >= this.totalPage; + this.isLoading = false; + + // 鏇存柊鍔犺浇鏇村鐘舵�� + this.options.status = this.noData ? 'noMore' : 'more'; + }).catch(err => { + console.error('鑾峰彇瀹為獙瀹ゆ暟鎹け璐�:', err); + this.isLoading = false; + this.options.status = 'fail'; + this.$showMessage('鑾峰彇鏁版嵁澶辫触锛岃閲嶈瘯'); + }); + }, + + viewDetail(item) { + // 璺宠浆鍒癓aboratory.vue椤甸潰 + uni.navigateTo({ + url: `Laboratory?id=${item.id || ''}` + }); + }, + + onClickItem(index) { + if (this.current !== index.currentIndex) { + this.current = index.currentIndex; + this.data = []; + this.pageIndex = 1; + this.init(); + } + } + }, + + /** + * 涓嬫媺鍒锋柊鍥炶皟鍑芥暟 + */ + onPullDownRefresh() { + this.pageIndex = 1; + this.init(); + this.tipShow = true; + + uni.stopPullDownRefresh(); + + setTimeout(() => { + this.tipShow = false; + }, 1000); + }, + + /** + * 涓婃媺鍔犺浇鍥炶皟鍑芥暟 + */ + onReachBottom() { + if (this.noData || this.isLoading) return; + + this.isLoading = true; + this.pageIndex++; + this.init(); + }, + + onShow() { + // 姣忔杩涘叆椤甸潰閮戒細鎵ц鐨勬柟娉� + // this.init(); + } +}; +</script> + +<style lang="scss"> +@import '@/common/uni-ui.scss'; + +/* 鍏ㄥ眬鏍峰紡 */ +page { + display: flex; + flex-direction: column; + box-sizing: border-box; + background-color: #f8f9fa; + min-height: 100%; + height: auto; + padding-bottom: 80px; +} + +.container { + padding: 0; + background-color: #f8f9fa; +} + +/* 椤堕儴鎻愮ず妗� */ +.tips { + position: fixed; + top: 0; + left: 0; + right: 0; + display: flex; + align-items: center; + justify-content: center; + color: #3a86ff; + font-size: 14px; + line-height: 40px; + background-color: #e6f7ff; + height: 0; + opacity: 0; + transform: translateY(-100%); + transition: all 0.3s ease; + z-index: 1000; + box-shadow: 0 2px 10px rgba(64, 158, 255, 0.2); +} + +.tips-ani { + transform: translateY(0); + height: 40px; + opacity: 1; +} + +.tips-icon { + margin-right: 8px; + font-size: 18px; + font-weight: bold; +} + +/* 鍥哄畾鏍囩椤垫牱寮� */ +.fixed-tabs { + background-color: #fff; + border-bottom: 2px solid #409EFF; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); + position: sticky; + top: 0; + z-index: 999; +} + +/* 鍒嗘鎺т欢鎸夐挳鏍峰紡澧炲己 */ +.uni-segmented-control__button { + font-weight: 500; + font-size: 16px; + color: #606266; + transition: all 0.2s; +} + +.uni-segmented-control__button--active { + color: #409EFF; + border-bottom: 2px solid #409EFF; + background-color: transparent; + font-weight: 600; +} + +/* 鍐呭鍖哄煙 */ +.content { + width: 100%; + padding: 15px; + box-sizing: border-box; + margin-top: 10px; +} + +/* 鍗$墖鏍峰紡 */ +.card-header, .card-body { + border-radius: 12px; + padding: 18px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05); + transition: all 0.3s ease; +} + +.card-header { + margin-bottom: 10px; + display: flex; + align-items: center; +} + +.card-body { + margin-bottom: 15px; +} + +/* 鏈畬鎴愮姸鎬佸崱鐗囨牱寮� */ +.pending-header { + background: linear-gradient(145deg, #f0f9ff, #e0f2fe); + border-left: 4px solid #409EFF; +} + +.pending-body { + background-color: #f0f9ff; +} + +/* 宸插畬鎴愮姸鎬佸崱鐗囨牱寮� */ +.submitted-header { + background: linear-gradient(145deg, #f6f6f6, #e9e9e9); + border-left: 4px solid #909399; +} + +.submitted-body { + background-color: #f6f6f6; +} + +/* 琛ㄥ崟鏍峰紡 */ +.form-group { + display: flex; + align-items: flex-start; + margin-bottom: 18px; +} + +.form-label { + margin-bottom: 0; + padding: 6px 10px; + font-size: 14px; + width: 100px; + color: #606266; + flex-shrink: 0; + font-weight: 500; +} + +.form-label.lab { + color: #303133; + font-weight: 600; +} + +.form-input { + flex: 1; + margin-bottom: 0; + padding: 10px 14px; + font-size: 14px; + background-color: rgba(255, 255, 255, 0.7); + border: 1px solid #dcdfe6; + border-radius: 8px; + color: #303133; + transition: all 0.2s; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); +} + +.form-input:active { + transform: scale(0.99); +} + +/* 宸ュ崟鍙峰簳鑹� */ +.order-no { + background-color: #e6f7ff; + border-color: #bfdbfe; + font-weight: 500; +} + +/* 琛屽拰鍒楀竷灞� */ +.row { + display: flex; + margin-bottom: 18px; +} + +.status-row { + border-top: 1px dashed #dcdfe6; + padding-top: 12px; + margin-top: 12px; +} + +.col-50 { + flex: 1; + margin-right: 18px; +} + +.col-50:last-child { + margin-right: 0; +} + +.col-100 { + flex: 1; +} + +/* 鐘舵�佹爣绛� */ +.status-group { + align-items: center; +} + +.status-tag { + display: inline-block; + padding: 6px 12px; + font-size: 14px; + border-radius: 20px; + margin-left: 12px; + font-weight: 500; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); +} + +.status-tag.success { + background-color: #e6f7ed; + color: #36b37e; + border: 1px solid #d1fae5; +} + +.status-tag.danger { + background-color: #ffefef; + color: #ff4d4f; + border: 1px solid #fee2e2; +} + +.submitted-tag { + background-color: rgba(144, 147, 153, 0.1); + color: #909399; +} + +/* 绌虹姸鎬� */ +.empty-state { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 60px 0; + color: #909399; +} + +.empty-icon { + font-size: 64px; + margin-bottom: 24px; + color: #c0c4cc; +} + +.empty-text { + font-size: 16px; + font-weight: 500; +} + +/* 鍔犺浇鏇村瀹瑰櫒 */ +.load-more-container { + padding: 30px 0; + text-align: center; +} + +/* 鍒楄〃椤瑰姩鐢� */ +.enhanced-list { + transition: all 0.3s ease; + border-radius: 12px; + overflow: hidden; +} + +.enhanced-list:active { + transform: translateY(2px); + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); +} + +.enhanced-list:hover { + box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08); + transform: translateY(-2px); +} +</style> -- Gitblit v1.9.3