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

429 lines
18 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">
<template>
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-input
placeholder="输入关键字进行查找"
v-model="filterText">
</el-input>
</div>
<el-tree class="filter-tree" :data="treeData" :props="defaultProps"
default-expand-all ref="tree"
highlight-current accordion @node-click="handleNodeClick" :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.name }}
</div>
<div v-if="node.level==2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.name==data.name"></i>
<i class="el-icon-help" v-else></i>
&emsp;{{ data.name }}
</div>
<div v-if="node.level==3"
style="font-size: 14px" :title="data.name" class="v-node">
<i class="fa fa-dot-circle-o" v-if="checkData.name==data.name"></i>
<i class="fa fa-circle-o" v-else></i>
&nbsp; {{ data.name }}
</div>
</div>
</el-tree>
</template>
<template>
<div style="padding: 0 10px">
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-select v-model="pageForm.gdh_id" filterable clearable
placeholder="届次">
<el-option
v-for="item in gdhList"
:label="item.gdhAllName"
:key="item.id"
:value="item.id">
</el-option>
</el-select>
</div>
<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-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<template v-if="checkData.childrens&&checkData.childrens.length>0">
</template>
<template v-else="">
<table-tool :label="label" :app="this">
<template #func>
<el-button type="primary" size="medium" @click="openAdd"
v-if="node.level==2">
添加人员
</el-button>
</template>
</table-tool>
<el-table :data="tableData" row-key="id" height="584">
<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"
show-overflow-tooltip>
<template scope="{row}" v-if="column.prop=='status'">
<span class="text-primary" v-if="row.role_name">{{row.role_name}}</span>
<template v-else>
<span class="text-primary" v-if="row.status==1">委员</span>
<span class="text-primary" v-if="row.status==2">副主任</span>
<span class="text-primary" v-if="row.status==3">主任</span>
</template>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template scope="{row}">
<el-dropdown>
<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
@click.native="delUser(row.id)">删除
</el-dropdown-item>
<el-dropdown-item v-if="row.status!==3"
@click.native="updateStatus(row,3)"
class="text-primary">设置主任
</el-dropdown-item>
<el-dropdown-item v-if="row.status!==2"
@click.native="updateStatus(row,2)"
class="text-primary">设置副主任
</el-dropdown-item>
<el-dropdown-item v-if="row.status!==1"
@click.native="updateStatus(row,1)"
class="text-primary">设置委员
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</template>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
</template>
</tree-layout>
</el-card>
</template>
</guava>
<el-dialog title="添加人员" :visible.sync="addDialogVisible" width="40%" :close-on-click-modal="false">
<el-form label-width="100px" :model="formData" ref="addUserForm">
<el-form-item prop="gdhAllName" label="届次">
<el-input v-model="formData.gdhAllName" disabled></el-input>
</el-form-item>
<el-form-item prop="organization_name" label="机构名称">
<el-input v-model="formData.organization_name" disabled></el-input>
</el-form-item>
<el-form-item prop="user_id" label="工号或姓名"
:rules="[{required:true,message:'请输入工号和姓名',trigger: ['blur', 'change']}]">
<el-select
@change="userChange"
style="width: 100%"
v-model="formData.user_id"
value-key="id"
filterable
remote
reserve-keyword
placeholder="请输入工号或者姓名"
:remote-method="queryNotWyhUser">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.username+'-'+item.loginname+'-'+item.unionname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="联系方式">
<el-input v-model="formData.mobile" readonly></el-input>
</el-form-item>
<el-form-item prop="unitname" label="所属单位">
<el-input v-model="formData.unitname" readonly></el-input>
</el-form-item>
<el-form-item label="身份" prop="status" v-if="checkData.code==='gdhwyh1'">
<el-radio-group v-model="formData.status">
<el-radio-button label="1">&emsp;</el-radio-button>
<el-radio-button label="2">副主席</el-radio-button>
<el-radio-button label="3">常务副主席</el-radio-button>
<el-radio-button label="4">&emsp;</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="身份" prop="status" v-else>
<el-radio-group v-model="formData.status">
<el-radio-button label="1">&emsp;</el-radio-button>
<el-radio-button label="2">副主任</el-radio-button>
<el-radio-button label="3">&emsp;</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doAdd" v-loading="addLoading">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
addLoading: false,
label: "工代会机构设置",
gdhList: [],
userList: [],
node: {
level: 1
},
checkData: {
id: ""
},
addDialogVisible: false,
checkData: {},
treeData: [],
filterText: '',
treeLoading: false,
defaultProps: {
children: 'childrens',
label: 'name',
},
pageForm: {
searchName: "u.username"
},
tableColumns: [
{prop: 'loginname', label: '工号', sortable: true},
{prop: 'username', label: '姓名', sortable: true},
{prop: 'sex', label: '性别', sortable: true},
{prop: 'mobile', label: '手机', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'gdh_name', label: '届次', sortable: true},
{prop: 'organization_name', label: '所属机构', sortable: true},
{prop: 'status', label: '身份', sortable: true},
],
}
},
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
'guava': httpVueLoader('/components/plugins/Guava.vue'),
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
methods: {
async updateStatus(row, status) {
const resp = await $.get(loc() + "/updateStatus", {
status: status,
gdh_id: row.gdh_id,
organization_id: row.organization_id,
user_id: row.user_id
})
if(resp.code===0){
this.notifySuccess(resp.msg)
this.pageData()
}else{
this.notifyWarning(resp.msg)
}
},
async loadTree() {
this.treeLoading = true
const data = await $.get("/platform/workersCongress/Organization/getTreeData")
this.treeData = [data]
this.treeLoading = false
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
async handleNodeClick(data, node) {
this.node = node
this.checkData = data
this.pageForm.organization_id = data.id
this.pageData()
this.label = data.name
},
userChange() {
const aa = this.userList.find(v => v.id == this.formData.user_id)
this.$set(this.formData, "mobile", aa.mobile)
this.$set(this.formData, "unitname", aa.unitname)
},
async doAdd() {
const valid = await this.$refs.addUserForm.validate()
if (!valid) return
this.addLoading = true
const resp = await $.get(loc() + "/doAdd", this.formData)
this.addLoading = false
if (resp.code === 0) {
this.pageData()
this.addDialogVisible = false
this.formData = {}
} else {
this.notifyWarning(resp.msg)
}
},
async openAdd() {
const aa = this.gdhList.find(v => v.id = this.pageForm.gdh_id)
this.$set(this.formData, 'gdhAllName', aa.gdhAllName)
this.$set(this.formData, 'status', 1)
this.$set(this.formData, 'gdh_id', this.pageForm.gdh_id)
this.$set(this.formData, 'organization_id', this.checkData.id)
this.$set(this.formData, 'organization_name', this.checkData.name)
this.$set(this.formData, 'organization_code', this.checkData.code)
this.addDialogVisible = true
},
async delUser(id) {
this.$confirm('您确定要删除此用户吗!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/delUser", {id: id})
this.pageData()
}
}
})
},
async queryNotWyhUser(key) {
const data = await $.get(loc() + "/getUserList", {
gdh_id: this.pageForm.gdh_id,
organization_id: this.checkData.id,
key: key
})
this.userList = data.list
}
},
async created() {
this.gdhList = await getGdh()
if (this.gdhList.length > 0) {
this.$set(this.pageForm, "gdh_id", this.gdhList[0].id)
}
this.loadTree()
this.pageData()
}
})
</script>
<!--#
}
#-->