From 03a05815d7ea5612206b6cfe5d6537b4d4cedc0a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 九月 2026 11:41:32 +0800
Subject: [PATCH] 天津潜宇塑胶app 1.添加采购需求、库存盘点、计件单价配置、产量统计、材料消耗核算、成本核算分析页面
---
src/pages/qualityManagement/processInspection/add.vue | 61 ++++++++++++++++++++----------
1 files changed, 40 insertions(+), 21 deletions(-)
diff --git a/src/pages/qualityManagement/processInspection/add.vue b/src/pages/qualityManagement/processInspection/add.vue
index 2f6a6d0..2fd5984 100644
--- a/src/pages/qualityManagement/processInspection/add.vue
+++ b/src/pages/qualityManagement/processInspection/add.vue
@@ -16,9 +16,9 @@
<up-input v-model="form.process"
placeholder="璇烽�夋嫨宸ュ簭"
readonly
- :disabled="processQuantityDisabled" />
+ :disabled="processQuantityDisabled || isReadonly" />
<template #right>
- <up-icon @click="showprocessSheet = true"
+ <up-icon @click="!isReadonly && (showprocessSheet = true)"
name="arrow-right" />
</template>
</up-form-item>
@@ -29,10 +29,10 @@
<up-input v-model="form.productName"
placeholder="璇烽�夋嫨浜у搧"
readonly
- @click="showProductTree = true"
- :disabled="isEdit" />
+ @click="!isReadonly && (showProductTree = true)"
+ :disabled="isEdit || isReadonly" />
<template #right>
- <up-icon @click="showProductTree = true"
+ <up-icon @click="!isReadonly && (showProductTree = true)"
name="arrow-right" />
</template>
</up-form-item>
@@ -43,9 +43,9 @@
<up-input v-model="form.model"
placeholder="璇烽�夋嫨瑙勬牸鍨嬪彿"
readonly
- :disabled="isEdit" />
+ :disabled="isEdit || isReadonly" />
<template #right>
- <up-icon @click="showModelSheet = true"
+ <up-icon @click="!isReadonly && (showModelSheet = true)"
name="arrow-right" />
</template>
</up-form-item>
@@ -55,7 +55,8 @@
border-bottom>
<up-input v-model="testStandardDisplay"
placeholder="璇烽�夋嫨鎸囨爣"
- readonly />
+ readonly
+ :disabled="isReadonly" />
<template #right>
<up-icon @click="openTestStandardSheet"
name="arrow-right" />
@@ -75,13 +76,14 @@
<up-input v-model="form.quantity"
type="number"
placeholder="璇疯緭鍏ユ暟閲�"
- :disabled="processQuantityDisabled" />
+ :disabled="processQuantityDisabled || isReadonly" />
</up-form-item>
<up-form-item label="妫�娴嬪崟浣�"
prop="checkCompany"
border-bottom>
<up-input v-model="form.checkCompany"
placeholder="璇疯緭鍏ユ娴嬪崟浣�"
+ :disabled="isReadonly"
clearable />
</up-form-item>
<up-form-item label="妫�娴嬬粨鏋�"
@@ -91,9 +93,10 @@
<up-input v-model="form.checkResult"
placeholder="璇烽�夋嫨妫�娴嬬粨鏋�"
readonly
+ :disabled="isReadonly"
@click="showResultSheet" />
<template #right>
- <up-icon @click="showResultSheet = true"
+ <up-icon @click="!isReadonly && (showResultSheet = true)"
name="arrow-right" />
</template>
</up-form-item>
@@ -103,9 +106,10 @@
<up-input v-model="form.checkName"
placeholder="璇烽�夋嫨妫�楠屽憳"
readonly
+ :disabled="isReadonly"
@click="showInspectorSheet" />
<template #right>
- <up-icon @click="showInspectorSheet = true"
+ <up-icon @click="!isReadonly && (showInspectorSheet = true)"
name="arrow-right" />
</template>
</up-form-item>
@@ -115,7 +119,8 @@
border-bottom>
<up-input v-model="form.checkTime"
placeholder="璇烽�夋嫨妫�娴嬫棩鏈�"
- readonly />
+ readonly
+ :disabled="isReadonly" />
<!-- <template #right>
<up-icon name="calendar"
@click="showDatePicker"></up-icon>
@@ -155,6 +160,7 @@
<text class="step-label">妫�楠屽�硷細</text>
<up-input v-model="item.testValue"
placeholder="璇疯緭鍏ユ楠屽��"
+ :disabled="isReadonly"
clearable
border-bottom
class="step-input" />
@@ -174,14 +180,16 @@
size="default"
@click="goBack"
class="bottom-btn">
- 鍙栨秷
+ {{ isReadonly ? '杩斿洖' : '鍙栨秷' }}
</up-button>
- <up-button type="primary"
+ <!-- 宸叉彁浜ゅ崟鎹彧璇伙紝闅愯棌淇濆瓨/鎻愪氦 -->
+ <up-button v-if="!isReadonly"
+ type="primary"
size="default"
@click="submitForm"
:loading="loading"
class="bottom-btn">
- {{ isEdit ? '淇濆瓨' : '鎻愪氦' }}
+ 淇濆瓨
</up-button>
</view>
<!-- 鏃ユ湡閫夋嫨鍣� -->
@@ -469,6 +477,9 @@
return !!(v.productMainId != null || v.purchaseLedgerId != null);
});
+ // 宸叉彁浜わ紙inspectState=1锛夊崟鎹暣浣撳彧璇�
+ const isReadonly = computed(() => Number(form.value?.inspectState) === 1);
+
// 杩斿洖涓婁竴椤�
const goBack = () => {
uni.navigateBack();
@@ -476,11 +487,13 @@
// 鏄剧ず鏃ユ湡閫夋嫨鍣�
const showDatePicker = () => {
+ if (isReadonly.value) return;
showDate.value = true;
};
// 纭鏃ユ湡閫夋嫨
const confirmDate = e => {
+ if (isReadonly.value) return;
form.value.checkTime = dayjs(e.value).format("YYYY-MM-DD");
};
@@ -601,7 +614,7 @@
});
};
const openTestStandardSheet = () => {
- console.log("openTestStandardSheet");
+ if (isReadonly.value) return;
showTestStandardSheet.value = true;
};
@@ -678,6 +691,11 @@
// 鎻愪氦琛ㄥ崟
const submitForm = async () => {
console.log("submitForm", form.value, tableData.value);
+ // 宸叉彁浜ゅ崟鎹姝繚瀛�/鎻愪氦
+ if (isReadonly.value) {
+ showToast("妫�楠屽崟宸叉彁浜わ紝涓嶅厑璁镐慨鏀�");
+ return;
+ }
try {
// await formRef.value.validate();
if (!form.value.productModelId) {
@@ -717,21 +735,22 @@
const data = { ...form.value, qualityInspectParams: tableData.value };
data.quantity = Number(data.quantity);
if (isEdit.value) {
- const res = await qualityInspectUpdate(data);
+ await qualityInspectUpdate(data);
showToast("淇濆瓨鎴愬姛");
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
- const res = await qualityInspectAdd(data);
- showToast("鎻愪氦鎴愬姛");
+ // 鏂板浠呬繚瀛樿崏绋匡紝姝e紡鎻愪氦鍦ㄥ垪琛ㄩ〉銆屾彁浜ゃ�嶆寜閽�
+ await qualityInspectAdd(data);
+ showToast("淇濆瓨鎴愬姛");
setTimeout(() => {
uni.navigateBack();
}, 1500);
}
} catch (error) {
- console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
- showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ // request.ts 宸茬粺涓� toast 鍚庣 msg锛岃繖閲屽彧璁板綍
+ console.error("鎻愪氦澶辫触:", error);
} finally {
loading.value = false;
}
--
Gitblit v1.9.3