Files
UNION_NSI/target/classes/views/platform/retired/group/manage.html
T
2026-09-08 19:49:21 +08:00

487 lines
21 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__body {
height: calc(100% - 40px);
}
.el-transfer-panel__list {
height: 100%;
}
.v-tree-layout-left {
overflow: unset !important;
}
.v-tree-layout-left .v-tree {
width: 100%;
height: calc(100vh - 170px);
overflow-y: auto;
}
.v-tree:hover::-webkit-scrollbar {
width: 3px;
background-color: transparent;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
display: flex;
align-items: center;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::-webkit-scrollbar {
/*width: 3px;*/
/*background-color: transparent;*/
display: none;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 10px;
}
</style>
<div id="app" v-cloak>
<guava>
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-input
@input="(val)=>{$refs.tree.filter(val)}"
placeholder="输入关键字进行查找" clearable
v-model="filterText">
</el-input>
</div>
<el-tree ref="tree" :data="treeData" v-loading="treeLoading" node-key="id"
:props="{label:'groupName'}"
:expand-on-click-node="false"
:default-expanded-keys="['1']"
@node-click="handleNodeClick" accordion
highlight-current :filter-node-method="filterNode">
<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.label }}
</div>
<div v-if="node.level==2" style="font-size: 15px" :title="data.name" class="v-node">
<i class="el-icon-school"></i>
&nbsp; {{ data.label }}
</div>
</div>
</el-tree>
</template>
<template>
<div style="padding: 0 10px">
<el-tabs v-model="tabActive" @tab-click="doSearch" type="card" style="box-shadow: none">
<el-tab-pane v-if="currentNode.level===1" label="小组信息" name="groupInfo"></el-tab-pane>
<el-tab-pane v-if="currentNode.level===2" label="组成单位"
name="componentUnit"></el-tab-pane>
<el-tab-pane v-if="currentNode.level===2" label="小组人员" name="userInfo"></el-tab-pane>
</el-tabs>
<el-card shadow="never">
<div class="btn-group tool-button">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch">
</el-input>
</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 v-if="tabActive==='groupInfo' && ${@shiro.hasAnyRoles('ltbzr,ltbfzr,ltbms,sysadmin')}" type="primary" icon="el-icon-plus"
@click="openAddGroup">新增小组
</el-button>
<el-button v-if="tabActive==='componentUnit' && ${@shiro.hasAnyRoles('ltbzr,ltbfzr,ltbms,sysadmin')}" type="primary" icon="el-icon-plus"
@click="openAddComponentUnit">新增组成单位
</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<div id="secondaryTableWrap" data-bottom="80">
<el-table :data="groupTableData" height="100%" v-if="tabActive==='groupInfo'">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="groupName" label="小组名称"></el-table-column>
<el-table-column prop="groupCode" label="小组代码"></el-table-column>
<el-table-column label="操作" width="200px" v-if="${@shiro.hasAnyRoles('ltbzr,ltbfzr,ltbms,sysadmin')}">
<template scope="{row}">
<el-button size="mini"
@click="groupDialogVisible=true;groupFormData={...row}">
编辑
</el-button>
<el-button size="mini" type="danger" @click="deleteGroup(row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-table :data="componentUnitTableData" height="100%"
v-else-if="tabActive==='componentUnit'">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="name" label="单位名称"></el-table-column>
<el-table-column prop="unitcode" label="单位代码"></el-table-column>
</el-table>
<el-table :data="userTableData" height="100%" v-else-if="tabActive==='userInfo'">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="loginname" label="工号"></el-table-column>
<el-table-column prop="username" label="姓名"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column prop="birthday" label="出生年月"></el-table-column>
<el-table-column prop="mobile" label="联系电话"></el-table-column>
<el-table-column prop="unitname" label="所属单位"
show-overflow-tooltip></el-table-column>
<el-table-column prop="unionname" label="所属工会"
show-overflow-tooltip></el-table-column>
<el-table-column prop="roleName" label="身份"></el-table-column>
<el-table-column label="操作" width="100px" v-if="${@shiro.hasAnyRoles('ltbzr,ltbfzr,ltbms,sysadmin')}">
<template scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{action:setGroupLeader,value:row}"
v-if="row.roleCode==null">
设为组长
</el-dropdown-item>
<el-dropdown-item :command="{action:removeGroupLeader,value:row}"
v-if="row.roleCode!=null">
取消组长
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</div>
<el-row class="el-pagination-container" style="margin-bottom: 0px">
<el-pagination
@size-change="(val)=>{pageForm.pageSize=val;pageData()}"
@current-change="(val)=>{pageForm.pageNumber=val;pageData()}"
:current-page="pageForm.pageNumber"
:page-sizes="[5,10, 20, 30, 50]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="pageForm.totalCount">
</el-pagination>
</el-row>
</el-card>
</div>
</template>
</tree-layout>
</el-card>
</guava>
<el-dialog :visible.sync="groupDialogVisible" title="小组">
<el-form :model="groupFormData" label-width="120px" ref="form">
<el-form-item label="小组名称" prop="groupName"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-input v-model="groupFormData.groupName" maxlength="20"></el-input>
</el-form-item>
<el-form-item label="小组代码" prop="groupCode"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-input-number v-model="groupFormData.groupCode"></el-input-number>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="groupDialogVisible = false">取消</el-button>
<el-button type="primary" @click="doSetGroup">确定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="componentUnitDialogVisible" title="组成单位">
<el-transfer v-model="groupComponentUnit" :data="groupComponentUnitLeft"
ref="componentUnitTransfer"
:props="{
key: 'id',
label: 'name'
}"
></el-transfer>
<span slot="footer" class="dialog-footer">
<el-button @click="componentUnitDialogVisible = false">取消</el-button>
<el-button type="primary" @click="doSetComponentUnit">确定</el-button>
</span>
</el-dialog>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
},
data() {
return {
treeLoading: false,
treeData: [],
filterText: null,
currentData: null,
currentNode: {level: 1},
tabActive: 'groupInfo',
//小组table
groupTableData: [],
groupDialogVisible: false,
groupFormData: {
groupName: null,
groupCode: null,
id: null
},
//组成单位table
componentUnitTableData: [],
componentUnitDialogVisible: false,
groupComponentUnit: [],
groupComponentUnitLeft: [],
userTableData: []
}
},
methods: {
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
pageData() {
if (this.tabActive === 'groupInfo') {
this.groupPageData()
} else if (this.tabActive === 'componentUnit') {
this.componentUnitPageData()
} else if (this.tabActive === 'userInfo') {
this.getGroupUser()
}
},
handleNodeClick(data, node) {
this.currentData = data
this.currentNode = node
if (node.level === 1) {
this.tabActive = 'groupInfo'
this.groupPageData()
} else if (node.level === 2) {
this.tabActive = 'componentUnit'
this.componentUnitPageData()
}
},
filterNode(value, data, node) {
if (!value) return true
return data.label.includes(value)
},
//左侧树数据
async getTree() {
const resp = await $.post(loc() + '/getTree')
if (resp.code === 0) {
this.treeData = resp.data
if (this.$refs.tree && this.$refs.tree.root.childNodes) {
this.currentNode = this.$refs.tree.root.childNodes[0]
}
} else {
this.notifyWarning(resp.msg)
}
},
//打开新增小组模态框
openAddGroup() {
this.groupDialogVisible = true
this.$nextTick(() => {
this.groupFormData = {
groupName: null,
groupCode: null,
id: null
}
this.$refs.form.resetFields()
})
},
//新增、编辑小组
async doSetGroup() {
const resp = await $.post(loc() + '/doSetGroup', this.groupFormData)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.groupDialogVisible = false
this.getTree()
this.groupPageData()
} else {
this.notifyWarning(resp.msg)
}
},
//小组分页数据
async groupPageData() {
const resp = await $.post(loc() + '/groupPageData', this.pageForm)
if (resp.code === 0) {
this.groupTableData = resp.data.list
this.pageForm.totalCount = resp.data.totalCount
}
},
//删除小组
deleteGroup(id) {
this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async res => {
const resp = await $.post(loc() + '/deleteGroup', {id})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.getTree()
this.groupPageData()
} else {
this.notifyWarning(resp.msg)
}
})
},
//组成单位分页数据
async componentUnitPageData() {
const resp = await $.post(loc() + '/componentUnitPageData', {
...this.pageForm,
groupId: this.currentData.id
})
if (resp.code === 0) {
this.componentUnitTableData = resp.data.list
this.pageForm.totalCount = resp.data.totalCount
}
},
openAddComponentUnit() {
this.componentUnitDialogVisible = true
const groupId = this.currentData.id
this.getNotSetUnit(groupId)
this.getGroupComponentUnit(groupId)
if (this.$refs.componentUnitTransfer) {
this.$refs.componentUnitTransfer.clearQuery('left')
this.$refs.componentUnitTransfer.clearQuery('right')
}
},
//小组组成单位
async getGroupComponentUnit(groupId) {
const resp = await $.post(loc() + '/groupComponentUnit', {groupId})
if (resp.code === 0) {
this.groupComponentUnit = resp.data
}
},
async getNotSetUnit(groupId) {
const resp = await $.post(loc() + '/notSetUnit', {groupId})
if (resp.code === 0) {
this.groupComponentUnitLeft = resp.data
}
},
async doSetComponentUnit() {
const params = {
groupId: this.currentData.id,
units: JSON.stringify(this.groupComponentUnit)
}
const resp = await $.post(loc() + '/doSetComponentUnit', params)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.componentUnitDialogVisible = false
this.componentUnitPageData()
} else {
this.notifyWarning(resp.msg)
}
},
async getGroupUser() {
const resp = await $.post(loc() + '/groupUser', {...this.pageForm, groupId: this.currentData.id})
if (resp.code === 0) {
this.userTableData = resp.data.list
this.pageForm.totalCount = resp.data.totalCount
} else {
this.notifyWarning(resp.msg)
}
},
setGroupLeader(user) {
this.$confirm('您确定要将' + user.username + '设为小组组长吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post(loc() + '/setGroupLeader', {
userId: user.id,
groupId: this.currentData.id
})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.getGroupUser()
} else {
this.notifyWarning(resp.msg)
}
})
},
removeGroupLeader(user) {
this.$confirm('您确定要将' + user.username + '设为小组组员吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post(loc() + '/removeGroupLeader', {
userId: user.id,
groupId: this.currentData.id
})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.getGroupUser()
} else {
this.notifyWarning(resp.msg)
}
})
}
},
async mounted() {
//动态改变table高度
await httpVueLoader('/components/plugins/Guava.vue', 'Guava')()
await httpVueLoader('/components/plugins/TreeLayout.vue', 'tree-layout')()
calcTableHeight(['secondaryTableWrap'])
window.onresize = () => {
calcTableHeight(['secondaryTableWrap'])
}
},
created() {
this.getTree()
this.groupPageData()
console.log(${@shiro.hasAnyRoles('ltbzr,ltbfzr,ltbms,sysadmin')})
}
})
</script>
<!--#
}
#-->