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

581 lines
25 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__list.is-filterable {
height: 300px;
}
.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 ref="guava">
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-select v-model="pageForm.gdh_id" filterable placeholder="请选择工代会代会" @change="gdhChange">
<el-option
v-for="item in gdhList"
:key="item.id"
:label="item.gdhAllName"
:value="item.id">
</el-option>
</el-select>
</div>
<el-tree class="v-tree" :data="treeData" :props="defaultProps"
default-expand-all :filter-node-method="filterNode" 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.dbt_name }}
</div>
<div v-if="node.level==2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.dbt_name==data.dbt_name"></i>
<i class="el-icon-help" v-else></i>
&emsp;{{ data.dbt_name }}
</div>
</div>
</el-tree>
</template>
<template>
<div v-if="node.level==1" style="padding:0 10px">
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-select v-model="pageForm.dbt_id" filterable clearable placeholder="请选择代表团"
@change="doSearch">
<el-option
v-for="item in delegations"
:key="item.id"
:label="item.dbt_name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="pull-right offscreen-right mt5">
<el-button @click="openAddDbt"><i class="ti-plus"></i> 新建代表团</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table :data="tableData" row-key="id" height="638"
ref="multipleTable">
<el-table-column
type="index" label="序号" header-align="center" align="center" width="100">
</el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable">
</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="delDbt(row.id)">
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
<div v-if="node.level==2" style="padding:0 10px">
<el-card shadow="never" v-if="['two','three'].includes(activeName)">
<el-row type="flex" justify="end">
<!-- <el-button type="primary" v-if="activeName==='two'" @click="unionOpenAdd()">设置组成基层工会</el-button>-->
<el-button type="primary" v-if="activeName==='two'" @click="unionOpenAdd()">设置组成基层单位</el-button>
<el-button type="primary" v-if="activeName==='three'" @click="openUserTz()">设置团长/副团长</el-button>
</el-row>
</el-card>
<el-card shadow="never" class="mt10">
<el-tabs v-model="activeName" type="card" @tab-click="handleTabClick">
<el-tab-pane label="代表" name="one">
<el-table highlight-current-row :data="dbTableData" size="small"
style="width: 100%;"
height="719">
<el-table-column label="序号" width="60px">
<template scope="scope"><span>{{scope.$index+1}}</span></template>
</el-table-column>
<el-table-column align="center" header-align="center" label="姓名" prop="username"
align="center"></el-table-column>
<el-table-column align="center" header-align="center" label="工号"
prop="loginname"
align="center"></el-table-column>
<el-table-column align="center" header-align="center" sortable prop="unionname"
label="工会"></el-table-column>
<el-table-column align="center" header-align="center" sortable prop="unitname"
label="单位"></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="设置组成基层单位" name="two">
<el-table highlight-current-row :data="unionTableData" size="small"
height="629"
style="width: 100%;">
<el-table-column label="序号" width="60px" type="index"></el-table-column>
<el-table-column label="基层单位名称" prop="unionname"
align="center"></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="设置团长/副团长" name="three">
<el-table :data="tzTableData" size="mini" height="629">
<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="unitname" 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>
</el-card>
</div>
</template>
</tree-layout>
</el-card>
</guava>
<el-dialog title="新建代表团" :visible.sync="addDialogVisible" width="40%" :close-on-click-modal="false">
<el-form :model="formData" ref="addForm" :rules="rules" label-width="100px">
<el-form-item prop="gdhAllName" label="所属教代会">
<el-input v-model="formData.gdhAllName" disabled placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item prop="dbt_id" label="代表团名称">
<el-select multiple v-model="formData.dbt_id" 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="doAddDbt">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="设置组成基层单位" :visible.sync="unionDialogVisible" width="55%">
<div style="width: 100%;">
<el-transfer :titles="['剩余单位', '代表团单位']" filterable
:props="{key: 'id',label: 'unionname'}"
:filter-method="unionFilterMethod"
v-model="unionFormData.unionValue"
:data="unionData">
</el-transfer>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="unionDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doUnion" :loading="unionSubLoading">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="设置团长副团长" :visible.sync="userDialogVisible" width="40%">
<el-form label-width="100px">
<el-form-item prop="gdhAllName" label="届次">
<el-input v-model="userFormData.gdhAllName" disabled></el-input>
</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+')'+item.unitname"
: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.unitname" 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 @click="userDialogVisible=false">取 消</el-button>
<el-button type="primary" @click="doAddTz">确 定</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 {
pageForm: {
gdh_id: ""
},
leaderInfo: {},
userList: [],
userFormData: {},
unionData: [],
unionFormData: {
unionValue: []
},
unionTableData: [],
unionDialogVisible: false,
userDialogVisible: false,
addDialogVisible: false,
unionSubLoading: false,
treeData: [],
dbTableData: [],
tzTableData: [],
checkData: {},
activeName: 'one',
label: "",
gdhList: [],
delegations: [],
dbtList: [],
node: {
level: 1
},
defaultProps: {
children: 'childrens',
label: 'dbtname',
disabled: 'disabled'
},
tableColumns: [
{prop: 'dbt_name', label: '代表团名称', sortable: true},
{prop: 'code', label: '代表团编号', sortable: true},
{prop: 'found_time', label: '创建时间', 所属教代会: true}
],
rules: {
dbt_id: [{required: true, message: '请选择代表团', trigger: ['change', 'blur']}]
},
}
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.dbt_name.indexOf(value) !== -1
return false
},
handleTabClick(tab) {
if (tab.name === 'one') {
this.butTitle = '设置组成基层工会'
this.getDbTableData()
} else if (tab.name === 'two') {
this.butTitle = '设置组成基层工会'
this.unionPageData()
} else {
this.butTitle = '设置团长/副团长'
this.getTzList()
}
},
handleNodeClick(data, node) {
this.node = node
this.checkData = data
if (node.level == 2) {
this.getDbTableData()
this.unionPageData()
this.getTzList()
}
},
gdhChange() {
this.undertakeUnitTree()
this.getDbTableData()
this.unionPageData()
this.getTzList()
},
async delUser(row) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.get(loc() + "/delUser", {
userId: row.id,
roleId: row.roleid,
gdh_id: this.pageForm.gdh_id
})
if (resp.code === 0) {
this.getTzList()
} else {
this.notifyWarning(resp.msg)
}
}
}
});
},
async undertakeUnitTree() {
const {data} = await $.get(loc() + "/undertakeUnionTree", {gdh_id: this.pageForm.gdh_id})
this.treeData = [data]
this.pageData()
},
openAddDbt() {
const gdhFind = this.gdhList.find(v => v.id = this.pageForm.gdh_id)
this.$set(this.formData, "gdhAllName", gdhFind.gdhAllName)
this.getDbtList()
this.addDialogVisible = true
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
async getDbtList() {
const resp = await $.post(loc() + "/getDbtFind", {gdh_id: this.pageForm.gdh_id})
this.dbtList = resp
},
doAddDbt() {
this.$refs['addForm'].validate(async (valid) => {
if (valid) {
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + '/doAddDbt', {
dbtList: JSON.stringify(this.formData.dbt_id),
gdh_id: this.pageForm.gdh_id
})
loading.close()
if (resp.code === 0) {
await this.undertakeUnitTree()
this.pageData()
this.addDialogVisible = false
this.delegations = await getGdhDbt(this.pageForm.gdh_id)
} else {
this.notifyWarning(resp.msg)
}
}
})
},
delDbt(id) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/delDbt", {dbt_id: id, gdh_id: this.pageForm.gdh_id})
if (resp.code === 0) {
this.undertakeUnitTree()
this.pageData()
this.delegations = await getGdhDbt(this.pageForm.gdh_id)
} else {
this.notifyWarning(resp.msg)
}
}
}
});
},
async unionOpenAdd() {
const {data} = await $.get(loc() + "/unionOpenAddList", {
gdh_id: this.pageForm.gdh_id,
dbt_id: this.checkData.id
})
this.unionData = data.data
this.unionFormData.unionValue = data.value.map(v => {
return v.union_id
})
this.unionDialogVisible = true
},
async doUnion() {
const resp = await $.post(loc() + "/doUnion", {
unionValue: JSON.stringify(this.unionFormData.unionValue),
gdh_id: this.pageForm.gdh_id,
dbt_id: this.checkData.id
})
await this.unionPageData()
this.unionDialogVisible = false
this.$notify.success({title: '成功', message: resp.msg});
},
async unionPageData() {
const resp = await $.post(loc() + "/unionPageData", {
gdh_id: this.pageForm.gdh_id,
dbt_id: this.checkData.id
})
this.unionTableData = resp
},
unionFilterMethod(query, item) {
return item.unionname.indexOf(query) > -1;
},
async getDbTableData() {
const resp = await $.post(loc() + "/getDbTableData", {
gdh_id: this.pageForm.gdh_id,
dbt_id: this.checkData.id
})
this.dbTableData = resp
},
async openUserTz() {
this.userFormData = {}
this.leaderInfo = {
mobile: '',
unitname: '',
sf: '2'
}
const aa = this.gdhList.find(v => v.id == this.pageForm.gdh_id)
this.$set(this.userFormData, 'gdhAllName', aa.gdhAllName)
const data = await $.get(loc() + "/queryUser", {
dbt_id: this.checkData.id,
gdh_id: this.pageForm.gdh_id
})
this.userList = data
this.userDialogVisible = true
},
userChange(val) {
this.leaderInfo = this.userList.find(v => {
if (v.id === val) {
return v
}
})
this.$set(this.leaderInfo, 'sf', 2)
},
async doAddTz() {
if (!this.userFormData.userid) {
this.$notify.warning({title: '警告', message: "请先选择需要添加的教职工"});
return
}
this.userFormData.sf = this.leaderInfo.sf
this.userFormData.dbt_id = this.checkData.id
this.userFormData.gdh_id = this.pageForm.gdh_id
const resp = await $.post(loc() + "/doAddTz", this.userFormData)
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.getTzList()
} else {
this.notifyWarning(resp.msg)
}
this.userList = []
this.userFormData.userid = ''
this.userDialogVisible = false
},
async getTzList() {
const resp = await $.get(loc() + '/getTzList', {
dbt_id: this.checkData.id,
gdh_id: this.pageForm.gdh_id
})
if (resp.code === 0) {
this.tzTableData = resp.data
} else {
this.notifyWarning(resp.msg)
}
},
},
async created() {
this.gdhList = await getGdh()
if (this.gdhList.length > 0) {
this.pageForm.gdh_id = this.gdhList[0].id
this.delegations = await getGdhDbt(this.gdhList[0].id)
}
this.pageData()
this.undertakeUnitTree()
}
})
</script>
<!--#
}
#-->