Files
dvcp_v2_webapp/project/pingchang/apps/AppOrganizationChange/components/organizationSetting.vue

192 lines
6.7 KiB
Vue
Raw Normal View History

2022-10-18 15:56:46 +08:00
<template>
<section class="organizationSetting">
<ai-detail>
2022-10-27 18:07:02 +08:00
<ai-title slot="title" :title="pageTitle" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
2022-10-18 15:56:46 +08:00
<template slot="content">
2022-10-24 16:13:01 +08:00
<el-form ref="SettingForm" :model="form" :rules="formRules" size="small" label-width="150px">
2022-10-27 18:07:02 +08:00
<ai-card title="基本信息" v-if="!isMakeUp">
2022-10-24 16:13:01 +08:00
<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="chooseUserList"
: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>
2022-10-27 18:07:02 +08:00
<ai-card title="当前届次">
<template #content>
2022-10-28 17:13:40 +08:00
<div flex class="wrap">
<el-form-item class="w50" label="本届换届时间" prop="changeTime">
2022-10-28 17:00:11 +08:00
<el-date-picker v-model="form.changeTime" @change="getNextChangeTime" value-format="yyyy-MM-dd" placeholder="本届换届时间"/>
2022-10-27 18:07:02 +08:00
</el-form-item>
2022-10-28 17:13:40 +08:00
<el-form-item class="w50" label="下届换届时间" prop="nextChangeTime" v-if="!isMakeUp">
2022-10-28 17:00:11 +08:00
<el-date-picker disabled v-model="form.nextChangeTime" placeholder="根据换届设置信息自动计算"/>
2022-10-27 18:07:02 +08:00
</el-form-item>
2022-10-28 17:13:40 +08:00
<el-form-item label="届次" prop="sessionTime" class="w50">
<el-input type="number" v-model="form.sessionTime" placeholder="请输入..."/>
</el-form-item>
2022-10-27 18:07:02 +08:00
</div>
<detail-panel :serve-list.sync="form.serveList" :candidate-list.sync="form.candidateList"/>
</template>
2022-10-24 16:13:01 +08:00
</ai-card>
</el-form>
2022-10-18 15:56:46 +08:00
</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>
2022-10-21 11:53:29 +08:00
2022-10-18 15:56:46 +08:00
</section>
</template>
<script>
2022-10-21 11:53:29 +08:00
import {mapState} from 'vuex'
2022-10-24 16:13:01 +08:00
import DetailPanel from "./detailPanel";
2022-10-21 11:53:29 +08:00
2022-10-18 15:56:46 +08:00
export default {
name: "organizationSetting",
2022-10-24 16:13:01 +08:00
components: {DetailPanel},
2022-10-24 11:58:47 +08:00
inject: ['permissions', 'instance', 'dict'],
2022-10-18 15:56:46 +08:00
data() {
return {
form: {
2022-10-24 16:13:01 +08:00
type: "",
2022-10-18 15:56:46 +08:00
userList: [],
2022-10-24 16:13:01 +08:00
sessionTime: "",
changeTime: "",
2022-10-27 18:07:02 +08:00
nextChangeTime: "",
serveList: [],
candidateList: []
2022-10-18 15:56:46 +08:00
},
formRules: {
2022-10-27 18:07:02 +08:00
type: [{required: true, message: "请选择换届类型", trigger: "change"}],
2022-10-28 17:00:11 +08:00
sessionTime: [{required: true, message: "请输入届次", trigger: "blur"}],
2022-10-27 18:07:02 +08:00
userList: [{required: true, message: "请选择换届提醒人", trigger: "change"}],
2022-10-28 17:00:11 +08:00
changeTime: [{required: true, message: "请选择本次换届时间", trigger: "blur"}],
2022-10-27 18:07:02 +08:00
nextChangeTime: [{required: true, message: "请选择下次换届时间", trigger: "change"}]
2022-10-18 15:56:46 +08:00
},
chooseUserList: [],
2022-10-31 13:59:09 +08:00
org: {}
2022-10-18 15:56:46 +08:00
}
},
computed: {
2022-10-24 11:58:47 +08:00
...mapState(['user']),
2022-10-27 18:07:02 +08:00
isMakeUp: v => v.$route.hash == "#makeup",
2022-10-31 11:23:30 +08:00
pageTitle: v => v.isMakeUp ? "补录换届" : "换届设置",
oid: v => v.$route.query.oid
2022-10-27 18:07:02 +08:00
},
watch: {
'form.type'() {
this.getNextChangeTime()
}
2022-10-18 15:56:46 +08:00
},
created() {
2022-10-31 11:23:30 +08:00
if (!!this.oid) {
this.org = new this.MODEL.PartyOrg(this.oid)
}
2022-10-28 17:13:40 +08:00
!!this.isMakeUp ? this.getSession() : this.getDetail()
2022-10-18 15:56:46 +08:00
},
methods: {
2022-10-21 11:53:29 +08:00
cancel() {
this.$router.back()
2022-10-18 15:56:46 +08:00
},
2022-10-27 18:07:02 +08:00
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
2022-10-28 17:13:40 +08:00
id && this.instance.post(`/app/apporganizationgeneralelection/queryDetailById`, null, {
2022-10-27 18:07:02 +08:00
pureBack: true,
params: {id}
}).then((res) => {
2022-10-31 11:23:30 +08:00
if (res?.data && res?.code == '0') {
2022-10-27 18:07:02 +08:00
this.form = res.data
}
})
},
2022-10-18 15:56:46 +08:00
getDetail() {
2022-10-27 18:07:02 +08:00
//获取到当前届次信息
2022-10-24 11:58:47 +08:00
const {oid: organizationId} = this.$route.query
2022-10-28 15:45:31 +08:00
this.instance.post(`/app/apporganizationgeneralelection/queryDetailByOrganizationId`, null, {
2022-10-27 18:07:02 +08:00
pureBack: true,
2022-10-24 11:58:47 +08:00
params: {organizationId}
}).then((res) => {
2022-10-31 11:23:30 +08:00
if (res?.data && res?.code == '0') {
2022-10-28 17:13:40 +08:00
this.form = res.data
2022-10-18 15:56:46 +08:00
}
})
},
selectUser(v) {
2022-10-28 17:00:11 +08:00
this.form.userList = v.map(e => ({
name: e.name,
organizationId: e.partyOrgId,
partyId: e.id,
phone: e.phone
}))
2022-10-18 15:56:46 +08:00
},
confirm() {
// 换届设置
2022-10-24 16:13:01 +08:00
this.$refs.SettingForm.validate(v => {
if (v) {
2022-10-24 11:58:47 +08:00
const {id: organizationId, name: organizationName} = this.org
2022-10-28 15:45:31 +08:00
const action = `/app/${this.isMakeUp ? 'apporganizationgeneralelection' : 'apporganizationchangeconfig'}/${!!this.form.id ? 'update' : 'add'}`
2022-10-27 18:07:02 +08:00
const addOrMakeup = !this.isMakeUp
2022-10-24 16:13:01 +08:00
this.instance.post(action, {
2022-10-31 11:23:30 +08:00
organizationId, organizationName,
...this.form, addOrMakeup
2022-10-21 11:53:29 +08:00
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
this.cancel(true)
}
})
}
2022-10-18 15:56:46 +08:00
})
},
},
}
</script>
<style lang="scss" scope>
.organizationSetting {
height: 100%;
2022-10-27 18:07:02 +08:00
.el-date-editor, .el-input {
width: 100% !important;
2022-10-18 15:56:46 +08:00
}
2022-10-28 17:13:40 +08:00
.w50 {
width: 50%;
}
2022-10-18 15:56:46 +08:00
.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;
}
}
2022-10-21 11:53:29 +08:00
</style>