Files
UNION_NSI/target/classes/views/platform/jdh/zzjg/groupManage.html
T
2026-09-08 19:49:21 +08:00

1139 lines
53 KiB
HTML
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.
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-tabs__nav {
background-color: #FFFFFF;
}
.dialog-footer .el-button {
padding: 12px 30px;
}
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__list.is-filterable {
height: 300px;
}
.v-box .el-card__header {
padding: 5px 15px;
}
.v-tree-layout-left .v-tree {
width: 100%;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.draggable-cell {
cursor: move;
user-select: none;
}
</style>
<div id="app" v-cloak>
<guava>
<tree-layout style="height: calc(100vh - 70px)">
<template #tree>
<div style="padding: 15px;">
<el-select v-model="pageForm.jdhId" filterable placeholder="请选择教代会"
style="width: 100%" @change="jdhChange">
<el-option
v-for="item in jdhList"
:key="item.id"
:label="item.jdhallname"
:value="item.id">
</el-option>
</el-select>
</div>
<el-tree class="filter-tree" :data="treeData" :props="defaultProps"
default-expand-all ref="tree" :expand-on-click-node="false"
highlight-current accordion @node-click="handleNodeClick">
<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.groupName }}
</div>
<div @dragover="handleDragOver" @dragenter="handleDragEnter"
@drop="(event) => {handleDrop(data, event)}"
v-if="node.level === 2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.groupName === data.groupName"></i>
<i class="el-icon-help" v-else></i>
{{ data.groupName + '' + data.count + '' }}
</div>
</div>
</el-tree>
</template>
<template>
<div v-if="node.level === 1" class="pl10 pr10">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-select v-model="pageForm.groupId" filterable clearable
placeholder="请选择小组">
<el-option
v-for="item in groupList"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
<div class="pull-right offscreen-right">
<el-button type="primary" @click="openAdd"><i class="ti-plus"></i> 添加小组</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<vi-title2 title="小组列表">
<template #func>
<el-button type="primary" size="small" @click="assignByLeader">根据分管校领导单位分配代表</el-button>
<el-dropdown trigger="click" @command="exportDropdownCommand" style="margin: 0 10px">
<el-button type="primary" size="small">
导出小组代表列表<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'group'}">按小组导出</el-dropdown-item>
<el-dropdown-item :command="{type:'unit'}">按单位导出</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" size="small" @click="clearAllGroup">清空全部小组代表</el-button>
<el-button type="primary" size="small" @click="randomGroup">一键随机分组</el-button>
</template>
</vi-title2>
<el-table :data="tableData">
<el-table-column 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" header-align="center" prop="groupName"
label="小组名称"></el-table-column>
<el-table-column align="center" header-align="center" prop="code"
label="小组编码"></el-table-column>
<el-table-column align="center" header-align="center" prop="jdhallname"
label="所属教代会"></el-table-column>
<el-table-column align="center" header-align="center" prop="workUser"
label="工作人员"></el-table-column>
<el-table-column align="center" header-align="center" prop="talkAddress"
label="讨论地点"></el-table-column>
<el-table-column align="center" header-align="center" prop="createTime" label="创建时间">
<template slot-scope="{row:{createTime}}">
{{moment(createTime).format('YYYY-MM-DD')}}
</template>
</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:'allot',data:scope.row}">
根据代表团分配
</el-dropdown-item>
<el-dropdown-item :command="{type:'clearGroup',data:scope.row}">
清空已有代表
</el-dropdown-item>
<el-dropdown-item :command="{type:'zz',data:scope.row}">
设置组长/副组长
</el-dropdown-item>
<el-dropdown-item :command="{type:'xld',data:scope.row}">
设置分管校领导
</el-dropdown-item>
<el-dropdown-item :command="{type:'editName',data:scope.row}">
编辑小组信息
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete',data:scope.row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
<div v-if="node.level === 2" class="pl10 pr10">
<el-tabs v-model="activeName" type="card" @tab-click="handleTabClick">
<el-tab-pane label="代表" name="one">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-input placeholder="请输入内容" clearable
v-model="dbPageForm.searchKeyword">
<el-select v-model="dbPageForm.searchName" slot="prepend"
placeholder="查询类型"
style="width: 120px;">
<el-option label="姓名" value="userName"></el-option>
<el-option label="工号" value="loginName"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button">
<el-select v-model="dbPageForm.unionId" filterable clearable @change="getUnits"
placeholder="请选择工会">
<el-option
v-for="item in unionList"
:label="item.unionname"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-select v-model="dbPageForm.unitId" filterable clearable
placeholder="请选择单位">
<el-option
v-for="item in unitList"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="dbDoSearch"></el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10" class="text-right">
<vi-title2 title="温馨提示:拖动姓名至左侧树菜单中的小组可快速调整">
<template #func>
</template>
</vi-title2>
<el-table :data="dbTableData">
<el-table-column label="序号" width="60px">
<template scope="scope"><span>{{scope.$index+1}}</span></template>
</el-table-column>
<el-table-column label="姓名" prop="username">
<template slot-scope="{ row }">
<div class="draggable-cell" draggable="true" style="color: #0e78c5"
@dragstart="(event) => {handleDragStart(row, event)}">
{{ row.username }}
</div>
</template>
</el-table-column>
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column label="代表团" prop="dbtname"></el-table-column>
<el-table-column sortable prop="unionname" label="工会"
show-overflow-tooltip></el-table-column>
<el-table-column sortable prop="unitname" label="单位"
show-overflow-tooltip></el-table-column>
<el-table-column sortable prop="roleName" label="代表身份"></el-table-column>
<el-table-column label="操作" width="200">
<template scope="{row}">
<el-button type="primary" size="mini"
@click="adjustGroup(row)">
调整小组
</el-button>
<el-button type="danger" size="mini"
@click="removeGroup(row)">
移除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
<el-tab-pane label="设置组长/副组长" name="two">
<el-card shadow="never" class="text-right">
<el-button type="primary" @click="openUser(adminPageForm.groupId)">
设置组长/副组长
</el-button>
</el-card>
<el-card shadow="never" class="mt10" class="text-right">
<el-table :data="zzTableData">
<el-table-column sortable prop="loginName" label="工号"></el-table-column>
<el-table-column sortable prop="userName" label="姓名"></el-table-column>
<el-table-column sortable prop="dwname" label="单位"
show-overflow-tooltip></el-table-column>
<el-table-column prop="mobile" label="电话"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column prop="rolename" label="身份">
<template slot-scope="scope">
<span v-if="scope.row.rolename==='代表小组组长'" class="text-primary">组长</span>
<span v-if="scope.row.rolename==='代表小组副组长'" class="text-info">副组长</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template scope="{row}">
<el-button type="danger" size="mini"
@click="delUser(row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
<el-tab-pane label="设置分管校领导" name="three">
<el-card shadow="never" class="text-right">
<el-button type="primary" @click="openXld(adminPageForm.groupId)">
设置分管校领导
</el-button>
</el-card>
<el-card shadow="never" class="mt10" class="text-right">
<el-table :data="xldTableData">
<el-table-column sortable prop="loginName" label="工号"></el-table-column>
<el-table-column sortable prop="userName" label="姓名"></el-table-column>
<el-table-column sortable prop="dwname" label="单位"
show-overflow-tooltip></el-table-column>
<el-table-column prop="mobile" label="电话"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column label="操作" width="100">
<template scope="{row}">
<el-button type="danger" size="mini"
@click="delXld(row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
</el-tabs>
</div>
</template>
</tree-layout>
</guava>
<el-dialog title="添加小组" :visible.sync="addDialogVisible" width="40%">
<el-form :model="formData" ref="addForm" :rules="rules" label-width="100px">
<el-form-item prop="jdhId" label="所属教代会">
<el-select v-model="formData.jdhId" @change="addGroupChange" placeholder="选择教代会"
style="width: 100%">
<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="group" label="小组名称">
<el-select multiple v-model="formData.group" filterable placeholder="请选择小组名称"
style="width: 100%">
<el-option
v-for="item in addGroupList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</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="设置组长/副组长" :visible.sync="userDialogVisible" width="40%">
<el-form label-width="100px">
<el-form-item prop="jdhallname" label="届次">
<el-select v-model="pageForm.jdhId" disabled style="width: 100%">
<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="userid" label="工号或姓名">
<el-select v-model="userFormData.userid" filterable placeholder="请输入工号或姓名关键字"
style="width: 100%" @change="userChange">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.username+'('+item.loginname+')'"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="联系方式">
<el-input v-model="leaderInfo.mobile" readonly></el-input>
</el-form-item>
<el-form-item prop="dwname" label="所属单位">
<el-input v-model="leaderInfo.dwname" readonly></el-input>
</el-form-item>
<el-form-item prop="sf" label="身份">
<el-radio-group v-model="leaderInfo.sf">
<el-radio-button label="2">&emsp;</el-radio-button>
<el-radio-button label="1">副组长</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="doAddZz" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="设置分管校领导" :visible.sync="xldDialogVisible" width="40%">
<el-form label-width="100px">
<el-form-item prop="jdhallname" label="届次">
<el-select v-model="pageForm.jdhId" disabled style="width: 100%">
<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="userid" label="工号或姓名">
<el-select v-model="xldInfo.userid" filterable placeholder="请输入工号或姓名关键字"
style="width: 100%" @change="xldChange">
<el-option
v-for="item in xldList"
:key="item.id"
:label="item.username+'('+item.loginname+')'"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="联系方式">
<el-input v-model="xldInfo.mobile" readonly></el-input>
</el-form-item>
<el-form-item prop="dwname" label="所属单位">
<el-input v-model="xldInfo.dwname" readonly></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="doAddXld" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="编辑小组名称" :visible.sync="updateGroupNameDialogVisible" width="30%">
<el-form :model="editForm" label-width="100px" ref="editForm">
<el-form-item prop="groupName" label="小组名称" ref="aa"
:rules="{required: true, message: '请填写小组名称', trigger: 'blur'}">
<el-input v-model="editForm.groupName"></el-input>
</el-form-item>
<el-form-item prop="workUser" label="工作人员" ref="aa"
:rules="{required: true, message: '请填写工作人员,多个请用逗号分隔', trigger: 'blur'}">
<el-input v-model="editForm.workUser"></el-input>
</el-form-item>
<el-form-item prop="talkAddress" label="讨论地点" ref="aa"
:rules="{required: true, message: '请填写讨论地点', trigger: 'blur'}">
<el-input v-model="editForm.talkAddress"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="updateGroupNameDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="updateGroupNameDo">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="调整小组" :visible.sync="adjustDialogVisible" width="30%">
<el-select v-model="newGroupId" placeholder="请选择要调整的小组" style="width: 100%">
<el-option
v-for="item in adjustOption"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
<span slot="footer" class="dialog-footer">
<el-button @click="adjustDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="adjustDo">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="根据代表团分配" :visible.sync="dbtDialogVisible" width="55%">
<div style="width: 100%;">
<el-transfer :titles="['未选', '已选']" filterable
:props="{key: 'id',label: 'dbtname'}"
:filter-method="dbtFilterMethod"
v-model="dbtFormData.dbtValue"
:data="dbtData">
</el-transfer>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dbtDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doDbt">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue')
},
data() {
return {
xldTableData: [],
dbtFormData: {
dbtValue: [],
},
dbtData: [],
dbtDialogVisible: false,
newGroupId: '',
adjustOption: [],
adjustDialogVisible: false,
editForm: {},
updateGroupNameDialogVisible: false,
zzTableData: [],
tableData: [],
groupList: [],
addGroupList: [],
adminPageForm: {},
node: {
level: 1
},
formData: {
jdhId: ''
},
dbPageForm: {
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: "",
unitId: "",
unionId: "",
searchName: 'userName',
},
checkData: {},
activeName: 'one',
jdhList: [],
unitList: [],
unionList: [],
treeData: [],
addDialogVisible: false,
rules: {
jdhId: [{required: true, message: '请选择教代会', trigger: ['blur']}],
group: [{required: true, message: '请选择代表团', trigger: ['blur']}]
},
defaultProps: {
children: 'childrens',
label: 'groupName',
disabled: 'disabled',
draggable: true
},
dbTableData: [],
userList: [],
userDialogVisible: false,
leaderInfo: {
sf: '2'
},
editData: {},
userFormData: {},
adjustRow: {},
dragRow: {},
xldInfo: {},
xldDialogVisible: false,
xldList: [],
}
},
methods: {
assignByLeader() {
this.$confirm('分配代表前请确认需要分配的代表小组是否设置了分管校领导?', '提示', {
confirmButtonText: '我已设置',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const loading = this.$loading({
lock: true,
text: '正在努力分配中,感谢您的耐心等待!',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
})
const resp = await $.post(loc() + "/assignByLeader", {
jdhId: this.pageForm.jdhId
})
if(resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg})
await this.undertakeUnitTree()
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
loading.close()
}
}
})
},
delXld(row) {
console.log(row)
this.$confirm('确定要移除该分管校领导吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const resp = await $.post(loc() + "/delXld", {
xldId: row.id,
groupId: this.adminPageForm.groupId
})
if(resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg})
await this.getXldList()
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
}
}
})
},
xldChange(val) {
this.xldInfo = this.xldList.find(v => {
if (v.id === val) {
return v
}
})
},
doAddXld: throttle(async function () {
if (this.xldInfo.userid === null || this.xldInfo.userid === '') {
this.$notify({
title: '警告',
message: '请先选择分管校领导',
type: 'warning'
});
return
}
const resp = await $.post(loc() + "/doAddXld", {
xldId: this.xldInfo.userid,
groupId: this.adminPageForm.groupId
})
if(resp.code === 0) {
await this.getXldList()
this.$notify.success({title: '成功', message: resp.msg});
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
this.xldList = []
this.xldInfo = {}
this.xldDialogVisible = false
}, 2000),
//查询二级单位分管校领导
async openXld(groupId) {
const resp = await $.get(loc() + '/findXld', {groupId: groupId})
this.xldList = resp.data
this.xldDialogVisible = true
},
exportDropdownCommand(command) {
if ("group" === command.type) {
location.href = '/platform/jdh/zzjg/groupManage/downloadDbList?jdhId=' + this.pageForm.jdhId
} else if("unit" === command.type) {
location.href = '/platform/jdh/zzjg/groupManage/downloadDbListByUnit?jdhId=' + this.pageForm.jdhId
}
},
randomGroup() {
this.$confirm('您确定要一键随机分组吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const loading = this.$loading({
lock: true,
text: '正在努力分配中,感谢您的耐心等待!',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
})
const resp = await $.post(loc() + "/randomGroup", {
jdhId: this.pageForm.jdhId
})
if (resp.code === 0) {
await this.undertakeUnitTree()
this.$notify.success({title: '成功', message: resp.msg})
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
loading.close()
}
}
})
},
async allotByDbt(groupId) {
const jdhId = this.pageForm.jdhId
this.dbtFormData.jdhId = jdhId
this.dbtFormData.groupId = groupId
const {data} = await $.get(loc() + "/findCanDbt", {jdhId, groupId})
if (data) {
this.dbtData = data.data
this.dbtFormData.dbtValue = data.value.map(v => {
return v.dbtId
})
}
this.dbtDialogVisible = true
},
async doDbt() {
const data = clone(this.dbtFormData)
data.dbtValue = JSON.stringify(data.dbtValue)
const resp = await $.post(loc() + "/doDbt", data)
if(resp.code === 0) {
this.pageData()
await this.undertakeUnitTree()
this.$notify.success({title: '成功', message: resp.msg})
this.dbtDialogVisible = false
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
this.fghSubLoading = false
},
dbtFilterMethod(query, item) {
return item.dbtname.indexOf(query) > -1;
},
handleDragStart(row, event) {
//event.dataTransfer.setData('text/plain', JSON.stringify(row));
this.dragRow = row
event.effectAllowed = 'move';
},
handleDragOver(event) {
event.preventDefault()
},
handleDragEnter(event) {
event.preventDefault()
},
handleDrop(nodeData, event) {
event.preventDefault()
//const row = JSON.parse(event.dataTransfer.getData('text/plain'))
const row = this.dragRow
if (nodeData.id === this.checkData.id) {
this.$message.warning(row.username + '已在' + nodeData.groupName + ',无法调整')
return
}
this.$confirm('您确定要将【' + row.username + '】调整到' + nodeData.groupName + '吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const resp = await $.post(loc() + "/adjustGroup", {
jdhId: this.pageForm.jdhId,
oldGroupId: row.groupId,
newGroupId: nodeData.id,
userId: row.userId,
roleId: row.roleId,
})
if(resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg})
await this.dbData()
await this.undertakeUnitTree()
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
}
}
})
},
adjustGroup(row) {
this.adjustRow = row
if (this.treeData[0].childrens && this.treeData[0].childrens.length > 0) {
this.adjustOption = this.treeData[0].childrens.filter(o => o.id !== this.checkData.id)
}
this.newGroupId = ''
this.adjustDialogVisible = true
},
removeGroup(row) {
this.$confirm('您确定要将【' + row.username + '】从' + this.checkData.groupName + '中移除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const resp = await $.post(loc() + "/removeGroup", {
jdhId: this.pageForm.jdhId,
groupId: row.groupId,
userId: row.userId,
roleId: row.roleId,
})
if(resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg})
await this.dbData()
await this.undertakeUnitTree()
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
}
}
})
},
async adjustDo() {
if (this.newGroupId === '') {
this.$message.warning('请选择要调整的小组')
return
}
const group = this.adjustOption.find(o => o.id === this.newGroupId)
this.$confirm('您确定要将【' + this.adjustRow.username + '】调整到' + group.groupName + '吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const resp = await $.post(loc() + "/adjustGroup", {
jdhId: this.pageForm.jdhId,
oldGroupId: this.adjustRow.groupId,
newGroupId: this.newGroupId,
userId: this.adjustRow.userId,
roleId: this.adjustRow.roleId,
})
if(resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg})
await this.dbData()
await this.undertakeUnitTree()
this.adjustDialogVisible = false
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
}
}
})
},
delUser(row) {
let data = {
userid: row.id,
groupId: this.adminPageForm.groupId,
jdhId: this.pageForm.jdhId,
roleid: row.roleid
}
this.$confirm('确定要移除该组长或副组长吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const resp = await $.post(loc() + "/userDoDelete", data)
if(resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg})
this.getZzList()
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
}
}
});
},
doAddZz: throttle(async function () {
if (this.userFormData.userid == null) {
this.$notify({
title: '警告',
message: '请先选择组长或副组长',
type: 'warning'
});
return
}
this.userFormData.num = this.leaderInfo.sf
const resp = await $.post(loc() + "/doAddZz", this.userFormData)
if(resp.code === 0) {
this.getZzList()
this.$notify.success({title: '成功', message: resp.msg});
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
this.userList = []
this.userFormData.userid = ''
this.userDialogVisible = false
}, 2000),
updateGroupNameDo() {
this.$refs['editForm'].validate(async (valid) => {
if (valid) {
this.$confirm('此操作需要先在字典表中添加新的代表小组名称,请确认', '提示', {
confirmButtonText: '我已添加',
cancelButtonText: '取消',
type: 'warning',
}).then(async ({value}) => {
const resp = await $.post(loc() + '/updateGroup', {
id: this.editData.id,
groupName: this.editForm.groupName,
workUser: this.editForm.workUser,
talkAddress: this.editForm.talkAddress,
})
if (resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg});
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
this.pageData()
this.updateGroupNameDialogVisible = false
}).catch(() => {
this.updateGroupNameDialogVisible = false
});
}
})
},
userChange(val) {
const sf = this.leaderInfo.sf
this.leaderInfo = this.userList.find(v => {
if (v.id === val) {
return v
}
})
this.$set(this.leaderInfo, 'sf', sf)
},
async openUser(groupId) {
this.userFormData = {}
this.userFormData.groupId = groupId
this.userFormData.jdhId = this.pageForm.jdhId
const {data} = await $.get(loc() + "/queryUser", {groupId: groupId, jdhId: this.pageForm.jdhId})
if (data) {
this.userList = data
}
this.userDialogVisible = true
},
dropdownCommand(command) {
const {type, data} = command
if (type === 'zz') {
this.openZz(data)
} else if (type === 'delete') {
this.doDelete(data.id)
} else if (type === 'editName') {
this.editName(data)
} else if (type === 'allot') {
this.allotByDbt(data.id)
} else if (type === 'clearGroup') {
this.clearGroup(data)
} else if (type === 'xld') {
this.openXld(data.id)
}
},
clearAllGroup() {
this.$confirm('您确认要清空全部小组的代表吗?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(async ({value}) => {
const row = {
jdhId: this.pageForm.jdhId
}
await this.clearGroupDo(row)
}).catch(() => {
})
},
clearGroup(row) {
this.$confirm('您确认要清空' + row.groupName + '的代表吗?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(async ({value}) => {
await this.clearGroupDo(row)
}).catch(() => {
})
},
async clearGroupDo(row) {
const resp = await $.post(loc() + '/clearGroup', {
id: row.id,
jdhId: row.jdhId,
})
if (resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg})
await this.undertakeUnitTree()
} else {
this.$notify.error({title: '失败', message: resp.msg})
}
},
openZz(row) {
this.leaderInfo = {
mobile: '',
dwname: '',
sf: '2'
}
const groupId = row.id
this.openUser(groupId)
},
editName(data) {
this.editData = data
this.$set(this.editForm, 'groupName', data.groupName)
this.updateGroupNameDialogVisible = true
if (this.$refs['editForm']) {
this.$refs['editForm'].resetFields()
}
},
async dbDoSearch() {
await this.dbData()
},
handleTabClick(tab) {
if (tab.name === 'one') {
this.dbData()
} else if (tab.name === 'two') {
this.getZzList()
} else if (tab.name === 'three') {
this.getXldList()
}
},
async getXldList() {
const resp = await $.get(loc() + '/getXldList', this.adminPageForm)
if(resp.code === 0) {
this.xldTableData = resp.data;
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
},
async getZzList() {
const resp = await $.get(loc() + '/getZzList', this.adminPageForm)
if(resp.code === 0) {
this.zzTableData = resp.data;
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
},
doDelete(id) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const resp = await $.post(loc() + "/doDelete", {id})
if(resp.code === 0) {
this.$notify.success({title: '成功', message: resp.msg});
await this.undertakeUnitTree()
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
}
}
});
},
openAdd() {
this.formData = {}
if (this.jdhList.length > 0) {
this.$set(this.formData, 'jdhId', this.jdhList[0].id)
this.getGroupList(this.formData.jdhId)
}
this.addDialogVisible = true
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
async getGroupList(jdhId) {
const resp = await $.post(loc() + "/findCanGroup", {jdhId: jdhId})
if(resp.code === 0) {
this.addGroupList = resp.data;
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
},
doAdd() {
this.$refs['addForm'].validate(async (valid) => {
let data = clone(this.formData)
data.group = JSON.stringify(data.group)
if (valid) {
const resp = await $.post(loc() + '/doAdd', data)
if (resp.code === 0) {
await this.undertakeUnitTree()
this.addDialogVisible = false
}
}
})
},
addGroupChange(val) {
this.getGroupList(val)
},
async jdhChange(id) {
this.pageForm.groupId = ''
this.groupList = await getGroup(id)
await this.undertakeUnitTree()
},
handleNodeClick(data, node) {
this.node = node
this.checkData = data
this.dbPageForm.groupId = data.id
this.adminPageForm.groupId = data.id
if(this.activeName === 'one') {
this.dbData()
} else if(this.activeName === 'two') {
this.getZzList()
} else if(this.activeName === 'three') {
this.getXldList()
}
},
async dbData() {
this.dbPageForm.jdhId = this.pageForm.jdhId
const resp = await $.get(loc() + '/dbTableData', this.dbPageForm)
if(resp.code === 0) {
this.dbTableData = resp.data;
} else {
this.$notify.error({title: '失败', message: resp.msg});
}
},
async getUnits() {
this.unitList = await getUnit(this.dbPageForm.unionId)
},
async undertakeUnitTree() {
const {data} = await $.get(loc() + "/undertakeUnionTree", {jdhId: this.pageForm.jdhId})
this.treeData = [data]
this.pageData()
},
},
async created() {
this.jdhList = await getOpenJdh()
if (this.jdhList.length > 0) {
this.$set(this.pageForm, 'jdhId', this.jdhList[0].id)
this.groupList = await getGroup(this.jdhList[0].id)
this.pageData()
}
await this.getUnits()
this.unionList = await getUnion()
await this.undertakeUnitTree()
}
})
</script>
<!--#
}
#-->