From 7cb0cf9a36e263d29be61a44b8caae2a896f3461 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 31 三月 2026 11:31:40 +0800
Subject: [PATCH] 新增入库选择器修改
---
src/views/salesManagement/salesLedger/index.vue | 822 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 423 insertions(+), 399 deletions(-)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index ab7b9d6..21986bc 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -82,70 +82,19 @@
<el-table :data="props.row.children"
border
show-summary
- :summary-method="summarizeChildrenTable">
+ :summary-method="summarizeChildrenTable"
+ style="min-width: 1200px;"
+ scrollbar-always-on>
<el-table-column align="center"
label="搴忓彿"
type="index"
- width="60" />
+ width="70" />
<el-table-column label="浜у搧澶х被"
prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿"
prop="specificationModel" />
<el-table-column label="鍗曚綅"
prop="unit" />
- <el-table-column label="鐢熶骇鐘舵��"
- width="100px"
- align="center">
- <template #default="scope">
- <el-tag v-if="scope.row.productionStatus === '宸插畬鎴�'"
- type="success">宸插畬鎴�</el-tag>
- <el-tag v-if="scope.row.productionStatus === '鐢熶骇涓�'"
- type="warning">鐢熶骇涓�</el-tag>
- <el-tag v-if="scope.row.productionStatus === '鏈紑濮�'"
- type="danger">鏈紑濮�</el-tag>
- <el-tag v-if="!scope.row.productionStatus"
- type="info">鏆傛棤鐘舵��</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="浜у搧鐘舵��"
- width="100px"
- align="center">
- <template #default="scope">
- <el-tag v-if="scope.row.approveStatus === 0"
- type="info">鏈嚭搴�</el-tag>
- <el-tag v-if="scope.row.approveStatus === 1"
- type="success">宸插嚭搴�</el-tag>
- <el-tag v-if="scope.row.approveStatus === 2"
- type="warning">瀹℃牳涓�</el-tag>
- <el-tag v-if="scope.row.approveStatus === 3"
- type="success">瀹℃牳鎴愬姛</el-tag>
- <el-tag v-if="scope.row.approveStatus === 4"
- type="danger">瀹℃牳澶辫触</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="鍙戣揣杞︾墝"
- minWidth="100px"
- align="center">
- <template #default="scope">
- <div>
- <el-tag type="success"
- v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}</el-tag>
- <el-tag v-else
- type="info">鏈彂璐�</el-tag>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="鍙戣揣鏃ユ湡"
- minWidth="100px"
- align="center">
- <template #default="scope">
- <div>
- <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div>
- <el-tag v-else
- type="info">鏈彂璐�</el-tag>
- </div>
- </template>
- </el-table-column>
<el-table-column label="鏁伴噺"
prop="quantity" />
<el-table-column label="绋庣巼(%)"
@@ -159,16 +108,15 @@
<el-table-column label="涓嶅惈绋庢�讳环(鍏�)"
prop="taxExclusiveTotalPrice"
:formatter="formattedNumber" />
- <!--鎿嶄綔-->
- <el-table-column Width="60px"
+ <el-table-column fixed="right"
label="鎿嶄綔"
+ width="150"
align="center">
<template #default="scope">
- <el-button :disabled="scope.row.approveStatus===2 || scope.row.approveStatus===5"
- link
+ <el-button link
type="primary"
size="small"
- @click="openDeliveryForm(scope.row)">鍙戣揣</el-button>
+ @click="openDeliveryForm(props.row, scope.row)">鍙戣揣</el-button>
</template>
</el-table-column>
</el-table>
@@ -198,6 +146,29 @@
prop="projectName"
width="180"
show-overflow-tooltip />
+ <el-table-column label="瀹℃牳鐘舵��"
+ width="140">
+ <template #default="scope">
+ <el-tag v-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 0"
+ type="warning">寰呭鏍�</el-tag>
+ <el-tag v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 1"
+ type="primary">瀹℃牳涓�</el-tag>
+ <el-tag v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 2"
+ type="success">瀹℃牳瀹屾垚</el-tag>
+ <el-tag v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 3"
+ type="danger">瀹℃牳鏈�氳繃</el-tag>
+ <el-tag v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 4"
+ type="info">宸查噸鏂版彁浜�</el-tag>
+ <el-tag v-else
+ type="info">-</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="閿�鍞被鍨�"
+ width="120">
+ <template #default="scope">
+ <el-tag :type="scope.row.salesType === '绱ф��' ? 'danger' : 'info'">{{ scope.row.salesType || '-' }}</el-tag>
+ </template>
+ </el-table-column>
<el-table-column label="浠樻鏂瑰紡"
prop="paymentMethod"
show-overflow-tooltip />
@@ -220,7 +191,7 @@
show-overflow-tooltip />
<el-table-column fixed="right"
label="鎿嶄綔"
- min-width="100"
+ min-width="150"
align="center">
<template #default="scope">
<el-button link
@@ -232,7 +203,7 @@
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" size="small" @click="openDeliveryForm(scope.row)">鍙戣揣</el-button> -->
</template>
</el-table-column>
</el-table>
@@ -366,6 +337,57 @@
placeholder="璇疯緭鍏�"
clearable
:disabled="operationType === 'view'" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="閿�鍞被鍨嬶細"
+ prop="salesType">
+ <el-select v-model="form.salesType"
+ placeholder="璇烽�夋嫨"
+ clearable
+ :disabled="operationType === 'view'"
+ style="width: 100%">
+ <el-option label="鏅��"
+ value="鏅��" />
+ <el-option label="绱ф��"
+ value="绱ф��" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item v-if="operationType !== 'view'">
+ <template #label>
+ <span>瀹℃壒浜洪�夋嫨锛�</span>
+ <el-button type="primary"
+ @click="addApproverNode"
+ style="margin-left: 8px;">鏂板鑺傜偣</el-button>
+ </template>
+ <div style="display: flex; align-items: flex-end; flex-wrap: wrap;">
+ <div v-for="(node, index) in approverNodes"
+ :key="node.id"
+ style="margin-right: 30px; text-align: center; margin-bottom: 10px;">
+ <div>
+ <span>瀹℃壒浜�</span>
+ 鈫�
+ </div>
+ <el-select v-model="node.userId"
+ placeholder="閫夋嫨浜哄憳"
+ style="width: 140px; margin-bottom: 8px;">
+ <el-option v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId" />
+ </el-select>
+ <div>
+ <el-button type="danger"
+ size="small"
+ @click="removeApproverNode(index)"
+ v-if="approverNodes.length > 1">鍒犻櫎</el-button>
+ </div>
+ </div>
+ </div>
</el-form-item>
</el-col>
</el-row>
@@ -765,22 +787,6 @@
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="30">
- <el-col :span="24">
- <el-form-item label="瀹℃壒浜猴細"
- prop="approverId">
- <el-select v-model="deliveryForm.approverId"
- placeholder="璇烽�夋嫨瀹℃壒浜�"
- clearable
- :disabled="operationType === 'view'">
- <el-option v-for="item in userList"
- :key="item.userId"
- :label="item.nickName"
- :value="item.userId" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
@@ -814,11 +820,11 @@
delProduct,
delLedgerFile,
getProductInventory,
- judgmentInventory,
} from "@/api/salesManagement/salesLedger.js";
import { modelList, productTreeList } from "@/api/basicData/product.js";
import useFormData from "@/hooks/useFormData.js";
import dayjs from "dayjs";
+ import { getStockInPage } from "@/api/inventoryManagement/stockIn.js";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
@@ -837,6 +843,8 @@
});
const total = ref(0);
const fileList = ref([]);
+ const approverNodes = ref([{ id: 1, userId: null }]);
+ let nextApproverId = 2;
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
const operationType = ref("");
@@ -863,8 +871,12 @@
productData: [],
executionDate: "",
paymentMethod: "",
+ salesType: "鏅��",
},
rules: {
+ salesType: [
+ { required: true, message: "璇烽�夋嫨閿�鍞被鍨�", trigger: "change" },
+ ],
salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
customerContractNo: [
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
@@ -878,6 +890,12 @@
});
const { form, rules } = toRefs(data);
const { form: searchForm } = useFormData(data.searchForm);
+ const addApproverNode = () => {
+ approverNodes.value.push({ id: nextApproverId++, userId: null });
+ };
+ const removeApproverNode = index => {
+ approverNodes.value.splice(index, 1);
+ };
// 浜у搧琛ㄥ崟寮规鏁版嵁
const productFormVisible = ref(false);
const productOperationType = ref("");
@@ -930,7 +948,7 @@
// 鍙戣揣鐩稿叧
const deliveryFormVisible = ref(false);
- const currentDeliveryRow = ref(null);
+ const currentDeliveryContext = ref(null);
const deliveryFormData = reactive({
deliveryForm: {
shippingDate: "",
@@ -942,12 +960,6 @@
],
shippingCarNumber: [
{ required: true, message: "璇疯緭鍏ュ彂璐ц溅鐗屽彿", trigger: "blur" },
- ],
- approverId: [
- {
- required: true,
- message: "",
- },
],
},
});
@@ -976,9 +988,7 @@
page.size = obj.limit;
getList();
};
- const getList = async () => {
- let userLists = await userListNoPage();
- userList.value = userLists.data;
+ const getList = () => {
tableLoading.value = true;
const { entryDate, ...rest } = searchForm;
ledgerListPage({ ...rest, ...page })
@@ -1059,31 +1069,23 @@
productSelectedRows.value = selectedRows;
};
const expandedRowKeys = ref([]);
- // 灞曞紑琛岋紙濮嬬粓鍙睍寮�涓�琛岋級
- const expandChange = row => {
- const rowKey = row.id;
- const isExpanded = expandedRowKeys.value.includes(rowKey);
-
- if (isExpanded) {
- // 褰撳墠琛屽凡灞曞紑 -> 鏀惰捣
+ // 灞曞紑琛�
+ const expandChange = (row, expandedRows) => {
+ if (expandedRows.length > 0) {
expandedRowKeys.value = [];
- return;
- }
-
- // 灞曞紑褰撳墠琛屽墠锛屽厛鏀惰捣鍏跺畠琛�
- expandedRowKeys.value = [];
-
- try {
- productList({ salesLedgerId: row.id, type: 1 }).then(res => {
- const index = tableData.value.findIndex(item => item.id === row.id);
- if (index > -1) {
- tableData.value[index].children = res.data;
- }
- // 鍙繚鐣欏綋鍓嶈繖涓�琛屽浜庡睍寮�鐘舵��
- expandedRowKeys.value = [rowKey];
- });
- } catch (error) {
- console.log(error);
+ try {
+ productList({ salesLedgerId: row.id, type: 1 }).then(res => {
+ const index = tableData.value.findIndex(item => item.id === row.id);
+ if (index > -1) {
+ tableData.value[index].children = res.data;
+ }
+ expandedRowKeys.value.push(row.id);
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ } else {
+ expandedRowKeys.value = [];
}
};
// 涓昏〃鍚堣鏂规硶
@@ -1107,6 +1109,10 @@
operationType.value = type;
form.value = {};
productData.value = [];
+ approverNodes.value = [{ id: 1, userId: null }];
+ nextApproverId = 2;
+ let userLists = await userListNoPage();
+ userList.value = userLists.data;
customerList().then(res => {
customerOption.value = res;
});
@@ -1116,8 +1122,26 @@
getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
form.value = { ...res };
form.value.entryPerson = Number(res.entryPerson);
+ if (!form.value.salesType) {
+ form.value.salesType = "鏅��";
+ }
productData.value = form.value.productData;
fileList.value = form.value.salesLedgerFiles;
+ const approveUserIds =
+ form.value.approveUserIds || form.value.approverIds;
+ if (approveUserIds) {
+ const ids = String(approveUserIds)
+ .split(",")
+ .map(id => Number(id.trim()))
+ .filter(id => !Number.isNaN(id));
+ if (ids.length > 0) {
+ approverNodes.value = ids.map((id, idx) => ({
+ id: idx + 1,
+ userId: id,
+ }));
+ nextApproverId = ids.length + 1;
+ }
+ }
});
}
// let userAll = await userStore.getInfo()
@@ -1127,6 +1151,9 @@
// }
// });
form.value.entryDate = getCurrentDate(); // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
+ if (type === "add") {
+ form.value.salesType = "鏅��";
+ }
dialogFormVisible.value = true;
};
function changs(val) {
@@ -1172,6 +1199,16 @@
const submitForm = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
+ if (operationType.value !== "view") {
+ const hasEmptyApprover = approverNodes.value.some(node => !node.userId);
+ if (hasEmptyApprover) {
+ proxy.$modal.msgWarning("璇蜂负鎵�鏈夊鎵硅妭鐐归�夋嫨瀹℃壒浜�");
+ return;
+ }
+ form.value.approveUserIds = approverNodes.value
+ .map(node => node.userId)
+ .join(",");
+ }
console.log("productData.value--", productData.value);
if (productData.value !== null && productData.value.length > 0) {
form.value.productData = proxy.HaveJson(productData.value);
@@ -1384,272 +1421,267 @@
// 鏋勫缓鎵撳嵃鍐呭
let printContent = `
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>鎵撳嵃棰勮</title>
- <style>
- body {
- margin: 0;
- padding: 0;
- font-family: "SimSun", serif;
- background: white;
- }
- .print-page {
- width: 200mm;
- height: 75mm;
- padding: 10mm;
- padding-left: 20mm;
- background: white;
- box-sizing: border-box;
- page-break-after: always;
- page-break-inside: avoid;
- }
- .print-page:last-child {
- page-break-after: avoid;
- }
- .delivery-note {
- width: 100%;
- height: 100%;
- font-size: 12px;
- line-height: 1.2;
- display: flex;
- flex-direction: column;
- color: #000;
- }
- .header {
- text-align: center;
- margin-bottom: 8px;
- }
- .company-name {
- font-size: 18px;
- font-weight: bold;
- margin-bottom: 4px;
- }
- .document-title {
- font-size: 16px;
- font-weight: bold;
- }
- .info-section {
- margin-bottom: 8px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .info-row {
- line-height: 20px;
- }
- .label {
- font-weight: bold;
- width: 60px;
- font-size: 12px;
- }
- .value {
- margin-right: 20px;
- min-width: 80px;
- font-size: 12px;
- }
- .table-section {
- margin-bottom: 40px;
- // flex: 0.6;
- }
- .product-table {
- width: 100%;
- border-collapse: collapse;
- border: 1px solid #000;
- }
- .product-table th, .product-table td {
- border: 1px solid #000;
- padding: 6px;
- text-align: center;
- font-size: 12px;
- line-height: 1.4;
- }
- .product-table th {
- font-weight: bold;
- }
- .total-value {
- font-weight: bold;
- }
- .footer-section {
- margin-top: auto;
- }
- .footer-row {
- display: flex;
- margin-bottom: 3px;
- line-height: 22px;
- justify-content: space-between;
- }
- .footer-item {
- display: flex;
- margin-right: 20px;
- }
- .footer-item .label {
- font-weight: bold;
- width: 80px;
- font-size: 12px;
- }
- .footer-item .value {
- min-width: 80px;
- font-size: 12px;
- }
- .address-item .address-value {
- min-width: 200px;
- }
- @media print {
- body {
- margin: 0;
- padding: 0;
- }
- .print-page {
- margin: 0;
- padding: 10mm;
- /* padding-left: 20mm; */
- page-break-inside: avoid;
- page-break-after: always;
- }
- .print-page:last-child {
- page-break-after: avoid;
- }
- }
- </style>
- </head>
- <body>
- `;
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="UTF-8">
+ <title>鎵撳嵃棰勮</title>
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ font-family: "SimSun", serif;
+ background: white;
+ }
+ .print-page {
+ width: 200mm;
+ height: 75mm;
+ padding: 10mm;
+ padding-left: 20mm;
+ background: white;
+ box-sizing: border-box;
+ page-break-after: always;
+ page-break-inside: avoid;
+ }
+ .print-page:last-child {
+ page-break-after: avoid;
+ }
+ .delivery-note {
+ width: 100%;
+ height: 100%;
+ font-size: 12px;
+ line-height: 1.2;
+ display: flex;
+ flex-direction: column;
+ color: #000;
+ }
+ .header {
+ text-align: center;
+ margin-bottom: 8px;
+ }
+ .company-name {
+ font-size: 18px;
+ font-weight: bold;
+ margin-bottom: 4px;
+ }
+ .document-title {
+ font-size: 16px;
+ font-weight: bold;
+ }
+ .info-section {
+ margin-bottom: 8px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+ .info-row {
+ line-height: 20px;
+ }
+ .label {
+ font-weight: bold;
+ width: 60px;
+ font-size: 12px;
+ }
+ .value {
+ margin-right: 20px;
+ min-width: 80px;
+ font-size: 12px;
+ }
+ .table-section {
+ margin-bottom: 40px;
+ // flex: 0.6;
+ }
+ .product-table {
+ width: 100%;
+ border-collapse: collapse;
+ border: 1px solid #000;
+ }
+ .product-table th, .product-table td {
+ border: 1px solid #000;
+ padding: 6px;
+ text-align: center;
+ font-size: 12px;
+ line-height: 1.4;
+ }
+ .product-table th {
+ font-weight: bold;
+ }
+ .total-value {
+ font-weight: bold;
+ }
+ .footer-section {
+ margin-top: auto;
+ }
+ .footer-row {
+ display: flex;
+ margin-bottom: 3px;
+ line-height: 22px;
+ justify-content: space-between;
+ }
+ .footer-item {
+ display: flex;
+ margin-right: 20px;
+ }
+ .footer-item .label {
+ font-weight: bold;
+ width: 80px;
+ font-size: 12px;
+ }
+ .footer-item .value {
+ min-width: 80px;
+ font-size: 12px;
+ }
+ .address-item .address-value {
+ min-width: 200px;
+ }
+ @media print {
+ body {
+ margin: 0;
+ padding: 0;
+ }
+ .print-page {
+ margin: 0;
+ padding: 10mm;
+ /* padding-left: 20mm; */
+ page-break-inside: avoid;
+ page-break-after: always;
+ }
+ .print-page:last-child {
+ page-break-after: avoid;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ `;
// 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
printData.value.forEach((item, index) => {
printContent += `
- <div class="print-page">
- <div class="delivery-note">
- <div class="header">
- <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
- <div class="document-title">闆跺敭鍙戣揣鍗�</div>
- </div>
-
- <div class="info-section">
- <div class="info-row">
- <div>
- <span class="label">鍙戣揣鏃ユ湡锛�</span>
- <span class="value">${formatDate(
- item.createTime
- )}</span>
- </div>
- <div>
- <span class="label">瀹㈡埛鍚嶇О锛�</span>
- <span class="value">${
- item.customerName || "寮犵埍鏈�"
- }</span>
- </div>
- </div>
- <div class="info-row">
- <span class="label">鍗曞彿锛�</span>
- <span class="value">${
- item.salesContractNo || ""
- }</span>
- </div>
- </div>
+ <div class="print-page">
+ <div class="delivery-note">
+ <div class="header">
+ <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
+ <div class="document-title">闆跺敭鍙戣揣鍗�</div>
+ </div>
- <div class="table-section">
- <table class="product-table">
- <thead>
- <tr>
- <th>浜у搧鍚嶇О</th>
- <th>瑙勬牸鍨嬪彿</th>
- <th>鍗曚綅</th>
- <th>鍗曚环</th>
- <th>闆跺敭鏁伴噺</th>
- <th>闆跺敭閲戦</th>
- </tr>
- </thead>
- <tbody>
- ${
- item.products &&
- item.products.length > 0
- ? item.products
- .map(
- product => `
- <tr>
- <td>${
- product.productCategory || ""
- }</td>
- <td>${
- product.specificationModel || ""
- }</td>
- <td>${product.unit || ""}</td>
- <td>${
- product.taxInclusiveUnitPrice ||
- "0"
- }</td>
- <td>${product.quantity || "0"}</td>
- <td>${
- product.taxInclusiveTotalPrice ||
- "0"
- }</td>
- </tr>
- `
- )
- .join("")
- : '<tr><td colspan="6" style="text-align: center; color: #999;">鏆傛棤浜у搧鏁版嵁</td></tr>'
- }
- </tbody>
- <tfoot>
- <tr>
- <td class="label">鍚堣</td>
- <td class="total-value"></td>
- <td class="total-value"></td>
- <td class="total-value"></td>
- <td class="total-value">${getTotalQuantityForPrint(
- item.products
- )}</td>
- <td class="total-value">${getTotalAmountForPrint(
- item.products
- )}</td>
- </tr>
- </tfoot>
- </table>
- </div>
-
- <div class="footer-section">
- <div class="footer-row">
- <div class="footer-item">
- <span class="label">鏀惰揣鐢佃瘽锛�</span>
- <span class="value"></span>
- </div>
- <div class="footer-item">
- <span class="label">鏀惰揣浜猴細</span>
- <span class="value"></span>
- </div>
- <div class="footer-item address-item">
- <span class="label">鏀惰揣鍦板潃锛�</span>
- <span class="value address-value"></span>
- </div>
- </div>
- <div class="footer-row">
- <div class="footer-item">
- <span class="label">鎿嶄綔鍛橈細</span>
- <span class="value">${
- userStore.nickName || "鎾曞紑鍓�"
- }</span>
- </div>
- <div class="footer-item">
- <span class="label">鎵撳嵃鏃ユ湡锛�</span>
- <span class="value">${formatDateTime(
- new Date()
- )}</span>
- </div>
- </div>
- </div>
+ <div class="info-section">
+ <div class="info-row">
+ <div>
+ <span class="label">鍙戣揣鏃ユ湡锛�</span>
+ <span class="value">${formatDate(
+ item.createTime
+ )}</span>
+ </div>
+ <div>
+ <span class="label">瀹㈡埛鍚嶇О锛�</span>
+ <span class="value">${
+ item.customerName || "寮犵埍鏈�"
+ }</span>
</div>
</div>
- `;
+ <div class="info-row">
+ <span class="label">鍗曞彿锛�</span>
+ <span class="value">${
+ item.salesContractNo || ""
+ }</span>
+ </div>
+ </div>
+
+ <div class="table-section">
+ <table class="product-table">
+ <thead>
+ <tr>
+ <th>浜у搧鍚嶇О</th>
+ <th>瑙勬牸鍨嬪彿</th>
+ <th>鍗曚綅</th>
+ <th>鍗曚环</th>
+ <th>闆跺敭鏁伴噺</th>
+ <th>闆跺敭閲戦</th>
+ </tr>
+ </thead>
+ <tbody>
+ ${
+ item.products && item.products.length > 0
+ ? item.products
+ .map(
+ product => `
+ <tr>
+ <td>${product.productCategory || ""}</td>
+ <td>${
+ product.specificationModel || ""
+ }</td>
+ <td>${product.unit || ""}</td>
+ <td>${
+ product.taxInclusiveUnitPrice || "0"
+ }</td>
+ <td>${product.quantity || "0"}</td>
+ <td>${
+ product.taxInclusiveTotalPrice || "0"
+ }</td>
+ </tr>
+ `
+ )
+ .join("")
+ : '<tr><td colspan="6" style="text-align: center; color: #999;">鏆傛棤浜у搧鏁版嵁</td></tr>'
+ }
+ </tbody>
+ <tfoot>
+ <tr>
+ <td class="label">鍚堣</td>
+ <td class="total-value"></td>
+ <td class="total-value"></td>
+ <td class="total-value"></td>
+ <td class="total-value">${getTotalQuantityForPrint(
+ item.products
+ )}</td>
+ <td class="total-value">${getTotalAmountForPrint(
+ item.products
+ )}</td>
+ </tr>
+ </tfoot>
+ </table>
+ </div>
+
+ <div class="footer-section">
+ <div class="footer-row">
+ <div class="footer-item">
+ <span class="label">鏀惰揣鐢佃瘽锛�</span>
+ <span class="value"></span>
+ </div>
+ <div class="footer-item">
+ <span class="label">鏀惰揣浜猴細</span>
+ <span class="value"></span>
+ </div>
+ <div class="footer-item address-item">
+ <span class="label">鏀惰揣鍦板潃锛�</span>
+ <span class="value address-value"></span>
+ </div>
+ </div>
+ <div class="footer-row">
+ <div class="footer-item">
+ <span class="label">鎿嶄綔鍛橈細</span>
+ <span class="value">${
+ userStore.nickName || "鎾曞紑鍓�"
+ }</span>
+ </div>
+ <div class="footer-item">
+ <span class="label">鎵撳嵃鏃ユ湡锛�</span>
+ <span class="value">${formatDateTime(
+ new Date()
+ )}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ `;
});
printContent += `
- </body>
- </html>
- `;
+ </body>
+ </html>
+ `;
// 鍐欏叆鍐呭鍒版柊绐楀彛
printWindow.document.write(printContent);
@@ -1814,13 +1846,12 @@
// 鏍规嵁鏁伴噺鍙樺寲璁$畻鎬讳环
const calculateFromQuantity = () => {
- // 杩欓噷
if (!productForm.value.taxRate) {
proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
return;
}
if (isCalculating.value) return;
- newfunction();
+
const quantity = parseFloat(productForm.value.quantity);
const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
@@ -1844,21 +1875,7 @@
isCalculating.value = false;
};
- const newfunction = () => {
- // productForm.value.productModelId;
- // productForm.quantity
- judgmentInventory({
- productModelId: productForm.value.productModelId,
- quantity: productForm.value.quantity,
- }).then(res => {
- console.log("res", res);
- // if (res.code === 200) {
- // proxy.$modal.msgSuccess("搴撳瓨鍏呰冻");
- // } else {
- // proxy.$modal.msgError(res.msg);
- // }
- });
- };
+
// 鏍规嵁鍚◣鍗曚环鍙樺寲璁$畻鎬讳环
const calculateFromUnitPrice = () => {
if (!productForm.value.taxRate) {
@@ -1929,13 +1946,23 @@
};
// 鎵撳紑鍙戣揣寮规
- const openDeliveryForm = row => {
- currentDeliveryRow.value = row;
- deliveryForm.value = {
- shippingDate: "", // 绉婚櫎榛樿鍊艰缃�
- shippingCarNumber: "",
- };
- deliveryFormVisible.value = true;
+ const openDeliveryForm = (props, scope) => {
+ getProductInventory({ salesLedgerId: props.id, type: 1 })
+ .then(res => {
+ currentDeliveryContext.value = {
+ id: props.id,
+ productId: scope.id,
+ };
+ deliveryForm.value = {
+ shippingDate: getCurrentDate(),
+ shippingCarNumber: "",
+ };
+ // currentDeliveryRow.value = props.row;
+ deliveryFormVisible.value = true;
+ })
+ .catch(err => {
+ // ElMessage.error(err);
+ });
};
// 鎻愪氦鍙戣揣琛ㄥ崟
@@ -1943,17 +1970,14 @@
proxy.$refs["deliveryFormRef"].validate(valid => {
if (valid) {
addShippingInfo({
- approverId: deliveryForm.value.approverId,
- salesLedgerId: currentDeliveryRow.value.salesLedgerId,
- salesLedgerProductId: currentDeliveryRow.value.id,
+ salesLedgerId: currentDeliveryContext.value.id,
+ salesLedgerProductId: currentDeliveryContext.value.productId,
shippingDate: deliveryForm.value.shippingDate,
shippingCarNumber: deliveryForm.value.shippingCarNumber,
})
.then(() => {
proxy.$modal.msgSuccess("鍙戣揣鎴愬姛");
closeDeliveryDia();
- getList();
- expandedRowKeys.value = [];
})
.catch(() => {
proxy.$modal.msgError("鍙戣揣澶辫触锛岃閲嶈瘯");
@@ -1966,7 +1990,7 @@
const closeDeliveryDia = () => {
proxy.resetForm("deliveryFormRef");
deliveryFormVisible.value = false;
- currentDeliveryRow.value = null;
+ currentDeliveryContext.value = null;
};
onMounted(() => {
--
Gitblit v1.9.3