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

740 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 :data="treeData" :expand-on-click-node="false" :filter-node-method="filterNode"
:props="defaultProps" @node-click="handleNodeClick"
accordion
class="v-tree" default-expand-all
highlight-current node-key="id"
ref="tree" v-loading="treeLoading">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div class="v-node" style="font-size: 16px;" v-if="node.level==1"><i
class="el-icon-s-home"></i>&nbsp;
{{ data.name }}
</div>
<div :title="data.name"
class="v-node" style="font-size: 15px" v-if="node.level==2">
<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 :title="data.name"
class="v-node" style="font-size: 14px" v-if="node.level==3">
<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 :title="data.name"
class="v-node" style="font-size: 14px" v-if="node.level>3">
<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 class="pl10 pr10" v-if="node.level==1">
<div v-if="hasChildren">
<el-card shadow="never">
<!-- <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">
<el-button @click="openAdd()" icon="el-icon-plus"
type="primary">
新建机构
</el-button>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<el-table :data="tableData" key="1" 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 align="center" label="机构名称" prop="name"></el-table-column>
<el-table-column align="center" label="机构编码" prop="mechanismcode"></el-table-column>
<el-table-column align="center" label="备注" prop="mechanismName"
show-overflow-tooltip></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 @change="jdhChange" filterable placeholder="请选择教代会"
v-model="pageForm.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in jdhList">
</el-option>
</el-select>
</div>
<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="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 @click="cyPageData" icon="el-icon-search" type="primary"></el-button>
</div>
<div class="offscreen-right pull-right">
<el-button @click="openCy()" icon="el-icon-plus"
size="medium"
type="primary">
设置委员
</el-button>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<el-table :data="cyTableData" key="2" 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 align="center" label="工号" prop="loginname"></el-table-column>
<el-table-column align="center" label="姓名" prop="username"></el-table-column>
<el-table-column align="center" label="性别" prop="sex"></el-table-column>
<el-table-column align="center" label="手机" prop="mobile"></el-table-column>
<el-table-column align="center" label="单位" prop="unitname" show-overflow-tooltip>
<template slot-scope="{row}">
({{row.unitcode}}){{row.unitname}}
</template>
</el-table-column>
<el-table-column align="center" label="届次" prop="jdhallname"></el-table-column>
<el-table-column label="身份" prop="sf" sortable>
<template slot-scope="{row}">
<span class="text-primary" v-if="row.sf===1">委员</span>
<span class="text-primary" v-if="row.sf===2">副主任</span>
<span class="text-primary" v-if="row.sf===3">主任</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 @click.native="updateSf(row,3)"
class="text-primary"
v-if="row.sf!==3">设置主任
</el-dropdown-item>
<el-dropdown-item @click.native="updateSf(row,2)"
class="text-primary"
v-if="row.sf!==2">设置副主任
</el-dropdown-item>
<el-dropdown-item @click.native="updateSf(row,1)"
class="text-primary"
v-if="row.sf!==1">设置委员
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
:current-page="cyPageForm.pageNumber"
:page-size="cyPageForm.pageSize"
:page-sizes="[5,10, 20, 30, 50]"
:total="cyPageForm.totalCount"
@current-change="cyPageNumberChange"
@size-change="cyPageSizeChange"
layout="total, sizes, prev, pager, next">
</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" :rules="rules" label-width="100px" ref="addForm">
<el-row gutter="30">
<el-col :span="24">
<el-form-item label="上级机构" prop="name">
<el-input :value="checkData.name" disabled maxlength="100"
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 :disabled="formData.id!=null" maxlength="100" placeholder="请输入机构名称"
type="text"
v-model="formData.name"></el-input>
</el-form-item>
<el-form-item label="机构名称" prop="name" v-else>
<el-select :disabled="formData.id!=null" @change="wyhChange" style="width: 100%"
v-model="formData.wyh"
value-key="id">
<el-option :key="i.id" :label="i.name" :value="i" v-for="i in wyhList"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机构代码" prop="unitcode">
<el-input maxlength="100" placeholder="请输入机构编码"
type="text"
v-model="formData.mechanismcode"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="unitcode">
<el-input :autosize="{ minRows: 4, maxRows: 8}" maxlength="100"
placeholder="请输入备注"
type="textarea"
v-model="formData.mechanismName"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="display: flex;justify-content:flex-end;margin-top: 30px">
<el-button :loading="loading" @click="!formData.id?doAdd():doEdit()" type="primary">提 交
</el-button>
</div>
</template>
</guava>
<el-dialog :visible.sync="cyDialogVisible" title="设置委员" width="40%">
<el-form label-width="100px">
<el-form-item label="届次" prop="jdhallname">
<el-select disabled style="width: 100%" v-model="pageForm.jdhid">
<el-option
:key="item.id"
:label="item.jdhallname"
:value="item.id"
v-for="item in jdhList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="工号或姓名" prop="userid">
<el-select @change="userChange" filterable placeholder="请输入工号或姓名关键字"
style="width: 100%" v-model="cyFormData.userid">
<el-option
:key="item.userid"
:label="item.username+'('+item.loginname+')'"
:value="item.userid"
v-for="item in userList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="联系方式" prop="mobile">
<el-input readonly v-model="cyFormData.mobile"></el-input>
</el-form-item>
<el-form-item label="所属单位" prop="dwname">
<el-input readonly v-model="cyFormData.dwname"></el-input>
</el-form-item>
<el-form-item label="身份" prop="sf">
<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 class="dialog-footer" slot="footer">
<el-button :loading="cySubLoading" @click="doCy" type="primary">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const 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() {
const {data} = await $.get(loc() + "/queryUser", {jdhid: this.pageForm.jdhid, jgid: this.checkData.id})
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,
}
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
this.formData.jdhallname
this.formData.mcid = this.formData.wyh.id
this.formData.name = this.formData.wyh.name
const resp = await $.post(loc() + "/doAdd", this.formData)
requestLaterMsgFun(this, resp, () => {
this.loadTree(false)
this.pageData();
}, null, () => {
this.loading = false
this.$refs.guava.index()
})
}
});
},
async openCy() {
this.cyFormData = {
userid: '',
mobile: '',
dwname: '',
sf: '1'
}
await this.queryUser()
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
this.cySubLoading = true
if (this.cyFormData.userid === '') {
this.$message.info('请先选择用户!')
return
}
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)
requestLaterFun(resp, () => {
this.cyDialogVisible = false
this.cyPageData();
this.$notify.success({title: '成功', message: resp.msg});
}, () => {
this.$notify.error({title: '失败', message: 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)
requestLaterMsgFun(this, resp, () => {
this.loadTree(false)
this.pageData();
}, null, () => {
this.loading = false
this.$refs.guava.index()
})
}
});
},
doDelete(id) {
this.$confirm('确定要删除该机构吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDelete", {id: id})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.pageData()
this.loadTree(true)
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
},
doDeleteCy(row) {
this.$confirm('确定要删除该委员吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDeleteCy", row)
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.pageData()
this.cyPageData()
this.loadTree(true)
}, () => {
this.$notify.error({title: '失败', message: 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 getOpenJdh()
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>
<!--#
}
#-->