This commit is contained in:
liuye
2023-11-20 10:25:54 +08:00
parent 688437a068
commit a784c2c9b4
13 changed files with 1958 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
<template>
<ai-detail list class="List">
<template slot="title">
<ai-title title="组织换届" isShowBottomBorder>
<template #rightBtn>
<el-button size="small" type="primary" @click="toAdd(selected.id)" v-if="hasConfig&&permissions('app_apporganizationchangeconfig')">换届设置
</el-button>
</template>
</ai-title>
</template>
<el-row slot="content" type="flex">
<ai-tree-menu title="组织目录" searchPlaceholder="请输入组织名称" @search="onSearch">
<ai-party-tree
:filter-node-method="filterNode"
ref="tree"
:instance="instance"
:root="user.info.organizationId"
:current-node-key="selected.id"
@select="onTreeChange"/>
</ai-tree-menu>
<el-scrollbar class="fill mar-l16 mainContent">
<ai-card title="当前届次">
<moment slot="content" :selected="selected" v-on="$listeners" :hasConfig.sync="hasConfig"/>
</ai-card>
<ai-card title="历史届次" v-if="hasConfig">
<history slot="content" :selected="selected" v-on="$listeners"/>
</ai-card>
</el-scrollbar>
</el-row>
</ai-detail>
</template>
<script>
import {mapState} from 'vuex'
import moment from './moment.vue'
import history from './history.vue'
export default {
name: 'List',
inject: ['permissions', 'instance', 'dict'],
data() {
return {
tabs: [
{label: '当前届次', name: 'moment', comp: moment, permission: ''},
{label: '历史届次', name: 'history', comp: history, permission: ''}
],
currIndex: '0',
selected: null,
hasConfig: false
}
},
components: {
moment,
history,
},
computed: {
...mapState(['user']),
},
methods: {
onTreeChange(e) {
this.selected = e
},
onSearch(v) {
this.$refs.tree?.$refs?.partyTree?.filter(v)
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
toAdd(oid) {
this.$router.push({hash: "#add", query: {oid}})
},
},
created() {
const {organizationId: id, organizationName: name} = this.user.info
this.selected = {id, name}
}
}
</script>
<style lang="scss" scoped>
.List {
position: relative;
:deep(.ai-detail__content--wrapper ){
height: 100%;
& > * {
height: inherit;
}
.mainContent {
.el-scrollbar__wrap {
overflow-x: hidden;
}
}
.AiTreeMenu {
min-width: 300px;
box-shadow: 0 4px 6px -2px rgb(15 15 21 / 15%);
}
}
:deep( .is-current > .el-tree-node__content ){
width: 100% !important;
padding-right: 16px !important;
}
}
</style>

View File

@@ -0,0 +1,157 @@
<template>
<section class="detailPanel">
<ai-title :title="`本届任职${!disabled?'(必填)':''}`">
<template #rightBtn v-if="!disabled">
<el-button type="text" icon="iconfont iconAdd" @click="showDialog({type:0})">添加任职人员</el-button>
</template>
</ai-title>
<el-table :data="serveList" border size="small">
<el-table-column label="职位" width="180px" prop="position"/>
<el-table-column label="姓名" prop="name"/>
<el-table-column label="操作" width="200px" align="center" v-if="!disabled">
<div slot-scope="{row,$index}" class="table-operation">
<el-button type="text" @click="showDialog(row,$index)">编辑</el-button>
<el-button type="text" @click="deleteItem($index,0)">删除</el-button>
</div>
</el-table-column>
</el-table>
<ai-title title="本届候选人">
<template #rightBtn v-if="!disabled">
<el-button type="text" icon="iconfont iconAdd" @click="showDialog({type:1})">添加候选人</el-button>
</template>
</ai-title>
<el-table :data="candidateList" border size="small">
<el-table-column label="职位" width="180px" prop="position"/>
<el-table-column label="候选人" prop="name"/>
<el-table-column label="操作" width="200px" align="center" v-if="!disabled">
<div slot-scope="{row,$index}" class="table-operation">
<el-button type="text" @click="showDialog(row,$index)">编辑</el-button>
<el-button type="text" @click="deleteItem($index,1)">删除</el-button>
</div>
</el-table-column>
</el-table>
<ai-dialog :visible.sync="visible" width="520px" :title="dialog.title" class="editStyle"
@closed="dialog={}" @onConfirm="submitAdd">
<el-form ref="editListItemForm" size="small" :model="dialog" :rules="rules" label-width="100px"
:validate-on-rule-change="false">
<el-form-item label="职位:" prop="position">
<el-input v-model="dialog.position" placeholder="请输入..."/>
</el-form-item>
<el-form-item :label="currentList.name+''" prop="name">
<el-input v-if="dialog.type==0" v-model="dialog.name" placeholder="请输入..."/>
<div v-else>
<el-input type="textarea" :rows="3" v-model="dialog.name" placeholder="请输入..."/>
<span style="color:#999;font-size: 12px">输入候选人姓名用空格隔开</span>
</div>
</el-form-item>
</el-form>
</ai-dialog>
</section>
</template>
<script>
export default {
name: "detailPanel",
props: {
candidateList: {default: () => []},
serveList: {default: () => []},
disabled: Boolean
},
data() {
return {
visible: false,
dialog: {
title: "",
name: "",
changeTime: ""
}
}
},
computed: {
currentList() {
let initData = {
0: {name: "姓名", dialogTitle: "本届任职人", list: "serveList"},
1: {name: "候选人", dialogTitle: "本届候选人", list: "candidateList"}
}
return initData[this.dialog.type || 0]
},
rules() {
return {
name: [{required: true, message: "请输入" + this.currentList.name, trigger: "change"}],
position: [{required: true, message: "请输入职位", trigger: "change"}],
}
},
},
methods: {
showDialog(v, rowIndex) {
this.dialog = {...this.dialog, ...v, rowIndex}
this.dialog.title = (this.dialog.rowIndex == 0 ? "编辑" : "添加") + this.currentList.dialogTitle
this.visible = true
},
submitAdd() {
this.$refs.editListItemForm.validate(v => {
if (v) {
this.handleData(this.currentList.list, list => {
if (this.dialog.rowIndex > -1) {
list.splice(this.dialog.rowIndex, 1, this.dialog)
} else list.push(this.dialog)
})
this.visible = false
}
})
},
handleData(prop, cb) {
const list = this.$copy(this.$props[prop]) || []
cb(list)
this.$emit("update:" + prop, list)
},
deleteItem(index, type) {
this.$confirm(`是否要删除该${type == 0 ? '本届任职人' : '本届候选人'}`, {type: "error"}).then(() => {
this.handleData(type == 0 ? "serveList" : "candidateList", list => {
list.splice(index, 1)
})
}).catch(() => {
})
}
}
}
</script>
<style lang="scss" scoped>
.detailPanel {
.itemTitle + .el-table {
margin-top: 16px;
}
.el-table + .itemTitle {
margin-top: 24px;
}
:deep( .table-header ){
box-sizing: border-box;
border-right: 1px solid #d0d4dc !important;
.cell {
padding-left: 32px;
}
&.is-center > .cell {
padding-left: 10px !important;
}
}
:deep( .table-cell ){
height: 44px;
color: #333;
.cell {
padding-left: 32px;
}
&.is-center > .cell {
padding-left: 10px !important;
}
}
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<section class="history">
<ai-search-bar>
<template #left>
<el-button type="primary" icon="iconfont iconEdit" @click="$router.push({hash:'#makeup',query:{oid}})">补录</el-button>
</template>
<template #right>
<el-input size="small" placeholder="请输入届次" v-model="search.sessionTime" clearable @change="getList"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :col-configs="colConfigs" :isShowPagination="false" @getList="getList">
<el-table-column slot="options" label="操作" align="center">
<template slot-scope="{ row }">
<el-button type="text" @click="handleEdit(row.id)">编辑</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</section>
</template>
<script>
export default {
name: "history",
inject: {
permissions: {},
instance: {},
dict: {}
},
data() {
return {
search: {sessionTime: null},
tableData: []
}
},
computed: {
colConfigs() {
return [
{prop: 'sessionTime', label: '届次', align: 'left'},
{prop: 'changeTime', label: '换届日期', align: 'center'},
{prop: 'createTime', label: '操作时间', align: 'center'},
{prop: 'createUserName', label: '操作人', align: 'center'},
{slot: 'options'},
]
},
oid: v => v.$attrs.selected.id
},
watch: {
oid: {
immediate: true,
handler() {
this.search.sessionTime = null
this.getList()
}
}
},
methods: {
handleEdit(id) {
this.$router.push({hash: "#makeup", query: {id}})
},
handleDelete(id) {
this.$confirm("是否要删除该条届次记录?").then(() => {
this.instance.post("/app/apporganizationgeneralelection/delete", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
this.$message.success("删除成功!")
this.getList()
}
})
}).catch(() => 0)
},
getList() {
const {oid: organizationId} = this
organizationId && this.instance.post("/app/apporganizationgeneralelection/list", null, {
throttle: 500,
params: {...this.search, organizationId}
}).then(res => {
if (res?.data) {
this.tableData = res.data
}
})
}
},
}
</script>
<style lang="scss" scope>
.history {
padding-top: 0 !important;
background-color: #FFF !important;
}
</style>

View File

@@ -0,0 +1,82 @@
<template>
<section class="moment">
<template v-if="detail.id">
<ai-title :title="detail.organizationName||'基本信息'" class="mar-b8"/>
<ai-wrapper>
<ai-info-item label="本届换届时间" :value="detail.changeTime"/>
<ai-info-item label="换届类型" :value="dict.getLabel('organizationChangeType',detail.type)"/>
<ai-info-item label="下届换届时间" :value="detail.nextChangeTime"/>
<ai-info-item label="当前届次" :value="detail.sessionTime"/>
</ai-wrapper>
<detail-panel :candidate-list="detail.candidateList" :serve-list="detail.serveList" disabled/>
</template>
<ai-empty v-else>
<div>暂无换届信息</div>
<el-row type="flex" justify="center" class="mar-t8">
<ai-highlight content="请点击【@v】完善基础内容后,再进行后续操作" value="开始设置"/>
</el-row>
<el-button class="mar-t32" type="primary" @click="$router.push({hash:'#add',query:{oid,new:1}})">开始设置</el-button>
</ai-empty>
</section>
</template>
<script>
import DetailPanel from "./detailPanel";
export default {
name: "moment",
components: {DetailPanel},
inject: ['permissions', 'instance', 'dict'],
data() {
return {
detail: {},
tableData: [],
totalJob: 0,
current: 1,
size: 10,
}
},
computed: {
colConfigs() {
return [
{prop: 'content', label: '职位'},
{prop: 'content', label: '姓名'},
{slot: 'options'},
]
},
oid: v => v.$attrs.selected.id
},
watch: {
oid: {
immediate: true,
handler() {
this.getDetail()
}
}
},
methods: {
getDetail() {
const {oid: organizationId} = this
this.detail = {}
organizationId && this.instance.post(`/app/apporganizationgeneralelection/queryDetailByOrganizationId`, null, {
pureBack:true,
params: {organizationId}
}).then(res => {
if (res?.data) {
this.detail = res.data
}
}).finally(() => this.$emit("update:hasConfig", !!this.detail.id))
},
},
created() {
this.dict.load("organizationChangeType")
}
}
</script>
<style lang="scss" scope>
.moment {
padding-top: 0 !important;
background-color: #FFF !important;
}
</style>

View File

@@ -0,0 +1,195 @@
<template>
<section class="organizationSetting">
<ai-detail>
<ai-title slot="title" :title="pageTitle" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
<template slot="content">
<el-form ref="SettingForm" :model="form" :rules="formRules" size="small" label-width="150px">
<ai-card title="基本信息" v-if="!isMakeUp">
<template #content>
<div class="tips">
<i class="el-icon-warning"></i>
系统将在下次换届时间开始前换届提醒人进行提醒提醒方式包括平台消息推送短信提醒
</div>
<el-form-item label="单位名称">{{ org.name }}</el-form-item>
<el-form-item label="成立时间">{{ $dateFormat(org.createTime) }}</el-form-item>
<el-form-item label="换届类型" prop="type">
<el-radio v-model="form.type" label="0">三年换届</el-radio>
<el-radio v-model="form.type" label="1">五年换届</el-radio>
</el-form-item>
<el-form-item label="换届提醒人" prop="userList">
<ai-person-select :instance="instance" :customClicker="true" :chooseUserList="form.userList"
:url="`/app/appparty/list?partyOrgId=${org.id}`" headerTitle="党员列表"
:isMultiple="true" dialogTitle="选择抄送人" @selectPerson="selectUser" class="aipersonselect">
<template name="option" v-slot:option="{ item }">
<span class="iconfont iconProlife">{{ item.name }}</span>
</template>
</ai-person-select>
</el-form-item>
</template>
</ai-card>
<ai-card title="当前届次">
<template #content>
<div flex class="wrap">
<el-form-item class="w50" label="本届换届时间" prop="changeTime">
<el-date-picker v-model="form.changeTime" @change="getNextChangeTime" value-format="yyyy-MM-dd" placeholder="本届换届时间"/>
</el-form-item>
<el-form-item class="w50" label="下届换届时间" prop="nextChangeTime" v-if="!isMakeUp">
<el-date-picker disabled v-model="form.nextChangeTime" placeholder="根据换届设置信息自动计算"/>
</el-form-item>
<el-form-item label="届次" prop="sessionTime" class="w50">
<el-input type="number" v-model="form.sessionTime" placeholder="请输入..."/>
</el-form-item>
</div>
<detail-panel :serve-list.sync="form.serveList" :candidate-list.sync="form.candidateList"/>
</template>
</ai-card>
</el-form>
</template>
<template slot="footer" class="footer">
<el-button class="delete-btn footer-btn" @click="cancel(false)">取消</el-button>
<el-button class="footer-btn" type="primary" @click="confirm()">保存</el-button>
</template>
</ai-detail>
</section>
</template>
<script>
import {mapState} from 'vuex'
import DetailPanel from "./detailPanel";
export default {
name: "organizationSetting",
components: {DetailPanel},
inject: ['permissions', 'instance', 'dict'],
data() {
return {
form: {
type: "",
userList: [],
sessionTime: "",
changeTime: "",
nextChangeTime: "",
serveList: [],
candidateList: []
},
formRules: {
type: [{required: true, message: "请选择换届类型", trigger: "change"}],
sessionTime: [{required: true, message: "请输入届次", trigger: "blur"}],
userList: [{required: true, message: "请选择换届提醒人", trigger: "change"}],
changeTime: [{required: true, message: "请选择本次换届时间", trigger: "blur"}],
nextChangeTime: [{required: true, message: "请选择下次换届时间", trigger: "change"}]
},
org: {}
}
},
computed: {
...mapState(['user']),
isMakeUp: v => v.$route.hash == "#makeup",
pageTitle: v => v.isMakeUp ? "补录换届" : "换届设置",
oid: v => v.$route.query.oid
},
watch: {
'form.type'() {
this.getNextChangeTime()
}
},
created() {
if (!!this.oid) {
this.org = new this.MODEL.PartyOrg(this.oid)
}
!!this.isMakeUp ? this.getSession() : this.getDetail()
},
methods: {
cancel() {
this.$router.back()
},
getNextChangeTime() {
const {type, changeTime} = this.form, sessionPeriod = {0: 3, 1: 5}[type]
this.form.nextChangeTime = type && changeTime ? this.$dateFormat(this.$moment(changeTime).add(sessionPeriod, "years")) : ""
},
getSession() {
//根据id获取对应届次信息
const {id} = this.$route.query
id && this.instance.post(`/app/apporganizationgeneralelection/queryDetailById`, null, {
pureBack: true,
params: {id}
}).then((res) => {
if (res?.data && res?.code == '0') {
this.form = res.data
}
})
},
getDetail() {
//获取到当前届次信息
const {oid: organizationId} = this.$route.query
this.instance.post(`/app/apporganizationgeneralelection/queryDetailByOrganizationId`, null, {
pureBack: true,
params: {organizationId}
}).then((res) => {
if (res?.data && res?.code == '0') {
this.form = res.data
}
})
},
selectUser(v) {
this.form.userList = v.map(e => ({
name: e.name,
organizationId: e.partyOrgId,
partyId: e.id,
phone: e.phone
}))
},
confirm() {
// 换届设置
this.$refs.SettingForm.validate(v => {
if (v) {
const {id: organizationId, name: organizationName} = this.org
let action
if (this.isMakeUp) {//补录
action = `/app/apporganizationgeneralelection/${!!this.form.id ? 'update' : 'add'}`
} else {//换届设置
action = `/app/${!!this.form.id ? "apporganizationgeneralelection/updateAll" : 'apporganizationchangeconfig/add'}`
}
const addOrMakeup = !this.isMakeUp
this.instance.post(action, {
organizationId, organizationName,
...this.form, addOrMakeup
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
this.cancel(true)
}
})
}
})
},
},
}
</script>
<style lang="scss" scope>
.organizationSetting {
height: 100%;
.el-date-editor, .el-input {
width: 100% !important;
}
.w50 {
width: 50%;
}
.tips {
width: 100%;
border: 1px solid #f82;
background-color: #fff3e9;
color: #f82;
padding: 8px 16px;
box-sizing: border-box;
border-radius: 4px;
margin-bottom: 32px;
font-size: 13px;
}
}
</style>