first commit
This commit is contained in:
@@ -0,0 +1,365 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button">
|
||||
<el-input placeholder="请输入项目名称" clearable v-model="pageForm.contributionName"
|
||||
@keyup.enter.native="doSearch">
|
||||
<template slot="prepend">项目名称</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
|
||||
</div>
|
||||
|
||||
<div class="pull-right offscreen-right">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="openAdd">添加项目</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
||||
>
|
||||
<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
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
sortable
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='contributionTypeName'">
|
||||
{{row.typeName?row.typeName:'暂无'}}
|
||||
</template>
|
||||
<template scope="{row}" v-else-if="column.prop=='isContributionEnable'">
|
||||
<el-switch @change="switchChange(row)" v-model="row.isContributionEnable"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" fixed="right"
|
||||
width="300px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button size="mini" @click="openView(row,false)">查看
|
||||
</el-button>
|
||||
<el-button size="mini" type="primary" @click="openEdit(row,true)">编辑
|
||||
</el-button>
|
||||
<el-button type="danger" size="mini" @click="doDelete(row.id)">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</guava>
|
||||
|
||||
<el-dialog :title="title" :visible.sync="DialogVisible" :close-on-click-modal="false"
|
||||
width="60%">
|
||||
<el-form :model="formData" ref="addForm" :rules="formRules"
|
||||
label-width="100px">
|
||||
<el-form-item label="项目名称" prop="contributionName">
|
||||
<el-input type="text" v-model="formData.contributionName" maxlength="50"
|
||||
placeholder="请填写项目名称" :readonly="!isView"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属捐款专题" prop="contributionTypeCode">
|
||||
<el-select placeholder="所属捐款专题" v-model="formData.contributionTypeCode"
|
||||
style="width: 100%;"
|
||||
clearable="true"
|
||||
filterable="true"
|
||||
:disabled="!isView">
|
||||
<el-option v-for="item in contributionTypes"
|
||||
:label="item.typeName+'('+item.typeCode+')'"
|
||||
:value="item.typeCode"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="捐款时间" prop="contributionTime">
|
||||
<el-date-picker
|
||||
:readonly="!isView"
|
||||
style="width: 100%;"
|
||||
v-model="formData.contributionTime"
|
||||
type="datetimerange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="捐款模式" prop="contributionMode">
|
||||
<el-radio-group v-model="formData.contributionMode" :disabled="!isView">
|
||||
<el-radio-button label="sdc">水滴筹</el-radio-button>
|
||||
<el-radio-button label="yrj">一日捐</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="捐款链接" prop="contributionUrl"
|
||||
v-if="formData.contributionMode==='sdc'">
|
||||
<el-input type="text" v-model="formData.contributionUrl" maxlength="50"
|
||||
placeholder="请填写捐款链接" :readonly="!isView"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="是否开启" prop="isContributionEnable">
|
||||
<el-switch v-model="formData.isContributionEnable" active-color="#13ce66"
|
||||
inactive-color="#ff4949" :readonly="!isView"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目介绍" prop="contributionIntroduce">
|
||||
<div id="contributionIntroduceEditor"></div>
|
||||
</el-form-item>
|
||||
<el-form-item label="封面图" prop="contributionFiles">
|
||||
<file-upload v-if="!isView"
|
||||
:files="formData.contributionFiles"
|
||||
:view="true"></file-upload>
|
||||
<file-upload :max="1" :files.sync="formData.contributionFiles" v-else>
|
||||
<template #el-upload__tip>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
图片类请上传jpg/png/jpeg等格式上传数量为1个
|
||||
</div>
|
||||
</template>
|
||||
</file-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="DialogVisible = false" v-if="!isView">取 消</el-button>
|
||||
<el-button type="primary" :disabled="subDis" @click="operation"
|
||||
v-if="isView">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let E = window.wangEditor
|
||||
let contributionIntroduceEditor = null
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
contributionTypes: [],
|
||||
isView: true,
|
||||
title: "",
|
||||
subDis: false,
|
||||
DialogVisible: false,
|
||||
imageUrl: '',
|
||||
pageForm: {},
|
||||
tableColumns: [
|
||||
{prop: 'contributionName', label: '项目名称'},
|
||||
{prop: 'contributionTypeName', label: '所属专题'},
|
||||
{prop: 'contributionCreationDate', label: '创建时间'},
|
||||
{prop: 'isContributionEnable', label: '是否开启'}
|
||||
],
|
||||
formRules: {
|
||||
contributionName: [{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
contributionIntroduce: [{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
contributionFiles: [{
|
||||
required: true,
|
||||
message: '必选',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
isContributionEnable: [{
|
||||
required: true,
|
||||
message: '必选',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
contributionTime: [{
|
||||
required: true,
|
||||
message: '必选',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
contributionMode: [{
|
||||
required: true,
|
||||
message: '必选',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
methods: {
|
||||
async handleAvatarSuccess(res, file) {
|
||||
this.$set(this.formData, 'contributionFiles', res.data.filepath)
|
||||
},
|
||||
beforeAvatarUpload(file) {
|
||||
const isJPEG = file.type === 'image/jpeg';
|
||||
const isJPG = file.type === 'image/jpg';
|
||||
const isPNG = file.type === 'image/png';
|
||||
const IsSVG = file.type === 'image/svg';
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
if (!(isJPEG || isPNG)) {
|
||||
this.$message.error('上传头像图片只能是 isJPG 格式!');
|
||||
}
|
||||
if (!isLt2M) {
|
||||
this.$message.error('上传头像图片大小不能超过 2MB!');
|
||||
}
|
||||
return (isJPEG || isPNG) && isLt2M;
|
||||
},
|
||||
openView(data, flag) {
|
||||
this.isView = flag
|
||||
this.title = "查看项目"
|
||||
data.contributionTime = [data.contributionStartTime, data.contributionEndTime]
|
||||
const formData = clone(data)
|
||||
this.formData = formData
|
||||
this.formData.contributionFiles = JSON.parse(this.formData.contributionFiles)
|
||||
this.$nextTick(() => {
|
||||
$("#contributionIntroduceEditor").html("")
|
||||
contributionIntroduceEditor = new E("#contributionIntroduceEditor")
|
||||
contributionIntroduceEditor.config.onchange = (html) => {
|
||||
this.formData.contributionIntroduce = html
|
||||
}
|
||||
contributionIntroduceEditor.config.uploadImgShowBase64 = true // 使用 base64 保存图片
|
||||
contributionIntroduceEditor.create()
|
||||
contributionIntroduceEditor.txt.html(this.formData.contributionIntroduce)
|
||||
})
|
||||
this.DialogVisible = true;
|
||||
if (this.$refs['addForm']) {
|
||||
this.$refs['addForm'].resetFields()
|
||||
}
|
||||
},
|
||||
openEdit(data, flag) {
|
||||
this.isView = flag
|
||||
this.title = "编辑项目"
|
||||
data.contributionTime = [data.contributionStartTime, data.contributionEndTime]
|
||||
const formData = clone(data)
|
||||
this.formData = formData
|
||||
this.formData.contributionFiles = JSON.parse(this.formData.contributionFiles)
|
||||
this.$nextTick(() => {
|
||||
$("#contributionIntroduceEditor").html("")
|
||||
contributionIntroduceEditor = new E("#contributionIntroduceEditor")
|
||||
contributionIntroduceEditor.config.onchange = (html) => {
|
||||
this.formData.contributionIntroduce = html
|
||||
}
|
||||
contributionIntroduceEditor.config.uploadImgShowBase64 = true // 使用 base64 保存图片
|
||||
contributionIntroduceEditor.create()
|
||||
contributionIntroduceEditor.txt.html(this.formData.contributionIntroduce)
|
||||
})
|
||||
this.DialogVisible = true;
|
||||
if (this.$refs['addForm']) {
|
||||
this.$refs['addForm'].resetFields()
|
||||
}
|
||||
},
|
||||
openAdd() {
|
||||
this.title = "添加项目"
|
||||
this.formData = {
|
||||
isContributionEnable: false
|
||||
}
|
||||
this.DialogVisible = true;
|
||||
if (this.$refs['addForm']) {
|
||||
this.$refs['addForm'].resetFields()
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
$("#contributionIntroduceEditor").html("")
|
||||
contributionIntroduceEditor = new E("#contributionIntroduceEditor")
|
||||
contributionIntroduceEditor.config.onchange = (html) => {
|
||||
this.formData.contributionIntroduce = html
|
||||
}
|
||||
contributionIntroduceEditor.config.uploadImgShowBase64 = true // 使用 base64 保存图片
|
||||
contributionIntroduceEditor.create()
|
||||
})
|
||||
},
|
||||
async switchChange(data) {
|
||||
this.formData = data
|
||||
const resp = await $.post(loc() + "/doEdit", {contribution: JSON.stringify(this.formData)})
|
||||
if(resp.code===0){
|
||||
this.notifySuccess(resp.msg)
|
||||
this.pageData()
|
||||
}else{
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
},
|
||||
async operation() {
|
||||
let method = this.formData.id ? "/doEdit" : "/doAdd"
|
||||
this.$refs["addForm"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在提交...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: COVER_LAYER_COLOR
|
||||
});
|
||||
this.formData.contributionStartTime = this.formData.contributionTime[0]
|
||||
this.formData.contributionEndTime = this.formData.contributionTime[1]
|
||||
const resp = await $.post(loc() + method, {
|
||||
contribution: JSON.stringify(this.formData)
|
||||
})
|
||||
loading.close()
|
||||
if(resp.code===0){
|
||||
this.DialogVisible = false;
|
||||
this.pageData();
|
||||
}else{
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
async doDelete(id) {
|
||||
let self = this
|
||||
this.$confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
callback: async (a, b) => {
|
||||
if ("confirm" === a) {
|
||||
const resp = await $.get(loc() + "/doDelete", {id: id})
|
||||
if(resp.code===0){
|
||||
this.notifySuccess(resp.msg)
|
||||
self.pageData()
|
||||
}else{
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.contributionTypes = await contribution.getContributionType()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,248 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button">
|
||||
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
|
||||
@keyup.enter.native="doSearch">
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
|
||||
style="width: 80px;">
|
||||
<el-option label="名称" value="typeName"></el-option>
|
||||
<el-option label="编码" value="typeCode"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
|
||||
</div>
|
||||
|
||||
<div class="pull-right offscreen-right">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="openAdd">添加类型</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
||||
>
|
||||
<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
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
sortable
|
||||
></el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" fixed="right"
|
||||
width="300px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button size="mini" @click="openView(row,true)">查看
|
||||
</el-button>
|
||||
<el-button size="mini" type="primary" @click="openEdit(row,false)">编辑
|
||||
</el-button>
|
||||
<el-button type="danger" size="mini" @click="doDelete(row.id)">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</guava>
|
||||
|
||||
<el-dialog :title="title" :visible.sync="DialogVisible" :close-on-click-modal="false"
|
||||
width="40%">
|
||||
<el-form :model="formData" ref="addForm" :rules="formRules"
|
||||
label-width="100px">
|
||||
<el-form-item label="专题编号" prop="typeCode">
|
||||
<el-input type="text" v-model="formData.typeCode" maxlength="50"
|
||||
placeholder="请填写专题编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="专题名称" prop="typeName">
|
||||
<el-input type="text" v-model="formData.typeName" maxlength="50"
|
||||
placeholder="请填写专题名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="专题介绍" prop="contributionTypeIntroduce">
|
||||
<el-input type="textarea" v-model="formData.contributionTypeIntroduce" :rows="4"
|
||||
placeholder="请填写专题介绍"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="封面图" prop="contributionTypeFiles">
|
||||
<file-upload :files.sync="formData.contributionTypeFiles" :max="1"
|
||||
:type="['jpg','jpeg','png','JPG','JPEG','PNG']" :view="isView">
|
||||
<template #el-upload__tip>
|
||||
<div class="el-upload__tip" slot="tip">请上传jpg/png/jpeg/JPG/PNG/JPEG等格式</div>
|
||||
</template>
|
||||
</file-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="DialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :disabled="subDis" @click="operation"
|
||||
v-if="!isView">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
isView: false,
|
||||
title: "",
|
||||
subDis: false,
|
||||
DialogVisible: false,
|
||||
imageUrl: '',
|
||||
pageForm: {
|
||||
searchName: 'typeName'
|
||||
},
|
||||
tableColumns: [
|
||||
{prop: 'typeCode', label: '专题编号'},
|
||||
{prop: 'typeName', label: '专题名称'}
|
||||
],
|
||||
formRules: {
|
||||
typeName: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
typeCode: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
contributionTypeIntroduce: [{
|
||||
required: true,
|
||||
message: '必填',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
contributionTypeFiles: [{
|
||||
required: true,
|
||||
message: '必选',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
methods: {
|
||||
async handleAvatarSuccess(res, file) {
|
||||
this.$set(this.formData, 'contributionTypeFiles', res.data.filepath)
|
||||
},
|
||||
beforeAvatarUpload(file) {
|
||||
/* const isJPEG = file.type === 'image/jpeg';
|
||||
const isJPG = file.type === 'image/jpg';
|
||||
const isPNG = file.type === 'image/png';
|
||||
const IsSVG = file.type === 'image/svg';
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
|
||||
/!* if (!isPNG) {
|
||||
this.$message.error('上传头像图片只能是 PNG格式!');
|
||||
}*!/
|
||||
if (!isLt2M) {
|
||||
this.$message.error('上传头像图片大小不能超过 2MB!');
|
||||
}
|
||||
return isLt2M;*/
|
||||
},
|
||||
openView(data, flag) {
|
||||
this.isView = flag
|
||||
this.title = "查看类型"
|
||||
this.formData = data
|
||||
this.DialogVisible = true;
|
||||
},
|
||||
openEdit(data, flag) {
|
||||
this.isView = flag
|
||||
this.title = "编辑类型"
|
||||
this.formData = data
|
||||
this.DialogVisible = true;
|
||||
},
|
||||
openAdd() {
|
||||
this.isView = false
|
||||
this.title = "添加类型"
|
||||
this.formData = {}
|
||||
this.DialogVisible = true;
|
||||
if (this.$refs['addForm']) {
|
||||
this.$refs['addForm'].resetFields()
|
||||
}
|
||||
},
|
||||
async operation() {
|
||||
let method = this.formData.id ? "/doEdit" : "/doAdd"
|
||||
this.$refs["addForm"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在提交...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: COVER_LAYER_COLOR
|
||||
});
|
||||
const resp = await $.post(loc() + method, {
|
||||
data: JSON.stringify(this.formData)
|
||||
})
|
||||
loading.close()
|
||||
if(resp.code===0){
|
||||
this.notifySuccess(resp.msg)
|
||||
this.DialogVisible = false;
|
||||
this.pageData();
|
||||
}else{
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
async doDelete(id) {
|
||||
let self = this
|
||||
this.$confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
callback: async (a, b) => {
|
||||
if ("confirm" === a) {
|
||||
const resp = await $.get(loc() + "/doDelete", {id: id})
|
||||
if(resp.code===0){
|
||||
self.notifySuccess(resp.msg)
|
||||
self.pageData()
|
||||
}else{
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,238 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button">
|
||||
<el-select placeholder="捐款项目" v-model="pageForm.contributionName"
|
||||
style="width: 100%;"
|
||||
clearable="true"
|
||||
filterable="true">
|
||||
<el-option v-for="item in contributionOption" :label="item.contributionName"
|
||||
:value="item.contributionName"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
|
||||
clearable="true"
|
||||
@change="flushUnits" @clear="flushUnits"
|
||||
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}"
|
||||
|
||||
filterable="true">
|
||||
<el-option v-for="item in unions" :label="item.unionname"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="btn-group tool-button">
|
||||
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
|
||||
clearable="true"
|
||||
filterable="true">
|
||||
<el-option v-for="item in units" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-select placeholder="捐款方式" v-model="pageForm.payMode" style="width: 100%;"
|
||||
clearable="true"
|
||||
filterable="true">
|
||||
<el-option label="微信" value="WeChat"></el-option>
|
||||
<el-option label="支付宝" value="Alipay"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
|
||||
</div>
|
||||
<div class="pull-right offscreen-right">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doExport">导出</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="捐款列表" :app="this">
|
||||
|
||||
</table-tool>
|
||||
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
||||
:size="tableSize"
|
||||
show-summary :summary-method="getSummaries">
|
||||
<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
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
sortable
|
||||
>
|
||||
<template v-if="column.prop=='payMode'" scope="{row}">
|
||||
{{row.payMode==='WeChat'?'微信':'支付宝'}}
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template slot-scope="{row}">
|
||||
<el-button size="mini" type="primary"
|
||||
@click="openView(row)">
|
||||
查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</guava>
|
||||
|
||||
<el-dialog
|
||||
title="捐款详情"
|
||||
:visible.sync="viewDialogVisible"
|
||||
width="50%"
|
||||
:close-on-click-modal="false">
|
||||
|
||||
<el-descriptions class="margin-top" title="" :column="3" border>
|
||||
<el-descriptions-item label="捐款项目">
|
||||
{{viewData.contributionName}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐款人工号">
|
||||
{{viewData.loginname}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="姓名">
|
||||
{{viewData.username}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系方式">
|
||||
{{viewData.mobile}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所属工会">
|
||||
{{viewData.unionname}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所属单位">
|
||||
{{viewData.unitname}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="善款金额">
|
||||
{{viewData.money}}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐款方式">
|
||||
{{viewData.payMode==='WeChat'?'微信':'支付宝'}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐款时间">
|
||||
{{viewData.contributionTime}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐款凭证">
|
||||
<file-upload :files="viewData.contributionFiles" :view="true">
|
||||
</file-upload>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="viewDialogVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
viewData: {},
|
||||
viewDialogVisible: false,
|
||||
contributionOption: [],
|
||||
unions: [],
|
||||
units: [],
|
||||
pageForm: {
|
||||
contributionName: '',
|
||||
unionId: '',
|
||||
unitId: '',
|
||||
payMode: ''
|
||||
},
|
||||
tableColumns: [
|
||||
{prop: 'contributionName', label: '捐款项目'},
|
||||
{prop: 'loginname', label: '捐款人工号'},
|
||||
{prop: 'username', label: '姓名'},
|
||||
{prop: 'mobile', label: '联系方式'},
|
||||
{prop: 'unionname', label: '所属工会'},
|
||||
{prop: 'unitname', label: '所属单位'},
|
||||
{prop: 'money', label: '善款金额'},
|
||||
{prop: 'payMode', label: '捐款方式'},
|
||||
{prop: 'contributionTime', label: '捐款时间'},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openView(row) {
|
||||
const rowc = clone(row)
|
||||
rowc.contributionFiles = JSON.parse(rowc.contributionFiles)
|
||||
this.viewData = rowc
|
||||
this.viewDialogVisible = true
|
||||
},
|
||||
doExport() {
|
||||
const {unionId, unitId, payMode, contributionName} = this.pageForm
|
||||
window.location.href = loc() + "/doExport?unionId=" + unionId + "&unitId=" + unitId + "&payMode=" + payMode + "&contributionName=" + contributionName
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", "")
|
||||
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
|
||||
}
|
||||
},
|
||||
async getContribution() {
|
||||
const data = await $.get("/platform/contribution/list/getContribution")
|
||||
return data
|
||||
},
|
||||
getSummaries(param) {
|
||||
const {columns, data} = param;
|
||||
const sums = [];
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '总额';
|
||||
return;
|
||||
}
|
||||
if (index !== 7) {
|
||||
sums[index] = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const values = data.map(item => Number(item[column.property]));
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return Math.floor((prev + curr) * 100) / 100;
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
sums[index] += ' 元';
|
||||
} else {
|
||||
sums[index] = null;
|
||||
}
|
||||
});
|
||||
|
||||
return sums;
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.unions = await getUnions(null)
|
||||
this.contributionOption = await this.getContribution()
|
||||
this.flushUnits()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,147 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button">
|
||||
<el-select placeholder="捐款项目" v-model="pageForm.contributionName"
|
||||
style="width: 100%;"
|
||||
@change="doSearch"
|
||||
filterable="true">
|
||||
<el-option v-for="item in contributionOption" :label="item.contributionName"
|
||||
:value="item.contributionName"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
|
||||
clearable="true"
|
||||
@change="doSearch"
|
||||
filterable="true">
|
||||
<el-option v-for="item in unions" :label="item.unionname"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="捐款列表" :app="this">
|
||||
|
||||
</table-tool>
|
||||
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
||||
show-summary :summary-method="getSummaries">
|
||||
<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
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
sortable
|
||||
>
|
||||
|
||||
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
contributionOption: [],
|
||||
unions: [],
|
||||
units: [],
|
||||
tableColumns: [
|
||||
{prop: 'unioncode', label: '工会编码'},
|
||||
{prop: 'unionname', label: '工会名称'},
|
||||
{prop: 'contributionUserNum', label: '捐款人数'},
|
||||
{prop: 'contributionNum', label: '捐款多少笔'},
|
||||
{prop: 'money', label: '捐款总额(元)'},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
pageData() {
|
||||
sublime.showLoadingbar();
|
||||
this.tableLoading = true
|
||||
$.post(loc() + "/pageData", this.pageForm, (data) => {
|
||||
sublime.closeLoadingbar();
|
||||
this.tableLoading = false
|
||||
if (data.code == 0) {
|
||||
this.tableData = data.data;
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
getSummaries(param) {
|
||||
const {columns, data} = param;
|
||||
const sums = [];
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '总计';
|
||||
return;
|
||||
}
|
||||
if (![3, 4, 5].includes(index)) {
|
||||
sums[index] = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const values = data.map(item => Number(item[column.property]));
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return Math.floor((prev + curr) * 100) / 100;
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
if (index === 3) {
|
||||
sums[index] += ' 人';
|
||||
} else if (index === 4) {
|
||||
sums[index] += ' 笔';
|
||||
} else {
|
||||
sums[index] += ' 元';
|
||||
}
|
||||
|
||||
} else {
|
||||
sums[index] = null;
|
||||
}
|
||||
});
|
||||
|
||||
return sums;
|
||||
},
|
||||
async getContribution() {
|
||||
const data = await $.get("/platform/contribution/list/getContribution")
|
||||
return data
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.unions = await getUnions(null)
|
||||
this.contributionOption = await this.getContribution()
|
||||
if (this.contributionOption && this.contributionOption.length > 0) {
|
||||
this.pageForm.contributionName = this.contributionOption[0].contributionName
|
||||
}
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user