Merge pull request 'feat : 台账导入' (#602) from dd into master

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/602
This commit is contained in:
2024-07-18 17:54:19 +00:00
2 changed files with 27 additions and 20 deletions

View File

@@ -1,25 +1,25 @@
<template>
<el-upload :action="uploadFileUrl"
:headers="headers"
<el-upload :file-list="[]"
:limit="maxSize"
with-credentials
:multiple="multiple"
:http-request="httpRequestHandle"
:data="uploadParams"
:auto-upload="true"
:show-file-list="false"
:before-upload="beforeUpload"
:on-success="handleUploadSuccess"
:on-error="uploadError"
:before-remove="beforeRemove"
:on-remove="handleRemove"
>
<el-button color="#DED0B2" style="margin-left: 10px; margin-right: 10px;" :disabled="disabled">导入</el-button>
<el-button color="#DED0B2" style="margin-left: 10px; margin-right: 10px;" :disabled="disabled">导入</el-button>
</el-upload>
</template>
<script setup>
import { ElMessageBox, ElNotification} from "element-plus";
import {ElMessageBox, ElNotification} from "element-plus";
import {getToken} from '@/utils/auth'
import axios from "axios";
const props = defineProps({
value: {
type: Array,
@@ -67,13 +67,31 @@ const handleRemove = (file) => {
}
const beforeUpload = () => {
// loading.value = true
console.log('水电费水电费,beforeUpload')
return true
}
const httpRequestHandle = (param) => {
let file = param.file
axios.post(uploadFileUrl.value, {
file: file
}, {
headers: {
'Content-Type': 'multipart/form-data',
...headers
}
}).then(res => {
handleUploadSuccess(res)
}).catch(error => {
uploadError(error)
})
}
const handleUploadSuccess = (res) => {
let data = res.data
ElNotification({
title: '提示',
message: res.code === 1000 ? '上传成功' : '上传失败',
type: res.code === 1000 ? 'success' : 'error'
message: data.code === 1000 ? '上传成功' : '上传失败',
type: data.code === 1000 ? 'success' : 'error'
})
emit("success")
}

View File

@@ -257,24 +257,13 @@ const init = async () => {
nextTick(() => {
buttonShow.value = !data.view
})
// if (!data.view) {
// btns.value.push({name: '上传费用', key: 'add', color: '#DED0B2', auth: ''},
// {name: '表格更新', key: 'update', color: '#DED0B2', auth: ''})
// }
baseForm.value.setValues(data)
}
// if (code !== 1000) {
// ElNotification({
// title: '提示',
// message: msg,
// type: 'error'
// })
// }
}
getBaseInfo()
init()
const importTheExpenseLedger = () => {
// tableIns.value.refresh()
tableIns.value.refresh()
}
const handleUploadFee = () => {
router.push({