活动管理
This commit is contained in:
@@ -0,0 +1,63 @@
|
|||||||
|
<template>
|
||||||
|
<div class="AppActivitiesManagement">
|
||||||
|
<keep-alive :include="['List']">
|
||||||
|
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
|
||||||
|
</keep-alive>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import activitiesList from './components/activitiesList'
|
||||||
|
import activitiesAdd from './components/activitiesAdd'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AppHomeReport',
|
||||||
|
label: '活动管理',
|
||||||
|
|
||||||
|
props: {
|
||||||
|
instance: Function,
|
||||||
|
dict: Object
|
||||||
|
},
|
||||||
|
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
component: 'activitiesList',
|
||||||
|
params: {},
|
||||||
|
include: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
components: {
|
||||||
|
activitiesList,
|
||||||
|
activitiesAdd
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
onChange (data) {
|
||||||
|
if (data.type === 'activitiesAdd') {
|
||||||
|
this.component = 'activitiesAdd'
|
||||||
|
this.params = data.params
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'activitiesList') {
|
||||||
|
this.component = 'activitiesList'
|
||||||
|
this.params = data.params
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (data.isRefresh) {
|
||||||
|
this.$refs.component.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.AppActivitiesManagement {
|
||||||
|
height: 100%;
|
||||||
|
background: #F3F6F9;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,404 @@
|
|||||||
|
<template>
|
||||||
|
<section class="activitiesAdd">
|
||||||
|
<ai-detail v-show="id && !isEdit">
|
||||||
|
<template slot="title">
|
||||||
|
<ai-title title="活动详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
|
||||||
|
</template>
|
||||||
|
<template slot="content">
|
||||||
|
<ai-card :title="info.title">
|
||||||
|
<template #right>
|
||||||
|
<span style="color:#2266FF;cursor: pointer;font-size: 12px;" class="iconfont iconEdit" v-if="isEdit==false && info.status==0" @click="update">修改</span>
|
||||||
|
</template>
|
||||||
|
<template #content v-if="isEdit == false">
|
||||||
|
<ai-wrapper>
|
||||||
|
<ai-info-item label="投票说明" :value="info.votingInstructions"></ai-info-item>
|
||||||
|
<ai-info-item label="单位名称" :value="info.organizationName"></ai-info-item>
|
||||||
|
<ai-info-item label="选举方式">
|
||||||
|
{{ info.electionMethod==0? '等额':'差额'}}
|
||||||
|
<el-tooltip class="item" effect="dark" content="差额选举:候选人数多于应选人数的选举方式;
|
||||||
|
等额选举:候选人数与应选人数相等的选举方式。" placement="top">
|
||||||
|
<i class="el-icon-info" style="margin-right: 8px"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</ai-info-item>
|
||||||
|
<ai-info-item label="应选人数" :value="info.candidatesNumber"></ai-info-item>
|
||||||
|
<ai-info-item label="投票日期" :value="info.votingDate"></ai-info-item>
|
||||||
|
</ai-wrapper>
|
||||||
|
</template>
|
||||||
|
</ai-card>
|
||||||
|
<ai-card title="参会人员信息">
|
||||||
|
<template #content v-if="isEdit == false">
|
||||||
|
<ai-wrapper>
|
||||||
|
<ai-info-item label="候选人" isLine>
|
||||||
|
<span v-for="(item,index) in candidateUsersList" :key="index">
|
||||||
|
{{ item }}
|
||||||
|
<span v-if="index < candidateUsersList.length - 1">、</span>
|
||||||
|
</span>
|
||||||
|
</ai-info-item>
|
||||||
|
<ai-info-item label="投票人" isLine>
|
||||||
|
<span v-for="(item,index) in voteUsersList" :key="index">
|
||||||
|
{{ item }}
|
||||||
|
<span v-if="index < voteUsersList.length - 1">、</span>
|
||||||
|
</span>
|
||||||
|
</ai-info-item>
|
||||||
|
</ai-wrapper>
|
||||||
|
</template>
|
||||||
|
</ai-card>
|
||||||
|
</template>
|
||||||
|
</ai-detail>
|
||||||
|
<ai-detail v-show="!id || isEdit==true">
|
||||||
|
<ai-title slot="title" :title="id? '编辑活动':'创建活动'" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
|
||||||
|
<template slot="content">
|
||||||
|
<ai-card title="基本信息">
|
||||||
|
<template #content>
|
||||||
|
<div class="add-form">
|
||||||
|
<el-form ref="form" :model="form" :rules="formRules" size="small" label-width="150px">
|
||||||
|
|
||||||
|
<el-form-item label="活动名称" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="请输入" show-word-limit maxlength="100"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="活动说明">
|
||||||
|
<el-input type="textarea" :rows="5" v-model="form.votingInstructions" placeholder="请输入" show-word-limit maxlength="500"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="行政地区" prop="title">
|
||||||
|
<ai-area-get v-model="form.areaId" :root="areaRootId" :instance="instance" @select="handleAreaSelect"/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="地图位置" prop="title">
|
||||||
|
<el-button @click="showMap = true">地图标绘</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="打卡范围" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="请输入" >
|
||||||
|
<template slot="append">米</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="进场打卡时间" prop="title">
|
||||||
|
<el-date-picker v-model="form.value1" type="datetimerange" start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期" :default-time="['00:00:00']"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="进场得积分" prop="title">
|
||||||
|
<el-input v-model="form.title" type="number" placeholder="请输入" >
|
||||||
|
<template slot="append">积分</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="离场打卡时间" prop="title">
|
||||||
|
<el-date-picker v-model="form.value1" type="datetimerange" start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期" :default-time="['00:00:00']"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="离场得积分" prop="title">
|
||||||
|
<el-input v-model="form.title" type="number" placeholder="请输入" >
|
||||||
|
<template slot="append">积分</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ai-card>
|
||||||
|
</template>
|
||||||
|
<template #footer>
|
||||||
|
<el-button class="delete-btn footer-btn" @click="cancel(false)">取消</el-button>
|
||||||
|
<el-button class="footer-btn" type="primary" @click="confirm()">保存</el-button>
|
||||||
|
</template>
|
||||||
|
</ai-detail>
|
||||||
|
<ai-dialog title="地图" :visible.sync="showMap" @opened="getCorpLocation" width="800px" class="mapDialog" @onConfirm="selectMap">
|
||||||
|
<div id="map"></div>
|
||||||
|
<el-form label-width="80px" style="padding: 10px 20px 0 20px;">
|
||||||
|
<el-row type="flex" justify="space-between">
|
||||||
|
<el-form-item label="经度">
|
||||||
|
<el-input disabled size="small" v-model="placeDetail.lng"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="纬度">
|
||||||
|
<el-input disabled size="small" v-model="placeDetail.lat"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<el-input id="searchPlaceInput" size="medium" class="searchPlaceInput" clearable v-model="searchPlace" autocomplete="on" @change="placeSearch.search(searchPlace)" placeholder="请输入关键字">
|
||||||
|
<el-button type="primary" slot="append" @click="placeSearch.search(searchPlace)">搜索</el-button>
|
||||||
|
</el-input>
|
||||||
|
<div id="searchPlaceOutput" />
|
||||||
|
</ai-dialog>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState } from "vuex";
|
||||||
|
export default {
|
||||||
|
name: "activitiesAdd",
|
||||||
|
props: {
|
||||||
|
instance: Function,
|
||||||
|
dict: Object,
|
||||||
|
params: Object,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
let validCandidate = (rule, value, callback) => {
|
||||||
|
if (!value.length) {
|
||||||
|
return callback(new Error('请选择候选人'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let validVote = (rule, value, callback) => {
|
||||||
|
if (!value.length) {
|
||||||
|
return callback(new Error('请选择投票人'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
title: '',
|
||||||
|
votingInstructions: '',
|
||||||
|
organizationName: '',
|
||||||
|
electionMethod: '',
|
||||||
|
chooseNumber: '',
|
||||||
|
votingDate: '',
|
||||||
|
candidateUsers: [],
|
||||||
|
voteUsers: [],
|
||||||
|
partyOrganizations: [],
|
||||||
|
partyOrgId: ''
|
||||||
|
},
|
||||||
|
formRules: {
|
||||||
|
title: [{required: true, message: "请输入标题", trigger: "blur"}],
|
||||||
|
organizationName: [{required: true, message: "请选择党组织", trigger: "blur"}],
|
||||||
|
electionMethod: [{required: true, message: "请选择选举方式", trigger: "blur"}],
|
||||||
|
chooseNumber: [{required: true, message: "请输入应选人数", trigger: "blur"}],
|
||||||
|
votingDate: [{required: true, message: "请选择投票日期", trigger: "blur"}],
|
||||||
|
candidateUsers: [{required: true,validator: validCandidate, trigger: "blur"}],
|
||||||
|
voteUsers: [{required: true,validator: validVote, trigger: "blur"}],
|
||||||
|
},
|
||||||
|
id: '',
|
||||||
|
isEdit: false,
|
||||||
|
info: {},
|
||||||
|
candidateUsersList: '',
|
||||||
|
voteUsersList: '',
|
||||||
|
chooseCandidateList: [],
|
||||||
|
chooseVoteList: [],
|
||||||
|
areaRootId: '',
|
||||||
|
map: null,
|
||||||
|
placeDetail: {
|
||||||
|
lng: '',
|
||||||
|
lat: '',
|
||||||
|
},
|
||||||
|
showMap: false,
|
||||||
|
searchPlace: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if(this.params && this.params.id) {
|
||||||
|
this.id = this.params.id
|
||||||
|
this.getDetail()
|
||||||
|
}
|
||||||
|
this.areaRootId = [this.user.info.areaId.substr(0, 6), '000000'].join("")
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(['user'])
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
selectMap() {
|
||||||
|
this.formData.lng = this.placeDetail.lng
|
||||||
|
this.formData.lat = this.placeDetail.lat
|
||||||
|
this.showMap = false
|
||||||
|
},
|
||||||
|
getCorpLocation() {
|
||||||
|
this.instance.post('/app/appdvcpconfig/getCorpLocation').then((res) => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
this.initMap(res.data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
initMap({ lng, lat }) {
|
||||||
|
AMapLoader.load({
|
||||||
|
key: 'b553334ba34f7ac3cd09df9bc8b539dc',
|
||||||
|
version: '2.0',
|
||||||
|
plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete', 'AMap.Geocoder'],
|
||||||
|
}).then((AMap) => {
|
||||||
|
this.placeDetail.lng = this.formData.lng
|
||||||
|
this.placeDetail.lat = this.formData.lat
|
||||||
|
this.map = new AMap.Map('map', {
|
||||||
|
resizeEnable: true,
|
||||||
|
zooms: [6, 20],
|
||||||
|
center: [lng, lat],
|
||||||
|
zoom: 11,
|
||||||
|
})
|
||||||
|
this.placeSearch = new AMap.PlaceSearch({ map: this.map })
|
||||||
|
new AMap.AutoComplete({
|
||||||
|
input: 'searchPlaceInput',
|
||||||
|
output: 'searchPlaceOutput',
|
||||||
|
}).on('select', (e) => {
|
||||||
|
if (e?.poi) {
|
||||||
|
this.placeSearch.setCity(e.poi.adcode)
|
||||||
|
this.movePosition(e.poi.location)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.map.on('click', (e) => {
|
||||||
|
new AMap.Geocoder().getAddress(e.lnglat, (sta, res) => {
|
||||||
|
if (res?.regeocode) {
|
||||||
|
this.placeDetail = {
|
||||||
|
lng: e.lnglat?.lng,
|
||||||
|
lat: e.lnglat?.lat,
|
||||||
|
address: res.regeocode.formattedAddress,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.movePosition(e.lnglat)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
movePosition(center) {
|
||||||
|
if (this.map) {
|
||||||
|
this.map.clearMap()
|
||||||
|
this.map.panTo(center)
|
||||||
|
this.map.add([
|
||||||
|
new AMap.Marker({
|
||||||
|
position: center,
|
||||||
|
clickable: true,
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
this.map.setFitView()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
cancel (isRefresh) {
|
||||||
|
this.$emit('change', {
|
||||||
|
type: 'activitiesList',
|
||||||
|
isRefresh: !!isRefresh
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.isEdit = true
|
||||||
|
this.getDetail()
|
||||||
|
},
|
||||||
|
|
||||||
|
getDetail() {
|
||||||
|
this.instance.post(`/app/appgeneralelectioninfo/queryDetailById`,null, {
|
||||||
|
params: {id:this.id}
|
||||||
|
}).then((res) => {
|
||||||
|
if(res?.data) {
|
||||||
|
this.form = res.data
|
||||||
|
this.form.organizationName = res.data.partyOrganizations[0].name
|
||||||
|
this.info = res.data
|
||||||
|
this.candidateUsersList = res.data.candidateUsers.map(v=> v.name)
|
||||||
|
this.voteUsersList = res.data.voteUsers.map(v=> v.name)
|
||||||
|
this.chooseCandidateList = res.data.candidateUsers
|
||||||
|
this.chooseVoteList = res.data.voteUsers
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
selectCandidate(v) {
|
||||||
|
this.form.candidateUsers = v
|
||||||
|
},
|
||||||
|
selectVote(e) {
|
||||||
|
this.form.voteUsers = e
|
||||||
|
},
|
||||||
|
|
||||||
|
handleAreaSelect(v) {
|
||||||
|
this.form.areaName = v?.[0]?.label
|
||||||
|
},
|
||||||
|
|
||||||
|
confirm() {
|
||||||
|
this.$refs.form.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if(this.form.electionMethod == 0) {
|
||||||
|
if(this.form.chooseNumber != this.form.candidateUsers.length) {
|
||||||
|
return this.$message.error('候选人数与应选人数应相等')
|
||||||
|
}
|
||||||
|
} else if(this.form.electionMethod == 1) {
|
||||||
|
if(this.form.chooseNumber >= this.form.candidateUsers.length) {
|
||||||
|
return this.$message.error('候选人数应多于应选人数')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.instance.post(`/app/appgeneralelectioninfo/addOrUpdate`,{
|
||||||
|
...this.form
|
||||||
|
}).then(res => {
|
||||||
|
if(res.code == 0) {
|
||||||
|
this.$message.success(this.id ? '编辑成功' : '新增成功')
|
||||||
|
this.cancel(true)
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scope>
|
||||||
|
.activitiesAdd {
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
::v-deep .el-date-editor .el-input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #f82;
|
||||||
|
background-color: #fff3e9;
|
||||||
|
color: #f82;
|
||||||
|
padding: 8px 16px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .mapDialog {
|
||||||
|
.el-dialog__body {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.ai-dialog__content {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-dialog__content--wrapper {
|
||||||
|
padding: 0 !important;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
height: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchPlaceInput {
|
||||||
|
position: absolute;
|
||||||
|
width: 250px;
|
||||||
|
top: 30px;
|
||||||
|
left: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchPlaceOutput {
|
||||||
|
position: absolute;
|
||||||
|
width: 250px;
|
||||||
|
left: 25px;
|
||||||
|
height: initial;
|
||||||
|
top: 80px;
|
||||||
|
background: white;
|
||||||
|
z-index: 250;
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
|
.auto-item {
|
||||||
|
text-align: left;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
<template>
|
||||||
|
<section class="activitiesList">
|
||||||
|
<ai-list>
|
||||||
|
<ai-title slot="title" title="活动管理" isShowBottomBorder />
|
||||||
|
<template #content>
|
||||||
|
<ai-search-bar>
|
||||||
|
<template #left>
|
||||||
|
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')" >创建活动</el-button>
|
||||||
|
<!-- <ai-select v-model="search.status" @change=";(page.current = 1), getList()" placeholder="请选择状态" :selectList="dict.getDict('electionStatus')"></ai-select> -->
|
||||||
|
</template>
|
||||||
|
<!-- <template #right>
|
||||||
|
<el-input v-model="search.title" class="search-input" size="small" v-throttle="() => {(page.current = 1), getList()} " placeholder="标题" clearable @change="getList" @clear="page.current = 1, (search.title = ''), getList()" suffix-icon="iconfont iconSearch">
|
||||||
|
</el-input>
|
||||||
|
</template> -->
|
||||||
|
</ai-search-bar>
|
||||||
|
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size" @getList="getList" :col-configs="colConfigs" :dict="dict">
|
||||||
|
<el-table-column slot="options" label="操作" fixed="right" align="center">
|
||||||
|
<template slot-scope="{ row }">
|
||||||
|
<el-button type="text" @click.native="toAdd(row.id)">详情</el-button>
|
||||||
|
<el-button type="text" v-show="row.status!=2" :disabled="row.status==2" @click.native="startEnd(row.id, row.status)">{{row.status == 0? '开启':'结束'}}</el-button>
|
||||||
|
<!-- <el-button type="text" v-show="row.status != 0" @click.native="toStatistics(row.id)">统计</el-button> -->
|
||||||
|
<!-- <el-button type="text" @click.native="handleDelete(row.id)">删除</el-button> -->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</ai-table>
|
||||||
|
</template>
|
||||||
|
</ai-list>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'activitiesList',
|
||||||
|
props: {
|
||||||
|
instance: Function,
|
||||||
|
dict: Object
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
search: {
|
||||||
|
status: '', // 0、未开始;1、进行中;2、已结束
|
||||||
|
title: '',
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
tableData: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.$dict.load('electionStatus', 'electionMethod').then(()=> {
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
colConfigs() {
|
||||||
|
return [
|
||||||
|
{prop: "", label: "活动名称", align: "left", showOverflowTooltip: true},
|
||||||
|
{prop: "", label: "创建人", align: "center"},
|
||||||
|
{prop: "", label: "开始结束时间", align: "center",dict:"electionMethod"},
|
||||||
|
{prop: "", label: "活动状态", align: "center"},
|
||||||
|
{ slot: "options", },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
this.instance.post(`/app/appgeneralelectioninfo/list`,null,{
|
||||||
|
params: {
|
||||||
|
...this.page,
|
||||||
|
...this.search,
|
||||||
|
}
|
||||||
|
}).then(res=> {
|
||||||
|
if(res?.data) {
|
||||||
|
this.tableData = res.data.records
|
||||||
|
this.page.total = res.data.total
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toAdd(id) {
|
||||||
|
this.$emit('change', {
|
||||||
|
type: 'activitiesAdd',
|
||||||
|
params: {
|
||||||
|
id: id || '',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDelete(id) {
|
||||||
|
this.$confirm('确定删除该数据?').then(() => {
|
||||||
|
this.instance.post(`/app/appgeneralelectioninfo/delete?ids=${id}`).then(res=>{
|
||||||
|
if(res.code == 0) {
|
||||||
|
this.$message.success('删除成功!')
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.search = {
|
||||||
|
status: '',
|
||||||
|
title: '',
|
||||||
|
}
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
// 开启、结束
|
||||||
|
startEnd(id, status) {
|
||||||
|
let title = ''
|
||||||
|
let bool = null
|
||||||
|
let tips = ''
|
||||||
|
if(status == 0) {
|
||||||
|
title = '未到投票开始时间,确定要提前开始吗?'
|
||||||
|
bool = true
|
||||||
|
tips = '开启成功'
|
||||||
|
} else if(status == 1) {
|
||||||
|
title = '投票正在进行中,确定要提前结束吗?'
|
||||||
|
bool = false
|
||||||
|
tips = '结束成功'
|
||||||
|
}
|
||||||
|
this.$confirm(title).then(() => {
|
||||||
|
this.instance.post(`/app/appgeneralelectioninfo/start-end?id=${id}&start=${bool}`).then(res=>{
|
||||||
|
if(res.code == 0) {
|
||||||
|
this.$message.success(tips)
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 统计
|
||||||
|
toStatistics(id) {
|
||||||
|
this.$emit('change', {
|
||||||
|
type: 'Statistics',
|
||||||
|
params: {
|
||||||
|
id: id || '',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.activitiesList {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user