Files
2026-09-08 19:49:21 +08:00

566 lines
24 KiB
HTML
Raw Permalink 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-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="jdhChange">
<el-option
v-for="item in gdhList"
:key="item.id"
:label="item.gdhAllName"
: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.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 style="padding: 0 10px">
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" clearable
v-model="pageForm.searchKeyword">
<el-select v-model="pageForm.searchName" slot="prepend"
placeholder="查询类型"
style="width: 80px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button mt5" v-if="node.level!=2">
<el-select style="width: 200px" v-model="pageForm.dbt_id" filterable clearable placeholder="请选择代表团">
<el-option
v-for="item in delegations"
:key="item.id"
:label="item.dbt_name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5" v-if="node.level!=2">
<el-select style="width: 200px" v-model="pageForm.unionId" filterable clearable @change="getUnitList"
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 mt5" v-if="node.level!=2">
<el-select v-model="pageForm.unitId" filterable clearable
style="width: 200px" placeholder="请选择单位">
<el-option
v-for="item in unitList"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
<div class="pull-right offscreen-right mt5">
<el-button @click="openAdd"><i class="ti-plus"></i> 添加代表</el-button>
</div>
<div class="pull-right offscreen-right mt5 mr10">
<el-button @click="openSetXld"><i class="el-icon-sort" style="transform: rotate(90deg);"></i>代表调整
</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool :label="label" :app="this">
<template #func>
<el-button @click="doDeleteUserList" plain size="small" type="primary"
v-if="selection.length>0"><i class="el-icon-delete"></i>批量删除
</el-button>
<el-button size="small" type="primary" plain @click="doExcel"><i
class="el-icon-s-promotion"></i> 导出Excel
</el-button>
</template>
</table-tool>
<el-table :data="tableData" row-key="id" @selection-change="handleSelectionChange"
ref="multipleTable" height="584">
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
<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="delUser(row)">
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</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="dbt_id" label="代表团名称">
<el-select v-model="formData.dbt_id" filterable clearable placeholder="请选择代表团" @change="getUserDbChange"
style="width: 100%;">
<el-option
v-for="item in delegations"
:key="item.id"
:label="item.dbt_name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="userId" label="工代会代表">
<el-select v-model="formData.userId" filterable clearable multiple placeholder="请选择工代会代表"
style="width: 100%;">
<el-option
v-for="item in dbList"
:key="item.id"
:label="item.username+''+item.loginname+''+item.unionname+''+item.unitname+''"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item prop="identity" label="代表类型">
<el-radio v-model="formData.identity" label="1" border>正式代表</el-radio>
<el-radio v-model="formData.identity" label="2" border>列席代表</el-radio>
<el-radio v-model="formData.identity" label="3" border>特邀代表</el-radio>
</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-dialog :visible.sync="xldDialogVisible" title="代表名单调整">
<el-select @change="xldJdhChange" v-model="xldFormData.gdhid">
<el-option :label="item.gdhAllName" :value="item.id" v-for="item in gdhList"></el-option>
</el-select>
<div class="pull-right offscreen-right">
<el-select :loading="loading" :remote-method="remotexldMethod"
filterable placeholder="请输入工号和姓名"
remote reserve-keyword v-model="xldFormData.userid">
<el-option :key="u.id" :label="u.username+'-'+u.loginname"
:value="u.id" v-for="u in xldUserList"></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="unitname"></el-table-column>
<el-table-column label="代表团">
<template slot-scope="scope">
<el-select clearable filterable v-model="scope.row.dbtid">
<el-option :label="d.dbt_name" :value="d.id" v-for="d in delegations"></el-option>
</el-select>
</template>
</el-table-column>
</el-table>
<span class="dialog-footer" slot="footer">
<el-button @click="xldDialogVisible = false">取 消</el-button>
<el-button @click="doSetxlddbt" type="primary">确 定</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 {
loading: false,
xldTableData: [],
xldFormData: {
userid: ""
},
xldUserList: [],
node: {
level: 1
},
label: "代表列表",
selection: [],
unionList: [],
unitList: {},
dbList: [],
delegations: [],
checkData: {
id: ""
},
treeData: [],
gdhList: [],
singleTableData: [],
pageForm: {
jdh_id: "",
unitId: "",
unionId: "",
searchName: "u.username",
},
defaultProps: {
children: 'childrens',
label: 'dbtname',
disabled: 'disabled'
},
tableColumns: [
{prop: 'loginname', label: '工号', sortable: true},
{prop: 'username', label: '姓名'},
{prop: 'sex', label: '性别', sortable: true},
{prop: 'mobile', label: '联系方式'},
{prop: 'dbt_name', label: '代表团', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'roleName', label: '代表身份', sortable: true},
],
addDialogVisible: false,
xldDialogVisible: false,
rules: {
dbt_id: [{required: true, message: '请选择代表团', trigger: ['change', 'blur']}],
userId: [{required: true, message: '请选择代表', trigger: ['change', 'blur']}],
identity: [{required: true, message: '请选择代表类型', trigger: ['change', 'blur']}]
},
}
},
methods: {
async doSetxlddbt() {
let flag = true
for (let o of this.xldTableData) {
if (!('dbtid' in o)) {
flag = false
break
}
}
if (!flag) {
this.$message.info('请先选择要分配的代表团!')
return
}
const data = await $.post(loc() + '/fpXldToDbt', {
user: this.xldTableData,
gdhid: this.xldFormData.gdhid
})
if (data.code === 0) {
this.$message.success(data.msg)
this.xldTableData = []
this.pageData()
}
},
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 = []
},
async remotexldMethod(key) {
if (this.xldFormData.gdhid === '') {
this.$message.info('请先选择工代会!')
return
}
if (key !== '') {
this.loading = true;
const {data} = await $.get(loc() + '/queryXldUser', {
query: key,
gdhid: this.xldFormData.gdhid
})
this.xldUserList = data
this.loading = false;
}
},
async xldJdhChange(jdhid) {
this.delegations = await getDbt(jdhid)
},
async openSetXld() {
if (this.gdhList && this.gdhList.length > 0) {
this.xldFormData.gdhid = this.gdhList[0].id
}
this.$set(this.xldFormData, "userid", "")
this.xldUserList = []
this.xldTableData = []
this.xldDialogVisible = true
},
doExcel() {
if (this.pageForm.gdh_id) {
const current_gdh = this.gdhList.find(v => v.id === this.pageForm.gdh_id)
location.href = '/platform/workersCongress/delegate/doExcel?gdhId=' + this.pageForm.gdh_id + '&dbtId=' + this.checkData.id + '&gdhAllName=' + current_gdh.gdhAllName
}
},
/*点击多选框*/
handleSelectionChange(val) {
this.selection = val
},
/*删除多个*/
doDeleteUserList() {
this.$confirm('确定要移除勾选的代表吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDeleteUserList", {
userData: JSON.stringify(this.selection),
dbt_id:this.pageForm.dbt_id,
gdh_id: this.pageForm.gdh_id
})
if(resp.code===0){
this.notifySuccess(resp.msg)
this.$refs.multipleTable.clearSelection();
this.pageData()
}else{
this.notifyWarning(resp.msg)
}
}
}
});
},
/*删除一个*/
delUser(row) {
const data = {
userId: row.userId,
dbt_id: row.dbt_id,
gdh_id: row.gdh_id,
identity: row.identity
}
this.$confirm('确定要移除该代表吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/userDoDelete", data)
if(resp.code===0){
this.notifySuccess(resp.msg)
this.pageData()
}else{
this.notifyWarning(resp.msg)
}
}
}
});
},
doAdd() {
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() + '/doAdd', {
userData: JSON.stringify(this.formData.userId),
gdh_id: this.pageForm.gdh_id,
dbt_id: this.formData.dbt_id,
identity: this.formData.identity
})
loading.close()
if(resp.code===0){
this.pageData()
this.addDialogVisible = false
}else{
this.notifyWarning(resp.msg)
}
}
})
},
openAdd() {
if (this.node.level == 2) {
this.delegations = this.delegations.filter(v => v.id == this.checkData.id)
this.formData.dbt_id = this.delegations[0].id
this.getUserDbChange()
}
this.addDialogVisible = true
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
async getUserDbChange() {
const {data} = await $.get(loc() + "/getUserDbChange", {
gdh_id: this.pageForm.gdh_id,
dbt_id: this.formData.dbt_id
})
this.dbList = data
},
/*查询代表团*/
async undertakeUnitTree() {
const {data} = await $.get("/platform/workersCongress/delegation/undertakeUnionTree", {gdh_id: this.pageForm.gdh_id})
this.treeData = [data]
},
/*点击左侧代表团触发*/
async handleNodeClick(data, node) {
this.$set(this.pageForm, "dbt_id", "")
this.node = node
this.checkData = data
this.label = "代表列表"
if (node.level == 2) {
this.label = data.dbt_name + "代表"
this.$set(this.pageForm, "dbt_id", data.id)
await this.getUnitList()
}
this.pageData();
this.delegations = await getGdhDbt(this.pageForm.gdh_id)
},
/*点击届次*/
async jdhChange(id) {
this.pageForm.dbt_id = ''
this.delegations = await getGdhDbt(id)
await this.undertakeUnitTree()
this.pageData();
},
async getUnitList() {
this.unitList = await getUnits(this.pageForm.unionId)
},
},
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.unionList = await getUnions()
this.getUnitList()
await this.undertakeUnitTree()
}
})
</script>
<!--#
}
#-->