| | |
| | | v-if="inspectionList.length > 0"> |
| | | <view v-for="(item, index) in inspectionList" |
| | | :key="index"> |
| | | <view class="inspection-item" |
| | | @click="viewDetail(item)"> |
| | | <view class="inspection-item"> |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <!-- <view class="material-icon" |
| | |
| | | </view> |
| | | </view> |
| | | <view class="status-tags"> |
| | | <u-tag :type="getTagType(item.checkResult)" |
| | | <u-tag :type="getPassRateTagType(item.passRate)" |
| | | v-if="item.passRate != null && item.passRate !== ''" |
| | | size="mini" |
| | | class="status-tag"> |
| | | {{ item.checkResult }} |
| | | {{ formatPassRate(item.passRate) }} |
| | | </u-tag> |
| | | <u-tag :type="getStateTagType(item.inspectState)" |
| | | size="mini" |
| | |
| | | <text class="detail-value">{{ item.checkName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">数量</text> |
| | | <text class="detail-label">总数量</text> |
| | | <text class="detail-value">{{ item.quantity || 0 }} {{ item.unit || '' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">合格数量</text> |
| | | <text class="detail-value">{{ item.qualifiedQuantity ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">不合格数量</text> |
| | | <text class="detail-value">{{ item.unqualifiedQuantity ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">检测单位</text> |
| | |
| | | return inspectState ? "checkmark-circle" : "time"; |
| | | }; |
| | | |
| | | // 获取标签类型 |
| | | const getTagType = checkResult => { |
| | | if (checkResult === "合格") return "success"; |
| | | if (checkResult === "不合格") return "error"; |
| | | return "default"; |
| | | const formatPassRate = val => { |
| | | if (val === null || val === undefined || val === "") return "-"; |
| | | const n = Number(val); |
| | | if (Number.isNaN(n)) return String(val); |
| | | if (n > 0 && n <= 1) return `${(n * 100).toFixed(1)}%`; |
| | | return `${Number.isInteger(n) ? n : Number(n.toFixed(1))}%`; |
| | | }; |
| | | |
| | | const getPassRateTagType = val => { |
| | | if (val === null || val === undefined || val === "") return "default"; |
| | | let n = Number(val); |
| | | if (Number.isNaN(n)) return "default"; |
| | | if (n > 0 && n <= 1) n *= 100; |
| | | if (n >= 100) return "success"; |
| | | if (n >= 60) return "warning"; |
| | | return "error"; |
| | | }; |
| | | |
| | | const isFullPassByPassRate = item => { |
| | | const v = item.passRate; |
| | | if (v === null || v === undefined || v === "") return false; |
| | | const n = Number(v); |
| | | if (Number.isNaN(n)) return false; |
| | | if (n > 0 && n <= 1) return n >= 1; |
| | | return n >= 100; |
| | | }; |
| | | |
| | | // 获取状态标签类型 |
| | |
| | | item => !item.inspectState |
| | | ).length; |
| | | qualifiedCount.value = inspectionList.value.filter( |
| | | item => item.checkResult === "合格" |
| | | isFullPassByPassRate |
| | | ).length; |
| | | }) |
| | | .catch(err => { |