Files
UNION_HUTB/target/classes/static/components/jdh/zmwyhInfo.vue
T
2026-09-09 09:14:28 +08:00

469 lines
16 KiB
Vue
Raw 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.
<template>
<guava ref="guava">
<template name="el-zoom-in-center">
<el-row class="header navbar bg-white shadow">
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" v-model="pageForm.wyhname" @keyup.enter.native="doSearch"></el-input>
</div>
<div class="btn-group tool-button mt5">
<el-select clearable v-model="pageForm.jdhid" placeholder="请选择教代会">
<el-option
v-for="item in jdhList"
:key="item.id"
:label="item.jdhallname"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button type="primary" @click="doSearch" icon="el-icon-search"></el-button>
</div>
<div class="pull-right offscreen-right mt5">
<el-button size="medium" @click="openAdd"><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 label="序号" type="index" header-align="center" align="center">
<template scope="scope"><span>{{ scope.$index + (pageForm.pageNumber - 1) * pageForm.pageSize + 1 }} </span>
</template>
</el-table-column>
<el-table-column sortable prop="jdhallname" label="教代会"></el-table-column>
<el-table-column prop="wyhname" label="委员会名称"></el-table-column>
<el-table-column prop="zrmobile" label="主任及联系方式"></el-table-column>
<el-table-column prop="gzzz" label="工作职责" show-overflow-tooltip></el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="100px">
<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 title="添加委员会" :visible.sync="addDialogVisible">
<el-form :model="formData" ref="addForm" :rules="rules" label-width="120px">
<el-form-item prop="jdhid" label="所属教代会">
<el-select v-model="formData.jdhid" @change="jdhChange" placeholder="选择教代会">
<el-option
v-for="item in jdhList"
:key="item.id"
:label="item.jdhallname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="name" label="委员会名称">
<el-select v-model="formData.wyh" value-key="id">
<el-option v-for="i in wyhList" :label="i.name" :value="i" :key="i.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="gzzz" label="委员会工作职责">
<el-input type="textarea" rows="5" v-model.trim="formData.gzzz"></el-input>
</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 :title="titleEdit" :visible.sync="editDialogVisible">
<el-form :model="formData" ref="editForm" :rules="rules" label-width="120px">
<el-form-item prop="jdhid" label="所属教代会">
<el-select v-model="formData.jdhid" disabled placeholder="选择教代会">
<el-option
v-for="item in jdhList"
:key="item.id"
:label="item.jdhallname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="name" label="委员会名称">
<el-select v-model="formData.wyh" value-key="i.id" disabled>
<el-option v-for="i in wyhList" :label="i.name" :value="i" :key="i.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="gzzz" label="委员会工作职责">
<el-input type="textarea" rows="5" v-model.trim="formData.gzzz"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editDialogVisible = false"> </el-button>
<el-button type="primary" @click="doEdit"> </el-button>
</span>
</el-dialog>
<el-dialog :title="titleEditUser" :visible.sync="userDialogVisible" width="70%">
<el-row>
<div class="btn-group tool-button mt5">
<div>
<el-select
size="mini"
style="width: 400px"
v-model="userFormData.userid"
filterable
remote
placeholder="请输入工号或姓名关键字"
:remote-method="queryUser">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.username+' '+item.loginname+'' + item.dwname"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div class="btn-group tool-button mt5">
<el-button size="mini" type="primary" @click="addUser2Tab " icon="el-icon-circle-plus">添加成员</el-button>
</div>
</el-row>
<el-row style="margin-top: 15px">
<el-table :data="userTableData" height="300">
<el-table-column prop="loginname" label="工号"></el-table-column>
<el-table-column prop="username" label="姓名"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column prop="mobile" label="手机号码"></el-table-column>
<el-table-column prop="dwname" label="所属单位"></el-table-column>
<el-table-column prop="sf" label="身份">
<template slot-scope="scope">
<span v-if="scope.row.sf===1" class="text-primary">成员</span>
<span v-if="scope.row.sf===2" class="text-primary">副主任</span>
<span v-if="scope.row.sf===3" class="text-primary">主任</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-dropdown placement="bottom">
<el-button type="primary" size="mini">
设置身份<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="scope.row.sf!==3" @click.native="updateSf(scope.row,3)">主任
</el-dropdown-item>
<el-dropdown-item v-if="scope.row.sf!==2" @click.native="updateSf(scope.row,2)">副主任
</el-dropdown-item>
<el-dropdown-item v-if="scope.row.sf!==1" @click.native="updateSf(scope.row,1)">成员
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="danger" size="mini" @click="doDeleteUser(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button type="danger" @click="userDialogVisible = false"> </el-button>
</span>
</el-dialog>
<el-dialog title="详情" :visible.sync="viewDialogVisible">
<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>
</template>
</guava>
</template>
<script>
module.exports = {
data() {
return {
titleEditUser: "",
titleEdit: "",
rules: {
jdhid: [{required: true, message: '请选择教代会', trigger: ['blur', 'change']}],
wyh: [{required: true, message: '请选择委员会', trigger: ['blur', 'change']}],
gzzz: [{required: true, message: '请输入委员会工作职责', trigger: ['blur', 'change']}]
},
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.titleEdit = obj.wyhname + '编辑'
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.titleEditUser = obj.wyhname + "设置"
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/zxwyh/queryUser', {
keyword: 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
})
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
pageData() {//加载分页数据
sublime.showLoadingbar();//显示loading
this.tabLoading = true
$.post("/platform/jdh/zzjg/zmwyh/pageData", this.pageForm, (data) => {
sublime.closeLoadingbar();//关闭loading
this.tabLoading = false
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message.error(data.msg);
}
}, "json");
},
pageOrder(column) {//按字段排序
this.pageForm.pageOrderName = column.prop;
this.pageForm.pageOrderBy = column.order;
this.pageData();
},
pageNumberChange(val) {//页码更新操作
this.pageForm.pageNumber = val;
this.pageData();
},
pageSizeChange(val) {//分页大小更新操作
this.pageForm.pageSize = val;
this.pageData();
},
},
async created() {
this.jdhList = await getAllJdh()
if (this.jdhList.length > 0) {
this.pageForm.jdhid = this.jdhList[0].id
}
this.unionOptions = await getUnions()
this.pageData()
}
}
</script>