From 6c0711ef3200ebcb2bdd35b9826eebcd02e2aec7 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期四, 26 三月 2026 16:59:00 +0800
Subject: [PATCH] fix: 将表格列标签从“出库数量”更正为“发货数量”
---
src/views/procurementManagement/procurementLedger/index.vue | 244 +++++++++++++++++++++++++++++-------------------
1 files changed, 148 insertions(+), 96 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index e40a68a..c28276d 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -26,13 +26,13 @@
prefix-icon="Search"
@change="handleQuery" />
</el-form-item>
- <el-form-item label="椤圭洰鍚嶇О锛�">
+ <!-- <el-form-item label="椤圭洰鍚嶇О锛�">
<el-input v-model="searchForm.projectName"
placeholder="璇疯緭鍏�"
clearable
prefix-icon="Search"
@change="handleQuery" />
- </el-form-item>
+ </el-form-item> -->
<el-form-item label="褰曞叆鏃ユ湡锛�">
<el-date-picker v-model="searchForm.entryDate"
value-format="YYYY-MM-DD"
@@ -53,6 +53,7 @@
<div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
<el-button type="primary"
@click="openForm('add')">鏂板鍙拌处</el-button>
+ <el-button type="primary" plain @click="handleImport">瀵煎叆</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
<el-button type="danger"
plain
@@ -119,10 +120,10 @@
prop="supplierName"
width="160"
show-overflow-tooltip />
- <el-table-column label="椤圭洰鍚嶇О"
+ <!-- <el-table-column label="椤圭洰鍚嶇О"
prop="projectName"
width="320"
- show-overflow-tooltip />
+ show-overflow-tooltip /> -->
<el-table-column label="瀹℃壒鐘舵��"
prop="approvalStatus"
width="100"
@@ -155,6 +156,9 @@
<el-table-column label="褰曞叆鏃ユ湡"
prop="entryDate"
width="100"
+ show-overflow-tooltip />
+ <el-table-column label="澶囨敞"
+ prop="remarks"
show-overflow-tooltip />
<el-table-column fixed="right"
label="鎿嶄綔"
@@ -228,16 +232,28 @@
<el-option v-for="item in supplierList"
:key="item.id"
:label="item.supplierName"
- :value="item.id" />
+ :value="item.id" >{{item.supplierName + '---' + item.supplierType}}</el-option>
</el-select>
</el-form-item>
</el-col>
- <el-col :span="12">
+ <!-- <el-col :span="12">
<el-form-item label="椤圭洰鍚嶇О"
prop="projectName">
<el-input v-model="form.projectName"
placeholder="璇疯緭鍏�"
clearable />
+ </el-form-item>
+ </el-col> -->
+ <el-col :span="12">
+ <el-form-item label="褰曞叆鏃ユ湡锛�"
+ prop="entryDate">
+ <el-date-picker style="width: 100%"
+ v-model="form.entryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
</el-form-item>
</el-col>
</el-row>
@@ -277,18 +293,7 @@
</el-select>
</el-form-item>
</el-col>
- <el-col :span="12">
- <el-form-item label="褰曞叆鏃ユ湡锛�"
- prop="entryDate">
- <el-date-picker style="width: 100%"
- v-model="form.entryDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable />
- </el-form-item>
- </el-col>
+
</el-row>
<el-row :gutter="30">
<el-col :span="24">
@@ -375,7 +380,6 @@
</div>
</el-option>
</el-select>
- <!-- 鎸夐挳锛氫笌 Select 楂樺害鍖归厤锛屽幓鎺夊乏渚ц竟妗嗭紝鏃犵紳琛旀帴 -->
<el-button size="small"
style="height: 32px;margin-left: 8px;"
@click="handleButtonClick"
@@ -425,15 +429,6 @@
prop="taxExclusiveTotalPrice"
:formatter="formattedNumber"
width="150" />
- <el-table-column label="鏄惁璐ㄦ"
- prop="isChecked"
- width="150">
- <template #default="scope">
- <el-tag :type="scope.row.isChecked ? 'success' : 'info'">
- {{ scope.row.isChecked ? '鏄�' : '鍚�' }}
- </el-tag>
- </template>
- </el-table-column>
<el-table-column fixed="right"
label="鎿嶄綔"
min-width="60"
@@ -449,8 +444,8 @@
<el-row :gutter="30">
<el-col :span="24">
<el-form-item label="澶囨敞路锛�"
- prop="remark">
- <el-input v-model="form.remark"
+ prop="remarks">
+ <el-input v-model="form.remarks"
placeholder="璇疯緭鍏�"
clearable
type="textarea"
@@ -461,7 +456,7 @@
<el-row :gutter="30">
<el-col :span="24">
<el-form-item label="闄勪欢鏉愭枡锛�"
- prop="remark">
+ prop="purchaseLedgerFiles">
<el-upload v-model:file-list="fileList"
:action="upload.url"
multiple
@@ -484,6 +479,41 @@
</el-col>
</el-row>
</el-form>
+ </FormDialog>
+ <!-- 瀵煎叆寮圭獥 -->
+ <FormDialog
+ v-model="importUpload.open"
+ :title="importUpload.title"
+ :width="'600px'"
+ @close="importUpload.open = false"
+ @confirm="submitImportFile"
+ @cancel="importUpload.open = false"
+ >
+ <el-upload
+ ref="importUploadRef"
+ :limit="1"
+ accept=".xlsx,.xls"
+ :action="importUpload.url"
+ :headers="importUpload.headers"
+ :before-upload="importUpload.beforeUpload"
+ :on-success="importUpload.onSuccess"
+ :on-error="importUpload.onError"
+ :on-progress="importUpload.onProgress"
+ :on-change="importUpload.onChange"
+ :auto-upload="false"
+ drag
+ >
+ <i class="el-icon-upload"></i>
+ <div class="el-upload__text">
+ 灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em>
+ </div>
+ <template #tip>
+ <div class="el-upload__tip">
+ 浠呮敮鎸� xls/xlsx锛屽ぇ灏忎笉瓒呰繃 10MB銆�
+ <el-button link type="primary" @click="downloadTemplate">涓嬭浇瀵煎叆妯℃澘</el-button>
+ </div>
+ </template>
+ </el-upload>
</FormDialog>
<FormDialog v-model="productFormVisible"
:title="productOperationType === 'add' ? '鏂板浜у搧' : '缂栬緫浜у搧'"
@@ -630,19 +660,6 @@
:min="0"
clearable
style="width: 100%" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鏄惁璐ㄦ锛�"
- prop="isChecked">
- <el-radio-group v-model="productForm.isChecked">
- <el-radio label="鏄�"
- :value="true" />
- <el-radio label="鍚�"
- :value="false" />
- </el-radio-group>
</el-form-item>
</el-col>
</el-row>
@@ -872,7 +889,6 @@
supplierId: "",
paymentMethod: "",
executionDate: "",
- isChecked: true,
},
rules: {
purchaseContractNumber: [
@@ -882,7 +898,7 @@
{ required: true, message: "璇烽�夋嫨瀹℃壒浜�", trigger: "change" },
],
projectName: [
- { required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" },
+ { required: false, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" },
],
supplierId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -920,7 +936,6 @@
taxExclusiveTotalPrice: "",
invoiceType: "",
warnNum: "",
- isChecked: true,
},
productRules: {
productId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -930,8 +945,8 @@
taxInclusiveUnitPrice: [
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
- taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- warnNum: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ taxRate: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+ warnNum: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
taxInclusiveTotalPrice: [
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
@@ -939,7 +954,6 @@
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- isChecked: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
},
});
const { productForm, productRules } = toRefs(productFormData);
@@ -949,6 +963,71 @@
// 璁剧疆涓婁紶鐨勮姹傚ご閮�
headers: { Authorization: "Bearer " + getToken() },
});
+
+ // 瀵煎叆鐩稿叧
+ const importUploadRef = ref(null);
+ const importUpload = reactive({
+ title: "瀵煎叆閲囪喘鍙拌处",
+ open: false,
+ url: import.meta.env.VITE_APP_BASE_API + "/purchase/ledger/import",
+ headers: { Authorization: "Bearer " + getToken() },
+ isUploading: false,
+ beforeUpload: (file) => {
+ const isExcel = file.name.endsWith(".xlsx") || file.name.endsWith(".xls");
+ const isLt10M = file.size / 1024 / 1024 < 10;
+ if (!isExcel) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢鍙兘鏄� xlsx/xls 鏍煎紡!");
+ return false;
+ }
+ if (!isLt10M) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 10MB!");
+ return false;
+ }
+ return true;
+ },
+ onChange: (file, fileList) => {
+ // noop
+ },
+ onProgress: (event, file, fileList) => {
+ // noop
+ },
+ onSuccess: (response, file, fileList) => {
+ importUpload.isUploading = false;
+ if (response?.code === 200) {
+ proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
+ importUpload.open = false;
+ if (importUploadRef.value) {
+ importUploadRef.value.clearFiles?.();
+ }
+ getList();
+ } else {
+ proxy.$modal.msgError(response?.msg || "瀵煎叆澶辫触");
+ }
+ },
+ onError: () => {
+ importUpload.isUploading = false;
+ proxy.$modal.msgError("瀵煎叆澶辫触锛岃閲嶈瘯");
+ },
+ });
+
+ const handleImport = () => {
+ importUpload.title = "瀵煎叆閲囪喘鍙拌处";
+ importUpload.open = true;
+ importUpload.isUploading = false;
+ if (importUploadRef.value) {
+ importUploadRef.value.clearFiles?.();
+ }
+ };
+
+ // 涓嬭浇瀵煎叆妯℃澘锛堝鍚庣璺緞涓嶅悓锛屽彲鍦ㄦ澶勮皟鏁达級
+ const downloadTemplate = () => {
+ proxy.download("/purchase/ledger/exportTemplate", {}, "閲囪喘鍙拌处瀵煎叆妯℃澘.xlsx");
+ };
+
+ const submitImportFile = () => {
+ importUpload.isUploading = true;
+ proxy.$refs["importUploadRef"]?.submit?.();
+ };
const changeDaterange = value => {
if (value) {
@@ -1487,6 +1566,10 @@
const submitProduct = () => {
proxy.$refs["productFormRef"].validate(valid => {
if (valid) {
+ // 濡傛灉閲岄潰鐨勬暟鎹病鏈塼axRate 閭e氨榛樿甯︿笂涓�涓猼axRate 涓�0
+ if (!Object.prototype.hasOwnProperty.call(productForm.value, 'taxRate') || productForm.value.taxRate === null || productForm.value.taxRate === undefined || productForm.value.taxRate === '') {
+ productForm.value.taxRate = 0;
+ }
if (operationType.value === "edit") {
submitProductEdit();
} else {
@@ -1543,7 +1626,7 @@
delProduct(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
closeProductDia();
- getSalesLedgerWithProducts({ id: currentId.value, type: 2 }).then(
+ getPurchaseById({ id: currentId.value, type: 2 }).then(
res => {
productData.value = res.productData;
}
@@ -1578,14 +1661,6 @@
const handleDelete = () => {
let ids = [];
if (selectedRows.value.length > 0) {
- // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
- const unauthorizedData = selectedRows.value.filter(
- item => item.recorderName !== userStore.nickName
- );
- if (unauthorizedData.length > 0) {
- proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
- return;
- }
ids = selectedRows.value.map(item => item.id);
} else {
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
@@ -1615,14 +1690,7 @@
return `${year}-${month}-${day}`;
}
const mathNum = () => {
- if (!productForm.value.taxRate) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
- return;
- }
- if (!productForm.value.taxInclusiveUnitPrice) {
- return;
- }
- if (!productForm.value.quantity) {
+ if (!productForm.value.taxInclusiveUnitPrice || !productForm.value.quantity) {
return;
}
// 鍚◣鎬讳环璁$畻
@@ -1631,23 +1699,14 @@
productForm.value.taxInclusiveUnitPrice,
productForm.value.quantity
);
- if (productForm.value.taxRate) {
- // 涓嶅惈绋庢�讳环璁$畻
- productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(
- productForm.value.taxInclusiveTotalPrice,
- productForm.value.taxRate
- );
- }
+
+ // 鏍规嵁绋庣巼璁$畻涓嶅惈绋庢�讳环
+ const taxRate = Number(productForm.value.taxRate) || 0;
+ productForm.value.taxExclusiveTotalPrice = (
+ Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)
+ ).toFixed(2);
};
const reverseMathNum = field => {
- if (!productForm.value.taxRate) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
- return;
- }
- const taxRate = Number(productForm.value.taxRate);
- if (!taxRate) return;
-
// 纭繚杈撳叆鍊间笉涓鸿礋鏁�
if (
field === "taxInclusiveTotalPrice" ||
@@ -1660,6 +1719,8 @@
return;
}
}
+
+ const taxRate = Number(productForm.value.taxRate) || 0;
if (field === "taxInclusiveTotalPrice") {
// 宸茬煡鍚◣鎬讳环鍜屾暟閲忥紝鍙嶇畻鍚◣鍗曚环
@@ -1684,25 +1745,16 @@
productForm.value.quantity = "0";
}
}
- // 鍙嶇畻涓嶅惈绋庢�讳环
+ // 鏍规嵁绋庣巼璁$畻涓嶅惈绋庢�讳环
productForm.value.taxExclusiveTotalPrice = (
- Number(productForm.value.taxInclusiveTotalPrice) /
- (1 + taxRate / 100)
+ Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)
).toFixed(2);
- // 纭繚缁撴灉涓嶄负璐熸暟
- if (Number(productForm.value.taxExclusiveTotalPrice) < 0) {
- productForm.value.taxExclusiveTotalPrice = "0";
- }
} else if (field === "taxExclusiveTotalPrice") {
- // 鍙嶇畻鍚◣鎬讳环
+ // 鏍规嵁绋庣巼璁$畻鍚◣鎬讳环
productForm.value.taxInclusiveTotalPrice = (
- Number(productForm.value.taxExclusiveTotalPrice) *
- (1 + taxRate / 100)
+ Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)
).toFixed(2);
- // 纭繚缁撴灉涓嶄负璐熸暟
- if (Number(productForm.value.taxInclusiveTotalPrice) < 0) {
- productForm.value.taxInclusiveTotalPrice = "0";
- }
+
// 宸茬煡鏁伴噺锛屽弽绠楀惈绋庡崟浠�
if (productForm.value.quantity) {
productForm.value.taxInclusiveUnitPrice = (
--
Gitblit v1.9.3