Merge pull request 'master' (#603) from master into prod
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/603
This commit is contained in:
@@ -1,25 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-upload :action="uploadFileUrl"
|
<el-upload :file-list="[]"
|
||||||
:headers="headers"
|
|
||||||
:limit="maxSize"
|
:limit="maxSize"
|
||||||
with-credentials
|
with-credentials
|
||||||
:multiple="multiple"
|
:multiple="multiple"
|
||||||
|
:http-request="httpRequestHandle"
|
||||||
:data="uploadParams"
|
:data="uploadParams"
|
||||||
:auto-upload="true"
|
:auto-upload="true"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
:on-success="handleUploadSuccess"
|
|
||||||
:on-error="uploadError"
|
|
||||||
:before-remove="beforeRemove"
|
:before-remove="beforeRemove"
|
||||||
:on-remove="handleRemove"
|
: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>
|
</el-upload>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ElMessageBox, ElNotification} from "element-plus";
|
import {ElMessageBox, ElNotification} from "element-plus";
|
||||||
import {getToken} from '@/utils/auth'
|
import {getToken} from '@/utils/auth'
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -67,13 +67,31 @@ const handleRemove = (file) => {
|
|||||||
}
|
}
|
||||||
const beforeUpload = () => {
|
const beforeUpload = () => {
|
||||||
// loading.value = true
|
// loading.value = true
|
||||||
|
console.log('水电费水电费,beforeUpload')
|
||||||
return true
|
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) => {
|
const handleUploadSuccess = (res) => {
|
||||||
|
let data = res.data
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
message: res.code === 1000 ? '上传成功' : '上传失败',
|
message: data.code === 1000 ? '上传成功' : '上传失败',
|
||||||
type: res.code === 1000 ? 'success' : 'error'
|
type: data.code === 1000 ? 'success' : 'error'
|
||||||
})
|
})
|
||||||
emit("success")
|
emit("success")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,24 +257,13 @@ const init = async () => {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
buttonShow.value = !data.view
|
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)
|
baseForm.value.setValues(data)
|
||||||
}
|
}
|
||||||
// if (code !== 1000) {
|
|
||||||
// ElNotification({
|
|
||||||
// title: '提示',
|
|
||||||
// message: msg,
|
|
||||||
// type: 'error'
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
getBaseInfo()
|
getBaseInfo()
|
||||||
init()
|
init()
|
||||||
const importTheExpenseLedger = () => {
|
const importTheExpenseLedger = () => {
|
||||||
// tableIns.value.refresh()
|
tableIns.value.refresh()
|
||||||
}
|
}
|
||||||
const handleUploadFee = () => {
|
const handleUploadFee = () => {
|
||||||
router.push({
|
router.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user