From 41acc01d0056630ac11083cf31397f2462acaf4e Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 06 三月 2026 11:28:39 +0800
Subject: [PATCH] 一些编辑功能隐藏
---
src/pages/procurementManagement/procurementInvoiceLedger/index.vue | 769 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 395 insertions(+), 374 deletions(-)
diff --git a/src/pages/procurementManagement/procurementInvoiceLedger/index.vue b/src/pages/procurementManagement/procurementInvoiceLedger/index.vue
index 4934371..cc35d42 100644
--- a/src/pages/procurementManagement/procurementInvoiceLedger/index.vue
+++ b/src/pages/procurementManagement/procurementInvoiceLedger/index.vue
@@ -1,95 +1,99 @@
<template>
- <view class="sales-account">
- <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
- <PageHeader title="鏉ョエ鍙拌处" @back="goBack" />
-
- <!-- 鎼滅储鍖哄煙 -->
- <view class="search-section">
- <view class="search-bar">
- <view class="search-input">
- <up-input
- class="search-text"
- placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О鎼滅储"
- v-model="searchForm.supplierName"
- @change="handleQuery"
- clearable
- />
- </view>
- <view class="filter-button" @click="handleQuery">
- <up-icon name="search" size="24" color="#999"></up-icon>
- </view>
- </view>
- </view>
-
- <!-- 鍒楄〃鍖哄煙 -->
- <view class="ledger-list" v-if="total > 0">
- <view v-for="(item, index) in ledgerList" :key="index">
- <view class="ledger-item">
- <view class="item-header">
- <view class="item-left">
- <view class="document-icon">
- <up-icon name="file-text" size="16" color="#ffffff"></up-icon>
- </view>
- <text class="item-id">{{ item.purchaseContractNumber }}</text>
- </view>
- </view>
- <up-divider></up-divider>
- <view class="item-details">
- <view class="detail-row">
- <text class="detail-label">閿�鍞悎鍚屽彿</text>
- <text class="detail-value">{{ item.salesContractNo }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">椤圭洰鍚嶇О</text>
- <text class="detail-value">{{ item.projectName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">渚涘簲鍟嗗悕绉�</text>
- <text class="detail-value">{{ item.supplierName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">浜у搧澶х被</text>
- <text class="detail-value">{{ item.productCategory }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">瑙勬牸鍨嬪彿</text>
- <text class="detail-value">{{ item.specificationModel }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鍙戠エ鍙�</text>
- <text class="detail-value">{{ item.invoiceNumber || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鍚堝悓閲戦(鍏�)</text>
- <text class="detail-value">{{ item.taxInclusiveTotalPrice || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鏉ョエ鏃ユ湡</text>
- <text class="detail-value">{{ item.createdAt || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鏉ョエ閲戦(鍏�)</text>
- <text class="detail-value highlight">{{ formatAmount(item.ticketsAmount) }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">涓嶅惈绋庨噾棰�(鍏�)</text>
- <text class="detail-value highlight">{{ formatAmount(item.unTicketsPrice) }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">澧炲�肩◣</text>
- <text class="detail-value">{{ item.invoiceAmount }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">褰曞叆浜�</text>
- <text class="detail-value">{{ item.issUer }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">褰曞叆鏃ユ湡</text>
- <text class="detail-value">{{ item.createdAt }}</text>
- </view>
- </view>
- <view class="action-buttons">
- <u-button
+ <view class="sales-account">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="鏉ョエ鍙拌处"
+ @back="goBack" />
+ <!-- 鎼滅储鍖哄煙 -->
+ <view class="search-section">
+ <view class="search-bar">
+ <view class="search-input">
+ <up-input class="search-text"
+ placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О鎼滅储"
+ v-model="searchForm.supplierName"
+ @change="handleQuery"
+ clearable />
+ </view>
+ <view class="filter-button"
+ @click="handleQuery">
+ <up-icon name="search"
+ size="24"
+ color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+ <!-- 鍒楄〃鍖哄煙 -->
+ <view class="ledger-list"
+ v-if="total > 0">
+ <view v-for="(item, index) in ledgerList"
+ :key="index">
+ <view class="ledger-item">
+ <view class="item-header">
+ <view class="item-left">
+ <view class="document-icon">
+ <up-icon name="file-text"
+ size="16"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="item-id">{{ item.purchaseContractNumber }}</text>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">閿�鍞悎鍚屽彿</text>
+ <text class="detail-value">{{ item.salesContractNo }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">椤圭洰鍚嶇О</text>
+ <text class="detail-value">{{ item.projectName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">渚涘簲鍟嗗悕绉�</text>
+ <text class="detail-value">{{ item.supplierName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浜у搧澶х被</text>
+ <text class="detail-value">{{ item.productCategory }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瑙勬牸鍨嬪彿</text>
+ <text class="detail-value">{{ item.specificationModel }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍙戠エ鍙�</text>
+ <text class="detail-value">{{ item.invoiceNumber || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍚堝悓閲戦(鍏�)</text>
+ <text class="detail-value">{{ item.taxInclusiveTotalPrice || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鏉ョエ鏃ユ湡</text>
+ <text class="detail-value">{{ item.createdAt || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鏉ョエ閲戦(鍏�)</text>
+ <text class="detail-value highlight">{{ formatAmount(item.ticketsAmount) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">涓嶅惈绋庨噾棰�(鍏�)</text>
+ <text class="detail-value highlight">{{ formatAmount(item.unTicketsPrice) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">澧炲�肩◣</text>
+ <text class="detail-value">{{ item.invoiceAmount }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">褰曞叆浜�</text>
+ <text class="detail-value">{{ item.issUer }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">褰曞叆鏃ユ湡</text>
+ <text class="detail-value">{{ item.createdAt }}</text>
+ </view>
+ </view>
+ <view class="action-buttons">
+ <!-- <u-button
type="primary"
size="small"
class="action-btn"
@@ -107,313 +111,330 @@
@click="handleDelete(item)"
>
鍒犻櫎
- </u-button>
-<!-- <u-button-->
-<!-- type="default"-->
-<!-- size="small"-->
-<!-- plain-->
-<!-- class="action-btn"-->
-<!-- v-if="item.invoiceFileName"-->
-<!-- @click="openFileActions(item.commonFiles || [])"-->
-<!-- >-->
-<!-- 鏌ョ湅闄勪欢-->
-<!-- </u-button>-->
-<!-- <u-button-->
-<!-- type="primary"-->
-<!-- size="small"-->
-<!-- class="action-btn"-->
-<!-- v-else-->
-<!-- :disabled="item.issUer !== userStore.nickName"-->
-<!-- @click="openUpload(item)"-->
-<!-- >-->
-<!-- 涓婁紶-->
-<!-- </u-button>-->
- </view>
- </view>
- </view>
- </view>
- <view v-else class="no-data">
- <text>鏆傛棤鏉ョエ鍙拌处鏁版嵁</text>
- </view>
-
- <!-- 鍗曡涓婁紶寮圭獥锛堟棤琛ㄥ崟锛� -->
- <u-popup v-model="showUpload" mode="bottom" border-radius="10">
- <view class="upload-container">
- <view class="popup-header">
- <text class="popup-title">涓婁紶闄勪欢锛堜粎鏀寔 pdf锛屾渶澶�10MB锛屾渶澶�10涓級</text>
- </view>
- <u-upload
- ref="uploadRef"
- accept="file"
- multiple
- :max-count="10"
- :show-progress="true"
- :before-upload="beforeReadPdf"
- :action="uploadUrl"
- :header="{ Authorization: 'Bearer ' + getToken() }"
- name="file"
- @on-success="onUploadSuccess"
- @on-error="onUploadError"
- />
- <view class="uploaded-list" v-if="fileList.length">
- <view class="uploaded-item" v-for="(f, idx) in fileList" :key="idx">
- <text class="file-name">{{ f.name || getFileNameFromUrl(f.url) }}</text>
- <u-button size="mini" type="error" plain @click="removeUploaded(idx)">绉婚櫎</u-button>
- </view>
- </view>
- <view class="filter-actions">
- <u-button @click="showUpload = false" type="default" size="default" style="width: 150px;">鍙栨秷</u-button>
- <u-button @click="confirmUpload" type="primary" size="default" style="width: 150px;">纭</u-button>
- </view>
- </view>
- </u-popup>
-
- <!-- 闄勪欢鍒楄〃閫夋嫨 -->
- <u-action-sheet v-model="showFileSheet" :list="fileActions" :cancel-btn="true" @click="onSelectFile" @close="showFileSheet = false" />
- </view>
+ </u-button> -->
+ <!-- <u-button-->
+ <!-- type="default"-->
+ <!-- size="small"-->
+ <!-- plain-->
+ <!-- class="action-btn"-->
+ <!-- v-if="item.invoiceFileName"-->
+ <!-- @click="openFileActions(item.commonFiles || [])"-->
+ <!-- >-->
+ <!-- 鏌ョ湅闄勪欢-->
+ <!-- </u-button>-->
+ <!-- <u-button-->
+ <!-- type="primary"-->
+ <!-- size="small"-->
+ <!-- class="action-btn"-->
+ <!-- v-else-->
+ <!-- :disabled="item.issUer !== userStore.nickName"-->
+ <!-- @click="openUpload(item)"-->
+ <!-- >-->
+ <!-- 涓婁紶-->
+ <!-- </u-button>-->
+ </view>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="no-data">
+ <text>鏆傛棤鏉ョエ鍙拌处鏁版嵁</text>
+ </view>
+ <!-- 鍗曡涓婁紶寮圭獥锛堟棤琛ㄥ崟锛� -->
+ <u-popup v-model="showUpload"
+ mode="bottom"
+ border-radius="10">
+ <view class="upload-container">
+ <view class="popup-header">
+ <text class="popup-title">涓婁紶闄勪欢锛堜粎鏀寔 pdf锛屾渶澶�10MB锛屾渶澶�10涓級</text>
+ </view>
+ <u-upload ref="uploadRef"
+ accept="file"
+ multiple
+ :max-count="10"
+ :show-progress="true"
+ :before-upload="beforeReadPdf"
+ :action="uploadUrl"
+ :header="{ Authorization: 'Bearer ' + getToken() }"
+ name="file"
+ @on-success="onUploadSuccess"
+ @on-error="onUploadError" />
+ <view class="uploaded-list"
+ v-if="fileList.length">
+ <view class="uploaded-item"
+ v-for="(f, idx) in fileList"
+ :key="idx">
+ <text class="file-name">{{ f.name || getFileNameFromUrl(f.url) }}</text>
+ <u-button size="mini"
+ type="error"
+ plain
+ @click="removeUploaded(idx)">绉婚櫎</u-button>
+ </view>
+ </view>
+ <view class="filter-actions">
+ <u-button @click="showUpload = false"
+ type="default"
+ size="default"
+ style="width: 150px;">鍙栨秷</u-button>
+ <u-button @click="confirmUpload"
+ type="primary"
+ size="default"
+ style="width: 150px;">纭</u-button>
+ </view>
+ </view>
+ </u-popup>
+ <!-- 闄勪欢鍒楄〃閫夋嫨 -->
+ <u-action-sheet v-model="showFileSheet"
+ :list="fileActions"
+ :cancel-btn="true"
+ @click="onSelectFile"
+ @close="showFileSheet = false" />
+ </view>
</template>
<script setup>
-import { ref, reactive, onMounted } from 'vue'
-import dayjs from 'dayjs'
-const showToast = (message) => {
- uni.showToast({
- title: message,
- icon: 'none'
- })
-}
-import useUserStore from '@/store/modules/user'
-import { getToken } from '@/utils/auth'
-import config from '@/config.js'
-import {
- registrationProductPage,
- commitFile,
- delInvoiceLedgerByRegProductId
-} from '@/api/salesManagement/invoiceLedger.js'
-import {onShow} from "@dcloudio/uni-app";
-import {productRecordPage} from "@/api/procurementManagement/procurementInvoiceLedger";
-import {delRegistration} from "@/api/procurementManagement/invoiceEntry";
-import PageHeader from '@/components/PageHeader.vue';
-import FooterButtons from '@/components/FooterButtons.vue';
+ import { ref, reactive, onMounted } from "vue";
+ import dayjs from "dayjs";
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+ import useUserStore from "@/store/modules/user";
+ import { getToken } from "@/utils/auth";
+ import config from "@/config.js";
+ import {
+ registrationProductPage,
+ commitFile,
+ delInvoiceLedgerByRegProductId,
+ } from "@/api/salesManagement/invoiceLedger.js";
+ import { onShow } from "@dcloudio/uni-app";
+ import { productRecordPage } from "@/api/procurementManagement/procurementInvoiceLedger";
+ import { delRegistration } from "@/api/procurementManagement/invoiceEntry";
+ import PageHeader from "@/components/PageHeader.vue";
+ import FooterButtons from "@/components/FooterButtons.vue";
-const userStore = useUserStore()
+ const userStore = useUserStore();
-// 鍒楄〃涓庢煡璇�
-const ledgerList = ref([])
-const total = ref(0)
-const page = reactive({ current: -1, size: -1 })
-const searchForm = reactive({
- supplierName: '',
-})
+ // 鍒楄〃涓庢煡璇�
+ const ledgerList = ref([]);
+ const total = ref(0);
+ const page = reactive({ current: -1, size: -1 });
+ const searchForm = reactive({
+ supplierName: "",
+ });
-const currentId = ref('')
-const fileList = ref([]) // 琛屼笂浼犳垨閫氱敤涓婁紶鍒楄〃
-const uploadRef = ref()
-const uploadUrl = config.baseUrl + '/invoiceLedger/uploadFile'
+ const currentId = ref("");
+ const fileList = ref([]); // 琛屼笂浼犳垨閫氱敤涓婁紶鍒楄〃
+ const uploadRef = ref();
+ const uploadUrl = config.baseUrl + "/invoiceLedger/uploadFile";
-// 琛屼笂浼犲脊绐�
-const showUpload = ref(false)
+ // 琛屼笂浼犲脊绐�
+ const showUpload = ref(false);
-// 闄勪欢鏌ョ湅
-const showFileSheet = ref(false)
-const fileActions = ref([])
-let currentFilesToOpen = []
+ // 闄勪欢鏌ョ湅
+ const showFileSheet = ref(false);
+ const fileActions = ref([]);
+ let currentFilesToOpen = [];
-const formatAmount = (val) => {
- if (val === undefined || val === null || val === '') return '0.00'
- const num = Number(val)
- if (Number.isNaN(num)) return '0.00'
- return num.toFixed(2)
-}
-const formatDateTime = (val) => {
- if (!val) return ''
- return dayjs(val).format('YYYY-MM-DD HH:mm:ss')
-}
+ const formatAmount = val => {
+ if (val === undefined || val === null || val === "") return "0.00";
+ const num = Number(val);
+ if (Number.isNaN(num)) return "0.00";
+ return num.toFixed(2);
+ };
+ const formatDateTime = val => {
+ if (!val) return "";
+ return dayjs(val).format("YYYY-MM-DD HH:mm:ss");
+ };
-const goBack = () => {
- uni.navigateBack()
-}
+ const goBack = () => {
+ uni.navigateBack();
+ };
-const handleQuery = () => {
- getList()
-}
+ const handleQuery = () => {
+ getList();
+ };
-const getList = async () => {
- try {
- uni.showLoading({
- title: '鍔犺浇涓�...'
- });
- const res = await productRecordPage({ ...searchForm, ...page })
- // 鍏煎涓嶅悓杩斿洖缁撴瀯
- const records = res?.data?.records || res?.records || res?.data || []
- const totalVal = res?.data?.total || res?.total || records.length || 0
- ledgerList.value = records
- total.value = totalVal
- uni.hideLoading();
- } catch (e) {
- uni.hideLoading();
- showToast('鑾峰彇鍒楄〃澶辫触')
- }
-}
+ const getList = async () => {
+ try {
+ uni.showLoading({
+ title: "鍔犺浇涓�...",
+ });
+ const res = await productRecordPage({ ...searchForm, ...page });
+ // 鍏煎涓嶅悓杩斿洖缁撴瀯
+ const records = res?.data?.records || res?.records || res?.data || [];
+ const totalVal = res?.data?.total || res?.total || records.length || 0;
+ ledgerList.value = records;
+ total.value = totalVal;
+ uni.hideLoading();
+ } catch (e) {
+ uni.hideLoading();
+ showToast("鑾峰彇鍒楄〃澶辫触");
+ }
+ };
-// 缂栬緫閫昏緫鏀逛负璺宠浆鏂伴〉闈�
-const openEdit = (row) => {
- try {
- uni.setStorageSync('invoiceLedgerEditRow', JSON.stringify(row))
- uni.navigateTo({ url: '/pages/procurementManagement/procurementInvoiceLedger/detail' })
- } catch (e) {
- showToast('璺宠浆澶辫触')
- }
-}
+ // 缂栬緫閫昏緫鏀逛负璺宠浆鏂伴〉闈�
+ const openEdit = row => {
+ try {
+ uni.setStorageSync("invoiceLedgerEditRow", JSON.stringify(row));
+ uni.navigateTo({
+ url: "/pages/procurementManagement/procurementInvoiceLedger/detail",
+ });
+ } catch (e) {
+ showToast("璺宠浆澶辫触");
+ }
+ };
-// 鍒犻櫎
-const handleDelete = (row) => {
- let ids = [];
- ids.push(row.id);
- console.log(ids)
- uni.showModal({
- title: '鍒犻櫎纭',
- content: '璇ュ彂绁ㄥ彴璐﹀皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�',
- success: async (res) => {
- if (res.confirm) {
- try {
- uni.showLoading({
- title: '澶勭悊涓�...'
- });
- await delRegistration(ids)
- uni.hideLoading();
- showToast('鍒犻櫎鎴愬姛')
- await getList()
- } catch (e) {
- uni.hideLoading();
- showToast('鍒犻櫎澶辫触锛岃閲嶈瘯')
- }
- }
- }
- })
-}
+ // 鍒犻櫎
+ const handleDelete = row => {
+ let ids = [];
+ ids.push(row.id);
+ console.log(ids);
+ uni.showModal({
+ title: "鍒犻櫎纭",
+ content: "璇ュ彂绁ㄥ彴璐﹀皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�",
+ success: async res => {
+ if (res.confirm) {
+ try {
+ uni.showLoading({
+ title: "澶勭悊涓�...",
+ });
+ await delRegistration(ids);
+ uni.hideLoading();
+ showToast("鍒犻櫎鎴愬姛");
+ await getList();
+ } catch (e) {
+ uni.hideLoading();
+ showToast("鍒犻櫎澶辫触锛岃閲嶈瘯");
+ }
+ }
+ },
+ });
+ };
-// 琛屼笂浼�
-const openUpload = (row) => {
- currentId.value = row.id
- fileList.value = []
- showUpload.value = true
-}
-const confirmUpload = async () => {
- try {
- const payload = { fileList: fileList.value, id: currentId.value }
- uni.showLoading({
- title: '鎻愪氦涓�...'
- });
- await commitFile(payload)
- uni.hideLoading();
- showToast('鎻愪氦鎴愬姛')
- showUpload.value = false
- fileList.value = []
- currentId.value = ''
- getList()
- } catch (e) {
- uni.hideLoading();
- showToast('鎻愪氦澶辫触锛岃閲嶈瘯')
- }
-}
+ // 琛屼笂浼�
+ const openUpload = row => {
+ currentId.value = row.id;
+ fileList.value = [];
+ showUpload.value = true;
+ };
+ const confirmUpload = async () => {
+ try {
+ const payload = { fileList: fileList.value, id: currentId.value };
+ uni.showLoading({
+ title: "鎻愪氦涓�...",
+ });
+ await commitFile(payload);
+ uni.hideLoading();
+ showToast("鎻愪氦鎴愬姛");
+ showUpload.value = false;
+ fileList.value = [];
+ currentId.value = "";
+ getList();
+ } catch (e) {
+ uni.hideLoading();
+ showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ }
+ };
-// 涓婁紶鐩稿叧
-const beforeReadPdf = (file) => {
- // 鍏煎澶氭枃浠�
- const files = Array.isArray(file) ? file : [file]
- for (const f of files) {
- const sizeOk = f.size <= 10 * 1024 * 1024
- const ext = (f.name || '').split('.').pop()?.toLowerCase()
- if (ext !== 'pdf') {
- showToast('浠呮敮鎸乸df鏂囦欢')
- return false
- }
- if (!sizeOk) {
- showToast('涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB')
- return false
- }
- }
- return true
-}
+ // 涓婁紶鐩稿叧
+ const beforeReadPdf = file => {
+ // 鍏煎澶氭枃浠�
+ const files = Array.isArray(file) ? file : [file];
+ for (const f of files) {
+ const sizeOk = f.size <= 10 * 1024 * 1024;
+ const ext = (f.name || "").split(".").pop()?.toLowerCase();
+ if (ext !== "pdf") {
+ showToast("浠呮敮鎸乸df鏂囦欢");
+ return false;
+ }
+ if (!sizeOk) {
+ showToast("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB");
+ return false;
+ }
+ }
+ return true;
+ };
-// uview-plus 鐨勪笂浼犳垚鍔熷洖璋�
-const onUploadSuccess = (res, file) => {
- try {
- const data = JSON.parse(res.data || '{}')
- if (data.code === 200) {
- fileList.value.push(data.data)
- showToast('涓婁紶鎴愬姛')
- } else {
- showToast('涓婁紶澶辫触: ' + (data.msg || '鏈煡閿欒'))
- }
- } catch (err) {
- showToast('涓婁紶澶辫触')
- }
-}
+ // uview-plus 鐨勪笂浼犳垚鍔熷洖璋�
+ const onUploadSuccess = (res, file) => {
+ try {
+ const data = JSON.parse(res.data || "{}");
+ if (data.code === 200) {
+ fileList.value.push(data.data);
+ showToast("涓婁紶鎴愬姛");
+ } else {
+ showToast("涓婁紶澶辫触: " + (data.msg || "鏈煡閿欒"));
+ }
+ } catch (err) {
+ showToast("涓婁紶澶辫触");
+ }
+ };
-// uview-plus 鐨勪笂浼犲け璐ュ洖璋�
-const onUploadError = (err) => {
- showToast('涓婁紶澶辫触')
-}
+ // uview-plus 鐨勪笂浼犲け璐ュ洖璋�
+ const onUploadError = err => {
+ showToast("涓婁紶澶辫触");
+ };
-const removeUploaded = (index) => {
- fileList.value.splice(index, 1)
-}
+ const removeUploaded = index => {
+ fileList.value.splice(index, 1);
+ };
-const getFileNameFromUrl = (url) => {
- try {
- if (!url) return ''
- return decodeURIComponent(url.split('/').pop())
- } catch (e) {
- return url
- }
-}
+ const getFileNameFromUrl = url => {
+ try {
+ if (!url) return "";
+ return decodeURIComponent(url.split("/").pop());
+ } catch (e) {
+ return url;
+ }
+ };
-// 闄勪欢鏌ョ湅
-const openFileActions = (commonFiles) => {
- currentFilesToOpen = commonFiles || []
- fileActions.value = (commonFiles || []).map((f, idx) => ({
- title: getFileNameFromUrl(f.url || ''),
- index: idx
- }))
- showFileSheet.value = true
-}
-const onSelectFile = async (action) => {
- try {
- const item = currentFilesToOpen[action.index]
- if (!item || !item.url) return
- uni.showLoading({
- title: '涓嬭浇涓�...'
- });
- uni.downloadFile({
- url: item.url,
- success: (res) => {
- uni.hideLoading();
- if (res.statusCode === 200) {
- uni.openDocument({ filePath: res.tempFilePath })
- } else {
- showToast('涓嬭浇澶辫触')
- }
- },
- fail: () => {
- uni.hideLoading();
- showToast('涓嬭浇澶辫触')
- }
- })
- } catch (e) {
- uni.hideLoading();
- showToast('鎵撳紑澶辫触')
- }
-}
+ // 闄勪欢鏌ョ湅
+ const openFileActions = commonFiles => {
+ currentFilesToOpen = commonFiles || [];
+ fileActions.value = (commonFiles || []).map((f, idx) => ({
+ title: getFileNameFromUrl(f.url || ""),
+ index: idx,
+ }));
+ showFileSheet.value = true;
+ };
+ const onSelectFile = async action => {
+ try {
+ const item = currentFilesToOpen[action.index];
+ if (!item || !item.url) return;
+ uni.showLoading({
+ title: "涓嬭浇涓�...",
+ });
+ uni.downloadFile({
+ url: item.url,
+ success: res => {
+ uni.hideLoading();
+ if (res.statusCode === 200) {
+ uni.openDocument({ filePath: res.tempFilePath });
+ } else {
+ showToast("涓嬭浇澶辫触");
+ }
+ },
+ fail: () => {
+ uni.hideLoading();
+ showToast("涓嬭浇澶辫触");
+ },
+ });
+ } catch (e) {
+ uni.hideLoading();
+ showToast("鎵撳紑澶辫触");
+ }
+ };
-onShow(() => {
- getList()
-})
+ onShow(() => {
+ getList();
+ });
</script>
<style scoped lang="scss">
-@import '@/styles/procurement-common.scss';
+ @import "@/styles/procurement-common.scss";
-// 鏉ョエ鍙拌处鐗规湁鏍峰紡锛堟墍鏈夋牱寮忛兘宸插寘鍚湪鍏叡鏍峰紡涓級
+ // 鏉ョエ鍙拌处鐗规湁鏍峰紡锛堟墍鏈夋牱寮忛兘宸插寘鍚湪鍏叡鏍峰紡涓級
</style>
\ No newline at end of file
--
Gitblit v1.9.3