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

747 lines
33 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.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;
}
.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;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<tree-layout id="treeLayout" style="height: calc(100vh - 70px)">
<template #tree>
<div style="border-right: 2px solid rgb(240,240,240);padding: 20px;">
<el-input
placeholder="输入关键字进行查找"
v-model="filterText">
</el-input>
</div>
<el-tree ref="tree" :data="treeData" class="v-tree" v-loading="treeLoading" node-key="id"
:props="defaultProps"
default-expand-all :expand-on-click-node="false"
@node-click="handleNodeClick" accordion
highlight-current :filter-node-method="filterNode">
<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-s-home"></i>&nbsp;
{{ data.name }}
</div>
<div v-if="node.level==2"
style="font-size: 15px" :title="data.name" class="v-node">
<i class="el-icon-star-on" v-if="checkData.name==data.name"></i>
<i class="el-icon-star-off" v-else></i>
&nbsp; {{ data.name }}
</div>
<div v-if="node.level==3"
style="font-size: 14px" :title="data.name" class="v-node">
<i class="fa fa-dot-circle-o" v-if="checkData.name==data.name"></i>
<i class="fa fa-circle-o" v-else></i>
&nbsp; {{ data.name }}
</div>
<div v-if="node.level>3"
style="font-size: 14px" :title="data.name" class="v-node">
<i class="fa fa-dot-circle-o" v-if="checkData.name==data.name"></i>
<i class="fa fa-circle-o" v-else></i>
&nbsp; {{ data.name }}
</div>
</div>
</el-tree>
</template>
<template>
<div v-if="node.level==1" class="pl10 pr10">
<div v-if="hasChildren">
<el-card shadow="never">
<el-row type="flex" justify="end">
<el-button type="primary" icon="el-icon-plus"
@click="openAdd()">
新建机构
</el-button>
</el-row>
<!-- <div class="btn-group tool-button">
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" clearable>
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询"
style="width: 100px;">
<el-option label="机构名称" value="name"></el-option>
<el-option label="机构编码" value="mechanismcode"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search" @click="pageData"></el-button>
</div>-->
<!-- <div class="pull-right offscreen-right">-->
<!-- </div>-->
</el-card>
<el-card shadow="never" class="mt10">
<el-table key="1" :data="tableData" ref="table1">
<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 prop="name" align="center" label="机构名称"></el-table-column>
<el-table-column prop="mechanismcode" align="center" label="机构编码"></el-table-column>
<el-table-column prop="mechanismName" show-overflow-tooltip align="center"
label="备注"></el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template 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:'edit',data:row}">
编辑
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete',data:row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
<div v-if="!hasChildren">
<el-card shadow="never" shadow="never">
<div class="btn-group tool-button">
<el-select v-model="pageForm.jdhid" filterable placeholder="请选择教代会"
@change="jdhChange">
<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">
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" clearable>
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询"
style="width: 100px;">
<el-option label="工号" value="us.loginname"></el-option>
<el-option label="姓名" value="us.username"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search" @click="cyPageData"></el-button>
</div>
<div class="offscreen-right pull-right">
<el-button size="medium" type="primary"
icon="el-icon-plus"
@click="openCy()">
设置委员
</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table key="2" :data="cyTableData" ref="table2">
<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 prop="loginname" align="center" label="工号"></el-table-column>
<el-table-column prop="username" align="center" label="姓名"></el-table-column>
<el-table-column prop="sex" align="center" label="性别"></el-table-column>
<el-table-column prop="mobile" align="center" label="手机"></el-table-column>
<el-table-column prop="unitname" align="center" label="单位" show-overflow-tooltip>
<template slot-scope="{row}">
({{row.unitcode}}){{row.unitname}}
</template>
</el-table-column>
<el-table-column prop="jdhallname" align="center" label="届次"></el-table-column>
<el-table-column sortable prop="sf" label="身份">
<template slot-scope="{row}">
<span class="text-primary" v-if="row.sf===1">委员</span>
<span v-if="row.sf===2" class="text-primary">副主任</span>
<span v-if="row.sf===3" class="text-primary">主任</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template 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="doDeleteCy(row)">删除
</el-dropdown-item>
<el-dropdown-item v-if="row.sf!==3"
@click.native="updateSf(row,3)"
class="text-primary">设置主任
</el-dropdown-item>
<el-dropdown-item v-if="row.sf!==2"
@click.native="updateSf(row,2)"
class="text-primary">设置副主任
</el-dropdown-item>
<el-dropdown-item v-if="row.sf!==1"
@click.native="updateSf(row,1)"
class="text-primary">设置委员
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
@size-change="cyPageSizeChange"
@current-change="cyPageNumberChange"
:current-page="cyPageForm.pageNumber"
:page-sizes="[5,10, 20, 30, 50]"
:page-size="cyPageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="cyPageForm.totalCount">
</el-pagination>
</el-row>
</el-card>
</div>
</div>
</template>
</tree-layout>
</template>
<template #edit>
<el-divider content-position="left"><span style="color: rgb(121, 187, 255)">请填写以下机构信息</span>
</el-divider>
<el-form :model="formData" ref="addForm" :rules="rules" label-width="100px">
<el-row gutter="30">
<el-col :span="24">
<el-form-item prop="name" label="上级机构">
<el-input maxlength="100" disabled :value="checkData.name"
type="text"></el-input>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item prop="jdhid" label="所属教代会">
<el-select v-model="formData.jdhid" placeholder="选择教代会" @change="ssChange"
:disabled="!nodeZm"
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-col>-->
<el-col :span="12">
<el-form-item label="机构名称" prop="name" v-if="!nodeZm">
<el-input maxlength="100" placeholder="请输入机构名称" :disabled="formData.id!=null"
v-model="formData.name"
type="text"></el-input>
</el-form-item>
<el-form-item prop="name" label="机构名称" v-else>
<el-select v-model="formData.wyh" value-key="id" style="width: 100%"
@change="wyhChange"
:disabled="formData.id!=null">
<el-option v-for="i in wyhList" :label="i.name" :value="i" :key="i.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机构代码" prop="unitcode">
<el-input maxlength="100" placeholder="请输入机构编码"
v-model="formData.mechanismcode"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="unitcode">
<el-input maxlength="100" placeholder="请输入备注"
v-model="formData.mechanismName"
:autosize="{ minRows: 4, maxRows: 8}"
type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="display: flex;justify-content:flex-end;margin-top: 30px">
<el-button type="primary" :loading="loading" @click="!formData.id?doAdd():doEdit()">提 交
</el-button>
</div>
</template>
</guava>
<el-dialog :visible.sync="cyDialogVisible" title="设置委员" 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="cyFormData.userid" filterable placeholder="请输入工号或姓名关键字"
remote reserve-keyword :remote-method="queryUser" style="width: 100%" @change="userChange">
<el-option
v-for="item in userList"
:key="item.userid"
:label="item.username+'('+item.loginname+')'"
:value="item.userid">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="联系方式">
<el-input v-model="cyFormData.mobile" readonly></el-input>
</el-form-item>
<el-form-item prop="dwname" label="所属单位">
<el-input v-model="cyFormData.dwname" readonly></el-input>
</el-form-item>
<el-form-item prop="sf" label="身份">
<el-radio-group v-model="cyFormData.sf">
<el-radio-button label="1">&emsp;</el-radio-button>
<el-radio-button label="2">副主任</el-radio-button>
<el-radio-button label="3">&emsp;</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCy" :loading="cySubLoading">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
userList: [],
nodeZm: false,
wyhList: [],
title: '',
hasChildren: true,
TableData: [],
loading: false,
checkData: {},
jdhList: [],
treeData: [],
cyTableData: [],
cyPageForm: {
searchName: "",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
},
filterText: '',
treeLoading: true,
cyDialogVisible: false,
cySubLoading: false,
defaultProps: {
children: 'child',
label: 'name',
},
cyData: [],
cyFormData: {
userid: "",
},
node: {
level: 1
},
rules: {
jdhid: [{required: true, message: '请选择教代会', trigger: ['change', 'blur']}],
},
tableHeight: null
}
},
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue')
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
methods: {
wyhChange(val) {
this.$set(this.formData, 'mechanismcode', val.code)
},
userChange(val) {
this.cyFormData = this.userList.find(v => {
if (v.userid === val) {
return v
}
})
this.$set(this.cyFormData, 'sf', '1')
},
async queryUser(query) {
const {data} = await $.get(loc() + "/queryUser", {
jdhid: this.pageForm.jdhid,
jgid: this.checkData.id,
query: query
})
if (data) {
this.userList = data
}
},
queryKyWyhMc(jdhid) {
if (jdhid !== '') {
$.get(loc() + '/queryKyWyhMc', {jdhid: jdhid}).then(res => {
if (res.code === 0) {
this.wyhList = res.data
}
})
}
},
adminFilterMethod(query, item) {
return item.username.indexOf(query) > -1;
},
async jdhChange(jdhid) {
await this.cyPageData()
await this.pageData()
this.queryKyWyhMc(jdhid)
},
async ssChange(jdhid) {
this.queryKyWyhMc(jdhid)
},
dropdownCommand: function (command) {
const {type, data} = command
if (type == 'view') {
} else if (type == 'edit') {
this.openEdit(data)
} else if (type == 'delete') {
this.doDelete(data.id)
}
},
filterNode(value, data, node) {
if (!value) return true;
return data.name.indexOf(value) !== -1
return false
},
async handleNodeClick(data, node) {
this.nodeZm = node.label === "专门委员会"
this.pageForm.mcid = data.mcid
this.pageForm.jgid = data.id
this.hasChildren = data.hasChildren
this.checkData = data
this.checkNode = node
this.pageForm.parentId = this.checkData.id
if (!this.hasChildren) {
await this.cyPageData()
} else {
this.pageData()
}
},
async loadTree(flush) {
this.treeLoading = true
const {
code,
data,
msg
} = await $.get("/platform/jdh/zzjg/mechanism/getJgszTreeData", {jdhid: this.pageForm.jdhid})
this.treeLoading = false
if (code == 0) {
this.treeData = data
} else {
this.$message({
message: msg,
type: 'error'
});
}
if (flush && code == 0) {
this.checkData = data[0]
this.pageData();
}
},
openAdd() {
const id = this.checkData
this.formData = {
parentId: id.id,
jdhid: id.jdhid,
}
this.ssChange()
this.$refs.guava.edit()
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
doAdd() {
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
this.loading = true
console.log(this.formData)
// this.formData.mcid = this.formData.wyh.id
// this.formData.name = this.formData.wyh.name
const resp = await $.post(loc() + "/doAdd", this.formData)
this.loading = false
if(resp.code===0){
await this.loadTree(false)
this.pageData();
this.$refs.guava.index()
}else{
this.notifyWarning(resp.msg)
}
}
});
},
async openCy() {
this.cyFormData = {
userid: '',
mobile: '',
dwname: '',
sf: '1'
}
this.cyDialogVisible = true
},
cyPageNumberChange(val) {
this.pageForm.pageNumber = val;
this.cyPageData();
},
cyPageSizeChange(val) {
this.pageForm.pageSize = val;
this.cyPageData();
},
async cyPageData() {
const jgid = this.pageForm.jgid
const jdhid = this.pageForm.jdhid
const data = await $.post(loc() + "/cyPageData", this.pageForm)
this.tableLoading = false
if (data.code == 0) {
this.cyTableData = data.data.list;
this.cyPageForm.totalCount = data.data.totalCount;
} else {
this.$message.error(data.msg);
}
},
async doCy() {
this.cyDialogVisible = true
if (this.cyFormData.userid === '') {
this.$message.info('请先选择用户!')
return
}
this.cySubLoading = true
this.cyFormData.jgid = this.pageForm.jgid
this.cyFormData.jdhid = this.pageForm.jdhid
this.cyFormData.mcid = this.pageForm.mcid
const resp = await $.post(loc() + "/cydoAdd", this.cyFormData)
if(resp.code===0){
this.cyDialogVisible = false
this.cyPageData();
this.notifySuccess(resp.msg)
}else{
this.notifyWarning(resp.msg)
}
this.cyPageData()
this.cyFormData.userid = ''
this.userList = []
this.cyDialogVisible = false
this.cySubLoading = false
},
async openEdit(row) {
this.wyhList = this.queryKyWyhMc(row.jdhid)
this.formData = {
id: row.id,
wyh: row.name,
name: row.name,
jdhid: row.jdhid,
mechanismName: row.mechanismName,
mechanismcode: row.mechanismcode
}
this.$refs.guava.edit()
},
doEdit() {
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
this.loading = true
this.formData.mcid = this.formData.wyh.id
this.formData.name = this.formData.wyh.name
const resp = await $.post(loc() + "/doEdit", this.formData)
this.loading = false
if(resp.code===0){
this.loadTree(false)
this.pageData();
this.$refs.guava.index()
}else{
this.notifyWarning(resp.msg)
}
}
});
},
doDelete(id) {
this.$confirm('确定要删除该机构吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDelete", {id: id})
if(resp.code===0){
this.notifySuccess(resp.msg)
this.pageData()
this.loadTree(true)
}else{
this.notifyWarning(resp.msg)
}
}
}
});
},
doDeleteCy(row) {
this.$confirm('确定要删除该委员吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDeleteCy", row)
if(resp.code===0){
this.notifySuccess(resp.msg)
this.pageData()
this.cyPageData()
this.loadTree(true)
}else{
this.notifyWarning(resp.msg)
}
}
}
});
},
updateSf(row, sf) {
$.post(loc() + '/updateSf',
{
userid: row.userid,
jgid: row.jgid,
sf: sf,
jdhid: row.jdhid
}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
this.cyPageData()
this.pageData()
}
})
},
},
async created() {
this.jdhList = await getAllMeeting()
if (this.jdhList.length > 0) {
this.pageForm.jdhid = this.jdhList[0].id
}
this.loadTree(true)
},
mounted() {
// setTimeout(() => {
// this.tableHeight = window.innerHeight - 88 - this.$refs.table1.$el.getBoundingClientRect().top
// this.tableHeight = window.innerHeight - 88 - this.$refs.table2.$el.getBoundingClientRect().top
// window.onresize = () => {
// this.tableHeight = window.innerHeight - 88 - this.$refs.table1.$el.getBoundingClientRect().top
// this.tableHeight = window.innerHeight - 88 - this.$refs.table2.$el.getBoundingClientRect().top
// }
// }, 100)
}
})
</script>
<!--#
}
#-->