From 67dbada263c0a112a2f22c4072c8dfd20241dbc6 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期四, 30 四月 2026 17:08:41 +0800
Subject: [PATCH] 计量器具台账文件上传修改
---
src/views/salesManagement/salesLedger/index.vue | 107 +++++++++--------------------------------------------
1 files changed, 19 insertions(+), 88 deletions(-)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 1edda61..1235f94 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -231,7 +231,7 @@
:disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫</el-button>
<el-button link
type="primary"
- @click="downLoadFile(scope.row)">闄勪欢</el-button>
+ @click="openFileDialog(scope.row)">闄勪欢</el-button>
</template>
</el-table-column>
</el-table>
@@ -475,26 +475,7 @@
<el-col :span="24">
<el-form-item label="闄勪欢鏉愭枡锛�"
prop="salesLedgerFiles">
- <el-upload v-model:file-list="fileList"
- :action="upload.url"
- multiple
- ref="fileUpload"
- auto-upload
- :headers="upload.headers"
- :before-upload="handleBeforeUpload"
- :on-error="handleUploadError"
- :on-success="handleUploadSuccess"
- :on-remove="handleRemove">
- <el-button type="primary"
- v-if="operationType !== 'view'">涓婁紶</el-button>
- <template #tip
- v-if="operationType !== 'view'">
- <div class="el-upload__tip">
- 鏂囦欢鏍煎紡鏀寔
- doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z
- </div>
- </template>
- </el-upload>
+ <FileUpload v-model:file-list="fileList" />
</el-form-item>
</el-col>
</el-row>
@@ -757,10 +738,9 @@
</template>
</el-upload>
</FormDialog>
+<!-- // todo 闄勪欢棰勮鐩稿叧 -->
<!-- 闄勪欢鍒楄〃寮圭獥 -->
- <FileListDialog ref="fileListRef"
- v-model="fileListDialogVisible"
- title="闄勪欢鍒楄〃" />
+ <FileList v-if="fileDialogVisible" v-model:visible="fileDialogVisible" record-type="sales_ledger" :record-id="recordId" />
<!-- 鎵撳嵃棰勮寮圭獥 -->
<el-dialog v-model="printPreviewVisible"
title="鎵撳嵃棰勮"
@@ -922,10 +902,8 @@
import { onMounted, ref, getCurrentInstance } from "vue";
import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
import { ElMessageBox, ElMessage } from "element-plus";
- import { UploadFilled, Download } from "@element-plus/icons-vue";
import useUserStore from "@/store/modules/user";
import { userListNoPage } from "@/api/system/user.js";
- import FileListDialog from "@/components/Dialog/FileListDialog.vue";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
import {
@@ -946,6 +924,10 @@
import { getCurrentDate } from "@/utils/index.js";
import { useRouter, useRoute } from "vue-router";
import { listCustomerPrivatePool } from "@/api/basicData/customerFile.js";
+ import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+
+ const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
+
const router = useRouter();
const route = useRoute();
const userStore = useUserStore();
@@ -1042,12 +1024,6 @@
const { productForm, productRules } = toRefs(productFormData);
// 闃叉寰幆璁$畻鐨勬爣蹇�
const isCalculating = ref(false);
- const upload = reactive({
- // 涓婁紶鐨勫湴鍧�
- url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
- // 璁剧疆涓婁紶鐨勮姹傚ご閮�
- headers: { Authorization: "Bearer " + getToken() },
- });
// 鎵撳嵃鐩稿叧
const printPreviewVisible = ref(false);
const printData = ref([]);
@@ -1409,7 +1385,7 @@
form.value = { ...res };
form.value.entryPerson = Number(res.entryPerson);
productData.value = form.value.productData;
- fileList.value = form.value.salesLedgerFiles;
+ fileList.value = form.value.storageBlobVOs;
});
}
// let userAll = await userStore.getInfo()
@@ -1529,42 +1505,6 @@
function changs(val) {
console.log(val);
}
- // 涓婁紶鍓嶆牎妫�
- function handleBeforeUpload(file) {
- // 鏍℃鏂囦欢澶у皬
- // if (file.size > 1024 * 1024 * 10) {
- // proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
- // return false;
- // }
- proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
- return true;
- }
- // 涓婁紶澶辫触
- function handleUploadError(err) {
- proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触");
- proxy.$modal.closeLoading();
- }
- // 涓婁紶鎴愬姛鍥炶皟
- function handleUploadSuccess(res, file, uploadFiles) {
- proxy.$modal.closeLoading();
- if (res.code === 200) {
- file.tempId = res.data.tempId;
- proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
- } else {
- proxy.$modal.msgError(res.msg);
- proxy.$refs.fileUpload.handleRemove(file);
- }
- }
- // 绉婚櫎鏂囦欢
- function handleRemove(file) {
- if (operationType.value === "edit") {
- let ids = [];
- ids.push(file.id);
- delLedgerFile(ids).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- });
- }
- }
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
proxy.$refs["formRef"].validate(valid => {
@@ -1576,11 +1516,7 @@
proxy.$modal.msgWarning("璇锋坊鍔犱骇鍝佷俊鎭�");
return;
}
- let tempFileIds = [];
- if (fileList.value !== null && fileList.value.length > 0) {
- tempFileIds = fileList.value.map(item => item.tempId);
- }
- form.value.tempFileIds = tempFileIds;
+ form.value.storageBlobDTOs = fileList;
form.value.type = 1;
addOrUpdateSalesLedger(form.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
@@ -2503,20 +2439,15 @@
return statusStr === "寰呭彂璐�" || statusStr === "瀹℃牳鎷掔粷";
};
- /**
- * 涓嬭浇鏂囦欢
- *
- * @param row 涓嬭浇鏂囦欢鐨勭浉鍏充俊鎭璞�
- */
- const fileListRef = ref(null);
- const fileListDialogVisible = ref(false);
- const downLoadFile = row => {
- getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
- if (fileListRef.value) {
- fileListRef.value.open(res.salesLedgerFiles);
- }
- });
- };
+ // 鎵撳紑闄勪欢寮圭獥
+ const recordId =ref(0)
+ const fileDialogVisible = ref(false)
+
+ // 鎵撳紑闄勪欢寮规
+ const openFileDialog = async (row) => {
+ recordId.value = row.id
+ fileDialogVisible.value = true
+ }
// 鎵撳紑鍙戣揣寮规
const openDeliveryForm = row => {
--
Gitblit v1.9.3