This commit is contained in:
2026-09-09 16:16:22 +08:00
parent ebffbab428
commit ba3a985c40
3749 changed files with 29 additions and 608551 deletions
@@ -1,160 +0,0 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.downLoadTemplate {
position: absolute;
right: 0;
top: 0;
}
.dividing-line {
display: flex;
justify-content: center;
position: relative;
margin: 10px 0;
}
.dividing-line::after {
content: '';
position: absolute;
border-bottom: 1px solid #ebeef5;
width: calc(100% + 40px);
bottom: 0;
}
</style>
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<template #header>
<h3 style="color: rgb(24, 103, 176);">财务数据导入</h3>
</template>
<el-row justify="center" style="position: relative" type="flex">
<div class="downLoadTemplate">
<el-button size="medium" type="primary"
@click="downLoadTemplate"
>下载模板
</el-button>
</div>
<el-upload
:action="uploadUrl"
:auto-upload="true"
:file-list="files"
:limit="1"
:on-error="handleError"
:on-exceed="()=>{this.notifyWarning('只能上传一个文件')}"
:on-remove="(f,fl)=>{fileList = fl;excelTableData=[];}"
:on-success="handleSuccess"
accept=".xls,.xlsx"
drag
ref="excelUpload">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
</el-upload>
</el-row>
<el-row style="text-align: center">
<span style="color: red;">请确保工会或社团名称书写完整,时间格式请书写为:2008-8-8</span>
</el-row>
<div class="dividing-line"></div>
<vi-title2 title="excel数据">
<template #func>
<el-button @click="importData" size="medium" type="primary">导入数据</el-button>
</template>
</vi-title2>
<el-table :data="excelTableData" :size="tableSize"
@sort-change="pageOrder"
header-align="center"
height="480" max-height="480">
<el-table-column header-align="center" label="序号" type="index" width="80">
</el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
:width="column.width"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
</el-table-column>
</el-table>
</el-card>
</guava>
</div>
<script>
var vue =new Vue({
el:'#app',
mixins: [initTableMixins],
data(){
return{
excelTableData: [],
tableColumns:[
{prop: 'year', label: '年度'},
{prop: 'month', label: '月份'},
{prop: 'unionId', label: '所属工会/社团'},
{prop: 'project', label: '活动名称'},
{prop: 'activitie_time', label: '活动时间'},
{prop: 'adjust_money', label: '费用'},
{prop: 'adjust_reason', label: '事由'},
],
files: [],
uploadUrl: loc() + '/readExcelData',
}
},
methods:{
handleError(err) {
console.log(err)
},
handleSuccess(resp) {
this.excelTableData = resp.data
},
downLoadTemplate(){
location.href= loc() + '/exportTemplate'
},
beforeUpload(file, files) {
const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
const whiteList = ['xlsx']
if (!whiteList.includes(fileSuffix)) {
this.files = []
this.$message.warning('上传文件只能是' + whiteList.join(',') + '格式')
return false
}
this.files = files
},
async importData(){
if (!this.excelTableData.length) {
this.notifyWarning('无数据')
return
}
const confirm = await this.$confirm('您确定导入吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if ('confirm' !== confirm) return
const loading = this.$loading({
lock: true,
text: '导入中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const resp = await $.post(loc() + '/doImport', {data: JSON.stringify(this.excelTableData)})
loading.close()
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.excelTableData = []
this.files = []
} else {
this.notifyWarning(resp.msg)
}
},
}
});
</script>
<!--#
}
#-->