main
parent
e69000485d
commit
90f1f8dad4
@ -0,0 +1,46 @@
|
||||
import httpService from "@/request"
|
||||
|
||||
// 查询所有的违禁关键字
|
||||
export function getForbiddenList(params) {
|
||||
return httpService({
|
||||
url: `/user/prohibitedKeywords/list`,
|
||||
method: 'get',
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 添加违禁字
|
||||
export function addForbidden(params) {
|
||||
return httpService({
|
||||
url: `/user/prohibitedKeywords/insert`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 删除违禁字
|
||||
export function deleteForbidden(params) {
|
||||
return httpService({
|
||||
url: `/user/prohibitedKeywords/delete`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 根据id查询违禁字
|
||||
export function findForbidden(params) {
|
||||
return httpService({
|
||||
url: `/user/prohibitedKeywords/findById`,
|
||||
method: 'get',
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 修改违禁字
|
||||
export function updateForbidden(params) {
|
||||
return httpService({
|
||||
url: `/user/prohibitedKeywords/update`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
import httpService from "@/request"
|
||||
|
||||
// 查询所有投票信息
|
||||
export function getVoteList(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/list`,
|
||||
method: 'get',
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 添加投票信息
|
||||
export function addVote(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/insert`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 删除投票信息
|
||||
export function deleteVote(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/delete`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 根据投票主键id查询投票信息
|
||||
export function findVote(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/findById`,
|
||||
method: 'get',
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 修改投票信息
|
||||
export function updateVote(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/update`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 发布下架投票
|
||||
export function releaseVote(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/isRelease`,
|
||||
method: 'get',
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询候选项信息(详情页面)
|
||||
export function getCandidateList(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/findCandidateList`,
|
||||
method: 'get',
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询候选人被投票信息(详情页面)
|
||||
export function getPersonalList(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/findPersonnelList`,
|
||||
method: 'get',
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 即将开始的投票个数
|
||||
export function getTodayVote(params) {
|
||||
return httpService({
|
||||
url: `/user/vote/countVoteExpectedStart`,
|
||||
method: 'get',
|
||||
params: params,
|
||||
})
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
export const columns = [
|
||||
{
|
||||
title: "违禁关键字",
|
||||
width: "33%",
|
||||
dataIndex: "keywords",
|
||||
},
|
||||
{
|
||||
title: "替换字符",
|
||||
width: "33%",
|
||||
dataIndex: "replaces",
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action",
|
||||
width: "240",
|
||||
fixed: "right",
|
||||
scopedSlots: { customRender: "action" },
|
||||
},
|
||||
]
|
||||
|
||||
export const rules = {
|
||||
replaces: [{ required: true, message: "请输入替换的字符", trigger: "blur" }],
|
||||
keywords: [{ required: true, message: "请输入违禁字", trigger: "blur" }],
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="cardTitle">
|
||||
<a-space size="large">
|
||||
<span>违禁字管理</span>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="search-box">
|
||||
<a-row>
|
||||
<a-col :span="20">
|
||||
<a-space size="large">
|
||||
<a-input v-model="form.keywords" style="width: 200px" placeholder="违禁关键字"></a-input>
|
||||
<a-input v-model="form.replaces" style="width: 200px" placeholder="替换字符"></a-input>
|
||||
<a-button type="primary" @click='getData'>查 询</a-button>
|
||||
<a-button @click='reset'>重 置</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
<a-button style="margin: 10px" class="add-btn" @click="detailShow = true;mode = 1">新增违禁字</a-button>
|
||||
<div class="main">
|
||||
<a-table :columns="columns" :data-source="tableData"
|
||||
:pagination="pagination" @change="handlerChange"
|
||||
:row-selection="{
|
||||
selectedRowKeys: selectedRowKeys,
|
||||
onChange: selectionChoosed,
|
||||
}"
|
||||
:row-key="
|
||||
(record, index) => {
|
||||
return record.id;
|
||||
}">
|
||||
<template slot="action" slot-scope="text,record">
|
||||
<span><a @click=edit(record)>编辑</a></span>
|
||||
<span><a style="margin-left: 8px;color:red" @click=del(record)>删除</a></span>
|
||||
</template>
|
||||
</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>
|
||||
</div>
|
||||
<a-drawer :title="mode==1?'新增违禁字':'编辑违禁字'" :width="720" :visible="detailShow" :body-style="{ paddingBottom: '60px' }" @close="detailClose">
|
||||
<div class="drawer-content">
|
||||
<span>违禁字信息</span>
|
||||
<a-divider></a-divider>
|
||||
<a-row>
|
||||
<a-form-model :model="addForm" :rules="rules">
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="违禁关键字" prop="keywords">
|
||||
<a-input style="width: 240px" v-model="addForm.keywords"></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="替换字符" prop="replaces">
|
||||
<a-input style="width: 240px" v-model="addForm.replaces"></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-form-model>
|
||||
</a-row>
|
||||
</div>
|
||||
<div class="drawer-footer" style="float: left">
|
||||
<a-button @click="addConfirm" type="primary" :style="{ marginRight: '8px' }">
|
||||
确认
|
||||
</a-button>
|
||||
<a-button @click="detailClose"> 关闭 </a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getForbiddenList, addForbidden, findForbidden, updateForbidden, deleteForbidden} from "@/api/basic/forbidden"
|
||||
import { rules, columns } from "./depend/config";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
keywords: '',
|
||||
replaces: ''
|
||||
},
|
||||
addForm: {
|
||||
keywords: '',
|
||||
replaces: ''
|
||||
},
|
||||
mode: 1, //1新增 2编辑
|
||||
activeId: undefined,
|
||||
activeName: 0,
|
||||
rules: rules,
|
||||
columns: columns,
|
||||
tableData: [],
|
||||
pagination: {
|
||||
current: 1,
|
||||
total: 0,
|
||||
pageSize: 10,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
},
|
||||
//详情
|
||||
detailShow: false,
|
||||
//批量删除
|
||||
selectedRowKeys: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData()
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
let obj = Object.assign(this.form, {pageNum: this.pagination.current,size: this.pagination.pageSize})
|
||||
getForbiddenList(obj).then(res => {
|
||||
this.tableData = res.data.rows;
|
||||
this.pagination.total = res.data.total
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
keywords: '',
|
||||
replaces: ''
|
||||
},
|
||||
this.getData()
|
||||
},
|
||||
handlerChange() {
|
||||
this.pagination.current = val.current;
|
||||
this.pagination.pageSize = val.pageSize;
|
||||
this.getData()
|
||||
},
|
||||
detailClose() {
|
||||
this.addForm = {
|
||||
name: '',
|
||||
tel: '',
|
||||
type: undefined,
|
||||
status: undefined,
|
||||
weight: 0,
|
||||
}
|
||||
this.detailShow = false
|
||||
},
|
||||
//添加电话
|
||||
addConfirm() {
|
||||
if(this.mode == 1) {
|
||||
addForbidden(this.addForm).then(res => {
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.detailClose()
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let obj = Object.assign(this.addForm, {id: this.activeId})
|
||||
updateForbidden(obj).then(res => {
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.detailClose()
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
//编辑
|
||||
edit(val) {
|
||||
this.mode = 2;
|
||||
findForbidden({prohibitedKeywordsId: val.id}).then(res => {
|
||||
let data = res.data;
|
||||
this.addForm = {
|
||||
keywords: data.keywords,
|
||||
replaces: data.replaces,
|
||||
},
|
||||
this.activeId = data.id
|
||||
})
|
||||
this.detailShow = true;
|
||||
},
|
||||
//删除
|
||||
del(val) {
|
||||
this.$confirm({
|
||||
title: "是否删除该违禁字?",
|
||||
icon:'delete',
|
||||
onOk:async()=>{
|
||||
let res = await deleteForbidden({prohibitedKeywordsIds: [val.id]})
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
//批量删除
|
||||
selectionChoosed(val) {
|
||||
this.selectedRowKeys = val
|
||||
},
|
||||
handleMenuClick(data) {
|
||||
if (data.key === "del") {
|
||||
this.$confirm({
|
||||
title: "是否删除选中的违禁字?",
|
||||
icon:'delete',
|
||||
onOk:async()=>{
|
||||
let res = await deleteForbidden({prohibitedKeywordsIds: this.selectedRowKeys})
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.selectedRowKeys = [];
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
hasSelected() {
|
||||
return this.selectedRowKeys.length > 0;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.drawer-content {
|
||||
padding: 16px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,17 @@
|
||||
export const columns = [
|
||||
{
|
||||
title: "答题人姓名",
|
||||
width: "20%",
|
||||
dataIndex: "name",
|
||||
},
|
||||
{
|
||||
title: "答案内容",
|
||||
width: "50%",
|
||||
dataIndex: "answer",
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
width: "30%",
|
||||
dataIndex: "createDate",
|
||||
},
|
||||
]
|
@ -0,0 +1,144 @@
|
||||
export const columns = [
|
||||
{
|
||||
title: "投票标题",
|
||||
width: "12%",
|
||||
dataIndex: "title",
|
||||
},
|
||||
{
|
||||
title: "投票开始时间",
|
||||
width: "15%",
|
||||
dataIndex: "beginDate",
|
||||
},
|
||||
{
|
||||
title: "投票结束时间",
|
||||
width: "15%",
|
||||
dataIndex: "endDate",
|
||||
},
|
||||
{
|
||||
title: "投票状态",
|
||||
width: "8%",
|
||||
dataIndex: "status",
|
||||
customRender: function(status) {
|
||||
switch(status) {
|
||||
case 1: return '未开始';
|
||||
case 2: return '进行中';
|
||||
case 3: return '已结束';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "投票候选项数量",
|
||||
width: "10%",
|
||||
dataIndex: "votePersonnelNum",
|
||||
},
|
||||
{
|
||||
title: "投票结果",
|
||||
width: "15%",
|
||||
dataIndex: "voteResult",
|
||||
},
|
||||
{
|
||||
title: "是否发布",
|
||||
width: "8%",
|
||||
dataIndex: "isRelease",
|
||||
scopedSlots: { customRender: "release" },
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action",
|
||||
width: "180",
|
||||
fixed: "right",
|
||||
scopedSlots: { customRender: "action" },
|
||||
},
|
||||
];
|
||||
|
||||
export const detailColumns = [
|
||||
{
|
||||
title: "选项名称",
|
||||
width: "20%",
|
||||
dataIndex: "name",
|
||||
},
|
||||
{
|
||||
title: "手机号",
|
||||
width: "20%",
|
||||
dataIndex: "tel",
|
||||
},
|
||||
{
|
||||
title: "票数",
|
||||
width: "10%",
|
||||
dataIndex: "total",
|
||||
},
|
||||
{
|
||||
title: "照片",
|
||||
width: "20%",
|
||||
dataIndex: "imgList",
|
||||
scopedSlots: { customRender: "img" },
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action",
|
||||
width: "120",
|
||||
fixed: "right",
|
||||
scopedSlots: { customRender: "action" },
|
||||
},
|
||||
]
|
||||
|
||||
export const voteColumns = [
|
||||
{
|
||||
title: "住户房号",
|
||||
width: "30%",
|
||||
dataIndex: "roomList",
|
||||
scopedSlots: { customRender: "roomList" },
|
||||
},
|
||||
{
|
||||
title: "住户姓名",
|
||||
width: "15%",
|
||||
dataIndex: "name",
|
||||
},
|
||||
{
|
||||
title: "手机号",
|
||||
width: "20%",
|
||||
dataIndex: "tel",
|
||||
},
|
||||
{
|
||||
title: "投票时间",
|
||||
width: "35%",
|
||||
dataIndex: "createDate",
|
||||
},
|
||||
];
|
||||
|
||||
export const pagination= {
|
||||
current: 1,
|
||||
total: 0,
|
||||
pageSize: 10,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
};
|
||||
|
||||
export const votePagination = {
|
||||
current: 1,
|
||||
total: 0,
|
||||
pageSize: 25,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
showQuickJumper: true,
|
||||
}
|
||||
|
||||
export const form = {
|
||||
title: '',
|
||||
content: '',
|
||||
beginDate: '',
|
||||
endDate: '',
|
||||
type: 1,
|
||||
isRelease: 0,
|
||||
voteInsertCandidateDTOList: [],
|
||||
imgUrls: [],
|
||||
};
|
||||
|
||||
export const rules = {
|
||||
title: [{ required: true, message: "请输入标题", trigger: "blur" }],
|
||||
content: [{ required: true, message: "请输入内容", trigger: "blur" }],
|
||||
type: [{ required: true, message: "请选择对象", trigger: "change" }],
|
||||
isRelease: [{ required: true, message: "请选择是否发布", trigger: "change" }],
|
||||
}
|
@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-drawer :title="title" :width="720" :visible="show" :body-style="{ paddingBottom: '80px' }" @close="addClose">
|
||||
<div class="drawer-content">
|
||||
<span style="font-weight: 600">投票信息</span>
|
||||
<a-divider></a-divider>
|
||||
<a-form-model ref="ruleForm" :model="form" :rules="rules">
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="投票标题" prop="title">
|
||||
<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 label="投票时间" :rules="{required: true,message:'请选择日期',trigger:'change'}">
|
||||
<a-range-picker v-model="selTime" @change="changeTime" value-format="YYYY-MM-DD HH:mm:ss" style="width: 80%"></a-range-picker>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="公开人群" prop="type">
|
||||
<a-select v-model="form.type" placeholder="请选择对象" style="width: 80%">
|
||||
<a-select-option :value="1">全部</a-select-option>
|
||||
<a-select-option :value="2">业主</a-select-option>
|
||||
<a-select-option :value="3">业主亲属</a-select-option>
|
||||
<a-select-option :value="4">租户</a-select-option>
|
||||
<a-select-option :value="5">租户亲属</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="是否发布" prop="isRelease">
|
||||
<a-select v-model="form.isRelease" placeholder="请选择" style="width: 80%">
|
||||
<a-select-option :value="1">发布</a-select-option>
|
||||
<a-select-option :value="0">不发布</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="投票内容" prop="content">
|
||||
<a-textarea v-model="form.content" placeholder="请输入内容" style="width: 90%"></a-textarea>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="图片上传">
|
||||
<commonUpload :fileList="fileList" @handleChange="handleChange"></commonUpload>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="投票选项">
|
||||
<a-button @click="addVoteItem">添加投票选项</a-button>
|
||||
<div class="vote-item" v-for="(item,index) in form.voteUpdateCandidateDTOList" :key="index">
|
||||
<div class="vote-item-title">
|
||||
<span style="font-weight: 600">选项{{index+1}}</span>
|
||||
<a @click="deleteVoteItem(item,index)" style="margin-left: 20px">删除</a>
|
||||
</div>
|
||||
<a-form-model layout="inline">
|
||||
<a-form-model-item label="选项名称">
|
||||
<a-input v-model="item.name"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="手机号">
|
||||
<a-input v-model="item.tel"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item>
|
||||
<a-upload
|
||||
:action="`${$upload}`"
|
||||
:multiple="false"
|
||||
accept=".jpg,.JPG,.png,.PNG,.jpeg,.JPEG"
|
||||
:headers="uploadHeaders"
|
||||
@change="voteImgChange"
|
||||
:file-list="item.defaultFileList"
|
||||
>
|
||||
<a-button @click="uploadIndex(index)"> <a-icon type="upload" />点击上传</a-button>
|
||||
</a-upload>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</div>
|
||||
</a-form-model-item>
|
||||
</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 store from "@/store";
|
||||
import { findVote, updateVote} from "@/api/operation/vote"
|
||||
import { form,rules } from "./config.js";
|
||||
export default {
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
editId: Number,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: "修改投票",
|
||||
form: {
|
||||
title: '',
|
||||
content: '',
|
||||
beginDate: '',
|
||||
endDate: '',
|
||||
type: 1,
|
||||
isRelease: 0,
|
||||
voteUpdateCandidateDTOList: [],
|
||||
imgUrls: [],
|
||||
},
|
||||
rules: rules,
|
||||
selTime: [],
|
||||
fileList: [],
|
||||
rule: [],
|
||||
activeId: undefined,
|
||||
deleteId: [], //删除的选项的Id
|
||||
|
||||
uploadHeaders: {
|
||||
"manage-login-token": store.getters.getToken,
|
||||
},
|
||||
activeIndex: undefined,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
addClose() {
|
||||
this.fileList = [];
|
||||
this.form = {
|
||||
title: '',
|
||||
content: '',
|
||||
beginDate: '',
|
||||
endDate: '',
|
||||
type: 1,
|
||||
isRelease: 0,
|
||||
voteInsertCandidateDTOList: [],
|
||||
imgUrls: [],
|
||||
};
|
||||
this.deleteId = [];
|
||||
this.selTime = [];
|
||||
this.$emit("addClose");
|
||||
},
|
||||
success() {
|
||||
this.$emit("success");
|
||||
this.addClose();
|
||||
},
|
||||
submit() {
|
||||
this.$refs.ruleForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
let obj = Object.assign(this.form, {id: this.activeId,deleteVoteCandidateIds: this.deleteId})
|
||||
updateVote(obj).then(res => {
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.success();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
//图片上传
|
||||
handleChange(data) {
|
||||
this.fileList = data;
|
||||
this.form.imgUrls = [];
|
||||
data.forEach(ele => {
|
||||
if(ele.status == 'done') {
|
||||
this.form.imgUrls.push(ele.response.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
//投票选项图片上传
|
||||
uploadIndex(index) {
|
||||
this.activeIndex = index
|
||||
},
|
||||
voteImgChange(data) {
|
||||
this.form.voteUpdateCandidateDTOList[this.activeIndex].imgUrls = []
|
||||
if(data.file.status == 'done') {
|
||||
this.form.voteUpdateCandidateDTOList[this.activeIndex].imgUrls.push(data.file.response.data)
|
||||
}
|
||||
},
|
||||
//修改时间
|
||||
changeTime(val) {
|
||||
this.form.beginDate = val[0];
|
||||
this.form.endDate = val[1];
|
||||
},
|
||||
//添加投票选项
|
||||
addVoteItem() {
|
||||
let obj = {
|
||||
id: null,
|
||||
name: '',
|
||||
tel: '',
|
||||
imgUrls: [],
|
||||
};
|
||||
this.form.voteUpdateCandidateDTOList.push(obj)
|
||||
},
|
||||
//删除投票选项
|
||||
deleteVoteItem(item,index) {
|
||||
this.deleteId.push(item.id);
|
||||
this.form.voteUpdateCandidateDTOList.splice(index,1)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
editId: {
|
||||
handler(val) {
|
||||
if (val !== null) {
|
||||
this.title = "修改投票";
|
||||
this.activeId = val;
|
||||
findVote({ voteId: val }).then((res) => {
|
||||
let data = res.data;
|
||||
//处理选项
|
||||
let arr = []
|
||||
data.voteFBICandidateVoList.forEach(ele => {
|
||||
let obj = {
|
||||
id: ele.id,
|
||||
name: ele.name,
|
||||
tel: ele.tel,
|
||||
imgUrls: [],
|
||||
}
|
||||
if(ele.imgList.length > 0) {
|
||||
obj.imgUrls.push(ele.imgList[0].url);
|
||||
};
|
||||
arr.push(obj);
|
||||
})
|
||||
////////
|
||||
this.form = {
|
||||
title: data.title,
|
||||
content: data.content,
|
||||
beginDate: data.beginDate,
|
||||
endDate: data.endDate,
|
||||
type: data.type,
|
||||
isRelease: data.isRelease,
|
||||
voteUpdateCandidateDTOList: arr,
|
||||
imgUrls: [],
|
||||
};
|
||||
console.log(this.form)
|
||||
this.selTime = [res.data.beginDate, res.data.endDate];
|
||||
if (res.data.imgList.length > 0) {
|
||||
const pic = [];
|
||||
this.form.imgUrls.push(res.data.imgList[0].url);
|
||||
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 lang="less">
|
||||
.vote-item {
|
||||
width: 600px;
|
||||
.vote-item-title {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,290 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-drawer :title="title" :width="720" :visible="show" :body-style="{ paddingBottom: '80px' }" @close="addClose">
|
||||
<div class="drawer-content">
|
||||
<span style="font-weight: 600">投票信息</span>
|
||||
<a-divider></a-divider>
|
||||
<a-form-model ref="ruleForm" :model="form" :rules="rules">
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="投票标题" prop="title">
|
||||
<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 label="投票时间" :rules="{required: true,message:'请选择日期',trigger:'change'}">
|
||||
<a-range-picker v-model="selTime" @change="changeTime" value-format="YYYY-MM-DD HH:mm:ss" style="width: 80%"></a-range-picker>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="公开人群" prop="type">
|
||||
<a-select v-model="form.type" placeholder="请选择对象" style="width: 80%">
|
||||
<a-select-option :value="1">全部</a-select-option>
|
||||
<a-select-option :value="2">业主</a-select-option>
|
||||
<a-select-option :value="3">业主亲属</a-select-option>
|
||||
<a-select-option :value="4">租户</a-select-option>
|
||||
<a-select-option :value="5">租户亲属</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="是否发布" prop="isRelease">
|
||||
<a-select v-model="form.isRelease" placeholder="请选择" style="width: 80%">
|
||||
<a-select-option :value="1">发布</a-select-option>
|
||||
<a-select-option :value="0">不发布</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="投票内容" prop="content">
|
||||
<a-textarea v-model="form.content" placeholder="请输入内容" style="width: 90%"></a-textarea>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="图片上传">
|
||||
<commonUpload :fileList="fileList" @handleChange="handleChange"></commonUpload>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="投票选项">
|
||||
<a-button @click="addVoteItem">添加投票选项</a-button>
|
||||
<div class="vote-item" v-for="(item,index) in form.voteInsertCandidateDTOList" :key="index">
|
||||
<div class="vote-item-title">
|
||||
<span style="font-weight: 600">选项{{index+1}}</span>
|
||||
<a @click="deleteVoteItem(item,index)" style="margin-left: 20px">删除</a>
|
||||
</div>
|
||||
<a-form-model layout="inline">
|
||||
<a-form-model-item label="选项名称">
|
||||
<a-input v-model="item.name"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="手机号">
|
||||
<a-input v-model="item.tel"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item>
|
||||
<a-upload
|
||||
:action="`${$upload}`"
|
||||
:multiple="false"
|
||||
accept=".jpg,.JPG,.png,.PNG,.jpeg,.JPEG"
|
||||
:headers="uploadHeaders"
|
||||
@change="voteImgChange"
|
||||
>
|
||||
<a-button @click="uploadIndex(index)"> <a-icon type="upload" />点击上传</a-button>
|
||||
</a-upload>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</div>
|
||||
</a-form-model-item>
|
||||
</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 store from "@/store";
|
||||
import { findVote, addVote, updateVote} from "@/api/operation/vote"
|
||||
import { form,rules } from "./config.js";
|
||||
export default {
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
editId: Number,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: "新增投票",
|
||||
form: form,
|
||||
rules: rules,
|
||||
selTime: [],
|
||||
fileList: [],
|
||||
rule: [],
|
||||
activeId: undefined,
|
||||
deleteId: [], //删除的选项的Id
|
||||
|
||||
uploadHeaders: {
|
||||
"manage-login-token": store.getters.getToken,
|
||||
},
|
||||
activeIndex: undefined,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
addClose() {
|
||||
this.fileList = [];
|
||||
this.form = {
|
||||
title: '',
|
||||
content: '',
|
||||
beginDate: '',
|
||||
endDate: '',
|
||||
type: 1,
|
||||
isRelease: 0,
|
||||
voteInsertCandidateDTOList: [],
|
||||
imgUrls: [],
|
||||
};
|
||||
this.deleteId = [];
|
||||
this.selTime = [];
|
||||
this.$emit("addClose");
|
||||
},
|
||||
success() {
|
||||
this.$emit("success");
|
||||
this.addClose();
|
||||
},
|
||||
submit() {
|
||||
this.$refs.ruleForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
if (this.editId === null) {
|
||||
addVote(this.form).then(res => {
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.success();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let obj = Object.assign(this.form, {id: this.activeId,deleteVoteCandidateIds: this.deleteId})
|
||||
console.log(obj)
|
||||
updateVote(obj).then(res => {
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.success();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//图片上传
|
||||
handleChange(data) {
|
||||
this.fileList = data;
|
||||
this.form.imgUrls = [];
|
||||
data.forEach(ele => {
|
||||
if(ele.status == 'done') {
|
||||
this.form.imgUrls.push(ele.response.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
//投票选项图片上传
|
||||
uploadIndex(index) {
|
||||
this.activeIndex = index
|
||||
},
|
||||
voteImgChange(data) {
|
||||
this.form.voteInsertCandidateDTOList[this.activeIndex].imgUrls = []
|
||||
if(data.file.status == 'done') {
|
||||
this.form.voteInsertCandidateDTOList[this.activeIndex].imgUrls.push(data.file.response.data)
|
||||
}
|
||||
},
|
||||
//修改时间
|
||||
changeTime(val) {
|
||||
this.form.beginDate = val[0];
|
||||
this.form.endDate = val[1];
|
||||
},
|
||||
//添加投票选项
|
||||
addVoteItem() {
|
||||
if(this.editId === null) {
|
||||
let obj = {
|
||||
name: '',
|
||||
tel: '',
|
||||
imgUrls: [],
|
||||
};
|
||||
this.form.voteInsertCandidateDTOList.push(obj)
|
||||
} else {
|
||||
let obj = {
|
||||
id: null,
|
||||
name: '',
|
||||
tel: '',
|
||||
imgUrls: [],
|
||||
};
|
||||
this.form.voteInsertCandidateDTOList.push(obj)
|
||||
}
|
||||
},
|
||||
//删除投票选项
|
||||
deleteVoteItem(item,index) {
|
||||
this.deleteId.push(item.id);
|
||||
this.form.voteInsertCandidateDTOList.splice(index,1)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
editId: {
|
||||
handler(val) {
|
||||
if (val !== null) {
|
||||
this.title = "修改投票";
|
||||
this.activeId = val;
|
||||
findVote({ voteId: val }).then((res) => {
|
||||
let data = res.data;
|
||||
//处理选项
|
||||
let arr = []
|
||||
data.voteFBICandidateVoList.forEach(ele => {
|
||||
let obj = {
|
||||
id: ele.id,
|
||||
name: ele.name,
|
||||
tel: ele.tel,
|
||||
imgUrls: [],
|
||||
}
|
||||
if(ele.imgList.length > 0) {
|
||||
obj.imgUrls = ele.imgList[0].url
|
||||
};
|
||||
arr.push(obj);
|
||||
})
|
||||
////////
|
||||
this.form = {
|
||||
title: data.title,
|
||||
content: data.content,
|
||||
beginDate: data.beginDate,
|
||||
endDate: data.endDate,
|
||||
type: data.type,
|
||||
isRelease: data.isRelease,
|
||||
voteInsertCandidateDTOList: arr,
|
||||
imgUrls: [],
|
||||
}
|
||||
this.selTime = [res.data.beginDate, res.data.endDate];
|
||||
if (res.data.imgList.length > 0) {
|
||||
const pic = [];
|
||||
this.form.imgUrls.push(res.data.imgList[0].url);
|
||||
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 lang="less">
|
||||
.vote-item {
|
||||
width: 600px;
|
||||
.vote-item-title {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,361 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="cardTitle">
|
||||
<a-space size="large">
|
||||
<span>投票管理</span>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="search-box" v-if="todayVote > 0">
|
||||
<a-alert :message="'温馨提示:有 '+todayVote+' 个投票即将开始'" type="warning" show-icon />
|
||||
</div>
|
||||
<div class="search-box">
|
||||
<a-row>
|
||||
<a-col :span="20">
|
||||
<a-space size="large">
|
||||
<a-input v-model="form.title" style="width: 200px" placeholder="投票标题"></a-input>
|
||||
<a-select v-model="form.status" style="width: 200px" placeholder="投票状态">
|
||||
<a-select-option :value="1">未开始</a-select-option>
|
||||
<a-select-option :value="2">进行中</a-select-option>
|
||||
<a-select-option :value="3">已结束</a-select-option>
|
||||
</a-select>
|
||||
<a-range-picker v-model="selTime" @change="timeChange" value-format="YYYY-MM-DD HH:mm:ss"></a-range-picker>
|
||||
<a-button type="primary" @click='getData'>查 询</a-button>
|
||||
<a-button @click='reset'>重 置</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
<a-button style="margin: 10px" class="add-btn" @click="addScroll">新增投票</a-button>
|
||||
<div class="main">
|
||||
<a-table :columns="columns" :data-source="tableData"
|
||||
:pagination="pagination" @change="handlerChange"
|
||||
:row-selection="{
|
||||
selectedRowKeys: selectedRowKeys,
|
||||
onChange: selectionChoosed,
|
||||
}"
|
||||
:row-key="
|
||||
(record, index) => {
|
||||
return record.id;
|
||||
}">
|
||||
<template slot="release" slot-scope="text,record">
|
||||
<a-switch checked-children="已发布"
|
||||
un-checked-children="未发布"
|
||||
:checked="record.isRelease == 1"
|
||||
@change="handleRelease(record)">
|
||||
</a-switch>
|
||||
</template>
|
||||
<template slot="action" slot-scope="text,record">
|
||||
<span><a @click=detail(record)>投票详情</a></span>
|
||||
<span><a style="margin-left: 8px" @click=edit(record)>编辑</a></span>
|
||||
<span><a style="margin-left: 8px;color:red" @click=del(record)>删除</a></span>
|
||||
</template>
|
||||
</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> -->
|
||||
</div>
|
||||
<addForm :show="drawerShow" @success="success" @addClose="addClose" :editId="null"></addForm>
|
||||
<editForm :show="editDrawerShow" @success="success" @addClose="editClose" :editId="editId"></editForm>
|
||||
<a-drawer title="投票详情" :width="720" :visible="detailShow" :body-style="{ paddingBottom: '80px' }" @close="detailClose">
|
||||
<span style="font-weight: 600">投票信息</span>
|
||||
<a-divider></a-divider>
|
||||
<a-descriptions :column="2">
|
||||
<a-descriptions-item label="投票标题">{{detailTotal.title}}</a-descriptions-item>
|
||||
<a-descriptions-item label="公开人群">
|
||||
{{detailTotal.type==1?'全部':detailTotal.type==2?'业主':detailTotal.type==3?'业主亲属':detailTotal.type==4?'租户':'租户亲属'}}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="开始时间">{{detailTotal.beginDate}}</a-descriptions-item>
|
||||
<a-descriptions-item label="结束时间">{{detailTotal.endDate}}</a-descriptions-item>
|
||||
<a-descriptions-item label="图片" :span="3">
|
||||
<img :src="$ImgUrl(img.url)" class="contentImg" v-for="(img, index) in detailTotal.imgList" :key="index" />
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="内容" :span="3">
|
||||
{{detailTotal.content}}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<a-divider></a-divider>
|
||||
<a-table :columns="detailColumns" :data-source="detailData" :pagination="false"
|
||||
:row-key="
|
||||
(record, index) => {
|
||||
return record.id;
|
||||
}">
|
||||
<template slot="img" slot-scope="text,record">
|
||||
<img :src="$ImgUrl(img.url)" class="tableImg" v-for="(img, index) in record.imgList" :key="index" />
|
||||
</template>
|
||||
<template slot="action" slot-scope="text,record">
|
||||
<span><a @click=voteDetail(record)>详情</a></span>
|
||||
</template>
|
||||
</a-table>
|
||||
<a-drawer title="投票人列表" :width="720" :visible="voteShow" :body-style="{ paddingBottom: '80px' }" @close="voteShow = false">
|
||||
<a-table :columns="voteColumns" :data-source="voteData" :pagination="votePagination" @change="votePChange"
|
||||
:row-key="
|
||||
(record, index) => {
|
||||
return record.id;
|
||||
}">
|
||||
<template slot="roomList" slot-scope="text,record">
|
||||
<div v-for="(item,index) in record.roomList" :key="index">
|
||||
{{item.buildingName}}栋-{{item.unitName}}单元-{{item.estateName}}-
|
||||
{{item.identity == 1?'业主':item.identity == 2?'业主亲属':item.identity == 3?'租户':'租户亲属'}}
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-drawer>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { rules, columns, pagination, detailColumns,voteColumns,votePagination } from "./depend/config.js";
|
||||
import addForm from "./depend/form.vue";
|
||||
import editForm from "./depend/editForm.vue";
|
||||
import { getVoteList, deleteVote, releaseVote,findVote, getCandidateList,getPersonalList,getTodayVote} from "@/api/operation/vote"
|
||||
export default {
|
||||
components: {
|
||||
addForm,
|
||||
editForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
todayVote: 0,
|
||||
form: {
|
||||
title: '',
|
||||
status: undefined,
|
||||
beginDate: '',
|
||||
endDate: ''
|
||||
},
|
||||
selTime: [],
|
||||
rules: rules,
|
||||
columns: columns,
|
||||
voteColumns: voteColumns,
|
||||
detailColumns: detailColumns,
|
||||
tableData: [],
|
||||
pagination: pagination,
|
||||
votePagination: votePagination,
|
||||
//批量删除
|
||||
selectedRowKeys: [],
|
||||
//抽屉
|
||||
drawerShow: false,
|
||||
editId: null,
|
||||
editDrawerShow: false,
|
||||
//详情抽屉
|
||||
detailShow: false,
|
||||
detailData: [],
|
||||
detailIndex: undefined,
|
||||
detailTotal: {
|
||||
title: '',
|
||||
content: '',
|
||||
beginDate: '',
|
||||
endDate: '',
|
||||
type: 0,
|
||||
isRelease: 0,
|
||||
imgList: [],
|
||||
},
|
||||
//投票详情抽屉
|
||||
voteShow: false,
|
||||
voteData: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
getTodayVote().then(res => {
|
||||
this.todayVote = res.data
|
||||
})
|
||||
this.getData()
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
let obj = Object.assign(this.form, {pageNum: this.pagination.current,size: this.pagination.pageSize})
|
||||
getVoteList(obj).then(res => {
|
||||
this.tableData = res.data.rows;
|
||||
this.pagination.total = res.data.total
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
title: '',
|
||||
status: undefined,
|
||||
beginDate: '',
|
||||
endDate: ''
|
||||
},
|
||||
this.selTime = [],
|
||||
this.getData()
|
||||
},
|
||||
handlerChange() {
|
||||
this.pagination.current = val.current;
|
||||
this.pagination.pageSize = val.pageSize;
|
||||
this.getData()
|
||||
},
|
||||
//编辑
|
||||
edit(val) {
|
||||
if(val.status == 2) {
|
||||
this.$confirm({
|
||||
title: "该活动已经开始投票,不可编辑",
|
||||
icon:'stop',
|
||||
})
|
||||
return false;
|
||||
} else {
|
||||
this.editId = val.id;
|
||||
this.editDrawerShow = true;
|
||||
}
|
||||
},
|
||||
//发布
|
||||
handleRelease(val) {
|
||||
if(val.status == 1 && val.isRelease == 0) {
|
||||
this.$confirm({
|
||||
title: "该投票还未开始,是否发布?",
|
||||
icon:'question',
|
||||
onOk:async()=>{
|
||||
let res = await releaseVote({voteId: val.id})
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
},
|
||||
})
|
||||
} else {
|
||||
releaseVote({voteId: val.id}).then(res => {
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
//删除
|
||||
del(val) {
|
||||
if(val.status == 2) {
|
||||
this.$confirm({
|
||||
title: "该活动已经开始投票,不可删除",
|
||||
icon:'stop',
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
this.$confirm({
|
||||
title: "是否删除该投票?",
|
||||
icon:'delete',
|
||||
onOk:async()=>{
|
||||
let res = await deleteVote({voteIds: [val.id]})
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
//批量删除
|
||||
selectionChoosed(val) {
|
||||
this.selectedRowKeys = val
|
||||
},
|
||||
handleMenuClick(data) {
|
||||
if (data.key === "del") {
|
||||
this.$confirm({
|
||||
title: "是否删除选中的投票?",
|
||||
icon:'delete',
|
||||
onOk:async()=>{
|
||||
let res = await deleteVote({voteIds: this.selectedRowKeys})
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg);
|
||||
this.selectedRowKeys = [];
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
// 新增问卷
|
||||
addScroll() {
|
||||
this.drawerShow = true;
|
||||
},
|
||||
addClose() {
|
||||
this.drawerShow = false;
|
||||
this.editId = null;
|
||||
},
|
||||
editClose() {
|
||||
this.editDrawerShow = false;
|
||||
this.editId = null;
|
||||
},
|
||||
success() {
|
||||
this.getData();
|
||||
},
|
||||
//详情
|
||||
detail(val) {
|
||||
let obj = {pageNum: 1,size: 20,voteId: val.id}
|
||||
this.detailIndex = val.id;
|
||||
findVote({voteId: val.id}).then(res => {
|
||||
let data = res.data
|
||||
this.detailTotal = {
|
||||
title: data.title,
|
||||
type: data.type,
|
||||
content: data.content,
|
||||
beginDate: data.beginDate,
|
||||
endDate: data.endDate,
|
||||
isRelease: data.isRelease,
|
||||
imgList: data.imgList,
|
||||
}
|
||||
})
|
||||
getCandidateList(obj).then(res => {
|
||||
this.detailData = res.data.rows;
|
||||
this.detailShow = true;
|
||||
})
|
||||
}, //投票者列表
|
||||
voteDetail(val) {
|
||||
let obj = {pageNum: this.votePagination.current,size: this.votePagination.pageSize,voteId: this.detailIndex,voteCandidateId: val.id}
|
||||
getPersonalList(obj).then(res => {
|
||||
let data = res.data;
|
||||
this.voteData = data.rows;
|
||||
this.voteShow = true;
|
||||
})
|
||||
}, //投票者列表分页
|
||||
votePChange(val) {
|
||||
|
||||
},
|
||||
//关闭详情
|
||||
detailClose() {
|
||||
this.detailIndex = undefined
|
||||
this.detailShow = false
|
||||
},
|
||||
//修改时间
|
||||
timeChange(val) {
|
||||
this.form.beginDate = val[0];
|
||||
this.form.endDate = val[1];
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
hasSelected() {
|
||||
return this.selectedRowKeys.length > 0;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.drawer-content {
|
||||
padding: 16px;
|
||||
}
|
||||
.contentImg {
|
||||
height: 108px;
|
||||
width: 194px;
|
||||
}
|
||||
.tableImg {
|
||||
height: 54px;
|
||||
width: 97px;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue