Files
2026-09-20 15:46:34 +08:00

791 lines
35 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"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<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">
<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>
<div class="btn-group tool-button mt5">
<el-select 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">
<el-select v-model="pageForm.unitId" filterable clearable
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-select 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">
<el-select v-model="pageForm.dbsf" clearable placeholder="请选择代表身份">
<el-option v-for="i in representativeRoleOptions" :label="i.label"
:key="i.value"
:value="i.value"></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>
</el-card>
<el-card shadow="never" class="mt20">
<table-tool label="代表列表" :app="this">
<template #func>
<el-button @click="doDeleteUserList" plain size="small" type="danger"
icon="el-icon-delete"> 批量删除
</el-button>
<el-button @click="openAdd" size="small" icon="ti-plus" type="success"
plain>
添加代表
</el-button>
<el-button @click="openSetXld" icon="el-icon-sort" size="small" plain
type="warning">代表调整
</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">
<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"
show-overflow-tooltip
header-align="center"
v-for="column in tableColumns"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable">
</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-row>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<member ref="memberInfo" :id="userId" view></member>
</template>
</guava>
<!-- <tree-layout>
<template #tree>
<div style="padding: 15px;">
<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>
<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 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
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" v-if="node.level!=2">
<el-select 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">
<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 d">
<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-row class="el-table-container">
<el-table :data="tableData" row-key="id" @selection-change="handleSelectionChange"
ref="multipleTable">
<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>
</el-row>
&lt;!&ndash;#include("/layouts/pagination.html"){}#&ndash;&gt;
</el-card>
</template>
</tree-layout>-->
<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="roleId" label="代表类型">
<el-radio v-model="formData.roleId" :label="i.value" border v-for="i in representativeRoleOptions">{{i.label}}</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>
<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.gdh_id" filterable placeholder="届次"
style="width: 100%"
@change="xldJdhChange">
<el-option v-for="item in gdhList" :key="item.id"
:label="item.gdhAllName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="dbtid" label="代表团">
<el-select v-model="representativeInfo.dbt_id" filterable style="width: 100%">
<el-option v-for="i in delegations" :label="i.dbt_name" :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>
</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 {
modifyDialogVisible: false,
representativeInfo: {},
representativeRoleOptions: [],
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: 'age', label: '年龄', sortable: true},
{prop: 'mobile', label: '联系方式'},
{prop: 'dbt_name', label: '代表团', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'gdhAllName', 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']}],
roleId: [{required: true, message: '请选择代表类型', trigger: ['change', 'blur']}]
},
userId: null,
}
},
methods: {
openView(row) {
const {userId} = row
this.userId = userId
this.$refs.memberInfo.getUserInfo()
this.$refs.guava.view()
},
doDbDelete(row) {
const data = {
userId: row.userId,
dbt_id: row.dbt_id,
roleId: row.roleId,
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("/platform/workersCongress/delegate/userDoDelete", data)
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.doSearch()
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
},
async modify(id) {
const resp = await $.get('/platform/workersCongress/delegate/representativeInfo/' + id)
AssertResponseMessage2({
response: resp,
success: ({data}) => {
this.modifyUnitList = this.allUnitList;
this.representativeInfo = data
this.modifyDialogVisible = true
},
})
},
async modifying() {
const response = await $.post('/platform/workersCongress/delegate/modifyRepresentativeInfo', this.representativeInfo)
AssertResponseMessage({
response,
success: () => {
this.modifyDialogVisible = false
this.doSearch()
}
})
},
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.id)
}
},
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() {
if (this.selection.length === 0) {
this.$notify.warning({title: '警告', message: "请在左侧勾选需要删除的代表"});
return
}
this.$confirm('确定要移除勾选的代表吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDeleteUserList", {
userData: JSON.stringify(this.selection),
gdh_id: this.pageForm.gdh_id
})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.$refs.multipleTable.clearSelection();
this.pageData()
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
},
/*删除一个*/
delUser(row) {
const data = {
userId: row.userId,
roleId: row.roleId,
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)
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.pageData()
}, () => {
this.$notify.error({title: '失败', message: 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,
roleId: this.formData.roleId
})
closeLoadingFunc(loading, resp, async () => {
this.pageData()
this.addDialogVisible = false
}, (data, msg) => {
this.$message.error(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 getUnit(this.pageForm.unionId)
},
async getRepresentativeRoleOptions() {
const {
code,
data
} = await $.get('/platform/workersCongress/delegate/representativeRoleOptions')
if (!code) {
this.representativeRoleOptions = data
}
},
},
async created() {
this.gdhList = await getOpenGdh()
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 getUnion()
this.getUnitList()
await this.undertakeUnitTree()
await this.getRepresentativeRoleOptions()
}
})
</script>
<!--#
}
#-->