先提交一波整理的代码

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>
<section class="AppOrganizationChange">
<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>
</section>
</template>
<script>
import {mapState} from "vuex";
import addChange from "./components/addChange.vue";
import List from "./components/List.vue";
import organizationSetting from "./components/organizationSetting.vue";
@@ -23,6 +24,16 @@ export default {
addChange,
organizationSetting,
},
computed: {
...mapState(['user']),
currentPage() {
if (this.$route.hash == "#add") {
return addChange
} else if (this.$route.hash == "#setting") {
return organizationSetting
} else return List
}
},
data() {
return {
component: "List",
@@ -33,26 +44,7 @@ export default {
},
methods: {
onChange(data) {
if (data.type === "List") {
this.component = "List";
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() {

View File

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

View File

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

View File

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

View File

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

View File

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