feat : 台账导入
This commit is contained in:
@@ -6,27 +6,20 @@
|
|||||||
:multiple="multiple"
|
:multiple="multiple"
|
||||||
:data="uploadParams"
|
:data="uploadParams"
|
||||||
:auto-upload="true"
|
:auto-upload="true"
|
||||||
|
:show-file-list="false"
|
||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
:on-success="handleUploadSuccess"
|
:on-success="handleUploadSuccess"
|
||||||
:on-error="uploadError"
|
: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;" :loading="loading" :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'
|
||||||
|
|
||||||
const baseURL = import.meta.env.VITE_BASE_URL
|
|
||||||
const uploadFileUrl = ref(baseURL + "/workflow/mosr/expense/ledger/import")
|
|
||||||
const headers = reactive({
|
|
||||||
authorization: getToken()
|
|
||||||
})
|
|
||||||
const loading = ref(false)
|
|
||||||
const uploadParams = ref({})
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -45,9 +38,21 @@ const props = defineProps({
|
|||||||
multiple: {
|
multiple: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
projectId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const baseURL = import.meta.env.VITE_BASE_URL
|
||||||
|
const uploadFileUrl = ref(baseURL + "/workflow/mosr/expense/ledger/import?projectId=" + props.projectId)
|
||||||
|
const headers = reactive({
|
||||||
|
authorization: getToken()
|
||||||
|
})
|
||||||
|
// const loading = ref(false)
|
||||||
|
const uploadParams = ref({})
|
||||||
const emit = defineEmits(["input", "getFile", "delete"])
|
const emit = defineEmits(["input", "getFile", "delete"])
|
||||||
const beforeRemove = (file) => {
|
const beforeRemove = (file) => {
|
||||||
return ElMessageBox.confirm(`确认删除名称为${file.name}的文件吗?`, '系统提示', {
|
return ElMessageBox.confirm(`确认删除名称为${file.name}的文件吗?`, '系统提示', {
|
||||||
@@ -61,7 +66,7 @@ const handleRemove = (file) => {
|
|||||||
emit("delete", file.response.data.id)
|
emit("delete", file.response.data.id)
|
||||||
}
|
}
|
||||||
const beforeUpload = () => {
|
const beforeUpload = () => {
|
||||||
loading.value = true
|
// loading.value = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
const handleUploadSuccess = (res) => {
|
const handleUploadSuccess = (res) => {
|
||||||
@@ -70,11 +75,10 @@ const handleUploadSuccess = (res) => {
|
|||||||
message: res.code === 1000 ? '上传成功' : '上传失败',
|
message: res.code === 1000 ? '上传成功' : '上传失败',
|
||||||
type: res.code === 1000 ? 'success' : 'error'
|
type: res.code === 1000 ? 'success' : 'error'
|
||||||
})
|
})
|
||||||
loading.value = false
|
|
||||||
emit("success")
|
emit("success")
|
||||||
}
|
}
|
||||||
const uploadError = (error) => {
|
const uploadError = (error) => {
|
||||||
loading.value = false
|
// loading.value = false
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
message: "上传失败,请稍后再试!",
|
message: "上传失败,请稍后再试!",
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
|
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
|
||||||
<div style="display: flex">
|
<div style="display: flex">
|
||||||
<el-button color="#DED0B2" @click="exportExcelHandler">导出</el-button>
|
<el-button color="#DED0B2" @click="exportExcelHandler">导出</el-button>
|
||||||
<import-excel v-if="buttonShow" @success="importTheExpenseLedger"/>
|
<import-excel :projectId="projectId" v-if="!buttonShow" @success="importTheExpenseLedger"/>
|
||||||
<el-button color="#DED0B2" v-if="buttonShow" @click="handleUploadFee">上传费用</el-button>
|
<el-button color="#DED0B2" v-if="!buttonShow" @click="handleUploadFee">上传费用</el-button>
|
||||||
<el-button color="#DED0B2" v-if="buttonShow" @click="handleUpdateTable">表格更新</el-button>
|
<el-button color="#DED0B2" v-if="!buttonShow" @click="handleUpdateTable">表格更新</el-button>
|
||||||
</div>
|
</div>
|
||||||
<fvTable ref="tableIns" :tableConfig="tableConfig" @selectionChange="selectionChange">
|
<fvTable ref="tableIns" :tableConfig="tableConfig" @selectionChange="selectionChange">
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@@ -41,6 +41,7 @@ import {searchUpdateLedgerData, exportExcel} from "@/api/project-manage";
|
|||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const projectId = ref(route.query.id)
|
||||||
const basicData = ref({})
|
const basicData = ref({})
|
||||||
const tableData = ref({})
|
const tableData = ref({})
|
||||||
const formDataArray = ref([
|
const formDataArray = ref([
|
||||||
@@ -273,7 +274,7 @@ const init = async () => {
|
|||||||
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