From 2e77330d87341624c88301562fd137b58f9a101a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 25 十二月 2025 10:57:35 +0800
Subject: [PATCH] 1.海川开心-录入日期都默认当天,封装公用组件和方法
---
src/views/procurementManagement/procurementInvoiceLedger/index.vue | 134 ++++++++++++++++++++++++++++++--------------
1 files changed, 90 insertions(+), 44 deletions(-)
diff --git a/src/views/procurementManagement/procurementInvoiceLedger/index.vue b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
index 7afd3d1..6ddc27e 100644
--- a/src/views/procurementManagement/procurementInvoiceLedger/index.vue
+++ b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
@@ -47,13 +47,13 @@
:tableLoading="loading"
:tableData="dataList"
:isSelection="true"
- height="calc(100vh - 15em)"
+ height="calc(100vh - 19.5em)"
:isShowSummary="true"
:summaryMethod="summarizeMainTable"
:page="{
current: pagination.currentPage,
size: pagination.pageSize,
- total: 0,
+ total: pagination.total,
}"
@selection-change="handleSelectionChange"
@pagination="changePage"
@@ -63,13 +63,6 @@
<el-button link :icon="Files" type="danger"> 闄勪欢 </el-button>
<template #dropdown>
<el-dropdown-menu>
- <el-dropdown-item
- v-if="row.commonFiles.length !== 0"
- :icon="Download"
- command="download"
- >
- 涓嬭浇
- </el-dropdown-item>
<el-dropdown-item :icon="Upload" command="upload">
涓婁紶
</el-dropdown-item>
@@ -80,15 +73,23 @@
<template #operation="{ row }">
<el-button
type="primary"
- text
- :icon="EditPen"
- @click="openEdit(row.id)"
+ link
+ @click="openEdit(row)"
>
缂栬緫
+ </el-button>
+ <el-button link type="primary" @click="downLoadFile(row)">闄勪欢</el-button>
+ <el-button
+ type="primary"
+ link
+ @click="handleDelete(row)"
+ >
+ 鍒犻櫎
</el-button>
</template>
</PIMTable>
</div>
+ <FileList ref="fileListRef" />
<UploadModal ref="modalRef" @uploadSuccess="uploadSuccess"></UploadModal>
<EditModal ref="editmodalRef" @success="getTableData"></EditModal>
</div>
@@ -103,15 +104,21 @@
Search,
Upload,
EditPen,
+ Delete,
} from "@element-plus/icons-vue";
import {
- productRecordPage,
- productUploadFile,
+ delRegistration,
+ productRecordPage,
+ productUploadFile,
} from "@/api/procurementManagement/procurementInvoiceLedger.js";
+import { delCommonFile } from "@/api/publicApi/commonFile.js";
import { onMounted } from "vue";
-import { ElMessageBox } from "element-plus";
+import { ElMessageBox, ElMessage } from "element-plus";
import UploadModal from "./Modal/UploadModal.vue";
import EditModal from "./Modal/EditModal.vue";
+import useUserStore from "@/store/modules/user.js";
+import dayjs from "dayjs";
+import FileList from "./fileList.vue";
defineOptions({
name: "鏉ョエ鍙拌处",
@@ -136,51 +143,39 @@
{
purchaseContractNumber: undefined, // 閲囪喘鍚堝悓鍙�
supplierName: undefined, // 渚涘簲鍟�
- createdAt: [], // 鏉ョエ鏃ユ湡
+ // 璁剧疆鏉ョエ鏃ユ湡鑼冨洿涓哄綋澶�
+ createdAt: [dayjs().startOf('day').format('YYYY-MM-DD'), dayjs().endOf('day').format('YYYY-MM-DD')], // 鏉ョエ鏃ユ湡
},
[
{
label: "閲囪喘鍚堝悓鍙�",
prop: "purchaseContractNumber",
- align: "center",
width: 150,
},
{
label: "閿�鍞悎鍚屽彿",
prop: "salesContractNo",
- align: "center",
- width: 150,
- },
- {
- label: "瀹㈡埛鍚嶇О",
- prop: "customerName",
- align: "center",
width: 150,
},
{
label: "渚涘簲鍟嗗悕绉�",
prop: "supplierName",
- align: "center",
width: 240,
},
{
label: "瑙勬牸鍨嬪彿",
prop: "specificationModel",
- align: "center",
width: 150,
},
{
label: "鍙戠エ鍙�",
prop: "invoiceNumber",
- align: "center",
-
width: 200,
},
{
label: "鍚堝悓閲戦(鍏�)",
prop: "taxInclusiveTotalPrice",
- align: "center",
- width: 120,
+ width: 200,
formatData: (cell) => {
return cell ? parseFloat(cell).toFixed(2) : 0;
},
@@ -188,14 +183,12 @@
{
label: "寮�绁ㄦ棩鏈�",
prop: "createdAt",
- align: "center",
- width: 100,
+ width: 110,
},
{
label: "寮�绁ㄩ噾棰�",
prop: "ticketsAmount",
- align: "center",
- width: 100,
+ width: 200,
formatData: (cell) => {
return cell ? parseFloat(cell).toFixed(2) : 0;
},
@@ -203,8 +196,7 @@
{
label: "涓嶅惈绋庨噾棰�",
prop: "unTicketsPrice",
- align: "center",
- width: 100,
+ width: 200,
formatData: (cell) => {
return cell ? parseFloat(cell).toFixed(2) : 0;
},
@@ -212,20 +204,25 @@
{
label: "澧炲�肩◣",
prop: "invoiceAmount",
- align: "center",
- width: 100,
+ width: 200,
+ },
+ {
+ label: "褰曞叆浜�",
+ prop: "issUer",
+ width: 200,
},
{
label: "闄勪欢",
align: "center",
prop: "commonFiles",
dataType: "slot",
+ fixed: "right",
slot: "commonFilesRef",
- width: 150,
+ width: 120,
},
{
fixed: "right",
- width: 120,
+ width: 190,
label: "鎿嶄綔",
dataType: "slot",
slot: "operation",
@@ -261,7 +258,12 @@
const handleSelectionChange = (val) => {
multipleVal.value = val;
};
-
+//闄勪欢鐩稿叧
+const fileListRef = ref(null)
+//鏌ョ湅闄勪欢
+const downLoadFile = (row) => {
+ fileListRef.value.open(row.commonFiles, row.id)
+}
// 瀵煎嚭
const handleOut = () => {
ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
@@ -283,8 +285,9 @@
});
};
-const changePage = ({ page }) => {
+const changePage = ({ page, limit }) => {
pagination.currentPage = page;
+ pagination.pageSize = limit;
onCurrentChange(page);
};
@@ -297,6 +300,29 @@
console.log(row.commonFiles);
openUoload(row.ticketRegistrationId);
break;
+ case "delete":
+ // 鍒犻櫎鎵�鏈夐檮浠�
+ if (row.commonFiles.length > 0) {
+ ElMessageBox.confirm(`纭鍒犻櫎璇ヨ褰曠殑鎵�鏈夐檮浠跺悧锛焋, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ // 鑾峰彇鎵�鏈夐檮浠剁殑ID
+ const fileIds = row.commonFiles.map(file => file.id);
+
+ delCommonFile(fileIds).then(() => {
+ ElMessage.success('鍒犻櫎鎴愬姛')
+ // 鍒锋柊鏁版嵁
+ getTableData();
+ }).catch(() => {
+ ElMessage.error('鍒犻櫎澶辫触')
+ })
+ }).catch(() => {
+ ElMessage.info('宸插彇娑堝垹闄�')
+ })
+ }
+ break;
}
};
@@ -304,8 +330,8 @@
modalRef.value.handleImport(id);
};
-const openEdit = (id) => {
- editmodalRef.value.open(id);
+const openEdit = (row) => {
+ editmodalRef.value.open(row);
};
// 涓婁紶鎴愬姛鍚庡仛浠�涔�
@@ -319,6 +345,26 @@
getTableData();
}
};
+// 鍒犻櫎
+const handleDelete = (row) => {
+ let ids = [];
+ ids.push(row.id);
+ ElMessageBox.confirm("璇ュ紑绁ㄥ彴璐﹀皢琚垹闄�,鏄惁纭鍒犻櫎", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ loading.value = true;
+ delRegistration(ids).then((res) => {
+ getTableData();
+ });
+ loading.value = false;
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
onMounted(() => {
getTableData();
--
Gitblit v1.9.3