From 4c8d18cc5ed8a7b0e220c91a858d16d0310896df Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 29 六月 2026 16:50:03 +0800
Subject: [PATCH] BOM新增修改删除功能开发、以及BOM结构的可编辑
---
src/pages/qualityManagement/materialInspection/add.vue | 140 +++++++++++++++++++++++-----------------------
1 files changed, 69 insertions(+), 71 deletions(-)
diff --git a/src/pages/qualityManagement/materialInspection/add.vue b/src/pages/qualityManagement/materialInspection/add.vue
index 0309813..fec83fd 100644
--- a/src/pages/qualityManagement/materialInspection/add.vue
+++ b/src/pages/qualityManagement/materialInspection/add.vue
@@ -51,6 +51,7 @@
</up-form-item>
<up-form-item label="鎸囨爣閫夋嫨"
prop="testStandardId"
+ required
border-bottom>
<up-input v-model="testStandardDisplay"
placeholder="璇烽�夋嫨鎸囨爣"
@@ -67,14 +68,32 @@
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"
@@ -82,19 +101,6 @@
<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"
@@ -114,9 +120,10 @@
border-bottom>
<up-input v-model="form.checkTime"
placeholder="璇烽�夋嫨妫�娴嬫棩鏈�"
- readonly />
+ readonly
+ @click="showDatePicker" />
<!-- <template #right>
- <up-icon name="calendar"
+ <up-icon name="arrow-right"
@click="showDatePicker"></up-icon>
</template> -->
</up-form-item>
@@ -191,11 +198,15 @@
</up-button>
</view>
<!-- 鏃ユ湡閫夋嫨鍣� -->
- <up-popup v-model:show="showDate"
- mode="date"
- :start-year="2020"
- :end-year="2030"
- @confirm="confirmDate" />
+ <up-popup :show="showDate"
+ mode="bottom"
+ @close="showDate = false">
+ <up-datetime-picker :show="true"
+ v-model="pickerValue"
+ @confirm="confirmDate"
+ @cancel="showDate = false"
+ mode="date" />
+ </up-popup>
<!-- 渚涘簲鍟嗛�夋嫨 -->
<up-action-sheet :show="showSupplierSheet"
:actions="supplierOptions"
@@ -214,12 +225,6 @@
@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"
@@ -309,7 +314,7 @@
<script setup>
import { ref, computed, onMounted, nextTick } from "vue";
- import { onShow } from "@dcloudio/uni-app";
+ import { onShow, onLoad } from "@dcloudio/uni-app";
import PageHeader from "@/components/PageHeader.vue";
import dayjs from "dayjs";
import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
@@ -337,6 +342,7 @@
const loading = ref(false);
// 鏃ユ湡閫夋嫨鍣�
const showDate = ref(false);
+ const pickerValue = ref(Date.now());
// 渚涘簲鍟嗛�夋嫨
const showSupplierSheet = ref(false);
// 浜у搧閫夋嫨
@@ -345,8 +351,6 @@
const showProductTree = ref(false);
// 瑙勬牸鍨嬪彿閫夋嫨
const showModelSheet = ref(false);
- // 妫�娴嬬粨鏋滈�夋嫨
- const showResultSheet = ref(false);
// 妫�楠屽憳閫夋嫨
const showInspectorSheet = ref(false);
// 鎸囨爣閫夋嫨
@@ -364,8 +368,9 @@
testStandardId: "",
unit: "",
quantity: "",
+ qualifiedQuantity: "",
+ unqualifiedQuantity: "",
checkCompany: "",
- checkResult: "",
productMainId: null,
purchaseLedgerId: null,
});
@@ -385,11 +390,6 @@
const modelOptions = ref([]);
// 妫�楠屽憳鍒楄〃
const userList = ref([]);
- // 妫�娴嬬粨鏋滈�夐」
- const resultOptions = ref([
- { label: "鍚堟牸", value: "鍚堟牸" },
- { label: "涓嶅悎鏍�", value: "涓嶅悎鏍�" },
- ]);
// 鎸囨爣閫夐」
const testStandardOptions = ref([]);
// 褰撳墠浜у搧ID
@@ -417,13 +417,6 @@
}));
});
- const resultSheetOptions = computed(() => {
- return resultOptions.value.map(item => ({
- name: item.label,
- value: item.value,
- }));
- });
-
const userSheetOptions = computed(() => {
return userList.value.map(item => ({
name: item.nickName,
@@ -448,19 +441,18 @@
{ required: true, message: "璇烽�夋嫨浜у搧鍨嬪彿", trigger: "change" },
],
testStandardId: [
- { required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change" },
+ { required: true, message: "璇烽�夋嫨鎸囨爣", trigger: "change" },
],
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" },
- ],
};
// 鏄惁涓虹紪杈戞ā寮�
const isEdit = computed(() => {
- const id = getPageId();
+ const id = optionsId.value;
return !!id;
});
@@ -469,13 +461,6 @@
const v = form.value || {};
return !!(v.productMainId != null || v.purchaseLedgerId != null);
});
-
- // 鑾峰彇椤甸潰ID
- const getPageId = () => {
- const pages = getCurrentPages();
- const currentPage = pages[pages.length - 1];
- return currentPage.options.id;
- };
// 杩斿洖涓婁竴椤�
const goBack = () => {
@@ -490,6 +475,7 @@
// 纭鏃ユ湡閫夋嫨
const confirmDate = e => {
form.value.checkTime = dayjs(e.value).format("YYYY-MM-DD");
+ showDate.value = false;
};
// 閫夋嫨渚涘簲鍟�
@@ -567,12 +553,6 @@
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;
};
// 閫夋嫨妫�楠屽憳
@@ -697,22 +677,29 @@
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("璇烽�夋嫨妫�娴嬬粨鏋�");
+ if (!form.value.testStandardId) {
+ showToast("璇烽�夋嫨鎸囨爣");
return;
}
-
loading.value = true;
form.value.inspectType = 0;
- if (isEdit.value) {
+ if (!isEdit.value) {
tableData.value.forEach(item => {
delete item.id;
});
@@ -720,6 +707,8 @@
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("淇濆瓨鎴愬姛");
@@ -743,7 +732,7 @@
// 鍒濆鍖栬〃鍗�
const initForm = async () => {
- const id = getPageId();
+ const id = optionsId.value;
if (id) {
// 缂栬緫妯″紡锛屽姞杞芥暟鎹�
// 鍏堥噸缃〃鍗曟暟鎹�
@@ -759,7 +748,8 @@
unit: "",
quantity: "",
checkCompany: "",
- checkResult: "",
+ qualifiedQuantity: "",
+ unqualifiedQuantity: "",
productMainId: null,
purchaseLedgerId: null,
};
@@ -781,7 +771,8 @@
unit: "kg",
quantity: 1000,
checkCompany: "绗笁鏂规娴嬫満鏋�",
- checkResult: "鍚堟牸",
+ qualifiedQuantity: 0,
+ unqualifiedQuantity: 0,
productMainId: null,
purchaseLedgerId: null,
};
@@ -860,8 +851,9 @@
testStandardId: "",
unit: "",
quantity: "",
+ qualifiedQuantity: "",
+ unqualifiedQuantity: "",
checkCompany: "",
- checkResult: "",
productMainId: null,
purchaseLedgerId: null,
};
@@ -896,6 +888,12 @@
onShow(() => {
initForm();
});
+
+ const optionsId = ref("");
+ onLoad(options => {
+ optionsId.value = options.id || "";
+ initForm();
+ });
</script>
<style scoped lang="scss">
--
Gitblit v1.9.3