diff --git a/project/pingchang/apps/AppGeneralElection/components/electionAdd.vue b/project/pingchang/apps/AppGeneralElection/components/electionAdd.vue index a8053e4f..edaf3e15 100644 --- a/project/pingchang/apps/AppGeneralElection/components/electionAdd.vue +++ b/project/pingchang/apps/AppGeneralElection/components/electionAdd.vue @@ -234,6 +234,15 @@ export default { 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 => { diff --git a/project/pingchang/apps/AppGeneralElection/components/electionList.vue b/project/pingchang/apps/AppGeneralElection/components/electionList.vue index faf2b651..3139fa2d 100644 --- a/project/pingchang/apps/AppGeneralElection/components/electionList.vue +++ b/project/pingchang/apps/AppGeneralElection/components/electionList.vue @@ -17,10 +17,9 @@ @@ -82,7 +81,7 @@ export default { } }) }, - toAdd(id,flag) { + toAdd(id) { this.$emit('change', { type: 'electionAdd', params: { @@ -107,12 +106,24 @@ export default { } this.getList() }, - // 结束 + // 开启、结束 startEnd(id, status) { - this.$confirm('投票正在进行中,确定要提前结束吗?').then(() => { - this.instance.post(`/app/appgeneralelectioninfo/start-end?id=${id}&start=${status}`).then(res=>{ + 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('结束成功') + this.$message.success(tips) this.getList() } })