| | |
| | | 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> |
| | |
| | | </view> |
| | | <!-- 操作按钮 --> |
| | | <view class="action-buttons"> |
| | | <!-- <u-button type="primary" |
| | | <u-button type="primary" |
| | | size="small" |
| | | class="action-btn" |
| | | :disabled="item.inspectState" |
| | | @click.stop="startInspection(item)"> |
| | | 编辑 |
| | | </u-button> --> |
| | | </u-button> |
| | | <u-button type="info" |
| | | size="small" |
| | | class="action-btn" |
| | | @click.stop="viewDetail(item)"> |
| | | 详情 |
| | | </u-button> |
| | | <!-- <u-button type="success" |
| | | <u-button type="success" |
| | | size="small" |
| | | class="action-btn" |
| | | :disabled="item.inspectState" |
| | | @click.stop="submitInspection(item)"> |
| | | 提交 |
| | | </u-button> --> |
| | | </u-button> |
| | | </view> |
| | | <view class="action-buttons"> |
| | | <!-- <u-button type="info" |
| | | <u-button type="info" |
| | | size="small" |
| | | class="action-btn" |
| | | @click.stop="viewFileList(item)"> |
| | |
| | | :disabled="item.inspectState || item.checkName !== ''" |
| | | @click.stop="assignInspector(item)"> |
| | | 分配检验员 |
| | | </u-button> --> |
| | | </u-button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | </view> |
| | | <!-- 分页组件 --> |
| | | <!-- 浮动新增按钮 --> |
| | | <!-- <view class="fab-button" |
| | | <view class="fab-button" |
| | | @click="addInspection"> |
| | | <up-icon name="plus" |
| | | size="24" |
| | | color="#ffffff"></up-icon> |
| | | </view> --> |
| | | </view> |
| | | <!-- 日期选择器 --> |
| | | <up-popup v-model:show="showDate" |
| | | mode="date" |
| | |
| | | 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 => { |
| | |
| | | |
| | | // 新增检验 |
| | | const addInspection = () => { |
| | | console.log("新增检验"); |
| | | uni.navigateTo({ |
| | | url: "/pages/qualityManagement/materialInspection/add", |
| | | }); |