更新质量管理,新增合格数量和不合格数量字段,修改数量标签为总数量,计算合格率展示
| | |
| | | placeholder="请输入单位" |
| | | disabled /> |
| | | </up-form-item> |
| | | <up-form-item label="数量" |
| | | <up-form-item label="总数量" |
| | | prop="quantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.quantity" |
| | | type="number" |
| | | placeholder="请输入数量" |
| | | placeholder="请输入总数量" |
| | | :disabled="processQuantityDisabled" /> |
| | | </up-form-item> |
| | | <up-form-item label="合格数量" |
| | | prop="qualifiedQuantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.qualifiedQuantity" |
| | | type="number" |
| | | placeholder="请输入合格数量" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="不合格数量" |
| | | prop="unqualifiedQuantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.unqualifiedQuantity" |
| | | type="number" |
| | | placeholder="请输入不合格数量" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="检测单位" |
| | | prop="checkCompany" |
| | |
| | | <up-input v-model="form.checkCompany" |
| | | placeholder="请输入检测单位" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="检测结果" |
| | | prop="checkResult" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.checkResult" |
| | | placeholder="请选择检测结果" |
| | | readonly |
| | | @click="showResultSheet" /> |
| | | <template #right> |
| | | <up-icon @click="showResultSheet = true" |
| | | name="arrow-right" /> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="检验员" |
| | | prop="checkName" |
| | |
| | | @select="selectModel" |
| | | @close="showModelSheet = false" |
| | | title="选择规格型号" /> |
| | | <!-- 检测结果选择 --> |
| | | <up-action-sheet :show="showResultSheet" |
| | | :actions="resultSheetOptions" |
| | | @select="selectResult" |
| | | @close="showResultSheet = false" |
| | | title="选择检测结果" /> |
| | | <!-- 检验员选择 --> |
| | | <up-action-sheet :show="showInspectorSheet" |
| | | :actions="userSheetOptions" |
| | |
| | | const showProductTree = ref(false); |
| | | // 规格型号选择 |
| | | const showModelSheet = ref(false); |
| | | // 检测结果选择 |
| | | const showResultSheet = ref(false); |
| | | // 检验员选择 |
| | | const showInspectorSheet = ref(false); |
| | | // 指标选择 |
| | |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }); |
| | |
| | | const modelOptions = ref([]); |
| | | // 检验员列表 |
| | | const userList = ref([]); |
| | | // 检测结果选项 |
| | | const resultOptions = ref([ |
| | | { label: "合格", value: "合格" }, |
| | | { label: "不合格", value: "不合格" }, |
| | | ]); |
| | | // 指标选项 |
| | | const testStandardOptions = ref([]); |
| | | // 当前产品ID |
| | |
| | | return modelOptions.value.map(item => ({ |
| | | name: item.model, |
| | | value: item.id, |
| | | })); |
| | | }); |
| | | |
| | | const resultSheetOptions = computed(() => { |
| | | return resultOptions.value.map(item => ({ |
| | | name: item.label, |
| | | value: item.value, |
| | | })); |
| | | }); |
| | | |
| | |
| | | ], |
| | | unit: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | checkCompany: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | checkResult: [ |
| | | { required: true, message: "请选择检测结果", trigger: "change" }, |
| | | ], |
| | | }; |
| | | |
| | | // 是否为编辑模式 |
| | |
| | | modelOptions.value.find(item => item.id == value)?.model || ""; |
| | | form.value.unit = |
| | | modelOptions.value.find(item => item.id == value)?.unit || ""; |
| | | }; |
| | | |
| | | // 选择检测结果 |
| | | const selectResult = e => { |
| | | form.value.checkResult = e.value; |
| | | showResultSheet.value = false; |
| | | }; |
| | | |
| | | // 选择检验员 |
| | |
| | | // return; |
| | | // } |
| | | if (!form.value.quantity) { |
| | | showToast("请输入数量"); |
| | | showToast("请输入总数量"); |
| | | return; |
| | | } |
| | | if (!form.value.qualifiedQuantity && form.value.qualifiedQuantity !== 0) { |
| | | showToast("请输入合格数量"); |
| | | return; |
| | | } |
| | | if (!form.value.unqualifiedQuantity && form.value.unqualifiedQuantity !== 0) { |
| | | showToast("请输入不合格数量"); |
| | | return; |
| | | } |
| | | if (!form.value.productId) { |
| | |
| | | showToast("请选择指标"); |
| | | return; |
| | | } |
| | | if (!form.value.checkResult) { |
| | | showToast("请选择检测结果"); |
| | | return; |
| | | } |
| | | |
| | | loading.value = true; |
| | | |
| | | form.value.inspectType = 2; |
| | |
| | | |
| | | const data = { ...form.value, qualityInspectParams: tableData.value }; |
| | | data.quantity = Number(data.quantity); |
| | | data.qualifiedQuantity = Number(data.qualifiedQuantity); |
| | | data.unqualifiedQuantity = Number(data.unqualifiedQuantity); |
| | | if (isEdit.value) { |
| | | const res = await qualityInspectUpdate(data); |
| | | showToast("保存成功"); |
| | |
| | | unit: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | unit: "kg", |
| | | quantity: 1000, |
| | | checkCompany: "第三方检测机构", |
| | | checkResult: "合格", |
| | | qualifiedQuantity: 0, |
| | | unqualifiedQuantity: 0, |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | </view> |
| | | <text class="header-title">{{ detailData.productName || '-' }}</text> |
| | | <view class="status-tags"> |
| | | <u-tag v-if="detailData.checkResult" |
| | | :type="getTagType(detailData.checkResult)" |
| | | <u-tag v-if="detailData.passRate != null && detailData.passRate !== ''" |
| | | type="primary" |
| | | size="small" |
| | | class="status-tag"> |
| | | {{ detailData.checkResult || '-' }} |
| | | 合格率 {{ formatPassRate(detailData.passRate) }} |
| | | </u-tag> |
| | | <u-tag :type="getStateTagType(detailData.inspectState)" |
| | | size="small" |
| | |
| | | <text class="detail-value">{{ detailData.unit || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">数量</text> |
| | | <text class="detail-value">{{ detailData.quantity || 0 }}</text> |
| | | <text class="detail-label">总数量</text> |
| | | <text class="detail-value">{{ detailData.quantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">合格数量</text> |
| | | <text class="detail-value">{{ detailData.qualifiedQuantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">不合格数量</text> |
| | | <text class="detail-value">{{ detailData.unqualifiedQuantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">合格率</text> |
| | | <text class="detail-value">{{ formatPassRate(detailData.passRate) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">检测单位</text> |
| | |
| | | }; |
| | | |
| | | // 获取标签类型 |
| | | const getTagType = result => { |
| | | switch (result) { |
| | | case "合格": |
| | | return "success"; |
| | | case "不合格": |
| | | return "error"; |
| | | default: |
| | | return "info"; |
| | | } |
| | | const formatPassRate = rate => { |
| | | if (rate === null || rate === undefined || rate === "") return "-"; |
| | | const num = Number(rate); |
| | | if (isNaN(num)) return rate; |
| | | if (num <= 1) return `${(num * 100).toFixed(2)}%`; |
| | | return `${num}%`; |
| | | }; |
| | | |
| | | // 获取状态标签类型 |
| | |
| | | </view> |
| | | </view> |
| | | <view class="status-tags"> |
| | | <u-tag v-if="item.checkResult" |
| | | :type="getTagType(item.checkResult)" |
| | | <u-tag v-if="item.passRate != null && item.passRate !== ''" |
| | | type="primary" |
| | | size="mini" |
| | | class="status-tag"> |
| | | {{ item.checkResult }} |
| | | 合格率 {{ formatPassRate(item.passRate) }} |
| | | </u-tag> |
| | | <u-tag :type="getStateTagType(item.inspectState)" |
| | | size="mini" |
| | |
| | | return inspectState ? "checkmark-circle" : "time"; |
| | | }; |
| | | |
| | | // 获取标签类型 |
| | | const getTagType = checkResult => { |
| | | if (checkResult === "合格") return "success"; |
| | | if (checkResult === "不合格") return "error"; |
| | | return "default"; |
| | | // 格式化合格率 |
| | | const formatPassRate = rate => { |
| | | if (rate === null || rate === undefined || rate === "") return "-"; |
| | | const num = Number(rate); |
| | | if (isNaN(num)) return rate; |
| | | if (num <= 1) return `${(num * 100).toFixed(2)}%`; |
| | | return `${num}%`; |
| | | }; |
| | | |
| | | // 获取状态标签类型 |
| | |
| | | pendingCount.value = inspectionList.value.filter( |
| | | item => !item.inspectState |
| | | ).length; |
| | | qualifiedCount.value = inspectionList.value.filter( |
| | | item => item.checkResult === "合格" |
| | | ).length; |
| | | qualifiedCount.value = inspectionList.value.filter(item => { |
| | | const rate = Number(item.passRate); |
| | | if (isNaN(rate)) return false; |
| | | return rate <= 1 ? rate >= 1 : rate >= 100; |
| | | }).length; |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |
| | |
| | | placeholder="请输入单位" |
| | | disabled /> |
| | | </up-form-item> |
| | | <up-form-item label="数量" |
| | | <up-form-item label="总数量" |
| | | prop="quantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.quantity" |
| | | type="number" |
| | | placeholder="请输入数量" |
| | | placeholder="请输入总数量" |
| | | :disabled="supplierQuantityDisabled" /> |
| | | </up-form-item> |
| | | <up-form-item label="合格数量" |
| | | prop="qualifiedQuantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.qualifiedQuantity" |
| | | type="number" |
| | | placeholder="请输入合格数量" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="不合格数量" |
| | | prop="unqualifiedQuantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.unqualifiedQuantity" |
| | | type="number" |
| | | placeholder="请输入不合格数量" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="检测单位" |
| | | prop="checkCompany" |
| | |
| | | <up-input v-model="form.checkCompany" |
| | | placeholder="请输入检测单位" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="检测结果" |
| | | prop="checkResult" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.checkResult" |
| | | placeholder="请选择检测结果" |
| | | readonly |
| | | @click="showResultSheet" /> |
| | | <template #right> |
| | | <up-icon @click="showResultSheet = true" |
| | | name="arrow-right" /> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="检验员" |
| | | prop="checkName" |
| | |
| | | @select="selectModel" |
| | | @close="showModelSheet = false" |
| | | title="选择规格型号" /> |
| | | <!-- 检测结果选择 --> |
| | | <up-action-sheet :show="showResultSheet" |
| | | :actions="resultSheetOptions" |
| | | @select="selectResult" |
| | | @close="showResultSheet = false" |
| | | title="选择检测结果" /> |
| | | <!-- 检验员选择 --> |
| | | <up-action-sheet :show="showInspectorSheet" |
| | | :actions="userSheetOptions" |
| | |
| | | const showProductTree = ref(false); |
| | | // 规格型号选择 |
| | | const showModelSheet = ref(false); |
| | | // 检测结果选择 |
| | | const showResultSheet = ref(false); |
| | | // 检验员选择 |
| | | const showInspectorSheet = ref(false); |
| | | // 指标选择 |
| | |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }); |
| | |
| | | const modelOptions = ref([]); |
| | | // 检验员列表 |
| | | const userList = ref([]); |
| | | // 检测结果选项 |
| | | const resultOptions = ref([ |
| | | { label: "合格", value: "合格" }, |
| | | { label: "不合格", value: "不合格" }, |
| | | ]); |
| | | // 指标选项 |
| | | const testStandardOptions = ref([]); |
| | | // 当前产品ID |
| | |
| | | return modelOptions.value.map(item => ({ |
| | | name: item.model, |
| | | value: item.id, |
| | | })); |
| | | }); |
| | | |
| | | const resultSheetOptions = computed(() => { |
| | | return resultOptions.value.map(item => ({ |
| | | name: item.label, |
| | | value: item.value, |
| | | })); |
| | | }); |
| | | |
| | |
| | | ], |
| | | unit: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | checkCompany: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | checkResult: [ |
| | | { required: true, message: "请选择检测结果", trigger: "change" }, |
| | | ], |
| | | }; |
| | | |
| | | // 是否为编辑模式 |
| | |
| | | modelOptions.value.find(item => item.id == value)?.model || ""; |
| | | form.value.unit = |
| | | modelOptions.value.find(item => item.id == value)?.unit || ""; |
| | | }; |
| | | |
| | | // 选择检测结果 |
| | | const selectResult = e => { |
| | | form.value.checkResult = e.value; |
| | | showResultSheet.value = false; |
| | | }; |
| | | |
| | | // 选择检验员 |
| | |
| | | return; |
| | | } |
| | | if (!form.value.quantity) { |
| | | showToast("请输入数量"); |
| | | showToast("请输入总数量"); |
| | | return; |
| | | } |
| | | if (!form.value.qualifiedQuantity && form.value.qualifiedQuantity !== 0) { |
| | | showToast("请输入合格数量"); |
| | | return; |
| | | } |
| | | if (!form.value.unqualifiedQuantity && form.value.unqualifiedQuantity !== 0) { |
| | | showToast("请输入不合格数量"); |
| | | return; |
| | | } |
| | | if (!form.value.productId) { |
| | |
| | | showToast("请选择指标"); |
| | | return; |
| | | } |
| | | if (!form.value.checkResult) { |
| | | showToast("请选择检测结果"); |
| | | return; |
| | | } |
| | | |
| | | loading.value = true; |
| | | |
| | | form.value.inspectType = 0; |
| | |
| | | |
| | | const data = { ...form.value, qualityInspectParams: tableData.value }; |
| | | data.quantity = Number(data.quantity); |
| | | data.qualifiedQuantity = Number(data.qualifiedQuantity); |
| | | data.unqualifiedQuantity = Number(data.unqualifiedQuantity); |
| | | if (isEdit.value) { |
| | | const res = await qualityInspectUpdate(data); |
| | | showToast("保存成功"); |
| | |
| | | unit: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | unit: "kg", |
| | | quantity: 1000, |
| | | checkCompany: "第三方检测机构", |
| | | checkResult: "合格", |
| | | qualifiedQuantity: 0, |
| | | unqualifiedQuantity: 0, |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | </view> |
| | | <text class="header-title">{{ detailData.productName || '-' }}</text> |
| | | <view class="status-tags"> |
| | | <u-tag v-if="detailData.checkResult" |
| | | :type="getTagType(detailData.checkResult)" |
| | | <u-tag v-if="detailData.passRate != null && detailData.passRate !== ''" |
| | | type="primary" |
| | | size="small" |
| | | class="status-tag"> |
| | | {{ detailData.checkResult || '-' }} |
| | | 合格率 {{ formatPassRate(detailData.passRate) }} |
| | | </u-tag> |
| | | <u-tag :type="getStateTagType(detailData.inspectState)" |
| | | size="small" |
| | |
| | | <text class="detail-value">{{ detailData.unit || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">数量</text> |
| | | <text class="detail-value">{{ detailData.quantity || 0 }}</text> |
| | | <text class="detail-label">总数量</text> |
| | | <text class="detail-value">{{ detailData.quantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">合格数量</text> |
| | | <text class="detail-value">{{ detailData.qualifiedQuantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">不合格数量</text> |
| | | <text class="detail-value">{{ detailData.unqualifiedQuantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">合格率</text> |
| | | <text class="detail-value">{{ formatPassRate(detailData.passRate) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">检测单位</text> |
| | |
| | | return dayjs(date).format("YYYY-MM-DD"); |
| | | }; |
| | | |
| | | // 获取标签类型 |
| | | const getTagType = result => { |
| | | switch (result) { |
| | | case "合格": |
| | | return "success"; |
| | | case "不合格": |
| | | return "error"; |
| | | default: |
| | | return "info"; |
| | | } |
| | | // 格式化合格率 |
| | | const formatPassRate = rate => { |
| | | if (rate === null || rate === undefined || rate === "") return "-"; |
| | | const num = Number(rate); |
| | | if (isNaN(num)) return rate; |
| | | if (num <= 1) return `${(num * 100).toFixed(2)}%`; |
| | | return `${num}%`; |
| | | }; |
| | | |
| | | // 获取状态标签类型 |
| | |
| | | </view> |
| | | </view> |
| | | <view class="status-tags"> |
| | | <u-tag v-if="item.checkResult" |
| | | :type="getTagType(item.checkResult)" |
| | | <u-tag v-if="item.passRate != null && item.passRate !== ''" |
| | | type="primary" |
| | | size="mini" |
| | | class="status-tag"> |
| | | {{ item.checkResult }} |
| | | 合格率 {{ formatPassRate(item.passRate) }} |
| | | </u-tag> |
| | | <u-tag :type="getStateTagType(item.inspectState)" |
| | | size="mini" |
| | |
| | | return inspectState ? "checkmark-circle" : "time"; |
| | | }; |
| | | |
| | | // 获取标签类型 |
| | | const getTagType = checkResult => { |
| | | if (checkResult === "合格") return "success"; |
| | | if (checkResult === "不合格") return "error"; |
| | | return "default"; |
| | | // 格式化合格率 |
| | | const formatPassRate = rate => { |
| | | if (rate === null || rate === undefined || rate === "") return "-"; |
| | | const num = Number(rate); |
| | | if (isNaN(num)) return rate; |
| | | if (num <= 1) return `${(num * 100).toFixed(2)}%`; |
| | | return `${num}%`; |
| | | }; |
| | | |
| | | // 获取状态标签类型 |
| | |
| | | pendingCount.value = inspectionList.value.filter( |
| | | item => !item.inspectState |
| | | ).length; |
| | | qualifiedCount.value = inspectionList.value.filter( |
| | | item => item.checkResult === "合格" |
| | | ).length; |
| | | qualifiedCount.value = inspectionList.value.filter(item => { |
| | | const rate = Number(item.passRate); |
| | | if (isNaN(rate)) return false; |
| | | return rate <= 1 ? rate >= 1 : rate >= 100; |
| | | }).length; |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |
| | |
| | | placeholder="请输入单位" |
| | | disabled /> |
| | | </up-form-item> |
| | | <up-form-item label="数量" |
| | | <up-form-item label="总数量" |
| | | prop="quantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.quantity" |
| | | type="number" |
| | | placeholder="请输入数量" |
| | | placeholder="请输入总数量" |
| | | :disabled="processQuantityDisabled" /> |
| | | </up-form-item> |
| | | <up-form-item label="合格数量" |
| | | prop="qualifiedQuantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.qualifiedQuantity" |
| | | type="number" |
| | | placeholder="请输入合格数量" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="不合格数量" |
| | | prop="unqualifiedQuantity" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.unqualifiedQuantity" |
| | | type="number" |
| | | placeholder="请输入不合格数量" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="检测单位" |
| | | prop="checkCompany" |
| | |
| | | <up-input v-model="form.checkCompany" |
| | | placeholder="请输入检测单位" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="检测结果" |
| | | prop="checkResult" |
| | | required |
| | | border-bottom> |
| | | <up-input v-model="form.checkResult" |
| | | placeholder="请选择检测结果" |
| | | readonly |
| | | @click="showResultSheet" /> |
| | | <template #right> |
| | | <up-icon @click="showResultSheet = true" |
| | | name="arrow-right" /> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="检验员" |
| | | prop="checkName" |
| | |
| | | @select="selectModel" |
| | | @close="showModelSheet = false" |
| | | title="选择规格型号" /> |
| | | <!-- 检测结果选择 --> |
| | | <up-action-sheet :show="showResultSheet" |
| | | :actions="resultSheetOptions" |
| | | @select="selectResult" |
| | | @close="showResultSheet = false" |
| | | title="选择检测结果" /> |
| | | <!-- 检验员选择 --> |
| | | <up-action-sheet :show="showInspectorSheet" |
| | | :actions="userSheetOptions" |
| | |
| | | const showProductTree = ref(false); |
| | | // 规格型号选择 |
| | | const showModelSheet = ref(false); |
| | | // 检测结果选择 |
| | | const showResultSheet = ref(false); |
| | | // 检验员选择 |
| | | const showInspectorSheet = ref(false); |
| | | // 指标选择 |
| | |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }); |
| | |
| | | const modelOptions = ref([]); |
| | | // 检验员列表 |
| | | const userList = ref([]); |
| | | // 检测结果选项 |
| | | const resultOptions = ref([ |
| | | { label: "合格", value: "合格" }, |
| | | { label: "不合格", value: "不合格" }, |
| | | ]); |
| | | // 指标选项 |
| | | const testStandardOptions = ref([]); |
| | | // 当前产品ID |
| | |
| | | return modelOptions.value.map(item => ({ |
| | | name: item.model, |
| | | value: item.id, |
| | | })); |
| | | }); |
| | | |
| | | const resultSheetOptions = computed(() => { |
| | | return resultOptions.value.map(item => ({ |
| | | name: item.label, |
| | | value: item.value, |
| | | })); |
| | | }); |
| | | |
| | |
| | | ], |
| | | unit: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | checkCompany: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | checkResult: [ |
| | | { required: true, message: "请选择检测结果", trigger: "change" }, |
| | | ], |
| | | }; |
| | | |
| | | // 是否为编辑模式 |
| | |
| | | modelOptions.value.find(item => item.id == value)?.model || ""; |
| | | form.value.unit = |
| | | modelOptions.value.find(item => item.id == value)?.unit || ""; |
| | | }; |
| | | |
| | | // 选择检测结果 |
| | | const selectResult = e => { |
| | | form.value.checkResult = e.value; |
| | | showResultSheet.value = false; |
| | | }; |
| | | |
| | | // 选择检验员 |
| | |
| | | return; |
| | | } |
| | | if (!form.value.quantity) { |
| | | showToast("请输入数量"); |
| | | showToast("请输入总数量"); |
| | | return; |
| | | } |
| | | if (!form.value.qualifiedQuantity && form.value.qualifiedQuantity !== 0) { |
| | | showToast("请输入合格数量"); |
| | | return; |
| | | } |
| | | if (!form.value.unqualifiedQuantity && form.value.unqualifiedQuantity !== 0) { |
| | | showToast("请输入不合格数量"); |
| | | return; |
| | | } |
| | | if (!form.value.productId) { |
| | |
| | | showToast("请选择指标"); |
| | | return; |
| | | } |
| | | if (!form.value.checkResult) { |
| | | showToast("请选择检测结果"); |
| | | return; |
| | | } |
| | | |
| | | loading.value = true; |
| | | |
| | | form.value.inspectType = 1; |
| | |
| | | |
| | | const data = { ...form.value, qualityInspectParams: tableData.value }; |
| | | data.quantity = Number(data.quantity); |
| | | data.qualifiedQuantity = Number(data.qualifiedQuantity); |
| | | data.unqualifiedQuantity = Number(data.unqualifiedQuantity); |
| | | if (isEdit.value) { |
| | | const res = await qualityInspectUpdate(data); |
| | | showToast("保存成功"); |
| | |
| | | unit: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | unit: "kg", |
| | | quantity: 1000, |
| | | checkCompany: "第三方检测机构", |
| | | checkResult: "合格", |
| | | qualifiedQuantity: 0, |
| | | unqualifiedQuantity: 0, |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | testStandardId: "", |
| | | unit: "", |
| | | quantity: "", |
| | | qualifiedQuantity: "", |
| | | unqualifiedQuantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | productMainId: null, |
| | | purchaseLedgerId: null, |
| | | }; |
| | |
| | | </view> |
| | | <text class="header-title">{{ detailData.productName || '-' }}</text> |
| | | <view class="status-tags"> |
| | | <u-tag v-if="detailData.checkResult" |
| | | :type="getTagType(detailData.checkResult)" |
| | | <u-tag v-if="detailData.passRate != null && detailData.passRate !== ''" |
| | | type="primary" |
| | | size="small" |
| | | class="status-tag"> |
| | | {{ detailData.checkResult }} |
| | | 合格率 {{ formatPassRate(detailData.passRate) }} |
| | | </u-tag> |
| | | <u-tag :type="getStateTagType(detailData.inspectState)" |
| | | size="small" |
| | |
| | | <text class="detail-value">{{ detailData.unit || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">数量</text> |
| | | <text class="detail-value">{{ detailData.quantity || 0 }}</text> |
| | | <text class="detail-label">总数量</text> |
| | | <text class="detail-value">{{ detailData.quantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">合格数量</text> |
| | | <text class="detail-value">{{ detailData.qualifiedQuantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">不合格数量</text> |
| | | <text class="detail-value">{{ detailData.unqualifiedQuantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">合格率</text> |
| | | <text class="detail-value">{{ formatPassRate(detailData.passRate) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">检测单位</text> |
| | |
| | | }; |
| | | |
| | | // 获取标签类型 |
| | | const getTagType = result => { |
| | | switch (result) { |
| | | case "合格": |
| | | return "success"; |
| | | case "不合格": |
| | | return "error"; |
| | | default: |
| | | return "info"; |
| | | } |
| | | const formatPassRate = rate => { |
| | | if (rate === null || rate === undefined || rate === "") return "-"; |
| | | const num = Number(rate); |
| | | if (isNaN(num)) return rate; |
| | | if (num <= 1) return `${(num * 100).toFixed(2)}%`; |
| | | return `${num}%`; |
| | | }; |
| | | |
| | | // 获取状态标签类型 |
| | |
| | | </view> |
| | | </view> |
| | | <view class="status-tags"> |
| | | <u-tag v-if="item.checkResult" |
| | | :type="getTagType(item.checkResult)" |
| | | <u-tag v-if="item.passRate != null && item.passRate !== ''" |
| | | type="primary" |
| | | size="mini" |
| | | class="status-tag"> |
| | | {{ item.checkResult }} |
| | | 合格率 {{ formatPassRate(item.passRate) }} |
| | | </u-tag> |
| | | <u-tag :type="getStateTagType(item.inspectState)" |
| | | size="mini" |
| | |
| | | return inspectState ? "checkmark-circle" : "time"; |
| | | }; |
| | | |
| | | // 获取标签类型 |
| | | const getTagType = checkResult => { |
| | | if (checkResult === "合格") return "success"; |
| | | if (checkResult === "不合格") return "error"; |
| | | return "default"; |
| | | // 格式化合格率 |
| | | const formatPassRate = rate => { |
| | | if (rate === null || rate === undefined || rate === "") return "-"; |
| | | const num = Number(rate); |
| | | if (isNaN(num)) return rate; |
| | | if (num <= 1) return `${(num * 100).toFixed(2)}%`; |
| | | return `${num}%`; |
| | | }; |
| | | |
| | | // 获取状态标签类型 |
| | |
| | | pendingCount.value = inspectionList.value.filter( |
| | | item => !item.inspectState |
| | | ).length; |
| | | qualifiedCount.value = inspectionList.value.filter( |
| | | item => item.checkResult === "合格" |
| | | ).length; |
| | | qualifiedCount.value = inspectionList.value.filter(item => { |
| | | const rate = Number(item.passRate); |
| | | if (isNaN(rate)) return false; |
| | | return rate <= 1 ? rate >= 1 : rate >= 100; |
| | | }).length; |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |