追加关于党组织的抽象类

This commit is contained in:
aixianling
2022-10-24 11:58:47 +08:00
parent bda2b10c7f
commit f178667db8
7 changed files with 85 additions and 133 deletions

View File

@@ -5,6 +5,15 @@ let components = [];
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册 // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
const install = function (Vue) { const install = function (Vue) {
if (install.installed) return; if (install.installed) return;
// 声明全局业务对象类
const models = require.context('./model', true, /\.js$/)
if (models) {
const model = {}
models.keys().map(e => {
model[e.replace(/\.[\/\\]([^\\\/]+)\.js$/, '$1')] = models(e).default
})
Vue.prototype.MODEL = model
}
// 遍历注册全局组件 // 遍历注册全局组件
let contexts = require.context('.', true, /[\\\/]Ai([^\\\/]+)\.vue$/); let contexts = require.context('.', true, /[\\\/]Ai([^\\\/]+)\.vue$/);
if (contexts) { if (contexts) {

View File

View File

@@ -0,0 +1,25 @@
import http from "dvcp-ui/lib/js/request";
export default class PartyOrg {
constructor(id) {
this.id = id
this.loaded = false
this.init().finally(() => this.loaded = true)
}
init() {
return PartyOrg.getInfo(this.id).then(data => {
Object.entries(data).map(([k, v]) => this[k] = v)
})
}
static getInfo(id) {
return http.post("/app/partyOrganization/queryOrgById", null, {
params: {id}
}).then(res => {
if (res?.data) {
return res.data
}
})
}
}

View File

@@ -15,9 +15,15 @@ import organizationSetting from "./components/organizationSetting.vue";
export default { export default {
name: "AppOrganizationChange", name: "AppOrganizationChange",
label: "组织换届", label: "组织换届",
provide() {
return {
...this.$props
}
},
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
permissions: Function
}, },
components: { components: {
List, List,
@@ -36,7 +42,6 @@ export default {
}, },
data() { data() {
return { return {
component: "List",
params: {}, params: {},
include: [], include: [],
selected: {}, selected: {},
@@ -47,10 +52,6 @@ export default {
this.params = data.params; this.params = data.params;
}, },
}, },
created() {
let {organizationId: id, organizationName: name} = this.user.info
this.selected = {id, name}
}
} }
</script> </script>

View File

@@ -1,11 +1,7 @@
<template> <template>
<ai-list class="List"> <ai-list class="List">
<template slot="title"> <template slot="title">
<ai-title title="组织换届" isShowBottomBorder> <ai-title title="组织换届" isShowBottomBorder/>
<template slot="rightBtn">
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toSetting('')">换届设置</el-button>
</template>
</ai-title>
</template> </template>
<template #left> <template #left>
<ai-tree-menu title="组织目录" searchPlaceholder="请输入组织名称" @search="onSearch"> <ai-tree-menu title="组织目录" searchPlaceholder="请输入组织名称" @search="onSearch">
@@ -19,10 +15,14 @@
</ai-tree-menu> </ai-tree-menu>
</template> </template>
<template slot="content" class="content"> <template slot="content" class="content">
<ai-title title="届次信息">
<template #rightBtn>
<el-button size="small" type="primary" @click="toSetting(selected.id)" v-if="permissions('app_apporganizationchangeconfig')">换届设置</el-button>
</template>
</ai-title>
<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==i" :is="tab.comp" lazy :selected="selected" v-on="$listeners"/>
:dict="dict" :permissions="permissions" v-on="$listeners"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>
@@ -36,12 +36,7 @@ import history from './history.vue'
export default { export default {
name: 'List', name: 'List',
props: { inject: ['permissions', 'instance', 'dict'],
instance: Function,
permissions: Function,
dict: Object,
selected: Object
},
data() { data() {
return { return {
tabs: [ tabs: [
@@ -49,6 +44,7 @@ export default {
{label: '历史届次', name: 'history', comp: history, permission: ''} {label: '历史届次', name: 'history', comp: history, permission: ''}
], ],
currIndex: '0', currIndex: '0',
selected: null
} }
}, },
components: { components: {
@@ -57,25 +53,15 @@ export default {
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
orgTree() {
return this.$refs.tree?.$refs?.partyTree
}, },
},
methods: { methods: {
showNeighbourSetting(id) {
this.$router.push({query: {id}, hash: "#ns"})
},
onTreeChange(e) { onTreeChange(e) {
this.$emit("update:selected", e) this.selected = e
this.$refs[this.tabs[Number(this.currIndex)].name][0].getList(e.id) this.$refs[this.tabs[Number(this.currIndex)].name][0].getList(e.id)
}, },
onSearch(v) { onSearch(v) {
this.orgTree.filter(v) this.$refs.tree?.$refs?.partyTree?.filter(v)
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true
return data.name.indexOf(value) !== -1 return data.name.indexOf(value) !== -1
@@ -83,9 +69,13 @@ export default {
toAdd(id) { toAdd(id) {
this.$router.push({hash: "#add", query: {id}}) this.$router.push({hash: "#add", query: {id}})
}, },
toSetting(id) { toSetting(oid) {
this.$router.push({hash: "#setting", query: {id}}) this.$router.push({hash: "#setting", query: {oid}})
} }
},
created() {
const {organizationId: id, organizationName: name} = this.user.info
this.selected = {id, name}
} }
} }
</script> </script>
@@ -132,6 +122,7 @@ export default {
.ai-list__content--right-wrapper { .ai-list__content--right-wrapper {
width: 100%; width: 100%;
padding-top: 0;
} }
} }

View File

@@ -53,8 +53,11 @@
</el-table-column> </el-table-column>
</ai-table> </ai-table>
</template> </template>
<ai-empty>暂无换届信息,请完善基础内容后,再进行后续操作<br/><br/><br/> <ai-empty>
<el-button size="small" type="primary" @click="toEdit(oid)">开始设置</el-button> <div>暂无换届信息</div>
<el-row type="flex" justify="center" class="mar-t8">
<ai-highlight content="请点击【@v】完善基础内容后,再进行后续操作" value="换届设置"/>
</el-row>
</ai-empty> </ai-empty>
<ai-dialog :visible.sync="dialogJob" title="添加本届任职人" width="720px" @closed="jobForm={}" @onConfirm="handleJobForm"> <ai-dialog :visible.sync="dialogJob" title="添加本届任职人" width="720px" @closed="jobForm={}" @onConfirm="handleJobForm">
<el-form ref="jobForm" size="small" :model="jobForm" :rules="jobRules" label-width="80px"> <el-form ref="jobForm" size="small" :model="jobForm" :rules="jobRules" label-width="80px">
@@ -82,12 +85,7 @@
<script> <script>
export default { export default {
name: "moment", name: "moment",
props: { inject: ['permissions', 'instance', 'dict'],
instance: Function,
permissions: Function,
dict: Object,
selected: Object,
},
data() { data() {
return { return {
detail: {}, detail: {},
@@ -127,10 +125,10 @@ export default {
name: [{required: true, message: "请输入姓名"}], name: [{required: true, message: "请输入姓名"}],
} }
}, },
oid: v => v.selected.id oid: v => v.$attrs.selected.id
}, },
mounted() { created() {
this.getList(this.selected.id) this.getList()
}, },
methods: { methods: {
jobEdit() { jobEdit() {
@@ -142,8 +140,11 @@ export default {
toEdit(id) { toEdit(id) {
this.$router.push({hash: "#add", query: {id}}) this.$router.push({hash: "#add", query: {id}})
}, },
getList(id) { getList() {
this.instance.post(`/app/apporganizationgeneralelection/queryDetailByOrganizationId?organizationId=${id}`).then(res => { const {oid: organizationId} = this
organizationId && this.instance.post(`/app/apporganizationgeneralelection/queryDetailByOrganizationId`, null, {
params: {organizationId}
}).then(res => {
if (res?.data) { if (res?.data) {
this.detail = res.data this.detail = res.data
} }

View File

@@ -1,45 +1,5 @@
<template> <template>
<section class="organizationSetting"> <section class="organizationSetting">
<!-- <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="isEdit = true">修改</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="选举方式">
{{ info.electionMethod==0? '等额':'差额'}}
<el-tooltip class="item" effect="dark" content="差额选举:候选人数多于应选人数的选举方式;
等额选举:候选人数与应选人数相等的选举方式。" placement="top">
<i class="el-icon-info" style="margin-right: 8px"></i>
</el-tooltip>
</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> <ai-detail>
<ai-title slot="title" title="换届设置" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/> <ai-title slot="title" title="换届设置" isShowBottomBorder isShowBack @onBackClick="cancel(true)"/>
<template slot="content"> <template slot="content">
@@ -51,27 +11,12 @@
</div> </div>
<div class="add-form"> <div class="add-form">
<el-form ref="form" :model="form" :rules="formRules" size="small" label-width="150px"> <el-form ref="form" :model="form" :rules="formRules" size="small" label-width="150px">
<el-form-item label="单位名称"> <el-form-item label="组织名称">{{ org.name }}</el-form-item>
<div>{{ user.info.organizationName }}</div> <el-form-item label="成立时间">{{ $dateFormat(org.createTime) }}</el-form-item>
</el-form-item>
<el-form-item label="成立时间">
<div>{{ createTime }}</div>
</el-form-item>
<el-form-item label="换届类型" prop="type"> <el-form-item label="换届类型" prop="type">
<el-radio v-model="form.type" label="0">三年换届</el-radio> <el-radio v-model="form.type" label="0">三年换届</el-radio>
<el-radio v-model="form.type" label="1">五年换届</el-radio> <el-radio v-model="form.type" label="1">五年换届</el-radio>
</el-form-item> </el-form-item>
<el-form-item label="单位名称" prop="organizationName">
<el-input size="small" disabled placeholder="请选择所属党组织" v-model="form.organizationName">
<template slot="append">
<ai-party :instance="instance" size="small" :value="form.organizationId" @origin="handlePartyOrgSelect"/>
</template>
</el-input>
</el-form-item>
<el-form-item label="换届提醒人" prop="userList"> <el-form-item label="换届提醒人" prop="userList">
<ai-person-select :instance="instance" :customClicker="true" :chooseUserList="chooseUserList" <ai-person-select :instance="instance" :customClicker="true" :chooseUserList="chooseUserList"
:url="`/app/appparty/list?partyOrgId=${form.organizationId}`" headerTitle="党员列表" :url="`/app/appparty/list?partyOrgId=${form.organizationId}`" headerTitle="党员列表"
@@ -100,11 +45,7 @@ import {mapState} from 'vuex'
export default { export default {
name: "organizationSetting", name: "organizationSetting",
props: { inject: ['permissions', 'instance', 'dict'],
instance: Function,
dict: Object,
},
data() { data() {
let validUser = (rule, value, callback) => { let validUser = (rule, value, callback) => {
if (!value.length) { if (!value.length) {
@@ -127,35 +68,27 @@ export default {
userList: [{required: true, validator: validUser, trigger: "blur"}], userList: [{required: true, validator: validUser, trigger: "blur"}],
}, },
chooseUserList: [], chooseUserList: [],
createTime: '',
} }
}, },
computed: { computed: {
...mapState(['user']) ...mapState(['user']),
org: v => new v.MODEL.PartyOrg(v.$route.query.oid)
}, },
created() { created() {
this.form.organizationId = this.$route.query.oid
this.getDetail() this.getDetail()
this.getOrganization()
}, },
methods: { methods: {
cancel() { cancel() {
this.$router.back() 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.createTime = data[0].createTime
}
})
},
getDetail() { getDetail() {
this.instance.post(`/app/apporganizationchangeconfig/queryDetailByOrganizationId?organizationId=${this.user.info.organizationId}`).then((res) => { const {oid: organizationId} = this.$route.query
this.instance.post(`/app/apporganizationchangeconfig/queryDetailByOrganizationId`, null, {
params: {organizationId}
}).then((res) => {
if (res?.data) { if (res?.data) {
// this.chooseCandidateList = res.data.candidateUsers this.form = res.data
// this.chooseVoteList = res.data.voteUsers
console.log(res);
} }
}) })
}, },
@@ -165,26 +98,18 @@ export default {
selectVote(e) { selectVote(e) {
this.form.voteUsers = e this.form.voteUsers = e
}, },
handlePartyOrgSelect(v) {
if (v) {
this.form.organizationId = v[0]?.id
this.form.organizationName = v[0]?.name
}
},
confirm() { confirm() {
// 换届设置 // 换届设置
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
const {id: organizationId, name: organizationName} = this.org
this.instance.post(`/app/apporganizationchangeconfig/update`, { this.instance.post(`/app/apporganizationchangeconfig/update`, {
...this.form ...this.form, organizationId, organizationName
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.$message.success('提交成功') this.$message.success('提交成功')
this.cancel(true) this.cancel(true)
} }
}).catch((err) => {
console.log(err);
}) })
} }
}) })