first commit
This commit is contained in:
@@ -0,0 +1,440 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none !important;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<el-row class="header navbar bg-white shadow">
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-date-picker
|
||||
@change="doSearch"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.year"
|
||||
type="year"
|
||||
value-format="yyyy"
|
||||
format="yyyy年"
|
||||
placeholder="选择年度">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
|
||||
<!--按院级工会-->
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-select v-model="pageForm.club_id" filterable placeholder="按协会名称" clearable>
|
||||
<el-option
|
||||
v-for="item in unionOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-button icon="el-icon-search" type="primary" @click="doSearch"></el-button>
|
||||
</div>
|
||||
|
||||
<!--文件上传按钮-->
|
||||
<div class="btn-group tool-button mt5" style="float: right;padding-right: 5px">
|
||||
<el-button type="primary" icon="el-icon-edit" @click="openExport" plain>导入数据</el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="btn-group tool-button mt5" style="float: right;padding-right: 5px">
|
||||
<el-button type="success" @click="issue" v-if="!this.flag">年度分配</el-button>
|
||||
<el-button type="danger" @click="reset" v-else>分配重置</el-button>
|
||||
</div>
|
||||
|
||||
</el-row>
|
||||
|
||||
<el-row class="el-table-container">
|
||||
<el-table :data="tableData" @sort-change="pageOrder" v-loading="tab_loading">
|
||||
<el-table-column label="序号" type="index" header-align="center" align="center">
|
||||
<template scope="scope"><span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="年度" show-overflow-tooltip header-align="center" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.year}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="协会名称" prop="name" show-overflow-tooltip header-align="center"
|
||||
align="center"></el-table-column>
|
||||
|
||||
<el-table-column label="协会人数" align="center" sortable header-align="center" show-overflow-tooltip
|
||||
prop="history_member"></el-table-column>
|
||||
|
||||
|
||||
<!-- <el-table-column label="人均额度" show-overflow-tooltip header-align="center" align="center">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span>{{scope.row.total_quota>0?+' 元':'暂未分配总额度'}}</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
|
||||
<el-table-column label="标准" show-overflow-tooltip header-align="center" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.history_club_avg!=null?scope.row.history_club_avg+' 元':'暂未分配平均额度'}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="总额度" sortable="custom" prop="total_quota" show-overflow-tooltip align="center"
|
||||
header-align="center"
|
||||
align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-if="scope.row.edit" maxlength="8" min="0" type="number" style="width: 70%" size="small"
|
||||
onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
|
||||
v-model="scope.row.total_quota2" placeholder="填写总额度">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
<div v-else>
|
||||
<span v-if="!scope.row.total_quota">暂未分配</span>
|
||||
<span v-else><i>{{scope.row.total_quota}}</i> 元</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" header-align="center" width="180px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.edit">
|
||||
<el-button type="success" icon="el-icon-check" size="mini" @click="doChangeYs(scope.row)"
|
||||
circle></el-button>
|
||||
<el-button type="danger" icon="el-icon-close" size="mini" @click="$set(scope.row,'edit',false)"
|
||||
circle></el-button>
|
||||
</div>
|
||||
<el-button v-else size="mini"
|
||||
@click="$set(scope.row,'edit',true);$set(scope.row,'total_quota2',scope.row.totalquota);"
|
||||
type="primary" plain>
|
||||
{{!scope.row.club_id?'分配':'编辑'}}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
|
||||
<el-row class="el-pagination-container">
|
||||
<el-pagination
|
||||
@current-change="pageNumberChange"
|
||||
:current-page="pageForm.pageNumber"
|
||||
layout="total, prev, pager, next, jumper"
|
||||
:total="pageForm.totalCount">
|
||||
</el-pagination>
|
||||
</el-row>
|
||||
|
||||
<!--上传数据文件弹出框-->
|
||||
<el-dialog
|
||||
title="导入数据"
|
||||
:visible.sync="exportVisible" :close-on-click-modal="false"
|
||||
width="60%">
|
||||
|
||||
|
||||
<el-steps :active="exportActive" finish-status="success" simple>
|
||||
<el-step title="下载模板"></el-step>
|
||||
<el-step title="上传文件"></el-step>
|
||||
<el-step title="导入结果"></el-step>
|
||||
</el-steps>
|
||||
|
||||
<div v-if="exportActive==0"
|
||||
style="padding: 20px ;display: flex;justify-content: center;align-content: center;align-items: center;;width: 100%">
|
||||
<div class="el-upload-dragger" @click="downloadTemplate">
|
||||
<i class="el-icon-download"></i>
|
||||
<div class="el-upload__text">点击下载模板</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="exportActive==1"
|
||||
style="padding: 20px ;display: flex;justify-content: center;align-content: center;align-items: center;;width: 100%">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
drag
|
||||
:on-change="tempFileChange"
|
||||
:file-list="tempFileList" :auto-upload="false" accept=".xls,.xlsx"
|
||||
:limit="1">
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
</el-upload>
|
||||
</div>
|
||||
|
||||
<div v-if="exportActive==2"
|
||||
style="padding: 20px ;display: flex;justify-content: center;align-content: center;align-items: center;;width: 100%">
|
||||
<div class="el-upload-dragger">
|
||||
<i class="el-icon-success"></i>
|
||||
<div class="el-upload__text">共检出 <span class="text-info">{{exportData.count}}</span> 条数据,入库成功 <span
|
||||
class="text-success">{{exportData.success_count}}</span> 条。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="exportVisible = false">取 消</el-button>
|
||||
|
||||
<el-button v-if="exportActive>0" @click="exportActive -= 1">上一步</el-button>
|
||||
|
||||
<el-button type="primary" v-if="exportActive==0" @click="exportActive = 1">我已下载</el-button>
|
||||
|
||||
<el-button type="primary" v-if="exportActive==1" @click="doExport">导入</el-button>
|
||||
|
||||
<el-button type="primary" v-if="exportActive==2"
|
||||
@click="exportVisible = false;window.location.reload();">完成</el-button>
|
||||
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: "#app",
|
||||
data: function () {
|
||||
return {
|
||||
textView: "本年下发",
|
||||
flag: false,
|
||||
unionOptions: [],
|
||||
tab_loading: false,
|
||||
pageForm: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
pageOrderName: '',
|
||||
pageOrderBy: '',
|
||||
totalCount: 0,
|
||||
year: moment().format("YYYY"),
|
||||
club_id: ''
|
||||
},
|
||||
tableData: [],
|
||||
|
||||
//数据文件导入
|
||||
tempFileList: [],
|
||||
exportActive: 0,
|
||||
exportVisible: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doExport() {
|
||||
if (!this.tempFileList.length) {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '请先选择文件',
|
||||
type: 'warning'
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
let formData = new FormData();
|
||||
const f = this.tempFileList[0]
|
||||
formData.append("file", f.raw, f.raw.name);
|
||||
// formData.append("park_id", parkId);
|
||||
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '数据提交中...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: "/platform/jf/club/dataInput/doExport",
|
||||
type: "post",
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
loading.close()
|
||||
if (data.code === 0) {
|
||||
this.$message({
|
||||
message: data.msg,
|
||||
type: 'success'
|
||||
});
|
||||
this.exportData = {...data.data}
|
||||
this.exportActive = 2
|
||||
window.vue.pageData()
|
||||
} else {
|
||||
this.$message({
|
||||
message: data.msg,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: data => {
|
||||
loading.close()
|
||||
this.$message({
|
||||
message: data.msg,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
tempFileChange(file, fileList) {
|
||||
this.tempFileList = fileList
|
||||
},
|
||||
// 模板下载
|
||||
downloadTemplate() {
|
||||
location.href = '/platform/jf/club/dataInput/downLoadTemp'
|
||||
},
|
||||
|
||||
//数据文件弹出框
|
||||
openExport() {
|
||||
this.tempFileList = []
|
||||
this.exportActive = 0
|
||||
this.exportVisible = true
|
||||
|
||||
},
|
||||
|
||||
|
||||
// 查询当前最大的一年
|
||||
async lastYear() {
|
||||
const resp = await $.get("/platform/jf/st/fp/lastYear")
|
||||
if (resp.data.year != new Date().getFullYear()) {
|
||||
this.pageForm.year = resp.data.year;
|
||||
}
|
||||
},
|
||||
// 重置下发
|
||||
async reset() {
|
||||
// 确认弹出框
|
||||
this.$confirm('您确定要重置年度费用吗, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在重置...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: COVER_LAYER_COLOR
|
||||
});
|
||||
|
||||
|
||||
const resp = $.get("/platform/jf/st/fp/reset")
|
||||
// 重新加载页面
|
||||
window.location.reload();
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
// 判断是否已经下发并改变下发按钮的状态
|
||||
async isSet() {
|
||||
const resp = await $.get("/platform/jf/st/fp/isSet")
|
||||
if (resp.data > 0) {
|
||||
this.textView = "今年已下发"
|
||||
this.flag = true
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 下发
|
||||
async issue() {
|
||||
|
||||
this.$confirm('生成年度费用前,请确认协会已在会员管理系统中调整。', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在下发...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: COVER_LAYER_COLOR
|
||||
});
|
||||
const resp = await $.get("/platform/jf/st/fp/issue")
|
||||
requestLaterMsgFun(vue, resp, async () => {
|
||||
// 成功
|
||||
this.$notify.success({title: '下发成功'});
|
||||
this.flag = false;
|
||||
// 重新加载页面
|
||||
|
||||
window.location.reload();
|
||||
}, () => {
|
||||
// 失败
|
||||
this.$notify.success({title: '下发失败'});
|
||||
// 重新加载页面
|
||||
/* window.location.reload();*/
|
||||
}, () => {
|
||||
// 最终
|
||||
this.pageData()
|
||||
loading.close()
|
||||
})
|
||||
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
// const resp = await $.get("/platform/jf/st/fp/issue")
|
||||
// requestLaterMsgFun(vue, resp, async () => {
|
||||
// // 成功
|
||||
// this.$notify({
|
||||
// title: '成功',
|
||||
// message: '下发成功',
|
||||
// type: 'success'
|
||||
//
|
||||
// });
|
||||
// this.flag=false;
|
||||
// this.pageData();
|
||||
// }, () => {
|
||||
// // 失败
|
||||
// this.$notify.error({
|
||||
// title: '错误',
|
||||
// message: '下发失败'
|
||||
// });
|
||||
// },() => {
|
||||
// // 最终
|
||||
//
|
||||
// })
|
||||
},
|
||||
|
||||
doChangeYs(row) {
|
||||
let self = this;
|
||||
$.post(base + "/platform/jf/st/fp/changeYs", {
|
||||
club_id: row.cid,
|
||||
year: self.pageForm.year,
|
||||
total_quota: row.total_quota2,
|
||||
}, function (data) {
|
||||
if (data.code === 0) {
|
||||
vue.$message.success("分配成功!");
|
||||
row.edit = false
|
||||
self.pageData()
|
||||
} else {
|
||||
vue.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
doSearch: function () {
|
||||
this.pageForm.pageNumber = 1;
|
||||
this.pageData();
|
||||
},
|
||||
pageNumberChange: function (val) {
|
||||
this.pageForm.pageNumber = val;
|
||||
this.pageData();
|
||||
},
|
||||
pageOrder(column) {//按字段排序
|
||||
this.pageForm.pageOrderName = column.prop;
|
||||
this.pageForm.pageOrderBy = column.order;
|
||||
this.pageData();
|
||||
},
|
||||
|
||||
// 封装了分页查询等
|
||||
...pageSomeThing
|
||||
},
|
||||
|
||||
async created() {
|
||||
this.lastYear();
|
||||
this.unionOptions = await getClubs();
|
||||
this.pageData();
|
||||
await this.isSet();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user