This commit is contained in:
shijingjing
2022-10-17 16:56:42 +08:00
parent 34694492b9
commit f1b35354dc
2 changed files with 43 additions and 29 deletions

View File

@@ -7,26 +7,28 @@
<template slot="content"> <template slot="content">
<ai-card title="基本信息"> <ai-card title="基本信息">
<template #right> <template #right>
<span style="color:#2266FF;cursor: pointer;font-size: 12px;" class="iconfont iconEdit" v-if="isEdit==false" @click="edit">修改</span> <span style="color:#2266FF;cursor: pointer;font-size: 12px;" class="iconfont iconEdit" v-if="isEdit==false" @click="isEdit = true">修改</span>
</template> </template>
<template #content v-if="isEdit == false"> <template #content v-if="isEdit == false">
<ai-wrapper> <ai-wrapper>
<ai-info-item label="标题" :value="info.title"></ai-info-item> <ai-info-item label="标题" :value="info.title"></ai-info-item>
<ai-info-item label="投票说明" :value="info.votingInstructions"></ai-info-item> <ai-info-item label="投票说明" :value="info.votingInstructions"></ai-info-item>
<ai-info-item label="单位名称" :value="info.organizationName"></ai-info-item> <ai-info-item label="单位名称" :value="info.organizationName"></ai-info-item>
<ai-info-item label="选举方式" :value="info.electionMethod"></ai-info-item> <ai-info-item label="选举方式">
{{ info.electionMethod==0? '等额':'差额'}}
</ai-info-item>
<ai-info-item label="应选人数" :value="info.candidatesNumber"></ai-info-item> <ai-info-item label="应选人数" :value="info.candidatesNumber"></ai-info-item>
<ai-info-item label="投票日期" :value="info.votingDate"></ai-info-item> <ai-info-item label="投票日期" :value="info.votingDate"></ai-info-item>
<ai-info-item label="候选人" isLine> <ai-info-item label="候选人" isLine>
<span v-for="(item,index) in candidateUsersList" :key="index"> <span v-for="(item,index) in candidateUsersList" :key="index">
{{ item }} {{ item }}
<span v-if="index < candidateUsersList.length - 1">,</span> <span v-if="index < candidateUsersList.length - 1"></span>
</span> </span>
</ai-info-item> </ai-info-item>
<ai-info-item label="投票人" isLine :value="info.voteUsers"> <ai-info-item label="投票人" isLine :value="info.voteUsers">
<span v-for="(item,index) in voteUsersList" :key="index"> <span v-for="(item,index) in voteUsersList" :key="index">
{{ item }} {{ item }}
<span v-if="index < voteUsersList.length - 1">,</span> <span v-if="index < voteUsersList.length - 1"></span>
</span> </span>
</ai-info-item> </ai-info-item>
</ai-wrapper> </ai-wrapper>
@@ -34,7 +36,7 @@
</ai-card> </ai-card>
</template> </template>
</ai-detail> </ai-detail>
<ai-detail v-else> <ai-detail v-if="!id || isEdit">
<ai-title slot="title" :title="id? '编辑换届选举':'添加换届选举'" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/> <ai-title slot="title" :title="id? '编辑换届选举':'添加换届选举'" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
<template slot="content"> <template slot="content">
<ai-card title="基本信息"> <ai-card title="基本信息">
@@ -64,14 +66,14 @@
<i class="el-icon-info" style="margin-right: 8px"></i> <i class="el-icon-info" style="margin-right: 8px"></i>
</el-tooltip> </el-tooltip>
<el-radio v-model="form.electionMethod" label="1">等额</el-radio> <el-radio v-model="form.electionMethod" label="0">等额</el-radio>
<el-radio v-model="form.electionMethod" label="2">差额</el-radio> <el-radio v-model="form.electionMethod" label="1">差额</el-radio>
</el-form-item> </el-form-item>
<el-row type="flex"> <el-row type="flex">
<el-col :span="20"> <el-col :span="20">
<el-form-item label="应选人数" prop="candidatesNumber"> <el-form-item label="应选人数" prop="chooseNumber">
<el-input type="number" v-model="form.candidatesNumber" placeholder="请输入"></el-input> <el-input type="number" v-model="form.chooseNumber" placeholder="请输入"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="20"> <el-col :span="20">
@@ -89,7 +91,7 @@
<template name="option" v-slot:option="{ item }"> <template name="option" v-slot:option="{ item }">
<span class="iconfont iconProlife">{{ item.name }}</span> <span class="iconfont iconProlife">{{ item.name }}</span>
<span>{{ item.phone }}</span> <span>{{ item.phone }}</span>
<!-- <span>{{ item}}</span> --> <span>{{ item}}</span>
</template> </template>
</ai-person-select> </ai-person-select>
</el-form-item> </el-form-item>
@@ -148,7 +150,7 @@ export default {
votingInstructions: '', votingInstructions: '',
organizationName: '', organizationName: '',
electionMethod: '', electionMethod: '',
candidatesNumber: '', chooseNumber: '',
votingDate: '', votingDate: '',
candidateUsers: [], candidateUsers: [],
voteUsers: [], voteUsers: [],
@@ -159,7 +161,7 @@ export default {
title: [{required: true, message: "请输入标题", trigger: "blur"}], title: [{required: true, message: "请输入标题", trigger: "blur"}],
organizationName: [{required: true, message: "请选择党组织", trigger: "blur"}], organizationName: [{required: true, message: "请选择党组织", trigger: "blur"}],
electionMethod: [{required: true, message: "请选择选举方式", trigger: "blur"}], electionMethod: [{required: true, message: "请选择选举方式", trigger: "blur"}],
candidatesNumber: [{required: true, message: "请输入应选人数", trigger: "blur"}], chooseNumber: [{required: true, message: "请输入应选人数", trigger: "blur"}],
votingDate: [{required: true, message: "请选择投票日期", trigger: "blur"}], votingDate: [{required: true, message: "请选择投票日期", trigger: "blur"}],
candidateUsers: [{required: true,validator: validCandidate, trigger: "blur"}], candidateUsers: [{required: true,validator: validCandidate, trigger: "blur"}],
voteUsers: [{required: true,validator: validVote, trigger: "blur"}], voteUsers: [{required: true,validator: validVote, trigger: "blur"}],
@@ -192,15 +194,15 @@ export default {
params: {id:this.id} params: {id:this.id}
}).then((res) => { }).then((res) => {
if(res?.data) { if(res?.data) {
// console.log(res.data); console.log(res.data,'getDetail');
this.form = res.data, this.form = res.data
this.form.organizationName = res.data.partyOrganizations[0].name
this.info = res.data this.info = res.data
this.candidateUsersList = res.data.candidateUsers.map(v=> v.name) this.candidateUsersList = res.data.candidateUsers.map(v=> v.name)
this.voteUsersList = res.data.voteUsers.map(v=> v.name) this.voteUsersList = res.data.voteUsers.map(v=> v.name)
} }
}) })
}, },
edit() {},
selectCandidate(v) { selectCandidate(v) {
this.form.candidateUsers = v this.form.candidateUsers = v
}, },
@@ -223,12 +225,8 @@ export default {
...this.form ...this.form
}).then(res => { }).then(res => {
if(res.code == 0) { if(res.code == 0) {
if(this.id) { this.$message.success(this.id ? '编辑成功' : '新增成功')
this.$message.success('编辑成功') this.cancel(true)
} else {
this.$message.success('新增成功')
}
this.cancel(false)
} }
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);

View File

@@ -6,10 +6,10 @@
<ai-search-bar> <ai-search-bar>
<template #left> <template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('', false)" >添加</el-button> <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('', false)" >添加</el-button>
<ai-select v-model="search.status" @change=";(page.current = 1), getList()" placeholder="请选择状态" :selectList="dict.getDict('cwpStatus')"></ai-select> <ai-select v-model="search.status" @change=";(page.current = 1), getList()" placeholder="请选择状态" :selectList="dict.getDict('electionStatus')"></ai-select>
</template> </template>
<template #right> <template #right>
<el-input v-model="search.groupName" 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 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> </el-input>
<el-button size="small" type="primary" icon="el-icon-refresh-right" @click="reset" >重置</el-button> <el-button size="small" type="primary" icon="el-icon-refresh-right" @click="reset" >重置</el-button>
</template> </template>
@@ -17,7 +17,6 @@
<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 }">
<!-- show-overflow-tooltip -->
<el-button type="text" @click.native="toAdd(row.id, true)">编辑</el-button> <el-button type="text" @click.native="toAdd(row.id, true)">编辑</el-button>
<el-button type="text" @click.native="toAdd(row.id, false)">详情</el-button> <el-button type="text" @click.native="toAdd(row.id, false)">详情</el-button>
<el-button type="text" @click.native="handleDelete(row.id)">删除</el-button> <el-button type="text" @click.native="handleDelete(row.id)">删除</el-button>
@@ -51,15 +50,16 @@ export default {
} }
}, },
created () { created () {
this.dict.load('yesOrNo', 'partyFourLinkageStatus') this.$dict.load('electionStatus', 'partyFourLinkageStatus').then(()=> {
this.getList() this.getList()
})
}, },
computed: { computed: {
colConfigs() { colConfigs() {
return [ return [
{prop: "title", label: "标题", align: "left", showOverflowTooltip: true}, {prop: "title", label: "标题", align: "left", showOverflowTooltip: true},
{prop: "organizationName", label: "所属支部", align: "center"}, {prop: "organizationName", label: "所属支部", align: "center"},
{prop: "electionMethod", label: "选举方式", align: "center"}, {prop: "electionMethod", label: "选举方式", align: "center",formart: v => v==0? '等额':'差额'},
{prop: "chooseNumber", label: "应选人数", align: "center"}, {prop: "chooseNumber", label: "应选人数", align: "center"},
{prop: "status", label: "状态", align: "center",width: "180px"}, {prop: "status", label: "状态", align: "center",width: "180px"},
{ slot: "options", }, { slot: "options", },
@@ -76,7 +76,7 @@ export default {
}).then(res=> { }).then(res=> {
if(res?.data) { if(res?.data) {
this.tableData = res.data.records this.tableData = res.data.records
this.total.total = res.data.total this.page.total = res.data.total
} }
}) })
}, },
@@ -89,7 +89,23 @@ export default {
} }
}) })
}, },
reset() {}, 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()
},
} }
} }
</script> </script>