From adb79299e86660a7f205466cf1ea48c6b25b1398 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 18 六月 2026 13:14:37 +0800
Subject: [PATCH] 1.计量器具台账上传附件报错 2.质量拉的数据不对(未明确) 3.计量器具台账逾期的做标红提醒 4.设备保养定时任务和记录要加上具体的保养内容 5.质量要区分质检规则抽检还是全检,抽检的话是抽多少百分比 6.供应商管理东西太少了,没有资质文件啊这些东西(是不是可以参考pro) 7.采购审批把人从李莹莹改成龙红星
---
src/views/qualityManagement/processInspection/components/quickCheckDia.vue | 150 ++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 132 insertions(+), 18 deletions(-)
diff --git a/src/views/qualityManagement/processInspection/components/quickCheckDia.vue b/src/views/qualityManagement/processInspection/components/quickCheckDia.vue
index 0aa069b..718b12b 100644
--- a/src/views/qualityManagement/processInspection/components/quickCheckDia.vue
+++ b/src/views/qualityManagement/processInspection/components/quickCheckDia.vue
@@ -9,6 +9,14 @@
<el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
<el-row :gutter="30">
<el-col :span="12">
+ <el-form-item label="妫�楠屾ā寮忥細">
+ <el-tag :type="inspectModeTag" size="large">{{ inspectModeLabel }}</el-tag>
+ <span v-if="showSampleFields && currentInspect" class="mode-tip">
+ (鎶芥姣斾緥: {{ currentInspect.sampleRatio || 0 }}%)
+ </span>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
<el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult">
<el-select v-model="form.checkResult" placeholder="璇烽�夋嫨妫�娴嬬粨鏋�" style="width: 100%" @change="handleCheckResultChange">
<el-option label="鍚堟牸" value="鍚堟牸" />
@@ -17,6 +25,8 @@
</el-select>
</el-form-item>
</el-col>
+ </el-row>
+ <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鎸囨爣閫夋嫨锛�" prop="testStandardId">
<el-select v-model="form.testStandardId" placeholder="璇烽�夋嫨鎸囨爣" style="width: 100%" @change="handleTestStandardChange">
@@ -29,12 +39,27 @@
</el-select>
</el-form-item>
</el-col>
+ <el-col :span="12" v-if="showSampleFields">
+ <el-form-item label="鎶芥鏁伴噺锛�" prop="sampleQuantity">
+ <el-input-number
+ :step="1"
+ :min="1"
+ :max="maxSampleQuantity"
+ style="width: 100%"
+ v-model="form.sampleQuantity"
+ placeholder="璇疯緭鍏ユ娊妫�鏁伴噺"
+ :precision="0"
+ />
+ <span class="tip-text">鏈�澶у彲鎶芥: {{ maxSampleQuantity }}</span>
+ </el-form-item>
+ </el-col>
</el-row>
<template v-if="form.checkResult">
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鏁伴噺锛�" prop="quantity">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏ユ暟閲�" clearable :precision="2" @change="handleQuantityChange"/>
+ <el-form-item label="妫�楠屾暟閲忥細" prop="quantity">
+ <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏ユ暟閲�" clearable :precision="2" @change="handleQuantityChange" :disabled="showSampleFields"/>
+ <span v-if="showSampleFields" class="tip-text">鎶芥妯″紡涓嬫楠屾暟閲忕瓑浜庢娊妫�鏁伴噺</span>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -46,12 +71,12 @@
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鍚堟牸鏁伴噺锛�" prop="qualifiedQuantity">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.qualifiedQuantity" placeholder="璇疯緭鍏ュ悎鏍兼暟閲�" clearable :precision="2" @change="handleQualifiedQuantityChange"/>
+ <el-input-number :step="0.01" :min="0" :max="form.quantity" style="width: 100%" v-model="form.qualifiedQuantity" placeholder="璇疯緭鍏ュ悎鏍兼暟閲�" clearable :precision="2" @change="handleQualifiedQuantityChange"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="涓嶅悎鏍兼暟閲忥細" prop="unqualifiedQuantity">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.unqualifiedQuantity" placeholder="璇疯緭鍏ヤ笉鍚堟牸鏁伴噺" clearable :precision="2" @change="handleUnqualifiedQuantityChange"/>
+ <el-input-number :step="0.01" :min="0" :max="form.quantity" style="width: 100%" v-model="form.unqualifiedQuantity" placeholder="璇疯緭鍏ヤ笉鍚堟牸鏁伴噺" clearable :precision="2" @change="handleUnqualifiedQuantityChange"/>
</el-form-item>
</el-col>
</el-row>
@@ -101,7 +126,7 @@
</template>
<script setup>
-import { ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
+import { ref, reactive, toRefs, getCurrentInstance, nextTick, computed, watch } from "vue";
import { userListNoPage } from "@/api/system/user.js";
import { batchQuickInspect } from "@/api/qualityManagement/rawMaterialInspection.js";
import { qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId } from "@/api/qualityManagement/metricMaintenance.js";
@@ -115,12 +140,14 @@
const selectedRows = ref([]);
const testStandardOptions = ref([]);
const inspectType = ref(1); // 杩囩▼妫�楠岀被鍨�
+const currentInspect = ref(null);
const data = reactive({
form: {
checkResult: '',
testStandardId: '',
quantity: undefined,
+ sampleQuantity: undefined,
qualifiedQuantity: undefined,
unqualifiedQuantity: undefined,
checkCompany: '',
@@ -140,6 +167,59 @@
});
const { form, rules } = toRefs(data);
+// 妫�楠屾ā寮忔爣绛�
+const inspectModeLabel = computed(() => {
+ if (!currentInspect.value) return '鍏ㄦ';
+ return currentInspect.value.inspectRule === 1 ? '鎶芥' : '鍏ㄦ';
+});
+
+const inspectModeTag = computed(() => {
+ if (!currentInspect.value) return 'success';
+ return currentInspect.value.inspectRule === 1 ? 'warning' : 'success';
+});
+
+// 鏄惁鏄剧ず鎶芥瀛楁
+const showSampleFields = computed(() => {
+ return currentInspect.value && currentInspect.value.inspectRule === 1;
+});
+
+// 鎬绘暟閲�
+const totalQuantity = computed(() => {
+ return currentInspect.value?.quantity || 0;
+});
+
+// 鏈�澶ф娊妫�鏁伴噺
+const maxSampleQuantity = computed(() => {
+ return totalQuantity.value;
+});
+
+// 榛樿鎶芥鏁伴噺锛堜粠妫�楠屽崟鑾峰彇鎴栨寜姣斾緥璁$畻锛�
+const defaultSampleQuantity = computed(() => {
+ if (!currentInspect.value) return 0;
+ if (currentInspect.value.sampleQuantity) {
+ return currentInspect.value.sampleQuantity;
+ }
+ if (currentInspect.value.sampleRatio) {
+ return Math.ceil(totalQuantity.value * currentInspect.value.sampleRatio / 100);
+ }
+ return totalQuantity.value;
+});
+
+// 鐩戝惉鎶芥鏁伴噺鍙樺寲
+watch(() => form.value.sampleQuantity, (val) => {
+ if (showSampleFields.value && val) {
+ form.value.quantity = val;
+ // 鏇存柊鍚堟牸/涓嶅悎鏍兼暟閲�
+ if (form.value.checkResult === '鍚堟牸') {
+ form.value.qualifiedQuantity = val;
+ form.value.unqualifiedQuantity = 0;
+ } else if (form.value.checkResult === '涓嶅悎鏍�') {
+ form.value.qualifiedQuantity = 0;
+ form.value.unqualifiedQuantity = val;
+ }
+ }
+});
+
const tableColumn = ref([
{
label: "鎸囨爣",
@@ -150,7 +230,7 @@
prop: "unit",
},
{
- label: "鏍囧噯鍊�",
+ label: "鍘傚鏍囧噯鍊�",
prop: "standardValue",
},
{
@@ -172,11 +252,18 @@
selectedIds.value = ids;
selectedRows.value = rows;
dialogVisible.value = true;
-
+
+ // 鍙栫涓�鏉℃楠屽崟鐨勪俊鎭綔涓哄弬鑰�
+ if (rows && rows.length > 0) {
+ currentInspect.value = rows[0];
+ } else {
+ currentInspect.value = null;
+ }
+
// 鍔犺浇鐢ㄦ埛鍒楄〃
const userListsRes = await userListNoPage();
userList.value = userListsRes.data;
-
+
// 鍔犺浇鎸囨爣閫夐」锛堟牴鎹涓�涓�変腑琛岀殑浜у搧ID锛�
if (rows && rows.length > 0 && rows[0].productId) {
const params = {
@@ -188,12 +275,16 @@
} else {
testStandardOptions.value = [];
}
-
+
// 閲嶇疆琛ㄥ崟
+ const totalQty = currentInspect.value?.quantity || undefined;
+ const sampleQty = showSampleFields.value ? defaultSampleQuantity.value : undefined;
+
form.value = {
checkResult: '',
testStandardId: '',
- quantity: undefined,
+ quantity: showSampleFields.value ? sampleQty : totalQty,
+ sampleQuantity: sampleQty,
qualifiedQuantity: undefined,
unqualifiedQuantity: undefined,
checkCompany: '',
@@ -201,7 +292,7 @@
checkTime: '',
};
tableData.value = [];
-
+
await nextTick();
proxy.$refs.formRef?.clearValidate();
};
@@ -230,14 +321,16 @@
// 妫�娴嬬粨鏋滃彉鍖栧鐞�
const handleCheckResultChange = (value) => {
+ const qty = form.value.quantity || 0;
if (value === '鍚堟牸') {
- // 鍚堟牸鏃讹紝鍚堟牸鏁伴噺绛変簬鏁伴噺锛屼笉鍚堟牸鏁伴噺涓�0
- form.value.qualifiedQuantity = form.value.quantity || 0;
+ form.value.qualifiedQuantity = qty;
form.value.unqualifiedQuantity = 0;
} else if (value === '涓嶅悎鏍�') {
- // 涓嶅悎鏍兼椂锛屽悎鏍兼暟閲忎负0锛屼笉鍚堟牸鏁伴噺绛変簬鏁伴噺
form.value.qualifiedQuantity = 0;
- form.value.unqualifiedQuantity = form.value.quantity || 0;
+ form.value.unqualifiedQuantity = qty;
+ } else if (value === '閮ㄥ垎鍚堟牸') {
+ form.value.qualifiedQuantity = undefined;
+ form.value.unqualifiedQuantity = undefined;
}
};
@@ -256,7 +349,7 @@
const handleQualifiedQuantityChange = (value) => {
const quantity = form.value.quantity || 0;
if (value > quantity) {
- proxy.$modal.msgWarning("鍚堟牸鏁伴噺涓嶈兘澶т簬鎬绘暟閲�");
+ proxy.$modal.msgWarning("鍚堟牸鏁伴噺涓嶈兘澶т簬妫�楠屾暟閲�");
form.value.qualifiedQuantity = quantity;
form.value.unqualifiedQuantity = 0;
} else {
@@ -269,7 +362,7 @@
const handleUnqualifiedQuantityChange = (value) => {
const quantity = form.value.quantity || 0;
if (value > quantity) {
- proxy.$modal.msgWarning("涓嶅悎鏍兼暟閲忎笉鑳藉ぇ浜庢�绘暟閲�");
+ proxy.$modal.msgWarning("涓嶅悎鏍兼暟閲忎笉鑳藉ぇ浜庢楠屾暟閲�");
form.value.unqualifiedQuantity = quantity;
form.value.qualifiedQuantity = 0;
} else {
@@ -283,7 +376,7 @@
const qualified = form.value.qualifiedQuantity || 0;
const unqualified = form.value.unqualifiedQuantity || 0;
const quantity = form.value.quantity || 0;
-
+
if (qualified === quantity && unqualified === 0) {
form.value.checkResult = '鍚堟牸';
} else if (unqualified === quantity && qualified === 0) {
@@ -297,6 +390,15 @@
const submitForm = () => {
proxy.$refs.formRef.validate((valid) => {
if (valid) {
+ // 閮ㄥ垎鍚堟牸鏃舵牎楠屾暟閲�
+ if (form.value.checkResult === '閮ㄥ垎鍚堟牸') {
+ const sum = (form.value.qualifiedQuantity || 0) + (form.value.unqualifiedQuantity || 0);
+ if (sum > (form.value.quantity || 0)) {
+ proxy.$modal.msgWarning('鍚堟牸鏁伴噺+涓嶅悎鏍兼暟閲忎笉鑳借秴杩囨楠屾暟閲�');
+ return;
+ }
+ }
+
const data = {
ids: selectedIds.value,
inspectType: inspectType.value,
@@ -324,4 +426,16 @@
</script>
<style scoped>
+.mode-tip {
+ margin-left: 10px;
+ font-size: 13px;
+ color: #909399;
+}
+
+.tip-text {
+ display: block;
+ font-size: 12px;
+ color: #909399;
+ margin-top: 4px;
+}
</style>
--
Gitblit v1.9.3