Files
UNION_HUTB/target/classes/views/platform/jdh/zzjg/zmwyh.html
T
2026-09-09 09:14:28 +08:00

445 lines
18 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-dialog .el-select {
width: 100% !important;
}
</style>
<div id="app" v-cloak>
<el-row class="header navbar bg-white shadow">
<div class="btn-group tool-button mt5">
<el-input @keyup.enter.native="doSearch" placeholder="请输入内容" v-model="pageForm.wyhname"></el-input>
</div>
<div class="btn-group tool-button mt5">
<el-select clearable placeholder="请选择教代会" v-model="pageForm.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in jdhList">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
</div>
<div class="pull-right offscreen-right mt5">
<el-button @click="openAdd" size="medium"><i class="ti-plus"></i> 添加委员会</el-button>
</div>
</el-row>
<el-row class="el-table-container">
<el-table :data="tableData" @sort-change='pageOrder'>
<el-table-column align="center" header-align="center" label="序号" type="index">
<template scope="scope"><span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column label="教代会" prop="jdhallname" sortable></el-table-column>
<el-table-column label="委员会名称" prop="wyhname"></el-table-column>
<el-table-column label="主任及联系方式" prop="zrmobile"></el-table-column>
<el-table-column label="工作职责" prop="gzzz" show-overflow-tooltip></el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="300">
<template slot-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="openView(row)">
查看
</el-dropdown-item>
<el-dropdown-item @click.native="openEdit(row)">
编辑
</el-dropdown-item>
<el-dropdown-item @click.native="doDelete(row)">
删除
</el-dropdown-item>
<el-dropdown-item @click.native="openEditUser(row)"
class="text-primary">成员管理
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</el-row>
<!--#include("/layouts/pagination.html"){}#-->
<el-dialog :visible.sync="addDialogVisible" title="添加委员会">
<el-form :model="formData" :rules="rules" label-width="120px" ref="addForm">
<el-form-item label="所属教代会" prop="jdhid">
<el-select @change="jdhChange" placeholder="选择教代会" v-model="formData.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in jdhList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="委员会名称" prop="name">
<el-select v-model="formData.wyh" value-key="id">
<el-option :key="i.id" :label="i.name" :value="i" v-for="i in wyhList"></el-option>
</el-select>
</el-form-item>
<el-form-item label="委员会工作职责" prop="gzzz">
<el-input rows="5" type="textarea" v-model.trim="formData.gzzz"></el-input>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button @click="doAdd" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="editDialogVisible" title="编辑委员会">
<el-form :model="formData" :rules="rules" label-width="120px" ref="editForm">
<el-form-item label="所属教代会" prop="jdhid">
<el-select disabled placeholder="选择教代会" v-model="formData.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in jdhList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="委员会名称" prop="name">
<el-select disabled v-model="formData.wyh" value-key="i.id">
<el-option :key="i.id" :label="i.name" :value="i" v-for="i in wyhList"></el-option>
</el-select>
</el-form-item>
<el-form-item label="委员会工作职责" prop="gzzz">
<el-input rows="5" type="textarea" v-model.trim="formData.gzzz"></el-input>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="editDialogVisible = false">取 消</el-button>
<el-button @click="doEdit" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="userDialogVisible" title="委员会成员设置" width="70%">
<el-row>
<div class="btn-group tool-button mt5">
<div>
<el-select
:remote-method="queryUser"
filterable
placeholder="请输入工号或姓名关键字"
remote
size="mini"
style="width: 400px"
v-model="userFormData.userid">
<el-option
:key="item.id"
:label="item.loginname+' '+item.username+' ' + item.dwname"
:value="item.id"
v-for="item in userList">
</el-option>
</el-select>
</div>
</div>
<div class="btn-group tool-button mt5">
<el-button @click="addUser2Tab " icon="el-icon-circle-plus" size="mini" type="primary">添加成员</el-button>
</div>
</el-row>
<el-row style="margin-top: 15px">
<el-table :data="userTableData" height="300">
<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="mobile"></el-table-column>
<el-table-column label="所属单位" prop="dwname"></el-table-column>
<el-table-column label="身份" prop="sf">
<template slot-scope="scope">
<span class="text-primary" v-if="scope.row.sf===1">成员</span>
<span class="text-primary" v-if="scope.row.sf===2">副主任</span>
<span class="text-primary" v-if="scope.row.sf===3">主任</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-dropdown placement="bottom">
<el-button size="mini" type="primary">
设置身份<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="updateSf(scope.row,3)" v-if="scope.row.sf!==3">主任
</el-dropdown-item>
<el-dropdown-item @click.native="updateSf(scope.row,2)" v-if="scope.row.sf!==2">副主任
</el-dropdown-item>
<el-dropdown-item @click.native="updateSf(scope.row,1)" v-if="scope.row.sf!==1">成员
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button @click="doDeleteUser(scope.row)" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
<span class="dialog-footer" slot="footer">
<el-button @click="userDialogVisible = false" type="danger">关 闭</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="viewDialogVisible" title="详情">
<table class="tabInfo">
<tr>
<td class="title">委员会名称</td>
<td class="content">{{viewData.wyhname}}</td>
</tr>
<tr>
<td class="title">所属教代会</td>
<td class="content">{{viewData.jdhallname}}</td>
</tr>
<tr>
<td class="title">主任</td>
<td class="content">
<template v-for="u in viewData.userList">
<span class="mr5" v-if="u.sf===3">{{u.username}}</span>
</template>
</td>
</tr>
<tr>
<td class="title">副主任</td>
<td class="content">
<template v-for="u in viewData.userList">
<span class="mr5" v-if="u.sf===2">{{u.username}}</span>
</template>
</td>
</tr>
<tr>
<td class="title">成员</td>
<td class="content">
<template v-for="u in viewData.userList">
<span class="mr5" v-if="u.sf===1">{{u.username}}</span>
</template>
</td>
</tr>
<tr>
<td class="title">委员会工作职责</td>
<td class="content">{{viewData.gzzz}}</td>
</tr>
</table>
</el-dialog>
</div>
<script>
const rules = {
jdhid: [{required: true, message: '请选择教代会', trigger: ['blur', 'change']}],
wyh: [{required: true, message: '请选择委员会', trigger: ['blur', 'change']}],
gzzz: [{required: true, message: '请输入委员会工作职责', trigger: ['blur', 'change']}]
}
let vue = new Vue({
el: "#app",
data() {
return {
rules: rules,
addDialogVisible: false,
editDialogVisible: false,
roleDialogVisible: false,
tableData: [],
jdhList: [],
userList: [],
pageForm: {
searchName: "u.username",
...getPageForm(),
jdhid: '',
wyhname: '',
union_id: ""
},
roleData: {jdh_cbldxz: {}, sys_user: {}, sys_unit: {}, jdh_jdhxx: {}},
formData: {},
wyhList: [],
userList: [],
userDialogVisible: false,
userFormData: {},
userTableData: [],
viewDialogVisible: false,
viewData: {},
}
},
methods: {
queryKyWyhMc(jdhid) {
if (jdhid !== '') {
$.get(base + '/platform/jdh/zzjg/zmwyh/queryKyWyhMc', {jdhid: jdhid}).then(res => {
if (res.code === 0) {
this.wyhList = res.data
}
})
}
},
openEdit(obj) {
this.wyhList = [{id: obj.mcid, name: obj.wyhname}]
this.formData = {
id: obj.id,
wyh: {id: obj.mcid, name: obj.wyhname},
gzzz: obj.gzzz,
jdhid: obj.jdhid
}
this.editDialogVisible = true
},
doEdit() {
this.$refs["editForm"].validate(valid => {
if (valid) {
this.formData.name = this.formData.wyh.name
this.formData.mcid = this.formData.wyh.id
$.post(base + '/platform/jdh/zzjg/zmwyh/doEdit', this.formData).then(res => {
if (res.code === 0) {
this.editDialogVisible = false
this.pageData()
this.$message.success(res.msg)
}
})
}
})
},
doDelete(obj) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.post(base + '/platform/jdh/zzjg/zmwyh/doDelete', {id: obj.id, jdhid: obj.jdhid}).then(res => {
if (res.code === 0) {
this.pageData()
this.$message.success(res.msg)
}
})
}).catch(() => {
})
},
jdhChange(jdhid) {
this.queryKyWyhMc(jdhid)
},
openAdd() {
this.formData = {
jdhid: this.jdhList.length > 0 ? this.jdhList[0].id : '',
name: '',
gzzz: ''
}
this.queryKyWyhMc(this.formData.jdhid)
this.addDialogVisible = true
},
doAdd() {
this.$refs["addForm"].validate(valid => {
if (valid) {
this.formData.name = this.formData.wyh.name
this.formData.mcid = this.formData.wyh.id
$.post(base + '/platform/jdh/zzjg/zmwyh/doAdd', this.formData).then(res => {
if (res.code === 0) {
this.addDialogVisible = false
this.pageData()
this.$message.success(res.msg)
}
})
}
})
},
//用户管理
userData(wyhid) {
$.get(base + '/platform/jdh/zzjg/zmwyh/userData', {wyhid: wyhid}).then(res => {
if (res.code === 0) {
this.userTableData = res.data
}
})
},
openEditUser(obj) {
this.userFormData = {
userid: '',
wyhid: obj.id,
jdhid: obj.jdhid,
wyhmcid: obj.mcid
}
this.userData(obj.id)
this.userDialogVisible = true
},
queryUser(query) {
if (query !== '') {
$.get(base + '/platform/jdh/zzjg/zmwyh/queryUser', {
query: query,
jdhid: this.userFormData.jdhid
}).then(res => {
//this.userList = QC(this.users,res.data.list,'id')
this.userList = res.data.list
})
}
},
addUser2Tab() {
if (this.userFormData.userid === '') {
this.$message.info('请先选择用户!')
return
}
$.post(base + '/platform/jdh/zzjg/zmwyh/doAddUser', this.userFormData).then(res => {
if (res.code === 0) {
this.userFormData.userid = ''
this.userList = []
this.userData(this.userFormData.wyhid)
}
})
},
updateSf(obj, sf) {
$.post(base + '/platform/jdh/zzjg/zmwyh/updateSf',
{
userid: obj.id,
zmwyhid: obj.zmwyhid,
sf: sf
}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.userData(obj.zmwyhid)
this.pageData()
}
})
},
doDeleteUser(obj) {
obj.jdhid = this.userFormData.jdhid
$.post(base + '/platform/jdh/zzjg/zmwyh/doDeleteUser', obj).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.userData(obj.zmwyhid)
}
})
},
async openView(row) {
this.viewDialogVisible = true
const {data} = await GET('/platform/jdh/zzjg/zmwyh/userData', {wyhid: row.id})
this.$nextTick(() => {
this.viewData = row
this.viewData.userList = data
})
},
...pageSomeThing
},
async created() {
this.pageData()
this.jdhList = await getAllJdh()
this.unionOptions = await getUnions()
}
})
</script>
<!--#
}
#-->