From 9e7ed81d5fcfdc1489fc8a08edf5fe826dfe5fdc Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 25 五月 2026 16:54:43 +0800
Subject: [PATCH] 宝东 1.协同审批部门选择筛选去掉
---
src/views/salesManagement/salesLedger/index.vue | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 226 insertions(+), 14 deletions(-)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 8d25f53..de17401 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -48,6 +48,9 @@
@click="openForm('add')">
鏂板鍙拌处
</el-button>
+ <el-button type="primary" plain :disabled="selectedRows.length === 0" @click="handleBatchExportContract">
+ 瀵煎嚭鍚堝悓
+ </el-button>
<el-button type="primary"
plain
@click="handleImport">瀵煎叆
@@ -155,6 +158,8 @@
</el-table-column>
<el-table-column label="鏁伴噺"
prop="quantity" />
+ <el-table-column label="姣忎欢鏁伴噺"
+ prop="singleQuantity" />
<el-table-column label="寰呭彂璐ф暟閲�"
prop="noQuantity" />
<el-table-column label="绋庣巼(%)"
@@ -240,7 +245,7 @@
<el-button link
type="primary"
@click="openForm('edit', scope.row)"
- :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫
+ :disabled="!canEditLedger(scope.row)">缂栬緫
</el-button>
<el-button link
type="primary"
@@ -284,10 +289,15 @@
<el-col :span="12">
<el-form-item label="閿�鍞悎鍚屽彿锛�"
prop="salesContractNo">
- <el-input v-model="form.salesContractNo"
- placeholder="鑷姩鐢熸垚"
- clearable
- disabled />
+ <div style="display: flex; align-items: center; gap: 12px;width: 100%;">
+ <el-checkbox v-model="form.autoGenerateContractNo" v-if="operationType === 'add'">鑷姩鐢熸垚
+ </el-checkbox>
+ <el-input v-model="form.salesContractNo"
+ :placeholder="form.autoGenerateContractNo ? '鑷姩鐢熸垚' : '璇疯緭鍏�'"
+ clearable
+ :disabled="form.autoGenerateContractNo" />
+
+ </div>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -440,6 +450,8 @@
prop="unit" />
<el-table-column label="鏁伴噺"
prop="quantity" />
+ <el-table-column label="姣忎欢鏁伴噺"
+ prop="singleQuantity" />
<el-table-column label="绋庣巼(%)"
prop="taxRate" />
<el-table-column label="鍚◣鍗曚环(鍏�)"
@@ -676,6 +688,30 @@
</el-row>
<el-row :gutter="30">
<el-col :span="12">
+ <el-form-item label="姣忎欢鏁伴噺锛�"
+ prop="singleQuantity">
+ <el-input-number :step="1"
+ :min="1"
+ v-model="productForm.singleQuantity"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :precision="0"
+ @change="calculateFromSingleQuantity"
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎬绘暟锛�"
+ prop="totalQuantity">
+ <el-input v-model="productForm.totalQuantity"
+ placeholder="鑷姩璁$畻"
+ disabled
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
<el-form-item label="鍚◣鎬讳环(鍏�)锛�"
prop="taxInclusiveTotalPrice">
<el-input v-model="productForm.taxInclusiveTotalPrice"
@@ -898,7 +934,8 @@
prop="type">
<el-select v-model="deliveryForm.type"
placeholder="璇烽�夋嫨鍙戣揣绫诲瀷"
- style="width: 100%">
+ style="width: 100%"
+ @change="handleDeliveryTypeChange">
<el-option label="璐ц溅"
value="璐ц溅" />
<el-option label="蹇��"
@@ -914,8 +951,43 @@
</el-col>
</el-row>
<el-row :gutter="30">
+ <el-col :span="24" v-if="deliveryForm.type === '璐ц溅'">
+ <el-form-item label="鍙戣揣杞︾墝鍙凤細"
+ prop="shippingCarNumber">
+ <el-input v-model="deliveryForm.shippingCarNumber"
+ placeholder="璇疯緭鍏ュ彂璐ц溅鐗屽彿"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="24" v-else>
+ <el-form-item label="蹇�掑叕鍙革細"
+ prop="expressCompany">
+ <el-input v-model="deliveryForm.expressCompany"
+ placeholder="璇疯緭鍏ュ揩閫掑叕鍙�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30" v-if="deliveryForm.type === '蹇��'">
<el-col :span="24">
- <el-form-item label="鎵瑰彿锛�"
+ <el-form-item label="蹇�掑崟鍙凤細"
+ prop="expressNumber">
+ <el-input v-model="deliveryForm.expressNumber"
+ placeholder="璇疯緭鍏ュ揩閫掑崟鍙�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="24">
+ <el-form-item label="鍙戣揣鍥剧墖锛�">
+ <ImageUpload v-model:file-list="deliveryFileList" :limit="9" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="24">
+ <el-form-item label="搴撳瓨锛�"
prop="batchNo">
<el-table :data="deliveryForm.batchNoList"
border
@@ -925,6 +997,15 @@
<el-table-column label="鎵瑰彿"
prop="batchNo"
min-width="180" />
+ <el-table-column label="浜у搧澶х被"
+ prop="productName"
+ min-width="100" />
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="model"
+ min-width="100" />
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ min-width="100" />
<el-table-column label="搴撳瓨鏁伴噺"
min-width="120"
align="center">
@@ -990,6 +1071,7 @@
import useFormData from "@/hooks/useFormData.js";
import dayjs from "dayjs";
import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+ import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
import { getCurrentDate } from "@/utils/index.js";
import { listCustomer } from "@/api/basicData/customer.js";
@@ -1017,6 +1099,7 @@
});
const total = ref(0);
const fileList = ref([]);
+ const deliveryFileList = ref([]);
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
const operationType = ref("");
@@ -1031,6 +1114,7 @@
},
form: {
salesContractNo: "",
+ autoGenerateContractNo: true,
salesman: "",
customerId: "",
entryPerson: "",
@@ -1039,7 +1123,6 @@
maintenanceTime: "",
productData: [],
executionDate: "",
- hasProductionRecord: false,
},
rules: {
salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -1062,6 +1145,8 @@
specificationModel: "",
unit: "",
quantity: "",
+ singleQuantity: 1,
+ totalQuantity: "",
taxInclusiveUnitPrice: "",
taxRate: "",
taxInclusiveTotalPrice: "",
@@ -1195,11 +1280,30 @@
deliveryQuantity: 0,
}));
};
+ const validateDeliveryShippingCarNumber = (_rule, value, callback) => {
+ if (deliveryForm.value.type === "璐ц溅" && !value) {
+ return callback(new Error("璇疯緭鍏ュ彂璐ц溅鐗屽彿"));
+ }
+ callback();
+ };
+ const validateDeliveryExpressCompany = (_rule, value, callback) => {
+ if (deliveryForm.value.type === "蹇��" && !value) {
+ return callback(new Error("璇疯緭鍏ュ揩閫掑叕鍙�"));
+ }
+ callback();
+ };
const deliveryFormData = reactive({
deliveryForm: {
+ shippingCarNumber: "",
+ expressCompany: "",
+ expressNumber: "",
type: "璐ц溅", // 璐ц溅, 蹇��
},
deliveryRules: {
+ shippingCarNumber: [
+ { validator: validateDeliveryShippingCarNumber, trigger: "blur" },
+ ],
+ expressCompany: [{ validator: validateDeliveryExpressCompany, trigger: "blur" }],
type: [{ required: true, message: "璇烽�夋嫨鍙戣揣绫诲瀷", trigger: "change" }],
},
});
@@ -1521,7 +1625,7 @@
selectedQuotation.value = null;
let userLists = await userListNoPage();
userList.value = userLists.data;
- listCustomer({ current: -1, size: -1 }).then(res => {
+ listCustomer({ current: -1, size: -1, type: 0 }).then(res => {
customerOption.value = res.data.records;
});
form.value.entryPerson = userStore.id;
@@ -1530,6 +1634,8 @@
form.value.entryDate = getCurrentDate();
// 绛捐鏃ユ湡榛樿涓哄綋澶�
form.value.executionDate = getCurrentDate();
+ // 榛樿鑷姩鐢熸垚閿�鍞悎鍚屽彿
+ form.value.autoGenerateContractNo = true;
} else {
currentId.value = row.id;
getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
@@ -1537,6 +1643,8 @@
form.value.entryPerson = Number(res.entryPerson);
productData.value = form.value.productData;
fileList.value = form.value.storageBlobVOs;
+ // 缂栬緫鏃惰缃嚜鍔ㄧ敓鎴愪负false锛屽厑璁告墜鍔ㄤ慨鏀�
+ form.value.autoGenerateContractNo = false;
});
}
// let userAll = await userStore.getInfo()
@@ -1648,6 +1756,8 @@
taxExclusiveTotalPrice: taxExclusiveTotalPrice,
invoiceType: "澧炴櫘绁�",
isProduction: true,
+ productId: p.productId,
+ productModelId: p.productModelId
};
});
@@ -1671,6 +1781,9 @@
}
form.value.storageBlobDTOs = fileList;
form.value.type = 1;
+ if (form.value.autoGenerateContractNo) {
+ form.value.salesContractNo = '';
+ }
addOrUpdateSalesLedger(form.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
@@ -1704,6 +1817,12 @@
if (type === "edit") {
productForm.value = { ...row };
productIndex.value = index;
+ // 濡傛灉娌℃湁 totalQuantity锛岃嚜鍔ㄨ绠楋細鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ if (!productForm.value.totalQuantity && productForm.value.quantity) {
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ const quantity = parseFloat(productForm.value.quantity);
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+ }
// 缂栬緫鏃舵牴鎹骇鍝佸ぇ绫诲悕绉板弽鏌� tree 鑺傜偣 id锛屽苟鍔犺浇瑙勬牸鍨嬪彿鍒楄〃
try {
const options =
@@ -2385,6 +2504,10 @@
);
}
+ // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+
isCalculating.value = false;
};
@@ -2418,6 +2541,10 @@
inclusiveTotalPrice / quantity
).toFixed(2);
+ // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+
isCalculating.value = false;
};
@@ -2438,7 +2565,7 @@
isCalculating.value = true;
- // 璁$畻鍚◣鎬讳环
+ // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺
productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
@@ -2449,6 +2576,10 @@
productForm.value.taxRate
);
}
+
+ // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
isCalculating.value = false;
};
@@ -2470,7 +2601,7 @@
isCalculating.value = true;
- // 璁$畻鍚◣鎬讳环
+ // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺
productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
@@ -2481,6 +2612,25 @@
productForm.value.taxRate
);
}
+
+ isCalculating.value = false;
+ };
+
+ // 鏍规嵁姣忎欢鏁伴噺鍙樺寲璁$畻鎬绘暟
+ const calculateFromSingleQuantity = () => {
+ if (isCalculating.value) return;
+
+ const quantity = parseFloat(productForm.value.quantity);
+
+ if (!quantity || quantity <= 0) {
+ return;
+ }
+
+ isCalculating.value = true;
+
+ // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+ const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+ productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
isCalculating.value = false;
};
@@ -2537,6 +2687,7 @@
瀹℃牳鎷掔粷: "瀹℃牳鎷掔粷",
瀹℃牳閫氳繃: "瀹℃牳閫氳繃",
宸插彂璐�: "宸插彂璐�",
+ 閮ㄥ垎鍙戣揣: "閮ㄥ垎鍙戣揣",
};
return statusTextMap[statusStr] || "寰呭彂璐�";
};
@@ -2568,6 +2719,7 @@
瀹℃牳鎷掔粷: "danger",
瀹℃牳閫氳繃: "success",
宸插彂璐�: "success",
+ 閮ㄥ垎鍙戣揣: "warning",
};
return typeTextMap[statusStr] || "info";
};
@@ -2593,7 +2745,7 @@
// 鍙戣揣鐘舵�佸繀椤绘槸"寰呭彂璐�"鎴�"瀹℃牳鎷掔粷"
const statusStr = shippingStatus ? String(shippingStatus).trim() : "";
- return statusStr === "寰呭彂璐�" || statusStr === "瀹℃牳鎷掔粷";
+ return statusStr === "寰呭彂璐�" || statusStr === "瀹℃牳鎷掔粷" || statusStr === "閮ㄥ垎鍙戣揣";
};
// 鎵撳紑闄勪欢寮圭獥
@@ -2605,7 +2757,40 @@
recordId.value = row.id;
fileDialogVisible.value = true;
};
-
+ const handleBatchExportContract = () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佸鍑虹殑鍙拌处");
+ return;
+ }
+ const firstCustomerKey =
+ selectedRows.value[0].customerId ?? selectedRows.value[0].customerName ?? "";
+ const hasDifferentCustomer = selectedRows.value.some((row) => {
+ const customerKey = row.customerId ?? row.customerName ?? "";
+ return String(customerKey) !== String(firstCustomerKey);
+ });
+ if (hasDifferentCustomer) {
+ proxy.$modal.msgWarning("浠呮敮鎸佸悓涓�瀹㈡埛鍚屾椂瀵煎嚭鍚堝悓");
+ return;
+ }
+ const ids = selectedRows.value
+ .map((row) => row.id)
+ .filter((id) => id !== null && id !== undefined);
+ if (ids.length === 0) {
+ proxy.$modal.msgWarning("鏈幏鍙栧埌鍚堝悓ID");
+ return;
+ }
+ proxy.download(
+ "/sales/ledger/exportContract",
+ ids,
+ `閿�鍞悎鍚宊鎵归噺_${dayjs().format("YYYYMMDDHHmmss")}.docx`,
+ {
+ method: "post",
+ filename: `閿�鍞悎鍚宊鎵归噺_${dayjs().format("YYYYMMDDHHmmss")}.docx`,
+ headers: { "Content-Type": "application/json;charset=utf-8" },
+ transformRequest: [(data) => JSON.stringify(data)],
+ }
+ );
+ }
// 鎵撳紑鍙戣揣寮规
const openDeliveryForm = async row => {
// 妫�鏌ユ槸鍚﹀彲浠ュ彂璐�
@@ -2621,10 +2806,14 @@
row.productModelId || row.modelId
);
deliveryForm.value = {
+ shippingCarNumber: "",
+ expressCompany: "",
+ expressNumber: "",
type: "璐ц溅",
batchNo: [],
batchNoList,
};
+ deliveryFileList.value = [];
deliveryFormVisible.value = true;
};
@@ -2662,6 +2851,19 @@
salesLedgerId: salesLedgerId,
salesLedgerProductId: currentDeliveryRow.value.id,
type: deliveryForm.value.type,
+ shippingCarNumber:
+ deliveryForm.value.type === "璐ц溅"
+ ? deliveryForm.value.shippingCarNumber
+ : "",
+ expressCompany:
+ deliveryForm.value.type === "蹇��"
+ ? deliveryForm.value.expressCompany
+ : "",
+ expressNumber:
+ deliveryForm.value.type === "蹇��"
+ ? deliveryForm.value.expressNumber
+ : "",
+ storageBlobDTOs: deliveryFileList.value || [],
batchNo: deliveryForm.value.batchNo,
batchNoDetailList: selectedBatchRows.map(item => ({
stockInventoryId: item.id,
@@ -2701,8 +2903,18 @@
};
// 鍏抽棴鍙戣揣寮规
+ const handleDeliveryTypeChange = val => {
+ if (val === "璐ц溅") {
+ deliveryForm.value.expressCompany = "";
+ deliveryForm.value.expressNumber = "";
+ } else {
+ deliveryForm.value.shippingCarNumber = "";
+ }
+ };
+
const closeDeliveryDia = () => {
proxy.resetForm("deliveryFormRef");
+ deliveryFileList.value = [];
deliveryFormVisible.value = false;
currentDeliveryRow.value = null;
};
@@ -2919,4 +3131,4 @@
page-break-after: avoid;
}
}
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.3