first commit
This commit is contained in:
@@ -0,0 +1,164 @@
|
||||
<!--#
|
||||
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 ref="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 @click="downLoadTemplate" size="small"
|
||||
type="primary">
|
||||
下载模板
|
||||
</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>
|
||||
|
||||
<div class="dividing-line"></div>
|
||||
|
||||
<vi-title2 title="excel数据">
|
||||
<template #func>
|
||||
<el-button @click="importData" size="small" 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"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='tips'">
|
||||
<span class="text-warning" v-if="row.id">
|
||||
数据库已存在该用户信息
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
</guava>
|
||||
</div>
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
excelTableData: [],
|
||||
tableColumns: [
|
||||
{prop: 'userName', label: '姓名'},
|
||||
{prop: 'loginName', label: '工号'},
|
||||
{prop: 'userState', label: '在职状态'},
|
||||
{prop: 'mutualGoldStartTime', label: '互助金开始起扣时间'},
|
||||
{prop: 'tips', label: '提示'},
|
||||
],
|
||||
files: [],
|
||||
uploadUrl: loc() + '/readExcelData',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleError(err) {
|
||||
console.log(err)
|
||||
},
|
||||
handleSuccess(resp) {
|
||||
this.excelTableData = resp.data
|
||||
},
|
||||
downLoadTemplate() {
|
||||
window.open(loc() + '/downLoadTemplate')
|
||||
},
|
||||
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>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,181 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">起扣时间:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
placeholder="选择起扣时间"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.mutualGoldStartTime"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">关键字:</div>
|
||||
<div class="search-item-option">
|
||||
<el-input clearable maxlength="10" placeholder="可输入基金会员的工号或姓名进行查询"
|
||||
v-model.trim="pageForm.keyWord"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-query">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="基金会员"></table-tool>
|
||||
<el-table :data="tableData" :size="tableSize"
|
||||
@sort-change="pageOrder" header-align="center">
|
||||
<el-table-column align="center" header-align="center" label="序号" width="120px">
|
||||
<template scope="scope">
|
||||
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</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"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='subsidyRatio'">
|
||||
{{row.subsidyRatio * 100 + '%'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</guava>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="editDialogVisible" title="编辑">
|
||||
<el-form :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="姓名" prop="userName">
|
||||
<el-input maxlength="10" v-model.trim="formData.userName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="工号" prop="loginName">
|
||||
<el-input maxlength="10" v-model.trim="formData.loginName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="在职状态" prop="userState">
|
||||
<!-- <el-select v-model="formData.userState">-->
|
||||
<!-- <el-option v-for="item in units"-->
|
||||
<!-- ></el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<el-input maxlength="10" v-model.trim="formData.userState"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="起扣时间" prop="mutualGoldStartTime">
|
||||
<el-date-picker
|
||||
:picker-options="pickerOptions"
|
||||
placeholder="选择起扣时间"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="formData.mutualGoldStartTime"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row justify="end" type="flex">
|
||||
<el-button @click="editDialogVisible=false">取消</el-button>
|
||||
<el-button @click="doEdit" type="primary">确定</el-button>
|
||||
</el-row>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'userName', label: '姓名', sortable: true},
|
||||
{prop: 'loginName', label: '工号', sortable: true},
|
||||
{prop: 'userState', label: '在职状态', sortable: true},
|
||||
{prop: 'mutualGoldStartTime', label: '互助金开始起扣时间', sortable: true},
|
||||
],
|
||||
units: [],
|
||||
rules: {
|
||||
loginName: [{required: true, message: '请输入工号', trigger: ['change', 'blur']}],
|
||||
userName: [{required: true, message: '请输入姓名', trigger: ['change', 'blur']}],
|
||||
userState: [{required: true, message: '请输入在职状态', trigger: ['change', 'blur']}],
|
||||
mutualGoldStartTime: [{required: true, message: '请输入起扣时间', trigger: ['change', 'blur']}],
|
||||
},
|
||||
editDialogVisible: false
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pickerOptions() {
|
||||
return {
|
||||
disabledDate(time) {
|
||||
return time.getTime() > Date.now()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doDelete(id) {
|
||||
const confirm = await this.$confirm('删除后补助数据可能会受到影响,您确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if ('confirm' !== confirm) return
|
||||
|
||||
const resp = await $.post(loc() + '/doDelete/' + id)
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.notifySuccess(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
},
|
||||
openEdit(row) {
|
||||
this.formData = clone(row)
|
||||
this.editDialogVisible = true
|
||||
},
|
||||
async doEdit() {
|
||||
const resp = await $.post(loc() + '/doEdit', this.formData)
|
||||
if (resp.code === 0) {
|
||||
this.pageData()
|
||||
this.editDialogVisible = false
|
||||
this.notifySuccess(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user