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

610 lines
27 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-form .el-select {
width: 100%;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="btn-group tool-button">
<el-input clearable placeholder="请输入内容" v-model="pageForm.searchKeyword">
<el-select placeholder="查询" slot="prepend" style="width: 100px;"
v-model="pageForm.searchName">
<el-option label="工号" value="u.loginname"></el-option>
<el-option label="姓名" value="u.username"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button">
<el-select @change="jdhChange" clearable filterable placeholder="请选择教代会"
v-model="pageForm.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in allTeacherMeets">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-select @change="delegationChange" clearable filterable placeholder="请选择代表团"
v-model="pageForm.dbtid">
<el-option
:key="item.id"
:label="item.dbtname"
:value="item.id"
v-for="item in delegations">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-select
@change="unitList = allUnitList.filter(v => pageForm.unionid?v.unionid === pageForm.unionid:true)"
clearable filterable placeholder="请选择工会"
v-model="pageForm.unionid">
<el-option
:key="item.id"
:label="item.unionname"
:value="item.id"
v-for="item in unionList">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-select clearable filterable placeholder="请选择单位" v-model="pageForm.unitid">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitList">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-select clearable placeholder="请选择代表身份" v-model="pageForm.dbsf">
<el-option label="正式代表" value="正式代表"></el-option>
<el-option label="列席代表" value="列席代表"></el-option>
<el-option label="特邀代表" value="特邀代表"></el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
</div>
<el-row class="mt20">
<div class="btn-group tool-button">
<el-button @click="doDeleteMany" icon="el-icon-delete" size="medium" type="danger">批量删除
</el-button>
</div>
<div class="btn-group tool-button">
<el-button @click="openAddDb" icon="el-icon-plus" size="medium" type="success">新增代表
</el-button>
</div>
<div class="btn-group tool-button">
<el-button @click="openSetXld" size="medium" type="warning">
<i class="el-icon-sort" style="transform: rotate(90deg);"></i>
代表调整
</el-button>
</div>
<div class="btn-group tool-button">
<el-button @click="dofpdbt" size="medium" type="warning">
一键分配代表团
</el-button>
</div>
</el-row>
</el-card>
<el-card class="mt20" shadow="never">
<el-table :data="tableData" @selection-change="handleSelectionChange" @sort-change='pageOrder'
row-key="id">
<el-table-column reserve-selection type="selection" width="55"></el-table-column>
<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 align="center" label="工号" prop="loginname"></el-table-column>
<el-table-column align="center" label="姓名" prop="username" sortable></el-table-column>
<el-table-column align="center" label="性别" prop="sex" sortable></el-table-column>
<el-table-column align="center" label="联系方式" prop="mobile"></el-table-column>
<el-table-column align="center" label="代表团" prop="dbtname" show-overflow-tooltip
sortable></el-table-column>
<el-table-column align="center" label="所属工会" prop="dbfghname" show-overflow-tooltip
sortable></el-table-column>
<el-table-column align="center" label="所属单位" prop="dbunitname" show-overflow-tooltip sortable>
<template scope="scope">
{{scope.row.dbunitname}}({{scope.row.dbunitid}})
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="届次" prop="jdhallname"
sortable></el-table-column>
<el-table-column align="center" header-align="center" label="代表身份"
prop="rolename"></el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="100">
<template slot-scope="{row}">
<el-dropdown @command="dropdownCommand">
<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>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<db-info :active="'1'" ref="DbInfo"></db-info>
</template>
<el-dialog :visible.sync="dbAddDialogVisible" @close="formData.role=''" title="新增教代会代表">
<el-form :model="formData" :rules="rules" label-width="80px" ref="AddForm">
<el-form-item label="届次" prop="jdhid">
<el-select @change="jdhChange" filterable placeholder="代表所属教代会" v-model="formData.jdhid">
<el-option :key="item.id" :label="item.jdhallname" :value="item.id"
v-for="item in allTeacherMeets"></el-option>
</el-select>
</el-form-item>
<el-form-item label="代表团" prop="dbtid">
<el-select @change="dbtChange" filterable v-model="formData.dbtid">
<el-option :key="i.id" :label="i.dbtname" :value="i.id"
v-for="i in delegations"></el-option>
</el-select>
</el-form-item>
<el-form-item label="代表类型" prop="role">
<el-select v-model="formData.role">
<el-option :key="i.value" :label="i.label" :value="i.value"
v-for="i in representativeRoleOptions"></el-option>
</el-select>
</el-form-item>
<el-form-item label="用户" prop="user">
<el-select
:remote-method="queryNotDbUser"
@change="$refs.secondedSelect.$children[1].clear()"
filterable
multiple
placeholder="请输入工号或者姓名"
ref="secondedSelect"
remote
reserve-keyword
v-model="formData.user"
value-key="id">
<el-option
:key="item.id"
:label="item.username+'-'+item.loginname+'-'+item.dwname"
:value="item"
v-for="item in notDbUserList">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="dbAddDialogVisible = false">取 消</el-button>
<el-button @click="doAddDb" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="xldDialogVisible" title="代表名单调整">
<el-select @change="xldJdhChange" v-model="xldFormData.jdhid">
<el-option :label="item.jdhallname" :value="item.id" v-for="item in allTeacherMeets"></el-option>
</el-select>
<div class="pull-right offscreen-right">
<el-select :remote-method="remotexldMethod" filterable
placeholder="请输入工号和姓名" remote
reserve-keyword v-model="xldFormData.userid">
<el-option :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="dwname"></el-table-column>
<el-table-column label="代表团">
<template slot-scope="scope">
<el-select clearable filterable v-model="scope.row.dbtid">
<el-option :label="d.dbtname" :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 :visible.sync="modifyDialogVisible" title="编辑教代会代表" width="50%">
<el-form :model="formData" :rules="formRules" label-width="80px" ref="form">
<el-row>
<el-col :span="12">
<el-form-item label="姓名" prop="username">
<el-input :value="representativeInfo.username" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工号" prop="loginname">
<el-input :value="representativeInfo.loginname" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="届次" prop="jdhid">
<el-select @change="jdhChange" filterable placeholder="届次"
v-model="representativeInfo.jdhid">
<el-option :key="item.id" :label="item.jdhallname" :value="item.id"
v-for="item in allTeacherMeets"></el-option>
</el-select>
</el-form-item>
<el-form-item label="代表团" prop="dbtid">
<el-select filterable v-model="representativeInfo.dbtid">
<el-option :key="i.id" :label="i.dbtname" :value="i.id"
v-for="i in delegationList"></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 label="代表类型" prop="roleid">
<el-select v-model="representativeInfo.roleid">
<el-option :key="i.value" :label="i.label" :value="i.value"
v-for="i in representativeRoleOptions"></el-option>
</el-select>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="modifyDialogVisible = false">取 消</el-button>
<el-button @click="modifying" type="primary">确 定</el-button>
</span>
</el-dialog>
</guava>
</div>
<script>
let vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
unionList: [],
allUnitList: [],
unitList: [],
delegations: [],
allTeacherMeets: [],
tableData: [],
pageForm: {
jdhid: '',
dbtid: '',
unitid: '',
dbsf: '',
searchName: 'u.username',
},
selection: [],
dbAddDialogVisible: false,
formData: {
user: []
},
rules: {},
notDbUserList: [],
xldDialogVisible: false,
xldFormData: {
jdhid: '',
userid: ''
},
xldUserList: [],
xldTableData: [],
xldDbtList: [],
uid: '',
formRules: {
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
modifyDialogVisible: false,
representativeRoleOptions: [],
representativeInfo: {},
modifyUnitList: [],
/*new*/
allTeacherMeets: [],
delegationList: [],
}
},
components: {
'db-info': httpVueLoader('/components/jdh/dbinfo.vue?v=1.0.0')
},
methods: {
dofpdbt() {
this.$confirm('确定要给当前教代会代表分配代表团吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
await $.post(loc() + '/dofpdbt', {jdhid: this.pageForm.jdhid})
this.$message.success("成功")
this.doSearch()
}).catch(() => {
});
},
/*代表团变化 工会列表也变化*/
async delegationChange(val) {
this.pageForm.unionid = ''
this.pageForm.unitid = ''
this.unionList = await getUnions(val)
},
async modifying() {
const response = await $.post(loc() + '/modifyRepresentativeInfo', this.representativeInfo)
AssertResponseMessage({
response,
success: () => {
this.modifyDialogVisible = false
this.pageData()
}
})
},
async modify(row) {
const resp = await $.get(loc() + '/representativeInfo/' + row.id)
AssertResponseMessage2({
response: resp,
success: ({data}) => {
this.modifyUnitList = this.allUnitList;
this.representativeInfo = data
this.modifyDialogVisible = true
},
})
this.delegationList = await getDbt(row.jdhid)
},
dropdownCommand(command) {
const {type, data} = command
if (type === 'view') {
this.openView(data)
} else if (type === 'doDelete') {
this.doDelete(data)
} else if (type === 'modify') {
this.modify(data)
}
},
openView(row) {
const {dbid} = row
this.$refs.DbInfo.openView(dbid)
this.$refs.guava.view()
},
async jdhChange(val) {
this.delegations = await getDbt(val)
},
handleSelectionChange(val) {
this.selection = val
},
doDelete(obj) {
this.$confirm('此操作将删除用户' + obj.username + '的正式代表身份!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let data = []
data.push({id: obj.id, dbid: obj.dbid, jdhid: obj.jdhid})
$.post(base + '/platform/jdh/db/dbgl/doDelete', {data: data}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.pageData()
}
})
}).catch(() => {
})
},
doDeleteMany() {
if (this.selection.length === 0) {
this.$message.info('请先选择')
return
}
this.$confirm('此操作将删除选中用户的正式代表身份!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let data = []
for (let obj of this.selection) {
data.push({id: obj.id, dbid: obj.dbid, jdhid: obj.jdhid})
}
$.post(base + '/platform/jdh/db/dbgl/doDelete', {data: data}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.doSearch()
}
})
}).catch(() => {
})
},
queryNotDbUser(key) {
if (this.formData.dbtid === '') {
this.$message.info('请先选择代表团')
return
}
let data = this.formData
data.keyword = key
$.post(base + '/platform/jdh/db/scmd/queryNotDbUser', data).then(res => {
if (res.code === 0) {
this.notDbUserList = QC(this.formData.user, res.data.list, 'id')
}
})
},
dbtChange() {
this.formData.user = []
this.notDbUserList = []
},
async openAddDb() {
if (this.allTeacherMeets) {
this.formData.jdhid = this.allTeacherMeets[0].id
this.delegations = await getDbt(this.allTeacherMeets[0].id)
}
this.formData.dbtid = this.pageForm.dbtid
this.formData.user = []
this.notDbUserList = []
this.dbAddDialogVisible = true
},
async doAddDb() {
const data = await $.post("/platform/jdh/db/dbgl/doAdd", this.formData)
this.$message.success(data.msg)
/*this.delegations = await getDbt(this.formData.jdhid)*/
/* this.$set(this.pageForm, "jdhid", this.formData.jdhid)
await this.jdhChange()*/
this.pageData()
this.dbAddDialogVisible = false
},
async openSetXld() {
if (this.allTeacherMeets) {
this.xldFormData.jdhid = this.allTeacherMeets[0].id
// this.xldDbtList = await getDbtList(this.allTeacherMeets[0].id)
this.delegations = await getDbt(this.allTeacherMeets[0].id)
}
this.xldFormData.userid = ''
this.xldUserList = []
this.xldTableData = []
this.xldDialogVisible = true
},
remotexldMethod(key) {
if (this.xldFormData.jdhid === '') {
this.$message.info('请先选择教代会!')
return
}
if (key !== '') {
$.get(base + '/platform/jdh/db/dbgl/queryXldUser', {
query: key,
jdhid: this.xldFormData.jdhid
}).then(res => {
if (res.code === 0) {
this.xldUserList = res.data.list
}
})
}
},
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 xldJdhChange(jdhid) {
// this.xldDbtList = await getDbtList(jdhid)
this.delegations = await getDbt(jdhid)
},
doSetxlddbt() {
let flag = true
for (let o of this.xldTableData) {
if (!('dbtid' in o)) {
flag = false
break
}
}
if (!flag) {
this.$message.info('请先选择要分配的代表团!')
return
}
$.post(base + '/platform/jdh/db/dbgl/fpXldToDbt', {
user: this.xldTableData,
jdhid: this.xldFormData.jdhid
}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.xldTableData = []
this.pageData()
}
})
},
async getRepresentativeRoleOptions() {
const {code, data} = await $.get(loc() + '/representativeRoleOptions')
if (!code) {
this.representativeRoleOptions = data
}
}
},
async created() {
this.allTeacherMeets = await getAllJdh()
if (this.allTeacherMeets && this.allTeacherMeets.length > 0) {
const lastTeacherMeeting = this.allTeacherMeets[0].id
this.pageForm.jdhid = lastTeacherMeeting
this.delegations = await getDbt(lastTeacherMeeting)
this.delegationList = await getDbt(lastTeacherMeeting)
this.unionList = await getUnion()
this.allUnitList = await getUnit()
this.unitList = clone(this.allUnitList)
this.pageData()
}
await this.getRepresentativeRoleOptions()
}
})
</script>
<!--#
}
#-->