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

332 lines
14 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<div class="btn-group tool-button">
<el-select @change="jdhChange" placeholder="请选择教代会" v-model="pageForm.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in openJdhList">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-select clearable filterable placeholder="请选择工会" v-model="pageForm.union_id">
<el-option
:key="item.id"
:label="item.unionname"
:value="item.id"
v-for="item in unionOptions">
</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-card>
<el-card class="mt20" shadow="never">
<el-table :data="tableData" :row-style="showRow">
<el-table-column align="center" label="序号" type="index" width="80"></el-table-column>
<el-table-column align="center" label="代表团名称" prop="dbtname"></el-table-column>
<el-table-column align="center" label="代表团总人数(人)" prop="ghzrs" sortable></el-table-column>
<el-table-column align="center" label="名额分配数(人)" prop="fps" sortable></el-table-column>
<el-table-column align="center" label="代表人数" prop="dbzrs" sortable></el-table-column>
<el-table-column align="center" label="代表占比" prop="dbrsb" sortable></el-table-column>
<el-table-column align="center" label="列席/特邀代表" prop="lxty">
</el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<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:'editFps',data:scope.row}">
修改分配数
</el-dropdown-item>
<el-dropdown-item :command="{type:'openDb',data:scope.row}">
查看列席/特邀代表
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</el-card>
</guava>
<el-dialog :visible.sync="fpsDialogVisible" title="修改名额分配数" width="30%">
<el-form :model="formData" :rules="mefpsRules" label-width="100px" ref="mefpsForm">
<el-form-item label="院级工会" prop="unionname">
<el-input disabled
v-model="formData.unionname">
</el-input>
</el-form-item>
<el-form-item label="总人数" prop="ghzrs">
<el-input disabled
v-model="formData.ghzrs">
</el-input>
</el-form-item>
<el-form-item label="名额分配数" prop="fps">
<el-input placeholder="请输入名额分配数"
v-model="formData.fps">
</el-input>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="fpsDialogVisible=false">取 消</el-button>
<el-button @click="doFp" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="dbDialogVisible" title="列席/特邀代表">
<el-alert :closable="false" show-icon title="不占代表团名额" type="info"></el-alert>
<el-row>
<div class="btn-group tool-button">
<el-select
:remote-method="queryNolxtyDb"
filterable
placeholder="请输入工号或姓名关键字"
remote
size="mini"
style="width: 300px"
v-model="lxtydbFormData.userid">
<el-option
:key="item.id"
:label="item.loginname+' '+item.username+' '+item.dwname"
:value="item.id"
v-for="item in lxtyUserList">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<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="doAddLxtyDb(2)">列席代表
</el-dropdown-item>
<el-dropdown-item @click.native="doAddLxtyDb(1)">特邀代表
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button type="primary" size="mini" @click="doAddLxtyDb">-->
<!-- 添加-->
<!-- </el-button>-->
</div>
</el-row>
<el-row style="margin-top: 15px">
<el-table :data="lxtydbTableData" height="450px">
<el-table-column label="工号" prop="loginname" sortable></el-table-column>
<el-table-column label="姓名" prop="username" sortable></el-table-column>
<el-table-column label="单位" prop="dbunitname" sortable></el-table-column>
<el-table-column label="电话" prop="mobile"></el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="身份" prop="rolename"></el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="{row}">
<el-button @click="delLxtyDb(row)" icon="el-icon-delete" size="mini" type="danger"></el-button>
</template>
</el-table-column>
</el-table>
</el-row>
</el-dialog>
</div>
<script>
let vue = new Vue({
el: '#app',
data() {
return {
pageForm: {
jdhid: '',
pageOrderName: '',
pageOrderBy: ''
},
unionOptions: [],
openJdhList: [],
tableData: [],
fpsDialogVisible: false,
mefpsRules: {
fps: [{required: true, message: '请输入', trigger: ['change', 'blur']}]
},
formData: {
dbtid: '',
fps: ''
},
dbDialogVisible: false,
lxtydbTableData: [],
lxtyUserList: [],
lxtydbFormData: {
dbtid: '',
userid: ''
}
}
},
methods: {
dropdownCommand(command) {
const {type, data} = command
if (type == 'editFps') {
this.editFps(data)
} else if (type == 'openDb') {
this.openDb(data)
}
},
doSearch() {
this.tabKey = new Date().getTime()
this.pageForm.pageNumber = 1
this.data()
},
jdhChange(jdhid) {
this.pageForm.jdhid = jdhid
this.data()
},
pageOrder(column) {
this.pageForm.pageOrderName = column.prop
this.pageForm.pageOrderBy = column.order
this.data()
},
data() {
sublime.showLoadingbar()
$.post(base + '/platform/jdh/cb/mefp/data', this.pageForm).then(res => {
console.log(res.data)
sublime.closeLoadingbar()
if (res.code === 0) {
this.tableData = res.data
for (let o of this.tableData) {
if (o.fps == null) {
o.fps = Math.round(o.ghzrs * 0.1)
}
o.dbrsb = o.dbzrs != 0 ? ((o.dbzrs / o.ghzrs) * 100).toFixed(2) + '%' : 0 + '%'
}
}
})
},
editFps(obj) {
// this.formData.dbtid = obj.id
this.formData.fghid = obj.id
this.formData.ghzrs = obj.ghzrs
this.formData.unionname = obj.unionname
if (obj.fps == null) {
this.formData.fps = Math.round(obj.ghzrs * 0.1)
} else {
this.formData.fps = obj.fps
}
this.fpsDialogVisible = true
},
doFp() {
this.$refs['mefpsForm'].validate(valid => {
if (valid) {
if (parseInt(this.formData.fps) > this.formData.ghzrs) {
this.$message.info('名额分配数不得大于分工会总人数')
return
}
this.formData.jdhid = this.pageForm.jdhid
$.post(base + '/platform/jdh/cb/mefp/doMefp', this.formData).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.fpsDialogVisible = false
this.data()
}
})
}
})
},
openDb(row) {
this.lxtydbFormData = {
fghid: row.id,
userid: ''
}
this.lxtyUserList = []
this.dbDialogVisible = true
this.lxtyPageData(row.id)
},
lxtyPageData(fghid) {
$.get('/platform/jdh/cb/mefp/lxtydbPgaeData', {fghid: fghid, jdhid: this.pageForm.jdhid}).then(res => {
if (res.code === 0) {
this.lxtydbTableData = res.data
}
})
},
queryNolxtyDb(keyword) {
if (keyword !== '') {
$.get('/platform/jdh/cb/mefp/queryNolxtyDb', {
keyword: keyword,
jdhid: this.pageForm.jdhid,
fghid: this.lxtydbFormData.fghid
}).then(res => {
if (res.code === 0) {
this.lxtyUserList = res.data
}
})
} else {
this.lxtyUserList = []
this.lxtydbFormData.userid = ''
}
},
doAddLxtyDb(val) {
if (this.lxtydbFormData.userid === '') {
this.$message.info('请先查询并选择用户后再添加!')
return
}
let o = this.lxtyUserList.find(u => {
return u.id === this.lxtydbFormData.userid
})
let u = JSON.parse(JSON.stringify(o))
u.jdhid = this.pageForm.jdhid
u.dbtid = this.lxtydbFormData.dbtid
u.dbid = u.id
u.id = undefined
u.lx = val
$.post('/platform/jdh/cb/mefp/doAddLxTyDb', u).then(res => {
if (res.code === 0) {
this.lxtydbFormData.userid = ''
this.lxtyUserList = []
this.$message.success(res.msg)
this.lxtyPageData(this.lxtydbFormData.dbtid)
this.data()
}
})
},
delLxtyDb(row) {
$.post('/platform/jdh/cb/mefp/delLxtyDb', {dbid: row.dbid, jdhid: row.jdhid}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.lxtyPageData(this.lxtydbFormData.dbtid)
this.data()
}
})
},
showRow({row}) {
if (row.dbzrs == 0 || (((row.dbzrs / row.ghzrs) * 100).toFixed(2)) < 10) {
return {color: 'red'}
}
}
},
async created() {
this.unionOptions = await getUnions()
this.openJdhList = await getOpenJdh()
if (this.openJdhList.length > 0) {
this.pageForm.jdhid = this.openJdhList[0].id
this.data()
}
}
})
</script>
<!--#
}
#-->