From cbd4fd7015296e419cce2fe84196e16cfc20ad88 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 05 二月 2026 17:22:57 +0800
Subject: [PATCH] 进销存升级app: 1.通过审批的采购台账所有数据都不能编辑修改。不单单包含产品
---
src/pages/procurementManagement/procurementLedger/detail.vue | 47 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/src/pages/procurementManagement/procurementLedger/detail.vue b/src/pages/procurementManagement/procurementLedger/detail.vue
index 41df1af..004713b 100644
--- a/src/pages/procurementManagement/procurementLedger/detail.vue
+++ b/src/pages/procurementManagement/procurementLedger/detail.vue
@@ -17,27 +17,30 @@
</up-form-item>
<up-form-item label="閿�鍞悎鍚屽彿"
prop="salesContractNo"
- required
- @click="showPicker = true">
+ required>
<up-input v-model="form.salesContractNo"
- readonly=""
- @click="showPicker = true"
+ readonly
+ :disabled="isReadOnly"
+ @click="!isReadOnly && (showPicker = true)"
placeholder="鐐瑰嚮閫夋嫨閿�鍞悎鍚屽彿" />
<template #right>
<up-icon name="arrow-right"
+ v-if="!isReadOnly"
@click="showPicker = true"></up-icon>
</template>
</up-form-item>
<up-form-item label="渚涘簲鍟嗗悕绉�"
prop="supplierName"
required
- @click="showCustomerPicker = true">
+ >
<up-input v-model="form.supplierName"
- readonly=""
- @click="showCustomerPicker = true"
+ readonly
+ :disabled="isReadOnly"
+ @click="!isReadOnly && (showCustomerPicker = true)"
placeholder="鐐瑰嚮閫夋嫨渚涘簲鍟�" />
<template #right>
<up-icon name="arrow-right"
+ v-if="!isReadOnly"
@click="showCustomerPicker = true"></up-icon>
</template>
</up-form-item>
@@ -45,11 +48,13 @@
prop="projectName"
required>
<up-input v-model="form.projectName"
+ :disabled="isReadOnly"
placeholder="璇疯緭鍏ラ」鐩悕绉�" />
</up-form-item>
<up-form-item label="浠樻鏂瑰紡"
prop="paymentMethod">
<up-input v-model="form.paymentMethod"
+ :disabled="isReadOnly"
placeholder="璇疯緭鍏ヤ粯娆炬柟寮�" />
</up-form-item>
<up-form-item label="绛捐鏃ユ湡"
@@ -57,9 +62,11 @@
prop="executionDate">
<up-input v-model="form.executionDate"
placeholder="璇烽�夋嫨"
- readonly="" />
+ readonly
+ :disabled="isReadOnly" />
<template #right>
<up-icon name="arrow-right"
+ v-if="!isReadOnly"
@click="showTimePicker = true"></up-icon>
</template>
</up-form-item>
@@ -99,10 +106,12 @@
<text class="approver-name">{{ step.nickName }}</text>
</view>
<view class="delete-approver-btn"
+ v-if="!isReadOnly"
@click="removeApprover(stepIndex)">脳</view>
</view>
<view v-else
class="add-approver-btn"
+ v-if="!isReadOnly"
@click="addApprover(stepIndex)">
<view class="add-circle">+</view>
<text class="add-label">閫夋嫨瀹℃壒浜�</text>
@@ -111,11 +120,11 @@
<view class="step-line"
v-if="stepIndex < approverNodes.length - 1"></view>
<view class="delete-step-btn"
- v-if="approverNodes.length > 1"
+ v-if="approverNodes.length > 1 && !isReadOnly"
@click="removeApprovalStep(stepIndex)">鍒犻櫎鑺傜偣</view>
</view>
</view>
- <view class="add-step-btn">
+ <view class="add-step-btn" v-if="!isReadOnly">
<u-button icon="plus"
plain
type="primary"
@@ -400,13 +409,17 @@
const operationType = ref("");
const editData = ref(null);
const formRef = ref(null);
- // 瀹℃壒閫氳繃锛坅pprovalStatus === 3锛夊悗锛岀姝㈢紪杈�/鍒犻櫎浜у搧
+ // 瀹℃壒閫氳繃锛坅pprovalStatus === 3锛夊悗锛屾暣鍗曠姝㈢紪杈戯紙鍚骇鍝併�佸熀鏈俊鎭�佸鎵规祦绋嬶級
const isApprovalPassed = computed(() => {
const status = editData.value?.approvalStatus ?? form.value?.approvalStatus;
return Number(status) === 3;
});
const canEditProducts = computed(() => {
return operationType.value !== "view" && !isApprovalPassed.value;
+ });
+ // 鏄惁鏁翠綋鍙锛氭煡鐪嬫ā寮� 鎴� 宸插鎵归�氳繃
+ const isReadOnly = computed(() => {
+ return operationType.value === "view" || isApprovalPassed.value;
});
const userStore = useUserStore();
@@ -891,6 +904,14 @@
};
const onSubmit = () => {
+ // 瀹℃壒閫氳繃鐨勫彴璐︾姝㈠啀娆′慨鏀�
+ if (isApprovalPassed.value) {
+ uni.showToast({
+ title: "宸插鎵归�氳繃鐨勫彴璐︿笉鍏佽淇敼",
+ icon: "none",
+ });
+ return;
+ }
const hasEmptyApprover = approverNodes.value.some(node => !node.userId);
if (hasEmptyApprover) {
uni.showToast({
@@ -1096,6 +1117,7 @@
};
const addApprover = stepIndex => {
+ if (isReadOnly.value) return;
// 璺宠浆鍒拌仈绯讳汉閫夋嫨椤甸潰
uni.setStorageSync("stepIndex", stepIndex);
uni.navigateTo({
@@ -1104,18 +1126,21 @@
};
const addApprovalStep = () => {
+ if (isReadOnly.value) return;
// 娣诲姞鏂扮殑瀹℃壒姝ラ
approverNodes.value.push({ userId: null, nickName: null });
console.log(approverNodes.value, "approverNodes.value");
};
const removeApprover = stepIndex => {
+ if (isReadOnly.value) return;
// 绉婚櫎瀹℃壒浜�
approverNodes.value[stepIndex].userId = null;
approverNodes.value[stepIndex].nickName = null;
};
const removeApprovalStep = stepIndex => {
+ if (isReadOnly.value) return;
// 纭繚鑷冲皯淇濈暀涓�涓鎵规楠�
if (approverNodes.value.length > 1) {
approverNodes.value.splice(stepIndex, 1);
--
Gitblit v1.9.3