This commit is contained in:
weiwei committed 2025-07-02 16:00:00 +08:00
1 parent 24155690ca
commit 61c5d76651
1 file changed
+36 -14
@@ -3,19 +3,36 @@
<el-dialog :title="prop.title" v-model="state.upload.open" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px">
<el-form-item label="充值类型" prop="bizType" class="mb20">
<dict-select v-model="form.bizType" dict-code="wallet_biz_recharge" :hide-ids="[
roleCodes.includes('RETURN_CANTEEN') || auths(['wallet_walletRechargeApply_refund']) ? '' : '3',
auths(['wallet_walletRechargeApply_select_jz']) ? '' : '2',
]" placeholder="请选择充值类型" />
<dict-select
v-model="form.bizType"
dict-code="wallet_biz_recharge"
:hide-ids="[
roleCodes.includes('RETURN_CANTEEN') || auths(['wallet_walletRechargeApply_refund']) ? '' : '3',
auths(['wallet_walletRechargeApply_select_jz']) ? '' : '2',
]"
placeholder="请选择充值类型"
/>
</el-form-item>
<el-form-item v-if="form.bizType == '1'" label="发票" prop="invoiceId" class="mb20">
<select-wallet-invoice v-model="form.invoiceId" />
</el-form-item>
<el-upload v-else v-loading="state.upload.isUploading" ref="uploadRef" :limit="1" accept=".xlsx, .xls"
:data="{ bizType: form.bizType }" :headers="headers" :action="baseURL + other.adaptationUrl(url)"
:disabled="state.upload.isUploading" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-error="handleFileError" :auto-upload="false" drag>
<el-upload
v-else
v-loading="state.upload.isUploading"
ref="uploadRef"
:limit="1"
accept=".xlsx, .xls"
:data="{ bizType: form.bizType }"
:headers="headers"
:action="baseURL + other.adaptationUrl(url)"
:disabled="state.upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileError"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
{{ $t("excel.operationNotice") }}
@@ -24,8 +41,13 @@
<template #tip>
<div class="el-upload__tip text-center">
<span>{{ $t("excel.fileFormat") }}</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
@click="downExcelTemp" v-if="tempUrl">{{ $t("excel.downloadTemplate") }}
<el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="downExcelTemp"
v-if="tempUrl"
>{{ $t("excel.downloadTemplate") }}
</el-link>
</div>
</template>
@@ -41,8 +63,7 @@
</el-dialog>
<!--校验失败错误数据-->
<el-dialog :title="$t('excel.validationFailureData')" v-model="state.errorVisible" :close-on-click-modal="false"
draggable>
<el-dialog :title="$t('excel.validationFailureData')" v-model="state.errorVisible" :close-on-click-modal="false" draggable>
<el-table :data="state.errorData">
<el-table-column property="lineNum" align="center" :label="$t('excel.lineNumbers')" width="100" />
<el-table-column property="errors" align="center" :label="$t('excel.misDescription')" show-overflow-tooltip>
@@ -161,10 +182,11 @@ const handleFileSuccess = (response: any) => {
*/
const submitFileForm = async () => {
if (form.bizType != "1") {
state.upload.isUploading = true
uploadRef.value.submit()
return
}
const valid = await dataFormRef.value.validate().catch(() => { })
const valid = await dataFormRef.value.validate().catch(() => {})
if (!valid) return
try {
state.upload.isUploading = true
@@ -173,7 +195,7 @@ const submitFileForm = async () => {
useMessage().success("导入成功充值")
emit?.("refreshDataList")
} catch (error: any) {
console.error(error);
console.error(error)
useMessage().error(error.msg || "新增充值数据错误")
} finally {
state.upload.isUploading = false