先提交一波整理的代码

This commit is contained in:
aixianling
2022-10-21 11:53:29 +08:00
parent 1e59444e0e
commit bd41857962
6 changed files with 196 additions and 227 deletions

View File

@@ -1,12 +1,13 @@
<template> <template>
<section class="AppOrganizationChange"> <section class="AppOrganizationChange">
<keep-alive :include="['List']"> <keep-alive :include="['List']">
<component ref="component" :is="component" :instance="instance" :selected.sync="selected" :params="params" :dict="dict" @change="onChange"/> <component :is="currentPage" :instance="instance" :selected.sync="selected" :params="params" :dict="dict" @change="onChange"/>
</keep-alive> </keep-alive>
</section> </section>
</template> </template>
<script> <script>
import {mapState} from "vuex";
import addChange from "./components/addChange.vue"; import addChange from "./components/addChange.vue";
import List from "./components/List.vue"; import List from "./components/List.vue";
import organizationSetting from "./components/organizationSetting.vue"; import organizationSetting from "./components/organizationSetting.vue";
@@ -23,6 +24,16 @@ export default {
addChange, addChange,
organizationSetting, organizationSetting,
}, },
computed: {
...mapState(['user']),
currentPage() {
if (this.$route.hash == "#add") {
return addChange
} else if (this.$route.hash == "#setting") {
return organizationSetting
} else return List
}
},
data() { data() {
return { return {
component: "List", component: "List",
@@ -33,26 +44,7 @@ export default {
}, },
methods: { methods: {
onChange(data) { onChange(data) {
if (data.type === "List") {
this.component = "List";
this.params = data.params; this.params = data.params;
}
if (data.type === "organizationSetting") {
this.component = "organizationSetting";
this.params = data.params;
}
if (data.type === "addChange") {
this.component = "addChange";
this.params = data.params;
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList();
}
});
}
}, },
}, },
created() { created() {

View File

@@ -3,7 +3,7 @@
<template slot="title"> <template slot="title">
<ai-title title="组织换届" isShowBottomBorder> <ai-title title="组织换届" isShowBottomBorder>
<template slot="rightBtn"> <template slot="rightBtn">
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toSetting('')" >换届设置</el-button> <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toSetting('')">换届设置</el-button>
</template> </template>
</ai-title> </ai-title>
</template> </template>
@@ -19,21 +19,21 @@
</ai-tree-menu> </ai-tree-menu>
</template> </template>
<template slot="content" class="content"> <template slot="content" class="content">
<el-tabs v-model="currIndex" > <el-tabs v-model="currIndex">
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label"> <el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
<component :ref="tab.name" v-if="currIndex == String(i)" :is="tab.comp" lazy :instance="instance" :selected="selected" <component :ref="tab.name" v-if="currIndex == String(i)" :is="tab.comp" lazy :instance="instance" :selected="selected"
:dict="dict" :permissions="permissions" v-on="$listeners"/> :dict="dict" :permissions="permissions" v-on="$listeners"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div class="add_btn"> <div class="add_btn">
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')" >新增换届</el-button> <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">新增换届</el-button>
</div> </div>
</template> </template>
</ai-list> </ai-list>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
import moment from './moment.vue' import moment from './moment.vue'
import history from './history.vue' import history from './history.vue'
@@ -84,20 +84,10 @@ export default {
return data.name.indexOf(value) !== -1 return data.name.indexOf(value) !== -1
}, },
toAdd(id) { toAdd(id) {
this.$emit('change', { this.$router.push({hash: "#add", query: {id}})
type: 'addChange',
params: {
id: id || ''
}
})
}, },
toSetting(id) { toSetting(id) {
this.$emit('change', { this.$router.push({hash: "#setting", query: {id}})
type: 'organizationSetting',
params: {
id: id || ''
}
})
} }
} }
} }
@@ -147,9 +137,10 @@ export default {
width: 100%; width: 100%;
} }
} }
::v-deep .is-current>.el-tree-node__content{
width: 100%!important; ::v-deep .is-current > .el-tree-node__content {
padding-right: 16px!important; width: 100% !important;
padding-right: 16px !important;
} }
} }
</style> </style>

View File

@@ -1,30 +1,27 @@
<template> <template>
<section class="addChange"> <section class="addChange">
<ai-detail> <ai-detail>
<ai-title slot="title" title="新增换届" isShowBottomBorder isShowBack @onBackClick="cancel(false)" /> <ai-title slot="title" title="新增换届" isShowBottomBorder isShowBack @onBackClick="cancel(false)"/>
<template #content> <template #content>
<ai-card title="基本信息"> <ai-card title="基本信息">
<template #content> <template #content>
<div class="Form"> <div class="Form">
<el-form ref="form" :model="form" :rules="rules" label-width="100px" label-position="right"> <el-form ref="form" :model="form" :rules="rules" label-width="100px" label-position="right" size="small">
<el-row type="flex"> <el-row type="flex">
<el-col :span="12"> <el-form-item class="fill" label="换届时间" prop="changeTime">
<el-form-item label="换届时间" prop="changeTime">
<el-date-picker v-model="form.changeTime" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width:338px"> <el-date-picker v-model="form.changeTime" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width:338px">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> <el-form-item class="fill" label="届次" prop="sessionTime">
<el-col :span="12">
<el-form-item label="届次" prop="sessionTime">
<el-input size="small" :maxlength="30" placeholder="请输入届次" v-model="form.sessionTime"></el-input> <el-input size="small" :maxlength="30" placeholder="请输入届次" v-model="form.sessionTime"></el-input>
</el-form-item> </el-form-item>
</el-col>
</el-row> </el-row>
<ai-bar title="本届任职(必填)"> <ai-title title="本届任职(必填)">
<template slot="right"> <template slot="rightBtn">
<el-button size="small" type="text" icon="iconfont iconAdd" @click="form.serveList.push({name:null,position:null,type:0})" >添加任职人员</el-button> <el-button size="small" type="text" icon="iconfont iconAdd" @click="form.serveList.push({name:null,position:null,type:0})">添加任职人员
</el-button>
</template> </template>
</ai-bar> </ai-title>
<el-table :data="form.serveList" size="mini" border stripe> <el-table :data="form.serveList" size="mini" border stripe>
<el-table-column label="职位" align="center"> <el-table-column label="职位" align="center">
<template slot-scope="{row}"> <template slot-scope="{row}">
@@ -33,7 +30,7 @@
</el-table-column> </el-table-column>
<el-table-column label="姓名" align="center"> <el-table-column label="姓名" align="center">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-input class="tableInput" v-model="row.name" clearable placeholder="请输入姓名" /> <el-input class="tableInput" v-model="row.name" clearable placeholder="请输入姓名"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
@@ -43,11 +40,12 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form> </el-form>
<ai-bar title="本届候选人"> <ai-title class="mar-t8" title="本届候选人">
<template slot="right"> <template slot="rightBtn">
<el-button size="small" type="text" icon="iconfont iconAdd" @click="form.candidateList.push({name:null,position:null,type: 1})" >添加候选人</el-button> <el-button size="small" type="text" icon="iconfont iconAdd" @click="form.candidateList.push({name:null,position:null,type: 1})">添加候选人
</el-button>
</template> </template>
</ai-bar> </ai-title>
<el-table :data="form.candidateList" size="mini" border stripe> <el-table :data="form.candidateList" size="mini" border stripe>
<el-table-column label="职位" align="center"> <el-table-column label="职位" align="center">
<template slot-scope="{row}"> <template slot-scope="{row}">
@@ -56,7 +54,7 @@
</el-table-column> </el-table-column>
<el-table-column label="候选人" align="center"> <el-table-column label="候选人" align="center">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-input class="tableInput" v-model="row.name" clearable placeholder="请输入姓名" /> <el-input class="tableInput" v-model="row.name" clearable placeholder="请输入姓名"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
@@ -95,34 +93,31 @@ export default {
candidateList: [], // 候选人员列表 candidateList: [], // 候选人员列表
}, },
rules: { rules: {
changeTime: [{ required: true, message: '请选择换届时间', trigger: 'blur' }], changeTime: [{required: true, message: '请选择换届时间', trigger: 'blur'}],
sessionTime: [{ required: true, message: '请输入届次', trigger: 'blur' }], sessionTime: [{required: true, message: '请输入届次', trigger: 'blur'}],
}, },
} }
}, },
methods: { methods: {
cancel (isRefresh) { cancel() {
this.$emit('change', { this.$router.push({})
type: 'List',
isRefresh: !!isRefresh
})
}, },
handleDelete(i, type) { handleDelete(i, type) {
this.$confirm("确定要删除该数据?").then(() => { this.$confirm("确定要删除该数据?").then(() => {
if(type == 'candidateList') { if (type == 'candidateList') {
this.form.candidateList.splice(i, 1) this.form.candidateList.splice(i, 1)
} else if(type == 'serveList') { } else if (type == 'serveList') {
this.form.serveList.splice(i, 1) this.form.serveList.splice(i, 1)
} }
}).catch(() => 0) }).catch(() => 0)
}, },
confirm() { confirm() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if(valid) { if (valid) {
this.instance.post(`/app/apporganizationgeneralelection/add`, { this.instance.post(`/app/apporganizationgeneralelection/add`, {
...this.form ...this.form
}).then(res=>{ }).then(res => {
if(res.code == 0) { if (res.code == 0) {
this.$message.success('提交成功') this.$message.success('提交成功')
this.cancel(true) this.cancel(true)
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<ai-list class="history"> <section class="history">
<template slot="content">
<ai-search-bar> <ai-search-bar>
<template #left> <template #left>
<el-button type="primary" icon="iconfont iconEdit" @click="fillupAdd('')">补录</el-button> <el-button type="primary" icon="iconfont iconEdit" @click="fillupAdd('')">补录</el-button>
@@ -26,8 +26,7 @@
</template> </template>
</el-table-column> </el-table-column>
</ai-table> </ai-table>
</template> </section>
</ai-list>
</template> </template>
<script> <script>

View File

@@ -1,22 +1,21 @@
<template> <template>
<ai-list class="moment"> <section class="moment">
<template slot="content"> <ai-title title="总体概况" class="mar-b8">
<ai-bar title="总体概况"> <template slot="rightBtn">
<template slot="right"> <el-button size="small" type="text" icon="iconfont iconEdit" @click="toEdit('')">修改</el-button>
<el-button size="small" type="text" icon="iconfont iconEdit" @click="toEdit('')" >修改</el-button>
</template> </template>
</ai-bar> </ai-title>
<ai-wrapper> <ai-wrapper>
<ai-info-item label="本届换届时间" :value="111" /> <ai-info-item label="本届换届时间" :value="111"/>
<ai-info-item label="换届类型" :value="111" /> <ai-info-item label="换届类型" :value="111"/>
<ai-info-item label="下届换届时间" :value="111" /> <ai-info-item label="下届换届时间" :value="111"/>
<ai-info-item label="当前届次" :value="111" /> <ai-info-item label="当前届次" :value="111"/>
</ai-wrapper> </ai-wrapper>
<ai-bar title="本届任职"> <ai-title title="本届任职" class="mar-b8">
<template slot="right"> <template slot="rightBtn">
<el-button size="small" type="text" icon="iconfont iconAdd" @click="dialogJob=true" >添加任职人员</el-button> <el-button size="small" type="text" icon="iconfont iconAdd" @click="dialogJob=true">添加任职人员</el-button>
</template> </template>
</ai-bar> </ai-title>
<ai-table <ai-table
class="detail-table__table" class="detail-table__table"
:tableData="tableData" :tableData="tableData"
@@ -32,11 +31,11 @@
</template> </template>
</el-table-column> </el-table-column>
</ai-table> </ai-table>
<ai-bar title="本届候选人"> <ai-title title="本届候选人" class="mar-b8">
<template slot="right"> <template slot="rightBtn">
<el-button size="small" type="text" icon="iconfont iconAdd" @click="dialogCandidate = true" >添加候选人</el-button> <el-button size="small" type="text" icon="iconfont iconAdd" @click="dialogCandidate = true">添加候选人</el-button>
</template> </template>
</ai-bar> </ai-title>
<ai-table <ai-table
class="detail-table__table" class="detail-table__table"
:tableData="tableData" :tableData="tableData"
@@ -62,7 +61,6 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</ai-dialog> </ai-dialog>
<ai-dialog :visible.sync="dialogCandidate" title="添加本届候选人" width="720px" @closed="CandFrom={}" @onConfirm="handleCandForm"> <ai-dialog :visible.sync="dialogCandidate" title="添加本届候选人" width="720px" @closed="CandFrom={}" @onConfirm="handleCandForm">
<el-form ref="CandFrom" size="small" :model="CandFrom" :rules="candRules" label-width="80px"> <el-form ref="CandFrom" size="small" :model="CandFrom" :rules="candRules" label-width="80px">
<el-form-item label="职位" prop="job"> <el-form-item label="职位" prop="job">
@@ -73,10 +71,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</ai-dialog> </ai-dialog>
</template> </section>
</ai-list>
</template> </template>
<script> <script>
@@ -132,26 +127,26 @@ export default {
this.getList(this.selected.id) this.getList(this.selected.id)
}, },
methods: { methods: {
jobEdit() {}, jobEdit() {
jobDelete() {}, },
getJobList() {}, jobDelete() {
},
getJobList() {
},
toEdit(id) { toEdit(id) {
this.$emit('change', { this.$router.push({hash: "#add", query: {id}})
type: 'addChange',
params: {
id: id || ''
}
})
}, },
getList(id) { getList(id) {
this.instance.post(`/app/apporganizationgeneralelection/queryDetailByOrganizationId?organizationId=${id}`).then(res=>{ this.instance.post(`/app/apporganizationgeneralelection/queryDetailByOrganizationId?organizationId=${id}`).then(res => {
if(res?.data) { if (res?.data) {
console.log(res,'111'); console.log(res, '111');
} }
}) })
}, },
handleJobForm() {}, handleJobForm() {
handleCandForm() {}, },
handleCandForm() {
},
} }
} }
</script> </script>

View File

@@ -96,13 +96,13 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { export default {
name: "organizationSetting", name: "organizationSetting",
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
params: Object,
}, },
data() { data() {
@@ -124,7 +124,7 @@ export default {
formRules: { formRules: {
type: [{required: true, message: "请选择选举方式", trigger: "blur"}], type: [{required: true, message: "请选择选举方式", trigger: "blur"}],
organizationName: [{required: true, message: "请选择党组织", trigger: "blur"}], organizationName: [{required: true, message: "请选择党组织", trigger: "blur"}],
userList: [{required: true,validator: validUser, trigger: "blur"}], userList: [{required: true, validator: validUser, trigger: "blur"}],
}, },
chooseUserList: [], chooseUserList: [],
createTime: '', createTime: '',
@@ -138,24 +138,21 @@ export default {
this.getOrganization() this.getOrganization()
}, },
methods: { methods: {
cancel (isRefresh) { cancel() {
this.$emit('change', { this.$router.back()
type: 'List',
isRefresh: !!isRefresh
})
}, },
// 查询组织关系 // 查询组织关系
getOrganization() { getOrganization() {
this.instance.post(`/app/partyOrganization/queryPartyOrganizationServiceList`).then(res=>{ this.instance.post(`/app/partyOrganization/queryPartyOrganizationServiceList`).then(res => {
if(res?.data) { if (res?.data) {
let data = res.data.filter(item=>item.id == this.user.info.organizationId) let data = res.data.filter(item => item.id == this.user.info.organizationId)
this.createTime = data[0].createTime this.createTime = data[0].createTime
} }
}) })
}, },
getDetail() { getDetail() {
this.instance.post(`/app/apporganizationchangeconfig/queryDetailByOrganizationId?organizationId=${this.user.info.organizationId}`).then((res) => { this.instance.post(`/app/apporganizationchangeconfig/queryDetailByOrganizationId?organizationId=${this.user.info.organizationId}`).then((res) => {
if(res?.data) { if (res?.data) {
// this.chooseCandidateList = res.data.candidateUsers // this.chooseCandidateList = res.data.candidateUsers
// this.chooseVoteList = res.data.voteUsers // this.chooseVoteList = res.data.voteUsers
console.log(res); console.log(res);
@@ -169,7 +166,7 @@ export default {
this.form.voteUsers = e this.form.voteUsers = e
}, },
handlePartyOrgSelect(v) { handlePartyOrgSelect(v) {
if(v) { if (v) {
this.form.organizationId = v[0]?.id this.form.organizationId = v[0]?.id
this.form.organizationName = v[0]?.name this.form.organizationName = v[0]?.name
@@ -179,10 +176,10 @@ export default {
// 换届设置 // 换届设置
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.instance.post(`/app/apporganizationchangeconfig/update`,{ this.instance.post(`/app/apporganizationchangeconfig/update`, {
...this.form ...this.form
}).then(res => { }).then(res => {
if(res.code == 0) { if (res.code == 0) {
this.$message.success('提交成功') this.$message.success('提交成功')
this.cancel(true) this.cancel(true)
} }