Files
UNION_HUTB/target/classes/views/platform/jdh/zzjg/delegation.html
T
2026-09-09 09:14:28 +08:00

781 lines
35 KiB
HTML

<!--#
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-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<div id="app" v-cloak>
<guava>
<tree-layout style="height: calc(100vh - 70px)">
<template #tree>
<div style="padding: 15px;">
<el-select @change="jdhChange" filterable placeholder="请选择教代会" v-model="pageForm.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in jdhList">
</el-option>
</el-select>
</div>
<el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"
accordion class="filter-tree"
default-expand-all highlight-current ref="tree">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div class="v-node" style="font-size: 16px;" v-if="node.level==1">
<i class="el-icon-office-building"></i>&nbsp;{{ data.dbtname }}
</div>
<div class="v-node" style="font-size: 14px" v-if="node.level==2">
<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 class="pl10 pr10" v-if="node.level==1">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-select clearable filterable placeholder="请选择代表团" v-model="pageForm.dbtid">
<el-option
:key="item.id"
:label="item.dbtname"
:value="item.id"
v-for="item in delegations">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
</div>
<div class="pull-right offscreen-right">
<el-button @click="openAdd" type="primary"><i class="ti-plus"></i> 添加代表团</el-button>
</div>
</el-card>
<el-dialog :visible.sync="addDialogVisible" title="添加代表团" width="40%">
<el-form :model="formData" :rules="rules" label-width="100px" ref="addForm">
<el-form-item label="所属教代会" prop="jdhid">
<el-select @change="addJdhChange" placeholder="选择教代会" style="width: 100%"
v-model="formData.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in jdhList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="代表团名称" prop="dbt">
<el-select filterable multiple placeholder="请选中代表团名称" style="width: 100%"
v-model="formData.dbt">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in dbtList">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button @click="doAdd" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-card class="mt20" shadow="never">
<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" label="代表团名称"
prop="dbtname"></el-table-column>
<el-table-column align="center" header-align="center" label="代表团编码"
prop="dictcode"></el-table-column>
<el-table-column align="center" header-align="center" label="所属教代会"
prop="jdhallname"></el-table-column>
<el-table-column align="center" header-align="center" label="创建时间" prop="cjsj">
<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 class="pl10 pr10" v-if="node.level==2">
<el-tabs @tab-click="handleTabClick" type="card" v-model="activeName">
<el-tab-pane label="代表" name="one">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-input clearable placeholder="请输入内容"
v-model="dbPageForm.searchKeyword">
<el-select placeholder="查询类型" slot="prepend"
style="width: 120px;"
v-model="dbPageForm.searchName">
<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 @change="getUnits" clearable filterable placeholder="请选择工会"
v-model="dbPageForm.unionid">
<el-option
:label="item.unionname"
:value="item.id"
v-for="item in unionList">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-select clearable filterable placeholder="请选择单位"
v-model="dbPageForm.unitid">
<el-option
:label="item.name"
:value="item.id"
v-for="item in unitList">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-button @click="dbDoSearch" icon="el-icon-search"
type="primary"></el-button>
</div>
</el-card>
<el-table :data="dbTableData" class="mt20">
<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 label="工会" prop="unionname" sortable></el-table-column>
<el-table-column label="单位" prop="unitname" sortable></el-table-column>
<el-table-column label="代表身份" prop="rolename" sortable></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="设置组成基层工会" name="two">
<el-card class="text-right" shadow="never">
<el-button @click="fghdoAdd(adminPageForm.dbtid)" type="primary">
{{butTitle}}
</el-button>
</el-card>
<el-table :data="adminTableData" class="mt20">
<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 @click="fghdoDelete(row)" circle icon="el-icon-delete" plain
size="mini"
type="danger">
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="设置团长/副团长" name="three">
<el-card class="text-right" shadow="never">
<el-button @click="openUser(adminPageForm.dbtid)" type="primary">
{{butTitle}}
</el-button>
</el-card>
<el-table :data="TzTableData" class="mt20" height="300">
<el-table-column label="工号" prop="loginname" sortable></el-table-column>
<el-table-column label="姓名" prop="username" sortable></el-table-column>
<el-table-column label="单位" prop="dwname" sortable></el-table-column>
<el-table-column label="电话" prop="mobile"></el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="身份" prop="rolename">
<template slot-scope="scope">
<span class="text-primary" v-if="scope.row.rolename==='代表团团长'">团长</span>
<span class="text-info" v-if="scope.row.rolename==='代表团副团长'">副团长</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template scope="{row}">
<el-button @click="delUser(row)" circle icon="el-icon-delete" plain size="mini"
type="danger">
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</template>
</tree-layout>
</guava>
<el-dialog :title="title" :visible.sync="fghDialogVisible" width="55%">
<div style="width: 100%;">
<el-transfer :data="fghData" :filter-method="adminFilterMethod"
:props="{key: 'id',label: 'unionname'}"
:titles="['剩余分工会', '代表团分工会']"
filterable
v-model="fghFormData.fghValue">
</el-transfer>
</div>
<span class="dialog-footer" slot="footer">
<el-button @click="fghDialogVisible = false">取 消</el-button>
<el-button :loading="fghSubLoading" @click="dofgh" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="userDialogVisible" title="设置团长副团长" width="40%">
<el-form label-width="100px">
<el-form-item label="届次" prop="jdhallname">
<el-select disabled style="width: 100%" v-model="pageForm.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in jdhList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="工号或姓名" prop="userid">
<el-select @change="userChange" filterable placeholder="请输入工号或姓名关键字"
style="width: 100%" v-model="userFormData.userid">
<el-option
:key="item.id"
:label="item.username+'('+item.loginname+')'"
:value="item.id"
v-for="item in userList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="联系方式" prop="mobile">
<el-input readonly v-model="leaderInfo.mobile"></el-input>
</el-form-item>
<el-form-item label="所属单位" prop="dwname">
<el-input readonly v-model="leaderInfo.dwname"></el-input>
</el-form-item>
<el-form-item label="身份" prop="sf">
<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 class="dialog-footer" slot="footer">
<el-button :disabled="userSubLoading" @click="doAddTz" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="deleDialogVisible" title="编辑代表团名称" width="30%">
<el-form :model="editForm" label-width="100px" ref="editForm">
<el-form-item :rules="{required: true, message: '请填写代表团名称', trigger: 'blur'}" label="代表团名称" prop="dbtName"
ref="aa">
<el-input v-model="editForm.dbtName"></el-input>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="deleDialogVisible = false">取 消</el-button>
<el-button @click="deleDo" type="primary">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue')
},
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']}]
},
deleData: {},
}
},
methods: {
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()
}
this.getUnits()
this.unionList = await getUnion()
await this.undertakeUnitTree()
}
})
</script>
<!--#
}
#-->