From 0c4bdf3dca76f9b8c348f2f7e48f9a6319dee4e1 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 17 四月 2026 17:09:22 +0800
Subject: [PATCH] 进销存升级 1.销售台账不能删除和编辑别人维护的数据 2.产品维护固定产品大类为:成品、半成品、原材料。
---
src/views/salesManagement/salesLedger/index.vue | 170 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 129 insertions(+), 41 deletions(-)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 8b7b17c..7c9ebf8 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -42,7 +42,7 @@
<el-table-column align="center" type="selection" width="55" fixed="left"/>
<el-table-column type="expand" width="60" fixed="left">
<template #default="props">
- <el-table :data="props.row.children" border show-summary :summary-method="summarizeChildrenTable">
+ <el-table :data="props.row.children" border show-summary :summary-method="(param) => summarizeChildrenTable(param, props.row)">
<el-table-column align="center" label="搴忓彿" type="index"/>
<el-table-column label="浜у搧澶х被" prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
@@ -51,10 +51,12 @@
width="100px"
align="center">
<template #default="scope">
- <el-tag v-if="scope.row.approveStatus === 1"
+
+ <el-tag v-if="scope.row.approveStatus === 1 && (!scope.row.shippingDate || !scope.row.shippingCarNumber)"
type="success">鍏呰冻</el-tag>
- <el-tag v-else
- type="danger">涓嶈冻</el-tag>
+ <el-tag v-else-if="scope.row.approveStatus === 0 && (scope.row.shippingDate || scope.row.shippingCarNumber)"
+ type="success">宸插嚭搴�</el-tag>
+ <el-tag v-else type="danger">涓嶈冻</el-tag>
</template>
</el-table-column>
<el-table-column label="鍙戣揣鐘舵��" width="140" align="center">
@@ -87,16 +89,15 @@
</el-table-column>
<el-table-column label="鏁伴噺" prop="quantity" />
<el-table-column label="绋庣巼(%)" prop="taxRate" />
- <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" />
- <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
- <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" />
+ <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="sensitiveAmountFormatter" />
+ <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="sensitiveAmountFormatter" />
+ <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="sensitiveAmountFormatter" />
<!--鎿嶄綔-->
<el-table-column Width="60px" label="鎿嶄綔" align="center">
<template #default="scope">
<el-button
link
- type="primary"
- size="small"
+ type="primary"
:disabled="!canShip(scope.row)"
@click="openDeliveryForm(scope.row)">
鍙戣揣
@@ -118,12 +119,11 @@
<el-table-column label="褰曞叆鏃ユ湡" prop="entryDate" width="120" show-overflow-tooltip />
<el-table-column label="绛捐鏃ユ湡" prop="executionDate" width="120" show-overflow-tooltip />
<el-table-column label="浜や粯鏃ユ湡" prop="deliveryDate" width="120" show-overflow-tooltip />
- <el-table-column fixed="right" label="鎿嶄綔" min-width="100" align="center">
+ <el-table-column label="澶囨敞" prop="remarks" width="200" show-overflow-tooltip />
+ <el-table-column fixed="right" label="鎿嶄綔" width="130" align="center">
<template #default="scope">
- <el-button link type="primary" size="small" @click="openForm('edit', scope.row)">缂栬緫</el-button>
-<!-- <el-button link type="primary" size="small" @click="openForm('view', scope.row)">璇︽儏</el-button>-->
- <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">闄勪欢</el-button>
-<!-- <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">鍙戣揣</el-button>-->
+ <el-button link type="primary" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫</el-button>
+ <el-button link type="primary" @click="downLoadFile(scope.row)">闄勪欢</el-button>
</template>
</el-table-column>
</el-table>
@@ -149,7 +149,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="涓氬姟鍛橈細" prop="salesman">
- <el-select v-model="form.salesman" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'">
+ <el-select v-model="form.salesman" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'" filterable>
<el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
:value="item.nickName" />
</el-select>
@@ -159,7 +159,7 @@
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customerId">
- <el-select v-model="form.customerId" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'">
+ <el-select v-model="form.customerId" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'" filterable>
<el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id">
{{
item.customerName + "鈥斺��" + item.taxpayerIdentificationNumber
@@ -242,14 +242,14 @@
</el-table>
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="澶囨敞路锛�" prop="remark">
- <el-input v-model="form.remark" placeholder="璇疯緭鍏�" clearable type="textarea" :rows="2" :disabled="operationType === 'view'" />
+ <el-form-item label="澶囨敞锛�" prop="remarks">
+ <el-input v-model="form.remarks" placeholder="璇疯緭鍏�" clearable type="textarea" :rows="2" :disabled="operationType === 'view'" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="闄勪欢鏉愭枡锛�" prop="remark">
+ <el-form-item label="闄勪欢鏉愭枡锛�" prop="salesLedgerFiles">
<el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload
:headers="upload.headers" :before-upload="handleBeforeUpload" :on-error="handleUploadError"
:on-success="handleUploadSuccess" :on-remove="handleRemove">
@@ -318,6 +318,15 @@
</el-table-column>
</el-table>
+ <pagination
+ v-show="quotationPage.total > 0"
+ :total="quotationPage.total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="quotationPage.current"
+ :limit="quotationPage.size"
+ @pagination="quotationPaginationChange"
+ />
+
<template #footer>
<el-button @click="quotationDialogVisible = false">鍏抽棴</el-button>
</template>
@@ -334,11 +343,8 @@
<el-row :gutter="30">
<el-col :span="24">
<el-form-item label="浜у搧澶х被锛�" prop="productCategory">
- <!-- <el-select v-model="productForm.productCategory" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
- </el-select> -->
- <el-tree-select v-model="productForm.productCategory" placeholder="璇烽�夋嫨" clearable check-strictly
- @change="getModels" :data="productOptions" :render-after-expand="false" style="width: 100%" />
+ <el-tree-select v-model="productForm.productCategory" placeholder="璇烽�夋嫨" clearable filterable check-strictly
+ @change="getModels" :data="productOptions" :render-after-expand="false" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
@@ -471,7 +477,6 @@
<div v-for="(item, index) in printData" :key="index" class="print-page">
<div class="delivery-note">
<div class="header">
- <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
<div class="document-title">闆跺敭鍙戣揣鍗�</div>
</div>
@@ -489,7 +494,7 @@
<div class="info-row">
<div>
<span class="label">瀹㈡埛鍚嶇О锛�</span>
- <span class="value">{{ item.customerName || '寮犵埍鏈�' }}</span>
+ <span class="value">{{ item.customerName }}</span>
</div>
<span class="label">鍗曞彿锛�</span>
<span class="value">{{ item.salesContractNo }}</span>
@@ -622,7 +627,6 @@
<div>
<el-button
type="danger"
- size="small"
@click="removeApproverNode(index)"
v-if="approverNodes.length > 1"
>鍒犻櫎</el-button>
@@ -670,6 +674,7 @@
import useFormData from "@/hooks/useFormData.js";
import dayjs from "dayjs";
import { getCurrentDate } from "@/utils/index.js";
+import {listCustomerPrivatePool} from "@/api/basicData/customerFile.js";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
@@ -710,6 +715,7 @@
maintenanceTime: "",
productData: [],
executionDate: "",
+ hasProductionRecord: false,
},
rules: {
salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -779,6 +785,12 @@
const quotationSearchForm = reactive({
quotationNo: "",
customer: "",
+});
+// 鎶ヤ环鍗曞脊妗嗗垎椤�
+const quotationPage = reactive({
+ current: 1,
+ size: 10,
+ total: 0,
});
const selectedQuotation = ref(null);
@@ -912,7 +924,49 @@
});
};
const formattedNumber = (row, column, cellValue) => {
+ if (cellValue === undefined || cellValue === null || cellValue === "") {
+ return "0.00";
+ }
return parseFloat(cellValue).toFixed(2);
+};
+const findLedgerRecordByRow = (row) => {
+ if (!row) return null;
+ if (
+ row.maintainer !== undefined ||
+ row.maintainerName !== undefined ||
+ row.entryPerson !== undefined ||
+ row.entryPersonName !== undefined
+ ) {
+ return row;
+ }
+ if (row.salesLedgerId !== undefined && row.salesLedgerId !== null) {
+ return tableData.value.find((item) => String(item.id) === String(row.salesLedgerId)) || null;
+ }
+ return null;
+};
+const isCurrentUserMaintainer = (row) => {
+ const ledgerRecord = findLedgerRecordByRow(row);
+ if (!ledgerRecord) return true;
+ const currentUserId = String(userStore.id ?? "");
+ const currentNickName = String(userStore.nickName ?? "").trim();
+ const maintainerId = ledgerRecord.maintainerId ?? ledgerRecord.entryPerson;
+ const maintainerName =
+ ledgerRecord.maintainerName ?? ledgerRecord.maintainer ?? ledgerRecord.entryPersonName;
+ if (maintainerId !== undefined && maintainerId !== null && String(maintainerId) !== "") {
+ return String(maintainerId) === currentUserId;
+ }
+ if (maintainerName !== undefined && maintainerName !== null && String(maintainerName).trim() !== "") {
+ return String(maintainerName).trim() === currentNickName;
+ }
+ return true;
+};
+const canEditLedger = (row) => isCurrentUserMaintainer(row);
+const canDeleteLedger = (row) => isCurrentUserMaintainer(row);
+const sensitiveAmountFormatter = (row, column, cellValue) => {
+ if (!isCurrentUserMaintainer(row)) {
+ return "*****";
+ }
+ return formattedNumber(row, column, cellValue);
};
// 鑾峰彇tree瀛愭暟鎹�
const getModels = (value) => {
@@ -1004,6 +1058,7 @@
// 娣诲姞琛ㄨ绫诲悕鏂规硶
const tableRowClassName = ({ row }) => {
+ if (!row.deliveryDate) return '';
if (row.isFh) return '';
const diff = row.deliveryDaysDiff;
@@ -1026,7 +1081,19 @@
]);
};
// 瀛愯〃鍚堣鏂规硶
-const summarizeChildrenTable = (param) => {
+const summarizeChildrenTable = (param, parentRow) => {
+ if (!isCurrentUserMaintainer(parentRow)) {
+ const { columns } = param;
+ return columns.map((column, index) => {
+ if (index === 0) {
+ return "鍚堣";
+ }
+ if (["taxInclusiveUnitPrice", "taxInclusiveTotalPrice", "taxExclusiveTotalPrice"].includes(column.property)) {
+ return "*****";
+ }
+ return "";
+ });
+ }
return proxy.summarizeTable(param, [
"taxInclusiveUnitPrice",
"taxInclusiveTotalPrice",
@@ -1035,14 +1102,18 @@
};
// 鎵撳紑寮规
const openForm = async (type, row) => {
+ if (type === "edit" && row && !canEditLedger(row)) {
+ proxy.$modal.msgWarning("褰撳墠绯荤粺鐧诲綍浜轰笉鏄淮鎶や汉锛屼笉鑳界紪杈戞暟鎹�");
+ return;
+ }
operationType.value = type;
form.value = {};
productData.value = [];
selectedQuotation.value = null;
let userLists = await userListNoPage();
userList.value = userLists.data;
- customerList().then((res) => {
- customerOption.value = res;
+ listCustomerPrivatePool({current: -1,size:-1}).then((res) => {
+ customerOption.value = res.data.records;
});
form.value.entryPerson = userStore.id;
if (type === "add") {
@@ -1073,11 +1144,14 @@
const openQuotationDialog = async () => {
if (operationType.value === "view") return;
quotationDialogVisible.value = true;
+ // 鎵撳紑寮圭獥鏃堕噸缃垎椤靛埌绗竴椤�
+ quotationPage.current = 1;
// 鍏堢‘淇濆鎴峰垪琛ㄥ凡鍔犺浇锛屼究浜庡悗缁洖濉� customerId
if (!customerOption.value || customerOption.value.length === 0) {
try {
- const res = await customerList();
- customerOption.value = res;
+ listCustomerPrivatePool({current: -1,size:-1}).then((res) => {
+ customerOption.value = res.data.records;
+ });
} catch (e) {
// ignore锛屽厑璁哥敤鎴峰悗缁墜鍔ㄩ�夋嫨瀹㈡埛
}
@@ -1089,14 +1163,15 @@
quotationLoading.value = true;
try {
const params = {
- // 鍏煎鍚庣鍒嗛〉瀛楁锛氳繖閲屾部鐢ㄦ姤浠烽〉闈㈠凡鏈夊彲鐢ㄧ殑瀛楁鍛藉悕
- currentPage: 1,
- pageSize: 100,
+ // 鍚庣鍒嗛〉瀛楁锛歝urrent / size
+ current: quotationPage.current,
+ size: quotationPage.size,
...quotationSearchForm,
status: "閫氳繃",
};
const res = await getQuotationList(params);
quotationList.value = res?.data?.records || [];
+ quotationPage.total = res?.data?.total || 0;
} finally {
quotationLoading.value = false;
}
@@ -1105,7 +1180,15 @@
const resetQuotationSearch = async () => {
quotationSearchForm.quotationNo = "";
quotationSearchForm.customer = "";
+ quotationPage.current = 1;
await fetchQuotationList();
+};
+
+// 鎶ヤ环鍗曞脊妗嗗垎椤靛垏鎹�
+const quotationPaginationChange = (obj) => {
+ quotationPage.current = obj.page;
+ quotationPage.size = obj.limit;
+ fetchQuotationList();
};
// 閫変腑鎶ヤ环鍗曞悗鍥炲~鍒板彴璐﹁〃鍗�
@@ -1212,6 +1295,7 @@
addOrUpdateSalesLedger(form.value).then((res) => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
+ expandedRowKeys.value = [];
getList();
});
}
@@ -1404,6 +1488,11 @@
const handleDelete = async () => {
if (selectedRows.value.length === 0) {
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const unauthorizedRows = selectedRows.value.filter((row) => !canDeleteLedger(row));
+ if (unauthorizedRows.length > 0) {
+ proxy.$modal.msgWarning("褰撳墠鐧诲綍鐢ㄦ埛涓嶆槸褰曞叆浜猴紝涓嶈兘鍒犻櫎璇ユ暟鎹�");
return;
}
const ids = selectedRows.value.map((item) => item.id);
@@ -1642,7 +1731,6 @@
<div class="print-page">
<div class="delivery-note">
<div class="header">
- <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
<div class="document-title">闆跺敭鍙戣揣鍗�</div>
</div>
@@ -1654,7 +1742,7 @@
</div>
<div>
<span class="label">瀹㈡埛鍚嶇О锛�</span>
- <span class="value">${item.customerName || '寮犵埍鏈�'}</span>
+ <span class="value">${item.customerName}</span>
</div>
</div>
<div class="info-row">
@@ -2168,19 +2256,19 @@
margin-left: 10px;
}
-::v-deep .yellow {
+:deep(.yellow) {
background-color: #FAF0DE;
}
-::v-deep .pink {
+:deep(.pink) {
background-color: #FAE1DE;
}
-::v-deep .red {
+:deep(.red) {
background-color: #FAE1DE;
}
-::v-deep .purple{
+:deep(.purple){
background-color: #F4DEFA;
}
--
Gitblit v1.9.3