From caae61dc1f477168b3c26404a86b33e3559dec50 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 01 六月 2026 18:14:37 +0800
Subject: [PATCH] 新疆马铃薯 1.采购台账页面隐藏一些字段
---
src/views/qualityManagement/processInspection/components/quickCheckDia.vue | 327 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 327 insertions(+), 0 deletions(-)
diff --git a/src/views/qualityManagement/processInspection/components/quickCheckDia.vue b/src/views/qualityManagement/processInspection/components/quickCheckDia.vue
new file mode 100644
index 0000000..0aa069b
--- /dev/null
+++ b/src/views/qualityManagement/processInspection/components/quickCheckDia.vue
@@ -0,0 +1,327 @@
+<template>
+ <div>
+ <el-dialog
+ v-model="dialogVisible"
+ title="蹇�熸楠�"
+ width="70%"
+ @close="closeDialog"
+ >
+ <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="妫�娴嬬粨鏋滐細" prop="checkResult">
+ <el-select v-model="form.checkResult" placeholder="璇烽�夋嫨妫�娴嬬粨鏋�" style="width: 100%" @change="handleCheckResultChange">
+ <el-option label="鍚堟牸" value="鍚堟牸" />
+ <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" />
+ <el-option label="閮ㄥ垎鍚堟牸" value="閮ㄥ垎鍚堟牸" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎸囨爣閫夋嫨锛�" prop="testStandardId">
+ <el-select v-model="form.testStandardId" placeholder="璇烽�夋嫨鎸囨爣" style="width: 100%" @change="handleTestStandardChange">
+ <el-option
+ v-for="item in testStandardOptions"
+ :key="item.id"
+ :label="item.standardName || item.standardNo"
+ :value="item.id"
+ />
+ </el-select>
+ </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>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="妫�娴嬪崟浣嶏細" prop="checkCompany">
+ <el-input v-model="form.checkCompany" placeholder="璇疯緭鍏ユ娴嬪崟浣�" clearable/>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <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-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-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="妫�楠屽憳锛�" prop="checkName">
+ <el-select v-model="form.checkName" placeholder="璇烽�夋嫨妫�楠屽憳" clearable style="width: 100%">
+ <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime">
+ <el-date-picker
+ v-model="form.checkTime"
+ type="date"
+ placeholder="璇烽�夋嫨妫�娴嬫棩鏈�"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%"
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </template>
+ </el-form>
+ <PIMTable
+ rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :tableLoading="tableLoading"
+ height="400"
+ >
+ <template #slot="{ row }">
+ <el-input v-model="row.testValue" clearable/>
+ </template>
+ </PIMTable>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="submitForm">纭</el-button>
+ <el-button @click="closeDialog">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
+import { userListNoPage } from "@/api/system/user.js";
+import { batchQuickInspect } from "@/api/qualityManagement/rawMaterialInspection.js";
+import { qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId } from "@/api/qualityManagement/metricMaintenance.js";
+
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(['close', 'success']);
+
+const dialogVisible = ref(false);
+const userList = ref([]);
+const selectedIds = ref([]);
+const selectedRows = ref([]);
+const testStandardOptions = ref([]);
+const inspectType = ref(1); // 杩囩▼妫�楠岀被鍨�
+
+const data = reactive({
+ form: {
+ checkResult: '',
+ testStandardId: '',
+ quantity: undefined,
+ qualifiedQuantity: undefined,
+ unqualifiedQuantity: undefined,
+ checkCompany: '',
+ checkName: '',
+ checkTime: '',
+ },
+ rules: {
+ checkResult: [{ required: true, message: "璇烽�夋嫨妫�娴嬬粨鏋�", trigger: "change" }],
+ testStandardId: [{ required: true, message: "璇烽�夋嫨鎸囨爣", trigger: "change" }],
+ quantity: [{ required: true, message: "璇疯緭鍏ユ暟閲�", trigger: "blur" }],
+ qualifiedQuantity: [{ required: true, message: "璇疯緭鍏ュ悎鏍兼暟閲�", trigger: "blur" }],
+ unqualifiedQuantity: [{ required: true, message: "璇疯緭鍏ヤ笉鍚堟牸鏁伴噺", trigger: "blur" }],
+ checkCompany: [{ required: true, message: "璇疯緭鍏ユ娴嬪崟浣�", trigger: "blur" }],
+ checkName: [{ required: true, message: "璇烽�夋嫨妫�楠屽憳", trigger: "change" }],
+ checkTime: [{ required: true, message: "璇烽�夋嫨妫�娴嬫棩鏈�", trigger: "change" }],
+ },
+});
+const { form, rules } = toRefs(data);
+
+const tableColumn = ref([
+ {
+ label: "鎸囨爣",
+ prop: "parameterItem",
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
+ label: "鏍囧噯鍊�",
+ prop: "standardValue",
+ },
+ {
+ label: "鍐呮帶鍊�",
+ prop: "controlValue",
+ },
+ {
+ label: "妫�楠屽��",
+ prop: "testValue",
+ dataType: 'slot',
+ slot: 'slot',
+ },
+]);
+const tableData = ref([]);
+const tableLoading = ref(false);
+
+// 鎵撳紑寮规
+const openDialog = async (ids, rows) => {
+ selectedIds.value = ids;
+ selectedRows.value = rows;
+ dialogVisible.value = true;
+
+ // 鍔犺浇鐢ㄦ埛鍒楄〃
+ const userListsRes = await userListNoPage();
+ userList.value = userListsRes.data;
+
+ // 鍔犺浇鎸囨爣閫夐」锛堟牴鎹涓�涓�変腑琛岀殑浜у搧ID锛�
+ if (rows && rows.length > 0 && rows[0].productId) {
+ const params = {
+ productId: rows[0].productId,
+ inspectType: 1
+ };
+ const res = await qualityInspectDetailByProductId(params);
+ testStandardOptions.value = res.data || [];
+ } else {
+ testStandardOptions.value = [];
+ }
+
+ // 閲嶇疆琛ㄥ崟
+ form.value = {
+ checkResult: '',
+ testStandardId: '',
+ quantity: undefined,
+ qualifiedQuantity: undefined,
+ unqualifiedQuantity: undefined,
+ checkCompany: '',
+ checkName: '',
+ checkTime: '',
+ };
+ tableData.value = [];
+
+ await nextTick();
+ proxy.$refs.formRef?.clearValidate();
+};
+
+// 鎸囨爣閫夋嫨鍙樺寲澶勭悊
+const handleTestStandardChange = async (testStandardId) => {
+ if (!testStandardId) {
+ tableData.value = [];
+ return;
+ }
+ tableLoading.value = true;
+ try {
+ const res = await getQualityTestStandardParamByTestStandardId(testStandardId);
+ tableData.value = (res.data || []).map(item => ({
+ ...item,
+ id: null,
+ testValue: ''
+ }));
+ } catch (error) {
+ console.error('鑾峰彇鏍囧噯鍙傛暟澶辫触:', error);
+ tableData.value = [];
+ } finally {
+ tableLoading.value = false;
+ }
+};
+
+// 妫�娴嬬粨鏋滃彉鍖栧鐞�
+const handleCheckResultChange = (value) => {
+ if (value === '鍚堟牸') {
+ // 鍚堟牸鏃讹紝鍚堟牸鏁伴噺绛変簬鏁伴噺锛屼笉鍚堟牸鏁伴噺涓�0
+ form.value.qualifiedQuantity = form.value.quantity || 0;
+ form.value.unqualifiedQuantity = 0;
+ } else if (value === '涓嶅悎鏍�') {
+ // 涓嶅悎鏍兼椂锛屽悎鏍兼暟閲忎负0锛屼笉鍚堟牸鏁伴噺绛変簬鏁伴噺
+ form.value.qualifiedQuantity = 0;
+ form.value.unqualifiedQuantity = form.value.quantity || 0;
+ }
+};
+
+// 鏁伴噺鍙樺寲澶勭悊
+const handleQuantityChange = (value) => {
+ if (form.value.checkResult === '鍚堟牸') {
+ form.value.qualifiedQuantity = value || 0;
+ form.value.unqualifiedQuantity = 0;
+ } else if (form.value.checkResult === '涓嶅悎鏍�') {
+ form.value.qualifiedQuantity = 0;
+ form.value.unqualifiedQuantity = value || 0;
+ }
+};
+
+// 鍚堟牸鏁伴噺鍙樺寲澶勭悊
+const handleQualifiedQuantityChange = (value) => {
+ const quantity = form.value.quantity || 0;
+ if (value > quantity) {
+ proxy.$modal.msgWarning("鍚堟牸鏁伴噺涓嶈兘澶т簬鎬绘暟閲�");
+ form.value.qualifiedQuantity = quantity;
+ form.value.unqualifiedQuantity = 0;
+ } else {
+ form.value.unqualifiedQuantity = Number((quantity - value).toFixed(2));
+ }
+ updateCheckResult();
+};
+
+// 涓嶅悎鏍兼暟閲忓彉鍖栧鐞�
+const handleUnqualifiedQuantityChange = (value) => {
+ const quantity = form.value.quantity || 0;
+ if (value > quantity) {
+ proxy.$modal.msgWarning("涓嶅悎鏍兼暟閲忎笉鑳藉ぇ浜庢�绘暟閲�");
+ form.value.unqualifiedQuantity = quantity;
+ form.value.qualifiedQuantity = 0;
+ } else {
+ form.value.qualifiedQuantity = Number((quantity - value).toFixed(2));
+ }
+ updateCheckResult();
+};
+
+// 鏍规嵁鍚堟牸/涓嶅悎鏍兼暟閲忔洿鏂版娴嬬粨鏋�
+const updateCheckResult = () => {
+ 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) {
+ form.value.checkResult = '涓嶅悎鏍�';
+ } else if (qualified > 0 && unqualified > 0) {
+ form.value.checkResult = '閮ㄥ垎鍚堟牸';
+ }
+};
+
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+ proxy.$refs.formRef.validate((valid) => {
+ if (valid) {
+ const data = {
+ ids: selectedIds.value,
+ inspectType: inspectType.value,
+ ...form.value,
+ paramList: tableData.value
+ };
+ batchQuickInspect(data).then(res => {
+ proxy.$modal.msgSuccess(res.msg || "蹇�熸楠屽畬鎴�");
+ emit('success');
+ closeDialog();
+ });
+ }
+ });
+};
+
+// 鍏抽棴寮规
+const closeDialog = () => {
+ dialogVisible.value = false;
+ emit('close');
+};
+
+defineExpose({
+ openDialog,
+});
+</script>
+
+<style scoped>
+</style>
--
Gitblit v1.9.3