main
bibi 3 years ago
parent ec274d30fd
commit 57b58a1f1f

@ -0,0 +1,53 @@
import httpService from "@/request"
// 活动列表
export function activityList(params) {
return httpService({
url: `/user/activity/list`,
method: 'get',
params: params,
})
}
export function organizerSelect(params) {
return httpService({
url: `/user/activityOrganizer/allList`,
method: 'get',
params: params,
})
}
// 报名人
export function registrationList(params) {
return httpService({
url: `/user/activity/registrationList`,
method: 'get',
params: params,
})
}
export function activityInfo(params) {
return httpService({
url: `/user/activity/findById`,
method: 'get',
params: params,
})
}
export function activityInsert(params) {
return httpService({
url: `/user/activity/insert`,
method: 'post',
data: params,
})
}
export function activityUpdate(params) {
return httpService({
url: `/user/activity/update`,
method: 'post',
data: params,
})
}
export function activityDel(params) {
return httpService({
url: `/user/activity/delete`,
method: 'post',
data: params,
})
}

@ -0,0 +1,38 @@
import httpService from "@/request"
// 主办方列表
export function organizerList(params) {
return httpService({
url: `/user/activityOrganizer/list`,
method: 'get',
params: params,
})
}
export function organizerInfo(params) {
return httpService({
url: `/user/activityOrganizer/findById`,
method: 'post',
params: params,
})
}
export function organizerInsert(params) {
return httpService({
url: `/user/activityOrganizer/insert`,
method: 'get',
data: params,
})
}
export function organizerUpdate(params) {
return httpService({
url: `/user/activityOrganizer/update`,
method: 'post',
data: params,
})
}
export function organizerDel(params) {
return httpService({
url: `/user/activityOrganizer/delete`,
method: 'post',
data: params,
})
}

@ -0,0 +1,122 @@
export const formItem = [
{
type: 'input',
label:'话题标题',
prop:'title',
placeholder:'请输入标题'
},
{
type: 'select',
label:'状态',
prop:'status',
option:[{ id:1,name:'启用中'},{ id:2,name:'禁用中'}],
placeholder:'请选择状态'
},
{
type: 'select',
label:'是否公开',
prop:'isPublic',
placeholder:'请选择',
option:[{ id:1,name:'是'},{ id:0,name:'否'}]
},
]
export const columns = [
{
title: "发布时间",
dataIndex: "createDate",
width: "12%",
},
{
title: "图片",
dataIndex: "imgpic",
width: "10%",
scopedSlots: { customRender: "imgpic"}
},
{
title: "活动状态",
dataIndex: "status",
width: "6%",
customRender: function (status) {
switch (status) {
case 1:
return '报名未开始'
case 2:
return '报名进行中'
case 3:
return '活动未开始'
case 4:
return '活动进行中'
case 5:
return '活动已结束'
}
}
},
{
title: "活动标题",
dataIndex: "title",
width: "8%",
},
{
title: "活动地点",
dataIndex: "activityAddress",
width: "8%",
},
{
title: "是否显示在app",
dataIndex: "isShow",
width: "5%",
customRender: function (isShow) {
switch (isShow) {
case true:
return '显示'
case false:
return '不显示'
}
}
},
{
title: "主办方",
dataIndex: "organizerName",
width: "8%",
},
{
title: "活动内容",
dataIndex: "content",
width: "8%",
},
{
title: "报名人数",
dataIndex: "registrationNum",
width: "5%",
},
{
title: "报名时间",
width: "12%",
customRender: function (data) {
return (data.registrationStartTime + '——' + data.registrationEndTime)
}
},
{
title: "活动时间",
width: "12%",
customRender: function (data) {
return (data.activityStartTime + '——' + data.activityEndTime)
}
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
export const pagination = {
current: 1,
total: 0,
pageSize: 10,
showTotal: (total) => `${total}`,
showSizeChanger: true,
showQuickJumper: true,
}

@ -0,0 +1,47 @@
export const form = {
title:undefined,
organizerId:undefined,
isShow:false,
activityObject:undefined,
content:undefined,
registrationStartTime:undefined,
registrationEndTime:undefined,
activityStartTime:undefined,
activityEndTime:undefined,
activityAddress:undefined,
registrationNumMax:undefined,
registrationCost:undefined,
activityContact:undefined,
activityTel:undefined,
imgUrls:[]
}
export const rules = {
title:[{required:true,message:'请输入标题',trigger:'blur'}],
organizerId:[{required:true,message:'请选择',trigger:'change'}],
isShow:[{required:true,message:'请选择',trigger:'change'}],
activityObject:[{required:true,message:'请选择活动对象',trigger:'change'}],
content:[{required:true,message:'请输入内容',trigger:'blur'}],
registrationStartTime:[{required:true,message:'请选择',trigger:'change'}],
registrationEndTime:[{required:true,message:'请选择',trigger:'change'}],
activityStartTime:[{required:true,message:'请选择',trigger:'change'}],
activityEndTime:[{required:true,message:'请选择',trigger:'change'}],
activityAddress:[{required:true,message:'请输入活动地址',trigger:'blur'}],
registrationNumMax:[{required:true,message:'请输入人数上限',trigger:'blur'}],
registrationCost:[{required:true,message:'请输入报名费用',trigger:'blur'}],
activityContact:[{required:true,message:'请输入活动联系人',trigger:'blur'}],
activityTel:[{required:true,message:'请输入活动联系方式',trigger:'blur'}],
}
export const options = {
isShow:[
{ id:true, name:'显示' },
{ id:false, name:'不显示' },
],
activityObject: [
{ id:1, name:'全部' },
{ id:2, name:'住户' },
{ id:3, name:'业主' },
{ id:4, name:'租户' },
{ id:5, name:'管家' },
],
organizer:[]
}

@ -0,0 +1,263 @@
<template>
<div>
<a-drawer
:title="title"
:width="720"
:visible="show"
:body-style="{ paddingBottom: '80px' }"
@close="addClose"
>
<div class="drawer-content">
基本信息
<a-divider></a-divider>
<a-form-model
ref="ruleForm"
:model="form"
:rules="rules"
layout="vertical"
>
<a-row>
<a-col :span="12">
<a-form-model-item prop="title" label="标题">
<a-input
v-model="form.title"
placeholder="请输入标题"
style="width: 80%"
></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="organizerId" label="主办方">
<a-select
v-model="form.organizerId"
placeholder="请选择"
style="width: 80%"
>
<a-select-option v-for="item in options.organizer" :key="item.id" :value="item.id">{{item.unit}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="isShow" label="是否显示">
<a-switch
v-model="form.isShow"
style="margin-left:20px"
>
</a-switch>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="activityObject" label="活动对象">
<a-select
v-model="form.activityObject"
placeholder="请选择"
style="width: 80%"
>
<a-select-option v-for="item in options.activityObject" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item prop="content" label="内容">
<a-textarea
v-model="form.content"
placeholder="请输入内容"
style="width: 80%"
></a-textarea>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="registrationStartTime" label="报名开始时间">
<a-date-picker v-model="form.registrationStartTime" value-format="YYYY-MM-DD HH:mm:ss"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="registrationEndTime" label="报名结束时间">
<a-date-picker v-model="form.registrationEndTime" value-format="YYYY-MM-DD HH:mm:ss"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="activityStartTime" label="活动开始时间">
<a-date-picker v-model="form.activityStartTime" value-format="YYYY-MM-DD HH:mm:ss"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="activityEndTime" label="活动结束时间">
<a-date-picker v-model="form.activityEndTime" value-format="YYYY-MM-DD HH:mm:ss"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="registrationNumMax" label="报名人数上限">
<a-input-number
v-model="form.registrationNumMax"
placeholder="请输入人数"
:min='0'
style="width: 30%"
></a-input-number>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="activityAddress" label="活动地址">
<a-input
v-model="form.activityAddress"
placeholder="请输入活动地址"
style="width: 80%"
></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="registrationCost" label="报名费用">
<a-input-number
v-model="form.registrationCost"
placeholder="请输入费用"
:min='0'
style="width: 30%"
></a-input-number>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="activityContact" label="活动联系人">
<a-input
v-model="form.activityContact"
placeholder="请输入活动联系人"
style="width: 80%"
></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="activityTel" label="活动联系方式">
<a-input
v-model="form.activityTel"
placeholder="请输入活动联系人"
style="width: 80%"
></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
活动图片
<commonUpload :fileList='fileList' @handleChange='handleChange'></commonUpload>
</a-col>
</a-row>
</a-form-model>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="addClose">
关闭
</a-button>
<a-button type="primary" @click="submit"> </a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { form, rules, options } from "./form.js";
import {
activityInsert,
activityUpdate,
activityInfo,
organizerSelect
} from "@/api/operation/activity";
export default {
props: {
show: {
type: Boolean,
default: false,
},
editId: Number,
},
data() {
return {
title: "新增活动",
form,
rules,
options,
fileList: [],
};
},
mounted() {
this.getOrganizer()
},
methods: {
async getOrganizer(){
let res = await organizerSelect()
this.options.organizer = res.data
},
addClose() {
this.$refs.ruleForm.resetFields();
this.fileList = [];
this.$emit("addClose");
},
success() {
this.$emit("success");
this.addClose();
},
submit() {
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
if (this.editId === null) {
let res = await activityInsert(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.success();
} else {
this.$message.error(res.msg);
}
} else {
console.log(this.form);
let res = await activityUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.success();
} else {
this.$message.error(res.msg);
}
}
}
});
},
handleChange(data) {
this.fileList = data;
if (data[0].status === "done") {
console.log('-------done-------');
this.form.imgUrls.push(data[0].response.data);
}
},
},
watch: {
editId: {
handler(val) {
if (val !== null) {
this.title = "修改活动";
this.form.id = val;
activityInfo({ activityId: val }).then((res) => {
this.form = res.data;
if (res.data.imgList.length > 0) {
console.log(res.data.imgList);
const pic = [];
for (let item of res.data.imgList) {
let obj = {
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
url: this.$ImgUrl(item.url),
uid: item.url.split("_")[1],
status: "done",
thumbUrl: this.$ImgUrl(item.url),
};
pic.push(obj);
}
this.fileList = pic;
}else{
this.form.imgUrls=[]
}
});
} else {
this.title = "新增活动";
}
},
immediate: true,
},
},
};
</script>
<style></style>

@ -1,13 +1,189 @@
<template>
<div></div>
<div>
<div class="cardTitle">活动管理</div>
<searchForm :formItem="formItem" @getSearch="getData($event)"></searchForm>
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true"
>新增活动</a-button
>
<a-table
:columns="columns"
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 2600 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,
}"
:row-key="
(record, index) => {
return record.id;
}
"
>
<span slot="action" slot-scope="text, row">
<a-space>
<a class="ant-dropdown-link" @click="edit(row.id)"></a>
<a class="ant-dropdown-link" @click="del([row.id])"></a>
</a-space>
</span>
<span slot="imgpic" slot-scope="text, row">
<img
v-if="row.imgList.length > 0"
:src="$ImgUrl(row.imgList[0].url)"
class="table-img"
alt=""
/>
<span v-else></span>
</span>
<span slot="switch" slot-scope="switchV, row">
<a-switch
:checked="switchV === 1"
@change="handleEnable(row)"
></a-switch>
</span>
</a-table>
<div class="action">
<a-dropdown :disabled="!hasSelected">
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="del"> 批量删除 </a-menu-item>
</a-menu>
<a-button> 批量操作 <a-icon type="down" /> </a-button>
</a-dropdown>
<span style="margin-left: 8px">
<template v-if="hasSelected">
{{ `已选择 ${selectedRowKeys.length}` }}
</template>
</span>
</div>
<addForm
:show="drawer.show"
@success="success"
@addClose="addClose"
:editId="editId"
></addForm>
</div>
</template>
<script>
import { activityList, activityDel } from "@/api/operation/activity";
import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue";
export default {
components: {
addForm,
},
data() {
return {
drawer: {
show: false,
},
editId: null,
tableData: [],
searchForm: {
activityAddress: undefined,
organizerName: undefined,
activityContact: undefined,
activityTel: undefined,
title: undefined,
status: undefined,
registrationStartTime: undefined,
registrationEndTime: undefined,
activityStartTime: undefined,
activityEndTime: undefined,
},
formItem,
columns,
pagination,
// index
selectedRowKeys: [],
};
},
mounted() {
this.getData();
},
methods: {
async getData(data) {
if (data !== undefined) {
console.log(data);
this.searchForm = data;
console.log(this.searchForm);
}
let res = await activityList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
activityAddress: this.searchForm.activityAddress,
organizerName: this.searchForm.organizerName,
activityContact: this.searchForm.activityContact,
activityTel: this.searchForm.activityTel,
title: this.searchForm.title,
status: this.searchForm.status,
registrationStartTime: this.searchForm.registrationStartTime,
registrationEndTime: this.searchForm.registrationEndTime,
activityStartTime: this.searchForm.activityStartTime,
activityEndTime: this.searchForm.activityEndTime,
});
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
this.selectedRowKeys=[]
},
edit(id) {
this.editId = id;
this.drawer.show = true;
},
del(ids) {
console.log(ids);
this.$confirm({
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "delete",
onOk: async () => {
let res = await activityDel({ activityIds: ids });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
});
},
selectionChoosed(data) {
this.selectedRowKeys = data;
},
handleMenuClick(data) {
console.log(data);
if (data.key === "del") {
this.del(this.selectedRowKeys);
}
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData();
},
addClose() {
this.drawer.show = false;
this.editId = null;
},
success() {
this.getData();
},
},
computed: {
hasSelected() {
return this.selectedRowKeys.length > 0;
},
},
};
</script>
<style>
<style lang="less" scoped>
.table-img {
width: 40px;
height: 40px;
}
</style>

@ -0,0 +1,13 @@
<template>
<div></div>
</template>
<script>
export default {
}
</script>
<style>
</style>

@ -0,0 +1,13 @@
<template>
<router-view></router-view>
</template>
<script>
export default {
}
</script>
<style>
</style>
Loading…
Cancel
Save