first commit
This commit is contained in:
@@ -0,0 +1,221 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="项目名称:">
|
||||
<el-select placeholder="请选择项目名称"
|
||||
v-model="pageForm.contributionName"
|
||||
style="width: 100%;"
|
||||
clearable @change="doSearch"
|
||||
filterable>
|
||||
<el-option v-for="item in contributionOptions"
|
||||
:label="item.contributionName"
|
||||
:key="item.contributionName"
|
||||
:value="item.contributionName"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属工会">
|
||||
<el-select v-model="pageForm.unionId" placeholder="请选择所属工会" filterable clearable
|
||||
@change="doSearch" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in unionList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属单位">
|
||||
<el-select @change="doSearch"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择单位" style="width: 100%" v-model="pageForm.unitId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unitList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="捐助方式:">
|
||||
<el-select placeholder="请选择捐助方式" v-model="pageForm.payMode" style="width: 100%;"
|
||||
clearable @change="doSearch"
|
||||
filterable>
|
||||
<el-option label="微信" value="WeChat"></el-option>
|
||||
<el-option label="支付宝" value="Alipay"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="捐助列表">
|
||||
<el-button type="primary" size="small" @click="onExport">
|
||||
<i class="el-icon-download"></i>
|
||||
导出
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" :size="tableSize"
|
||||
row-key="id" show-summary :summary-method="getSummaries">
|
||||
<el-table-column label="序号" type="index" :index="indexMethod" width="60"></el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:key="column.prop"
|
||||
:width="column.width"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-slot="{ row }" v-if="column.prop === 'payMode'">
|
||||
{{ row.payMode === 'WeChat' ? '微信' : '支付宝' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template v-slot="{ row }">
|
||||
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #view>
|
||||
<el-descriptions :column="2" border class="table_fixed">
|
||||
<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 || 0}}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐助方式">
|
||||
{{ viewData.payMode === 'WeChat' ? '微信' : '支付宝' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐助时间" :span="2">
|
||||
{{ viewData.contributionTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐助凭证" :span="2">
|
||||
<file-preview v-if="viewData.contributionFiles" complete_result :files="viewData.contributionFiles"></file-preview>
|
||||
<span v-else>暂无</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
|
||||
</guava>
|
||||
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
const vue = new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
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: '捐助时间'},
|
||||
],
|
||||
contributionOptions: [],
|
||||
unionList: [],
|
||||
unitList: [],
|
||||
viewData: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
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
|
||||
},
|
||||
onView(row) {
|
||||
this.$refs.guava.view(() => {
|
||||
if(row.contributionFiles) {
|
||||
row.contributionFiles = JSON.parse(row.contributionFiles)
|
||||
}
|
||||
this.viewData = clone(row)
|
||||
})
|
||||
},
|
||||
onExport() {
|
||||
this.$downLoad("/platform/contribution/detailed/doExport", this.pageForm)
|
||||
},
|
||||
pageData() {
|
||||
this.$axios.post(loc() + "/pageData", this.pageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
}
|
||||
})
|
||||
},
|
||||
queryContributionList() {
|
||||
this.$axios.post('/platform/contribution/list/queryContributionList')
|
||||
.then((resp) => {
|
||||
this.contributionOptions = resp.data
|
||||
})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.unionList = await this.$businessTool.listUnion()
|
||||
this.unitList = await this.$businessTool.listUnit()
|
||||
this.queryContributionList()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,115 @@
|
||||
const basicForm = {
|
||||
template: /*language=HTML*/ `
|
||||
<div>
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="110px" label-position="left">
|
||||
<el-form-item label="项目名称" prop="contributionName">
|
||||
<el-input type="text" v-model="formData.contributionName" maxlength="50"
|
||||
placeholder="请填写项目名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属捐助专题" prop="contributionTypeCode">
|
||||
<el-select placeholder="所属捐助专题" v-model="formData.contributionTypeCode"
|
||||
style="width: 100%;"
|
||||
clearable
|
||||
filterable>
|
||||
<el-option v-for="item in contributionTypeList"
|
||||
:label="item.typeName + '(' + item.typeCode + ')'"
|
||||
:value="item.typeCode"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="捐助时间" prop="contributionTime">
|
||||
<el-date-picker
|
||||
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">
|
||||
<el-radio-button :label="1">水滴筹</el-radio-button>
|
||||
<el-radio-button :label="2">一日捐</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="捐助链接" prop="contributionUrl"
|
||||
v-if="formData.contributionMode === 1">
|
||||
<el-input type="text" v-model="formData.contributionUrl" maxlength="50"
|
||||
placeholder="请填写捐助链接"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启" prop="isContributionEnable">
|
||||
<el-switch v-model="formData.isContributionEnable" active-color="#13ce66"
|
||||
inactive-color="#ff4949"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目介绍" prop="contributionIntroduce">
|
||||
<text-editor v-model="formData.contributionIntroduce"></text-editor>
|
||||
</el-form-item>
|
||||
<el-form-item label="封面图" prop="contributionFiles">
|
||||
<file-upload :value.sync="formData.contributionFiles" accept=".jpg,.jpeg,.png"
|
||||
:upload_number="1" upload_result_category="interval"
|
||||
complete_result upload_mode="drag"></file-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row class="mt10" justify="end" type="flex">
|
||||
<el-button @click="$emit('refresh')">取消</el-button>
|
||||
<el-button @click="onSubmit" type="primary">提交</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
formData: {},
|
||||
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']}],
|
||||
},
|
||||
contributionTypeList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen(row) {
|
||||
if(row && row.id) {
|
||||
this.formData = clone(row)
|
||||
this.$set(this.formData, 'contributionTime', [this.formData.contributionStartTime, this.formData.contributionEndTime])
|
||||
}
|
||||
},
|
||||
onSubmit() {
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
this.$set(this.formData, 'contributionStartTime', this.formData.contributionTime[0])
|
||||
this.$set(this.formData, 'contributionEndTime', this.formData.contributionTime[1])
|
||||
const resp = await this.$axios.post("/platform/contribution/list/onSubmit", this.formData)
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.$emit('refresh')
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
queryContributionType() {
|
||||
this.$axios.post('/platform/contribution/type/queryContributionType')
|
||||
.then((resp) => {
|
||||
this.contributionTypeList = resp.data
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.queryContributionType()
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
|
||||
`
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="项目名称:">
|
||||
<el-input placeholder="请输入项目名称" clearable v-model="pageForm.contributionName"
|
||||
@keyup.enter.native="doSearch">
|
||||
</el-input>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="项目列表">
|
||||
<el-button type="primary" size="small" @click="onAdd">
|
||||
<i class="ti-plus"></i>
|
||||
新增项目
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" :size="tableSize">
|
||||
<el-table-column label="序号" type="index" :index="indexMethod" width="60"></el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:key="column.prop"
|
||||
:width="column.width"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-slot="{ row }" v-if="column.prop === 'contributionTypeName'">
|
||||
{{ row.typeName || '暂无' }}
|
||||
</template>
|
||||
<template v-slot="{ 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 label="操作" width="230">
|
||||
<template v-slot="{ row }">
|
||||
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
|
||||
<el-button @click="onEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="onDelete(row)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #edit>
|
||||
<basic-form ref="basicFormRef" @refresh="refresh"></basic-form>
|
||||
</template>
|
||||
|
||||
<template #view>
|
||||
<info ref="infoRef"></info>
|
||||
</template>
|
||||
|
||||
</guava>
|
||||
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include('basicForm.js'){}#-->
|
||||
<!--#include('info.js'){}#-->
|
||||
const vue = new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"basic-form": basicForm,
|
||||
"info": info,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'contributionName', label: '项目名称'},
|
||||
{prop: 'contributionTypeName', label: '所属专题'},
|
||||
{prop: 'contributionCreationDate', label: '创建时间'},
|
||||
{prop: 'isContributionEnable', label: '是否开启'}
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchChange(row) {
|
||||
this.$axios.post("/platform/contribution/list/onSubmit", row).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
},
|
||||
refresh() {
|
||||
this.doSearch()
|
||||
this.$refs.guava.index()
|
||||
},
|
||||
onView(row) {
|
||||
this.$refs.guava.view(() => {
|
||||
this.$refs.infoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
onAdd() {
|
||||
this.$refs.guava.edit(() => {
|
||||
this.$refs.basicFormRef.onOpen()
|
||||
})
|
||||
},
|
||||
onEdit(row) {
|
||||
this.$refs.guava.edit(() => {
|
||||
this.$refs.basicFormRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
onDelete(row) {
|
||||
this.$confirm("您确定要删除吗, 是否继续?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios.post("/platform/contribution/list/onDelete", { id: row.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
pageData() {
|
||||
this.$axios.post(loc() + "/pageData", this.pageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,45 @@
|
||||
const info = {
|
||||
template: /*language=HTML*/ `
|
||||
<div>
|
||||
<el-descriptions :column="2" border class="table_fixed">
|
||||
<el-descriptions-item label="项目名称">
|
||||
{{ viewData.contributionName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所属捐助专题">
|
||||
{{ viewData.typeName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐助时间">
|
||||
{{ viewData.contributionStartTime + ' 至 ' + viewData.contributionEndTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐助模式">
|
||||
{{ viewData.contributionMode === 1 ? '水滴筹' : '一日捐' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="捐助链接" :span="2">
|
||||
{{ viewData.contributionUrl || '暂无' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目介绍" :span="2">
|
||||
<div v-html="viewData.contributionIntroduce"></div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="封面图" :span="2">
|
||||
<img :src="viewData.contributionFiles"
|
||||
style="height: 100px;width: auto" v-if="viewData.contributionFiles">
|
||||
<span v-else>暂无</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
viewData: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen(row) {
|
||||
this.viewData = clone(row)
|
||||
this.$set(this.formData, 'contributionTime', [this.formData.contributionStartTime, this.formData.contributionEndTime])
|
||||
},
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
|
||||
`
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="项目名称:">
|
||||
<el-select placeholder="请选择项目名称"
|
||||
v-model="pageForm.contributionId"
|
||||
style="width: 100%;"
|
||||
@change="doSearch"
|
||||
filterable>
|
||||
<el-option v-for="item in contributionOptions"
|
||||
:label="item.contributionName"
|
||||
:key="item.id"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属工会">
|
||||
<el-select v-model="pageForm.unionId" placeholder="请选择所属工会" filterable clearable
|
||||
@change="doSearch" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in unionList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="捐助列表"></table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" :size="tableSize"
|
||||
row-key="id" show-summary :summary-method="getSummaries"
|
||||
max-height="600">
|
||||
<el-table-column label="序号" type="index" :index="indexMethod" width="60"></el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:key="column.prop"
|
||||
:width="column.width"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
</guava>
|
||||
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
const vue = new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'unionCode', label: '工会编码'},
|
||||
{prop: 'name', label: '工会名称'},
|
||||
{prop: 'contributionUserNum', label: '捐助人数'},
|
||||
{prop: 'contributionNum', label: '捐助多少笔'},
|
||||
{prop: 'money', label: '捐助总额(元)'},
|
||||
],
|
||||
contributionOptions: [],
|
||||
unionList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
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
|
||||
},
|
||||
pageData() {
|
||||
this.$axios.post(loc() + "/pageData", this.pageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
async queryContributionList() {
|
||||
const resp = await this.$axios.post('/platform/contribution/list/queryContributionList')
|
||||
this.contributionOptions = resp.data
|
||||
if (this.contributionOptions && this.contributionOptions.length > 0) {
|
||||
this.pageForm.contributionId = this.contributionOptions[0].id
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.unionList = await this.$businessTool.listUnion()
|
||||
await this.queryContributionList()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,69 @@
|
||||
const basicForm = {
|
||||
template: /*language=HTML*/ `
|
||||
<div>
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="110px" label-position="left">
|
||||
<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 :value.sync="formData.contributionTypeFiles" accept=".jpg,.jpeg,.png"
|
||||
:upload_number="1" upload_result_category="interval"
|
||||
complete_result upload_mode="drag"></file-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row class="mt10" justify="end" type="flex">
|
||||
<el-button @click="$emit('refresh')">取消</el-button>
|
||||
<el-button @click="onSubmit" type="primary">提交</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
formData: {},
|
||||
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']}],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen(row) {
|
||||
if(row && row.id) {
|
||||
this.formData = clone(row)
|
||||
}
|
||||
},
|
||||
onSubmit() {
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$confirm("您确定要提交吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
const resp = await this.$axios.post("/platform/contribution/type/onSubmit", this.formData)
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.$emit('refresh')
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
|
||||
`
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="名称/编码">
|
||||
<el-input placeholder="请输入名称或编码" clearable v-model="pageForm.searchKeyword"
|
||||
@keyup.enter.native="doSearch">
|
||||
</el-input>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="专题列表">
|
||||
<el-button type="primary" size="small" @click="onAdd">
|
||||
<i class="ti-plus"></i>
|
||||
新增专题
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" :size="tableSize">
|
||||
<el-table-column label="序号" type="index" :index="indexMethod" width="60"></el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:key="column.prop"
|
||||
:width="column.width"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-slot="{ row }" v-if="column.prop === 'createdAt'">
|
||||
{{ $moment(row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="230">
|
||||
<template v-slot="{ row }">
|
||||
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
|
||||
<el-button @click="onEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="onDelete(row)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #edit>
|
||||
<basic-form ref="basicFormRef" @refresh="refresh"></basic-form>
|
||||
</template>
|
||||
|
||||
<template #view>
|
||||
<info ref="infoRef"></info>
|
||||
</template>
|
||||
|
||||
</guava>
|
||||
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include('basicForm.js'){}#-->
|
||||
<!--#include('info.js'){}#-->
|
||||
const vue = new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"basic-form": basicForm,
|
||||
"info": info,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'typeCode', label: '专题编号'},
|
||||
{prop: 'typeName', label: '专题名称'},
|
||||
{prop: 'createdAt', label: '创建时间'},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.doSearch()
|
||||
this.$refs.guava.index()
|
||||
},
|
||||
onView(row) {
|
||||
this.$refs.guava.view(() => {
|
||||
this.$refs.infoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
onAdd() {
|
||||
this.$refs.guava.edit(() => {
|
||||
this.$refs.basicFormRef.onOpen()
|
||||
})
|
||||
},
|
||||
onEdit(row) {
|
||||
this.$refs.guava.edit(() => {
|
||||
this.$refs.basicFormRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
onDelete(row) {
|
||||
this.$confirm("您确定要删除吗, 是否继续?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios.post("/platform/contribution/type/onDelete", { id: row.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
pageData() {
|
||||
this.$axios.post(loc() + "/pageData", this.pageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,35 @@
|
||||
const info = {
|
||||
template: /*language=HTML*/ `
|
||||
<div>
|
||||
<el-descriptions :column="2" border class="table_fixed">
|
||||
<el-descriptions-item label="专题编号">
|
||||
{{ viewData.typeCode }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专题名称">
|
||||
{{ viewData.typeName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专题介绍" :span="2">
|
||||
{{ viewData.contributionTypeIntroduce }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="封面图" :span="2">
|
||||
<img :src="viewData.contributionTypeFiles"
|
||||
style="height: 100px;width: auto" v-if="viewData.contributionTypeFiles">
|
||||
<span v-else>暂无</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
viewData: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen(row) {
|
||||
this.viewData = clone(row)
|
||||
},
|
||||
},
|
||||
style: /*language=CSS*/ `
|
||||
|
||||
`
|
||||
}
|
||||
Reference in New Issue
Block a user