From 076bb96b437258f0e8cdbe184040e1e302b60d4b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 22 十二月 2025 14:10:12 +0800
Subject: [PATCH] 1.军泰伟业代码初始化
---
src/views/salesManagement/invoiceLedger/index.vue | 85 +++++++++++++++++++++++++++---------------
1 files changed, 54 insertions(+), 31 deletions(-)
diff --git a/src/views/salesManagement/invoiceLedger/index.vue b/src/views/salesManagement/invoiceLedger/index.vue
index 14f6908..814b36f 100644
--- a/src/views/salesManagement/invoiceLedger/index.vue
+++ b/src/views/salesManagement/invoiceLedger/index.vue
@@ -31,9 +31,8 @@
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
<el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" show-overflow-tooltip width="180" />
- <el-table-column label="瀹㈡埛鍚堝悓鍙�" prop="customerContractNo" show-overflow-tooltip width="180" />
<el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip width="240" />
- <el-table-column label="椤圭洰" prop="projectName" width="320" />
+<!-- <el-table-column label="椤圭洰" prop="projectName" width="320" />-->
<el-table-column label="浜у搧澶х被" prop="productCategory" width="200" />
<el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="160" show-overflow-tooltip />
<el-table-column label="鍙戠エ鍙�" prop="invoiceNo" width="200" show-overflow-tooltip />
@@ -43,21 +42,22 @@
<el-table-column label="褰曞叆浜�" prop="invoicePerson" show-overflow-tooltip />
<el-table-column label="褰曞叆鏃ユ湡" prop="createTime" show-overflow-tooltip :formatter="formatDate" width="180" />
<el-table-column label="寮�绁ㄦ棩鏈�" prop="invoiceDate" show-overflow-tooltip width="120" />
- <el-table-column label="鍙戠エ" prop="invoiceFileName" width="120" align="center" show-overflow-tooltip fixed="right">
+ <!-- <el-table-column label="鍙戠エ" prop="invoiceFileName" width="120" align="center" show-overflow-tooltip fixed="right">
<template #default="scope">
<el-button v-if="scope.row.invoiceFileName" text bg type="primary"
@click="handleFile(scope.row.commonFiles)">
鏌ョ湅闄勪欢
</el-button>
- <el-button v-else link type="primary" @click="handleDownload(scope.row)" :disabled="scope.row.invoicePerson !== userStore.nickName">
+ <el-button v-else link type="primary" @click="handleDownload(scope.row)">
涓婁紶
</el-button>
</template>
- </el-table-column>
+ </el-table-column> -->
<el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
<template #default="scope">
- <el-button link type="primary" size="small" @click="openForm(scope.row)" :disabled="scope.row.invoicePerson !== userStore.nickName">缂栬緫</el-button>
- <el-button link type="primary" size="small" @click="delInvoiceLedger(scope.row)" :disabled="scope.row.invoicePerson !== userStore.nickName">鍒犻櫎</el-button>
+ <el-button link type="primary" size="small" @click="openForm(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="delInvoiceLedger(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -108,7 +108,7 @@
<el-form-item label="闄勪欢鏉愭枡锛�" prop="remark">
<el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload
:headers="upload.headers" accept=".pdf" :limit="10" :before-upload="handleBeforeUpload"
- :on-error="handleUploadError" :on-success="handleUploadSuccess" :on-remove="handleRemove">
+ :on-error="handleUploadError" :on-success="handleUploadSuccess">
<el-button type="primary">涓婁紶</el-button>
<template #tip>
<!-- 鏂囦欢鏍煎紡鏀寔 doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z-->
@@ -149,6 +149,7 @@
</div>
</template>
</el-dialog>
+ <FileList ref="fileListRef" />
</div>
</template>
@@ -164,10 +165,11 @@
commitFile,
registrationProductPage,
delInvoiceLedgerByRegProductId,
-} from "../../../api/salesManagement/invoiceLedger.js";
+} from "@/api/salesManagement/invoiceLedger.js";
import useUserStore from "@/store/modules/user.js";
import useFormData from "@/hooks/useFormData";
import dayjs from "dayjs";
+import FileList from "./fileList.vue";
const { proxy } = getCurrentInstance();
const tableData = ref([]);
@@ -245,7 +247,11 @@
const getList = () => {
tableLoading.value = true;
const { invoiceDate, ...rest } = searchForm;
- registrationProductPage({ ...rest, ...page }).then((res) => {
+ // 灏嗚寖鍥存棩鏈熷瓧娈典紶閫掔粰鍚庣
+ const params = { ...rest, ...page };
+ // 绉婚櫎寮�绁ㄦ棩鏈熺殑榛樿鍊艰缃紝鍙繚鐣欒寖鍥存棩鏈熷瓧娈�
+ delete params.invoiceDate;
+ registrationProductPage(params).then((res) => {
tableLoading.value = false;
tableData.value = res.data.records;
total.value = res.data.total;
@@ -272,13 +278,15 @@
invoiceLedgerProductInfo({ id: row.id }).then((res) => {
form.value = { ...res.data };
fileList.value = res.data.fileList;
+ // 淇濆瓨ticketRegistrationId鍒拌〃鍗曟暟鎹腑
+ if (row.ticketRegistrationId) {
+ form.value.ticketRegistrationId = row.ticketRegistrationId;
+ }
if (!form.value.invoicePerson) {
form.value.invoicePerson = userStore.nickName;
- form.value.entryDate = getCurrentDate();
+ // 绉婚櫎褰曞叆鏃ユ湡榛樿鍊艰缃紝鍙鐞嗚寖鍥存棩鏈熷瓧娈�
}
- if (!form.value.invoiceDate) {
- form.value.invoiceDate = getCurrentDate();
- }
+ // 绉婚櫎寮�绁ㄦ棩鏈熼粯璁ゅ�艰缃紝鍙鐞嗚寖鍥存棩鏈熷瓧娈�
});
dialogFormVisible.value = true;
};
@@ -291,7 +299,6 @@
};
// 涓婁紶鍓嶆牎妫�
function handleBeforeUpload(file) {
- console.log("file", file);
// 鏍℃鏂囦欢澶у皬
if (file.size > 1024 * 1024 * 10) {
proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
@@ -303,6 +310,7 @@
proxy.$modal.msgError("鏂囦欢鏍煎紡涓嶅尮閰�");
return false;
}
+ console.log('handleBeforeUpload');
proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
return true;
}
@@ -314,20 +322,27 @@
// 涓婁紶鎴愬姛鍥炶皟
function handleUploadSuccess(res, file, uploadFiles) {
proxy.$modal.closeLoading();
+ console.log('handleUploadSuccess');
if (res.code === 200) {
- proxy.$refs["fileUpload"].handleRemove(file);
- fileList.value.push(res.data);
proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+ // 灏嗕笂浼犳垚鍔熺殑鏂囦欢淇℃伅娣诲姞鍒癴ileList涓�
+ const fileInfo = {
+ name: file.name,
+ url: res.data.url || file.response?.data?.url || file.url,
+ response: file.response
+ };
+ // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓鏂囦欢锛岄伩鍏嶉噸澶嶆坊鍔�
+ const existingFileIndex = fileList.value.findIndex(f => f.name === fileInfo.name);
+ if (existingFileIndex === -1) {
+ fileList.value.push(fileInfo);
+ } else {
+ fileList.value[existingFileIndex] = fileInfo;
+ }
+ // 纭繚琛ㄥ崟鏁版嵁涓殑fileList涔熸洿鏂�
+ form.value.fileList = fileList.value;
} else {
proxy.$modal.msgError(res.msg);
proxy.$refs.fileUpload.handleRemove(file);
- }
-}
-// 绉婚櫎鏂囦欢
-function handleRemove(file) {
- let index = fileList.value.findIndex((item) => item.url === file.url);
- if (index > -1) {
- fileList.value.splice(index, 1);
}
}
// 鎻愪氦琛ㄥ崟
@@ -361,13 +376,6 @@
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-};
-
-// 鎵撳紑闄勪欢涓婁紶寮圭獥
-const handleDownload = (val) => {
- fileList.value = [];
- uploadModal.value = true;
- currentId.value = val.id;
};
// 纭鏂囦欢涓婁紶
@@ -433,7 +441,22 @@
getList();
};
+//闄勪欢鐩稿叧
+const fileListRef = ref(null)
+//鏌ョ湅闄勪欢
+const downLoadFile = (row) => {
+ invoiceLedgerProductInfo({ id: row.id }).then((res) => {
+ fileListRef.value.open(res.data.fileList)
+ });
+}
+
onMounted(() => {
+ // 璁剧疆寮�绁ㄦ棩鏈熻寖鍥撮粯璁ゅ�间负褰撳ぉ
+ const today = dayjs().format('YYYY-MM-DD');
+ searchForm.invoiceDate = [today, today];
+ // 璁剧疆鑼冨洿鏃ユ湡瀛楁鐨勮捣濮嬪拰缁撴潫鏃堕棿
+ searchForm.invoiceDateStart = today;
+ searchForm.invoiceDateEnd = today;
getList();
});
</script>
--
Gitblit v1.9.3