This commit is contained in:
shijingjing
2022-10-17 15:59:19 +08:00
parent 7691c392e4
commit 026fd37a22
2 changed files with 81 additions and 39 deletions

View File

@@ -1,7 +1,41 @@
<template>
<section class="electionAdd">
<ai-detail>
<ai-title slot="title" title="添加换届选举" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
<ai-detail class="add" v-if="id && !isEdit">
<template slot="title">
<ai-title title="换届选举详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #right>
<span style="color:#2266FF;cursor: pointer;font-size: 12px;" class="iconfont iconEdit" v-if="isEdit==false" @click="edit">修改</span>
</template>
<template #content v-if="isEdit == false">
<ai-wrapper>
<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.organizationName"></ai-info-item>
<ai-info-item label="选举方式" :value="info.electionMethod"></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="候选人" 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 :value="info.voteUsers">
<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-else>
<ai-title slot="title" :title="id? '编辑换届选举':'添加换届选举'" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
<template slot="content">
<ai-card title="基本信息">
<template #content>
@@ -80,31 +114,7 @@
<el-button class="footer-btn" type="primary" @click="confirm()">保存</el-button>
</template>
</ai-detail>
<!-- <ai-detail class="add" v-if="id && !isEdit">
<template slot="title">
<ai-title title="行政许可信息详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #right>
<span style="color:#2266FF;cursor: pointer;font-size: 12px;" class="iconfont iconEdit" v-if="isEdit==false" @click="edit">修改</span>
</template>
<template #content v-if="isEdit == false">
<ai-wrapper>
<ai-info-item label="许可文书名称" :value="data.licenseName"></ai-info-item>
<ai-info-item label="许可文书号" :value="data.licenseCode"></ai-info-item>
<ai-info-item label="许可决定日期" :value="data.decisionDate"></ai-info-item>
<ai-info-item label="许可有效期自" :value="data.startDate"></ai-info-item>
<ai-info-item label="许可有效期至" :value="data.endDate"></ai-info-item>
<ai-info-item label="许可机关" isLine :value="data.licenseOrganization"></ai-info-item>
<ai-info-item label="经营主体" isLine :value="data.enterpriseName"></ai-info-item>
<ai-info-item label="统一信用代码" isLine :value="data.unifiedCode"></ai-info-item>
<ai-info-item label="许可内容" isLine :value="data.licenseContent"></ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail> -->
</section>
</template>
@@ -114,7 +124,9 @@ export default {
props: {
instance: Function,
dict: Object,
params: Object,
},
data() {
let validCandidate = (rule, value, callback) => {
if (!value.length) {
@@ -154,10 +166,20 @@ export default {
},
id: '',
isEdit: false,
info: {},
candidateUsersList: '',
voteUsersList: '',
}
},
computed: {
},
created() {
if(this.params && this.params.id) {
this.id = this.params.id
this.isEdit = this.params.isEdit
this.getDetail()
}
},
methods: {
cancel (isRefresh) {
this.$emit('change', {
@@ -165,6 +187,20 @@ export default {
isRefresh: !!isRefresh
})
},
getDetail() {
this.instance.post(`/app/appgeneralelectioninfo/queryDetailById`,null, {
params: {id:this.id}
}).then((res) => {
if(res?.data) {
// console.log(res.data);
this.form = res.data,
this.info = res.data
this.candidateUsersList = res.data.candidateUsers.map(v=> v.name)
this.voteUsersList = res.data.voteUsers.map(v=> v.name)
}
})
},
edit() {},
selectCandidate(v) {
this.form.candidateUsers = v
},
@@ -173,9 +209,11 @@ export default {
},
handlePartyOrgSelect(v) {
if(v) {
// console.log(v);
this.form.organizationName = v[0].name
this.form.partyOrganizations = [v[0]]
} else {
this.form.organizationName = this.chooseUserList[0].name
this.form.partyOrganizations = this.chooseUserList
}
},
confirm() {
@@ -185,7 +223,11 @@ export default {
...this.form
}).then(res => {
if(res.code == 0) {
this.$message.success('新增成功')
if(this.id) {
this.$message.success('编辑成功')
} else {
this.$message.success('新增成功')
}
this.cancel(false)
}
}).catch((err) => {

View File

@@ -5,7 +5,7 @@
<template #content>
<ai-search-bar>
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')" >添加</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>
</template>
<template #right>
@@ -18,8 +18,8 @@
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{ row }">
<!-- show-overflow-tooltip -->
<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" @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="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
@@ -57,11 +57,11 @@ export default {
computed: {
colConfigs() {
return [
{prop: "", label: "标题", align: "left", showOverflowTooltip: true},
{prop: "", label: "所属支部", align: "center"},
{prop: "", label: "选举方式", align: "center"},
{prop: "", label: "应选人数", align: "center"},
{prop: "", label: "状态", align: "center",width: "180px"},
{prop: "title", label: "标题", align: "left", showOverflowTooltip: true},
{prop: "organizationName", label: "所属支部", align: "center"},
{prop: "electionMethod", label: "选举方式", align: "center"},
{prop: "chooseNumber", label: "应选人数", align: "center"},
{prop: "status", label: "状态", align: "center",width: "180px"},
{ slot: "options", },
]
}
@@ -75,17 +75,17 @@ export default {
}
}).then(res=> {
if(res?.data) {
// console.log(res);
this.tableData = res.data.records
this.total.total = res.data.total
}
})
},
toAdd(id) {
toAdd(id,flag) {
this.$emit('change', {
type: 'electionAdd',
params: {
id: id || '',
isEdit: flag
}
})
},