换届选举
This commit is contained in:
		| @@ -234,6 +234,15 @@ export default { | |||||||
|     confirm() { |     confirm() { | ||||||
|       this.$refs.form.validate((valid) => { |       this.$refs.form.validate((valid) => { | ||||||
|           if (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.instance.post(`/app/appgeneralelectioninfo/addOrUpdate`,{ | ||||||
|               ...this.form |               ...this.form | ||||||
|             }).then(res => { |             }).then(res => { | ||||||
|   | |||||||
| @@ -17,10 +17,9 @@ | |||||||
|         <ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size" @getList="getList" :col-configs="colConfigs" :dict="dict"> |         <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"> |           <el-table-column slot="options" label="操作" fixed="right" align="center"> | ||||||
|             <template slot-scope="{ row }"> |             <template slot-scope="{ row }"> | ||||||
|               <!-- <el-button v-show="row.status==0" type="text" @click.native="toAdd(row.id, true)">编辑</el-button> --> |  | ||||||
|               <el-button type="text" @click.native="toAdd(row.id)">详情</el-button> |               <el-button type="text" @click.native="toAdd(row.id)">详情</el-button> | ||||||
|               <el-button type="text" :disabled="row.status==2" @click.native="startEnd(row.id, false)">结束</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" @click.native="toStatistics(row.id)">统计</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> |               <el-button type="text" @click.native="handleDelete(row.id)">删除</el-button> | ||||||
|             </template> |             </template> | ||||||
|           </el-table-column> |           </el-table-column> | ||||||
| @@ -82,7 +81,7 @@ export default { | |||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|     toAdd(id,flag) { |     toAdd(id) { | ||||||
|       this.$emit('change', { |       this.$emit('change', { | ||||||
|         type: 'electionAdd', |         type: 'electionAdd', | ||||||
|         params: { |         params: { | ||||||
| @@ -107,12 +106,24 @@ export default { | |||||||
|       } |       } | ||||||
|       this.getList() |       this.getList() | ||||||
|     }, |     }, | ||||||
|     // 结束 |     // 开启、结束 | ||||||
|     startEnd(id, status) { |     startEnd(id, status) { | ||||||
|       this.$confirm('投票正在进行中,确定要提前结束吗?').then(() => { |       let title = '' | ||||||
|         this.instance.post(`/app/appgeneralelectioninfo/start-end?id=${id}&start=${status}`).then(res=>{ |       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) { |           if(res.code == 0) { | ||||||
|             this.$message.success('结束成功') |             this.$message.success(tips) | ||||||
|             this.getList() |             this.getList() | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user