Files
zhgh_hhu/target/classes/views/platform/jdh/zzjg/delegation.html
T
2026-09-20 15:46:34 +08:00

1099 lines
49 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-tabs__nav {
background-color: #FFFFFF;
}
.dialog-footer .el-button {
padding: 12px 30px;
}
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__list.is-filterable {
height: 300px;
}
.v-box .el-card__header {
padding: 5px 15px;
}
.v-tree-layout-left .v-tree {
width: 100%;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
}
.v-tree-layout-left .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<tree-layout style="height: calc(100vh - 70px)">
<template #tree>
<div style="padding: 15px;">
<el-select v-model="pageForm.jdhid" filterable placeholder="请选择教代会"
@change="jdhChange">
<el-option
v-for="item in jdhList"
:key="item.id"
:label="item.jdhallname"
:value="item.id">
</el-option>
</el-select>
</div>
<el-tree class="filter-tree" :data="treeData" :props="defaultProps"
default-expand-all ref="tree"
highlight-current accordion @node-click="handleNodeClick">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level==1" style="font-size: 16px;" class="v-node">
<i class="el-icon-office-building"></i>&nbsp;{{ data.dbtname }}
</div>
<div v-if="node.level==2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.dbtname==data.dbtname"></i>
<i class="el-icon-help" v-else></i>
&emsp;{{ data.dbtname }}
</div>
</div>
</el-tree>
</template>
<template>
<div v-if="node.level==1" class="pl10 pr10">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-select v-model="pageForm.dbtid" filterable clearable
placeholder="请选择代表团">
<el-option
v-for="item in delegations"
:key="item.id"
:label="item.dbtname"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="doSearch"></el-button>
</div>
<div class="pull-right offscreen-right">
<el-button type="primary" @click="openAdd"><i class="ti-plus"></i> 添加代表团
</el-button>
</div>
</el-card>
<el-dialog title="添加代表团" :visible.sync="addDialogVisible" width="40%">
<el-form :model="formData" ref="addForm" :rules="rules" label-width="100px">
<el-form-item prop="jdhid" label="所属教代会">
<el-select v-model="formData.jdhid" @change="addJdhChange"
placeholder="选择教代会"
style="width: 100%">
<el-option
v-for="item in jdhList"
:key="item.id"
:label="item.jdhallname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="dbt" label="代表团名称">
<el-select multiple v-model="formData.dbt" filterable
placeholder="请选中代表团名称"
style="width: 100%">
<el-option
v-for="item in dbtList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAdd">确 定</el-button>
</span>
</el-dialog>
<el-card shadow="never" class="mt20">
<el-table :data="tableData">
<el-table-column label="序号" type="index">
<template scope="scope"><span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" prop="dbtname"
label="代表团名称"></el-table-column>
<el-table-column align="center" header-align="center" prop="dictcode"
label="代表团编码"></el-table-column>
<el-table-column align="center" header-align="center" prop="jdhallname"
label="所属教代会"></el-table-column>
<el-table-column align="center" header-align="center" prop="tzusername"
label="团长">
<template slot-scope="{row}">
{{row.tzusername}}
<template v-if="row.ftzusername">
({{row.ftzusername}})
</template>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" prop="cjsj"
label="创建时间">
<template slot-scope="{row:{cjsj}}">
{{moment(cjsj).format('YYYY-MM-DD')}}
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
:command="{type:'fgh',data:scope.row}">
设置组成基层工会
</el-dropdown-item>
<el-dropdown-item :command="{type:'tz',data:scope.row}">
设置团长/副团长
</el-dropdown-item>
<el-dropdown-item
:command="{type:'editName',data:scope.row}">
编辑代表团名称
</el-dropdown-item>
<el-dropdown-item
:command="{type:'delete',data:scope.row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
<div v-if="node.level==2" class="pl10 pr10">
<el-tabs v-model="activeName" type="card" @tab-click="handleTabClick">
<el-tab-pane label="代表" name="one">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-input placeholder="请输入内容" clearable
v-model="dbPageForm.searchKeyword">
<el-select v-model="dbPageForm.searchName" slot="prepend"
placeholder="查询类型"
style="width: 120px;">
<el-option label="姓名" value="username"></el-option>
<el-option label="工号" value="loginname"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button">
<el-select v-model="dbPageForm.unionid" filterable clearable
@change="getUnits"
placeholder="请选择工会">
<el-option
v-for="item in unionList"
:label="item.unionname"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-select v-model="dbPageForm.unitid" filterable clearable
placeholder="请选择单位">
<el-option
v-for="item in unitList"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<template class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="dbDoSearch"></el-button>
</template>
<template>
<el-button class="pull-right offscreen-right" type="primary"
icon="el-icon-sort" @click="openSetXld">
代表调整
</el-button>
</template>
</el-card>
<el-table class="mt20" :data="dbTableData" max-height="708px">
<el-table-column label="序号" width="60px">
<template scope="scope"><span>{{scope.$index+1}}</span>
</template>
</el-table-column>
<el-table-column label="姓名" prop="username"></el-table-column>
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column sortable prop="unionname"
label="工会"></el-table-column>
<el-table-column sortable prop="unitname"
label="单位"></el-table-column>
<el-table-column sortable prop="rolename"
label="代表身份"></el-table-column>
<el-table-column header-align="center" align="center" label="操作"
width="100">
<template slot-scope="{row}">
<el-dropdown @command="dbDropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:row}">
查看
</el-dropdown-item>
<el-dropdown-item
:command="{type:'modify',data:row}">
编辑
</el-dropdown-item>
<el-dropdown-item
:command="{type:'doDelete',data:row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="代表团组成单位" name="two">
<el-card shadow="never" class="text-right">
<el-button type="primary" @click="fghdoAdd(adminPageForm.dbtid)">
{{butTitle}}
</el-button>
</el-card>
<el-table class="mt20" :data="adminTableData">
<el-table-column label="序号" width="60px">
<template scope="scope"><span>{{scope.$index+1}}</span>
</template>
</el-table-column>
<el-table-column label="基层工会名称" prop="unionname"></el-table-column>
<el-table-column label="操作">
<template scope="{row}">
<el-button plain type="danger" size="mini"
icon="el-icon-delete" circle
@click="fghdoDelete(row)">
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="设置团长/副团长" name="three">
<el-card shadow="never" class="text-right">
<el-button type="primary" @click="openUser(adminPageForm.dbtid)">
{{butTitle}}
</el-button>
</el-card>
<el-table class="mt20" :data="TzTableData" height="300">
<el-table-column sortable prop="loginname"
label="工号"></el-table-column>
<el-table-column sortable prop="username"
label="姓名"></el-table-column>
<el-table-column sortable prop="dwname"
label="单位"></el-table-column>
<el-table-column prop="mobile" label="电话"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column prop="rolename" label="身份">
<template slot-scope="scope">
<span v-if="scope.row.rolename==='代表团团长'"
class="text-primary">团长</span>
<span v-if="scope.row.rolename==='代表团副团长'"
class="text-info">副团长</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template scope="{row}">
<el-button plain type="danger" size="mini"
icon="el-icon-delete" circle
@click="delUser(row)">
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</template>
</tree-layout>
<template #view>
<member ref="memberInfo" :id="userId" view></member>
</template>
</guava>
<el-dialog :title="title" :visible.sync="fghDialogVisible" width="55%">
<div style="width: 100%;">
<el-transfer :titles="['剩余分工会', '代表团分工会']" filterable
:props="{key: 'id',label: 'unionname'}"
:filter-method="adminFilterMethod"
v-model="fghFormData.fghValue"
:data="fghData">
</el-transfer>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="fghDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="dofgh" :loading="fghSubLoading">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="设置团长副团长" :visible.sync="userDialogVisible" width="40%">
<el-form label-width="100px">
<el-form-item prop="jdhallname" label="届次">
<el-select v-model="pageForm.jdhid" disabled style="width: 100%">
<el-option
v-for="item in jdhList"
:key="item.id"
:label="item.jdhallname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="userid" label="工号或姓名">
<el-select v-model="userFormData.userid" filterable placeholder="请输入工号或姓名关键字"
style="width: 100%" @change="userChange">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.username+'('+item.loginname+')'"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="联系方式">
<el-input v-model="leaderInfo.mobile" readonly></el-input>
</el-form-item>
<el-form-item prop="dwname" label="所属单位">
<el-input v-model="leaderInfo.dwname" readonly></el-input>
</el-form-item>
<el-form-item prop="sf" label="身份">
<el-radio-group v-model="leaderInfo.sf">
<el-radio-button label="2">团&emsp;长</el-radio-button>
<el-radio-button label="1">副团长</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button :disabled="userSubLoading" @click="doAddTz" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="编辑代表团名称" :visible.sync="deleDialogVisible" width="30%">
<el-form :model="editForm" label-width="100px" ref="editForm">
<el-form-item prop="dbtName" label="代表团名称" ref="aa"
:rules="{required: true, message: '请填写代表团名称', trigger: 'blur'}">
<el-input v-model="editForm.dbtName"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="deleDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="deleDo">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="编辑教代会代表" :visible.sync="modifyDialogVisible" width="50%">
<el-form :model="formData" ref="form" :rules="formRules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item prop="username" label="姓名">
<el-input disabled :value="representativeInfo.username"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="loginname" label="工号">
<el-input disabled :value="representativeInfo.loginname"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item prop="jdhid" label="届次">
<el-select v-model="representativeInfo.jdhid" filterable placeholder="届次"
style="width: 100%"
@change="jdhChange">
<el-option v-for="item in jdhList" :key="item.id"
:label="item.jdhallname"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="dbtid" label="代表团">
<el-select v-model="representativeInfo.dbtid" filterable style="width: 100%">
<el-option v-for="i in delegations" :label="i.dbtname" :key="i.id"
:value="i.id"></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item prop="dbfghid" label="所属工会">-->
<!-- <el-select v-model="representativeInfo.dbfghid" filterable disabled-->
<!-- @change="representativeInfo.dbunitid = '';modifyUnitList = allUnitList.filter(v => representativeInfo.dbfghid?v.unionid === representativeInfo.dbfghid:true)">-->
<!-- <el-option v-for="i in unionList" :label="i.unionname" :key="i.id"-->
<!-- :value="i.id"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item prop="dbunitid" label="所属单位">-->
<!-- <el-select v-model="representativeInfo.dbunitid" filterable disabled>-->
<!-- <el-option v-for="i in modifyUnitList" :label="i.name" :key="i.id"-->
<!-- :value="i.id"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item prop="roleid" label="代表类型">
<el-select v-model="representativeInfo.roleid" style="width: 100%">
<el-option v-for="i in representativeRoleOptions" :label="i.label"
:key="i.value"
:value="i.value"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="modifyDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="modifying">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="代表名单调整" :visible.sync="xldDialogVisible">
<el-select v-model="xldFormData.jdhid" @change="xldJdhChange">
<el-option v-for="item in jdhList" :label="item.jdhallname"
:value="item.id"></el-option>
</el-select>
<div class="pull-right offscreen-right">
<el-select filterable placeholder="请输入工号和姓名"
remote :remote-method="remotexldMethod"
reserve-keyword v-model="xldFormData.userid">
<el-option v-for="u in xldUserList" :label="u.username+'-'+u.loginname"
:value="u.id"></el-option>
</el-select>
<el-button @click="addXldUser">
添加人员
</el-button>
</div>
<el-table :data="xldTableData" height="350">
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column label="姓名" prop="username"></el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="所属工会" prop="unionname"></el-table-column>
<el-table-column label="所属单位" prop="dwname"></el-table-column>
<el-table-column label="代表团">
<template slot-scope="scope">
<el-select v-model="scope.row.dbtid" clearable filterable>
<el-option v-for="d in delegations" :label="d.dbtname"
:value="d.id"></el-option>
</el-select>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="xldDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doSetxlddbt">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.3'),
},
data() {
return {
editForm: {dbtName: ''},
deleDialogVisible: false,
node: {
level: 1
},
pageForm: {
jdhid: ""
},
title: '',
checkData: {},
activeName: 'one',
jdhList: [],
dbtList: [],
unitList: [],
unionList: [],
delegations: [],
treeData: [],
adminTableData: [],
dbTableData: [],
adminPageForm: {},
dbPageForm: {
...getPageForm(),
unitid: "",
unionid: "",
searchName: 'username',
},
TzTableData: [],
addDialogVisible: false,
fghDialogVisible: false,
fghDialog: false,
userDialogVisible: false,
fghData: [],
fghFormData: {
fghValue: []
},
leaderInfo: {
sf: '2'
},
userList: [],
userFormData: {},
fghSubLoading: false,
userSubLoading: false,
setzcfghdbtname: '',
setFghId: '',
butTitle: '设置代表团组成单位',
defaultProps: {
children: 'childrens',
label: 'dbtname',
disabled: 'disabled'
},
rules: {
jdhid: [{required: true, message: '请选择教代会', trigger: ['change', 'blur']}],
dbt: [{required: true, message: '请选择代表团', trigger: ['change', 'blur']}]
},
userId: "",
deleData: {},
modifyDialogVisible: false,
representativeRoleOptions: [],
representativeInfo: {},
modifyUnitList: [],
xldFormData: {
jdhid: '',
userid: ''
},
xldDialogVisible: false,
xldUserList: [],
xldTableData: [],
}
},
methods: {
doSetxlddbt() {
let flag = true
for (let o of this.xldTableData) {
if (!('dbtid' in o)) {
flag = false
break
}
}
if (!flag) {
this.$message.info('请先选择要分配的代表团!')
return
}
$.post(base + '/platform/jdh/db/dbgl/fpXldToDbt', {
user: this.xldTableData,
jdhid: this.xldFormData.jdhid
}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.xldTableData = []
this.dbDoSearch()
}
})
},
addXldUser() {
if (this.xldFormData.userid === '') {
this.$message.info('请先选择用户!')
return
}
let u = this.xldTableData.find(u => {
return u.id === this.xldFormData.userid
})
if (u) {
this.$message.info('不要重复添加')
return
}
let user = this.xldUserList.find(u => {
return u.id === this.xldFormData.userid
})
this.xldTableData.push(user)
this.xldFormData.userid = ''
this.xldUserList = []
},
remotexldMethod(key) {
if (this.xldFormData.jdhid === '') {
this.$message.info('请先选择教代会!')
return
}
if (key !== '') {
$.get(base + '/platform/jdh/db/dbgl/queryXldUser', {
query: key,
jdhid: this.xldFormData.jdhid
}).then(res => {
if (res.code === 0) {
this.xldUserList = res.data.list
}
})
}
},
async xldJdhChange(jdhid) {
this.delegations = await getDbt(jdhid)
},
async openSetXld() {
if (this.jdhList) {
this.xldFormData.jdhid = this.jdhList[0].id
this.delegations = await getDbt(this.jdhList[0].id)
}
this.xldFormData.userid = ''
this.xldUserList = []
this.xldTableData = []
this.xldDialogVisible = true
},
dbDropdownCommand(command) {
const {type, data} = command
if (type === 'view') {
this.openView(data)
} else if (type === 'doDelete') {
this.doDbDelete(data)
} else if (type === 'modify') {
this.modify(data.dbid)
}
},
openView(row) {
const {userid} = row
this.userId = userid
this.$refs.memberInfo.getUserInfo()
this.$refs.guava.view()
},
doDbDelete(obj) {
this.$confirm('此操作将删除用户' + obj.username + '的正式代表身份!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let data = []
data.push({id: obj.dbid, dbid: obj.userid, jdhid: obj.jdhid})
$.post(base + '/platform/jdh/db/dbgl/doDelete', {data: data}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.dbDoSearch()
}
})
}).catch(() => {
})
},
async modify(id) {
const resp = await $.get('/platform/jdh/db/dbgl/representativeInfo/' + id)
AssertResponseMessage2({
response: resp,
success: ({data}) => {
this.modifyUnitList = this.allUnitList;
this.representativeInfo = data
this.modifyDialogVisible = true
},
})
},
async modifying() {
const response = await $.post('/platform/jdh/db/dbgl/modifyRepresentativeInfo', this.representativeInfo)
AssertResponseMessage({
response,
success: () => {
this.modifyDialogVisible = false
this.dbDoSearch()
}
})
},
async getRepresentativeRoleOptions() {
const {code, data} = await $.get('/platform/jdh/db/dbgl/representativeRoleOptions')
if (!code) {
this.representativeRoleOptions = data
}
},
dropdownCommand(command) {
const {type, data} = command
if (type == 'fgh') {
this.openFgh(data)
} else if (type == 'tz') {
this.openTz(data)
} else if (type == 'delete') {
this.doDelete(data.id)
} else if (type === 'editName') {
this.editName(data)
}
},
editName(data) {
this.deleData = data
this.deleDialogVisible = true
if (this.$refs['editForm']) {
this.$refs['editForm'].resetFields()
}
},
async deleDo() {
this.$refs['editForm'].validate(async (valid) => {
if (valid) {
this.$confirm('此操作需要先在字典表中添加新的代表团名称,请确认', '提示', {
confirmButtonText: '我已添加',
cancelButtonText: '取消',
type: 'warning',
}).then(async ({value}) => {
const resp = await $.post(loc() + '/updateDelegation', {
id: this.deleData.id,
delegationName: this.editForm.dbtName
})
if (resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg});
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
this.pageData()
this.deleDialogVisible = false
}).catch(() => {
this.deleDialogVisible = false
});
}
})
},
async dbData() {
this.dbPageForm.jdhid = this.pageForm.jdhid
const resp = await $.get(loc() + '/dbTableData', this.dbPageForm)
requestLaterFun(resp, () => {
this.dbTableData = resp.data;
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
},
async dbDoSearch() {
await this.dbData()
},
openAdd() {
this.formData = {}
if (this.jdhList.length > 0) {
this.formData.jdhid = this.jdhList[0].id
this.getDbtList(this.formData.jdhid)
}
this.addDialogVisible = true
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
addJdhChange(val) {
this.getDbtList(val)
},
async getDbtList(jdhid) {
const resp = await $.post(loc() + "/queryKyDbtMc", {jdhid: jdhid})
requestLaterFun(resp, () => {
this.dbtList = resp.data;
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
},
async doAdd() {
this.$refs['addForm'].validate(async (valid) => {
let data = clone(this.formData)
data.dbt = JSON.stringify(data.dbt)
if (valid) {
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + '/doAdd', data)
closeLoadingFunc(loading, resp, async () => {
await this.undertakeUnitTree()
this.pageData()
this.addDialogVisible = false
}, (data, msg) => {
this.$message.error(msg);
})
}
})
},
doDelete(id) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDelete", {id})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.undertakeUnitTree()
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
},
fghdoDelete(row) {
const {id} = row
this.$confirm('确定要移除该分工会吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/fghdoDelete", {id: id})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.adminPageData()
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
},
delUser(row) {
let data = {
userid: row.id,
dbtid: this.adminPageForm.dbtid,
jdhid: this.pageForm.jdhid,
roleid: row.roleid
}
this.$confirm('确定要移除该团长或副团长吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/userDoDelete", data)
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.getTzList()
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
},
async jdhChange(id) {
this.pageForm.dbtid = ''
this.delegations = await getDbt(id)
await this.undertakeUnitTree()
this.pageData()
},
handleNodeClick(data, node) {
this.node = node
this.checkData = data
this.dbPageForm.dbtid = data.id
this.adminPageForm.dbtid = data.id
this.adminPageForm.flag = this.activeName === 'one'
this.adminPageData()
this.getTzList()
this.dbData()
},
handleTabClick(tab) {
if (tab.name === 'one') {
this.butTitle = '设置代表团组成单位'
this.adminPageForm.flag = tab.name === 'one'
this.adminPageData()
} else if (tab.name === 'two') {
this.butTitle = '设置代表团组成单位'
this.adminPageForm.flag = tab.name === 'two'
this.getTzList()
} else {
this.butTitle = '设置团长/副团长'
this.adminPageForm.flag = tab.name === 'three'
this.dbData()
}
},
adminFilterMethod(query, item) {
return item.unionname.indexOf(query) > -1;
},
//查询没有被代表团设置的组成基层工会
async fghdoAdd(dbtid) {
const jdhid = this.pageForm.jdhid
this.fghFormData.jdhid = jdhid
this.fghFormData.dbtid = dbtid
const {data} = await $.get(loc() + "/findfgh", {jdhid, dbtid})
if (data) {
this.fghData = data.data
this.fghFormData.fghValue = data.value.map(v => {
return v.fghid
})
}
this.fghDialogVisible = true
},
//查询该代表团下的没有被设为团长副团长的代表
async openUser(dbtid) {
this.userFormData = {}
this.userFormData.dbtid = dbtid
this.userFormData.jdhid = this.pageForm.jdhid
const {data} = await $.get(loc() + "/queryUser", {
dbtid: dbtid,
jdhid: this.pageForm.jdhid
})
if (data) {
this.userList = data
}
this.userDialogVisible = true
},
//添加分工会
async dofgh() {
this.fghSubLoading = true
const data = clone(this.fghFormData)
data.fghValue = JSON.stringify(data.fghValue)
const resp = await $.post(loc() + "/fghdoAdd", data)
requestLaterFun(resp, () => {
this.fghDialogVisible = false
this.pageData()
this.adminPageData()
this.$notify.success({title: '成功', message: resp.msg});
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
}, () => {
this.fghSubLoading = false
})
},
async undertakeUnitTree() {
const {data} = await $.get(loc() + "/undertakeUnionTree", {jdhid: this.pageForm.jdhid})
this.treeData = [data]
this.pageData()
},
//该代表团下的组成基层工会
async adminPageData() {
const resp = await $.post(loc() + "/adminPageData", this.adminPageForm)
requestLaterFun(resp, () => {
this.adminTableData = resp.data;
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
},
//获取团长副团长
async getTzList() {
const resp = await $.get(loc() + '/getTzList', this.adminPageForm)
requestLaterFun(resp, () => {
this.TzTableData = resp.data;
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
},
//添加团长或者副团长
doAddTz: throttle(async function () {
if (this.userFormData.userid == null) {
this.$notify({
title: '警告',
message: '请先选择团长或副团长',
type: 'warning'
});
return
}
this.userFormData.num = this.leaderInfo.sf
const resp = await $.post(loc() + "/doAddTz", this.userFormData)
requestLaterFun(resp, () => {
this.getTzList()
this.$notify.success({title: '成功', message: resp.msg});
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
}, () => {
this.userList = []
this.userFormData.userid = ''
this.userDialogVisible = false
})
}, 2000),
openFgh(row) {
const {dbtname} = row
const dbtid = row.id
this.setzcfghdbtname = dbtname
this.fghdoAdd(dbtid)
},
userChange(val) {
const sf = this.leaderInfo.sf
this.leaderInfo = this.userList.find(v => {
if (v.id === val) {
return v
}
})
this.$set(this.leaderInfo, 'sf', sf)
},
openTz(row) {
this.leaderInfo = {
mobile: '',
dwname: '',
sf: '2'
}
const dbtid = row.id
this.openUser(dbtid)
},
async getUnits() {
this.unitList = await getUnit(this.dbPageForm.unionid)
}
},
async created() {
this.jdhList = await getOpenJdh()
if (this.jdhList.length > 0) {
this.pageForm.jdhid = this.jdhList[0].id
this.delegations = await getDbt(this.jdhList[0].id)
this.pageData()
}
await this.getUnits()
this.unionList = await getUnion()
await this.undertakeUnitTree()
await this.getRepresentativeRoleOptions()
}
})
</script>
<!--#
}
#-->