453 lines
20 KiB
HTML
453 lines
20 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
<style>
|
|
.dialog-footer .el-button {
|
|
padding: 12px 30px;
|
|
}
|
|
|
|
.el-tag {
|
|
border-radius: 50%;
|
|
height: 22px;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<guava>
|
|
<tree-layout>
|
|
<template #tree>
|
|
<div style="padding: 15px;">
|
|
<el-input placeholder="输入单位名称进行过滤" v-model="filterText"></el-input>
|
|
</div>
|
|
<el-tree :data="treeData" :filter-node-method="filterNode" :props="defaultProps"
|
|
@node-click="handleNodeClick" accordion class="filter-tree"
|
|
default-expand-all highlight-current ref="tree">
|
|
<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-office-building"></i> {{ data.unitName }}
|
|
</div>
|
|
|
|
<div class="v-node" style="font-size: 14px" v-if="node.level==2">
|
|
<i class="el-icon-s-help" v-if="checkData.unitName==data.unitName"></i>
|
|
<i class="el-icon-help" v-else></i>
|
|
 {{ data.unitName }}
|
|
</div>
|
|
</div>
|
|
</el-tree>
|
|
</template>
|
|
|
|
<template>
|
|
<div style="width: 100%;" v-if="node.level==1">
|
|
<el-card shadow="never">
|
|
<div class="btn-group tool-button">
|
|
<el-input @keyup.enter.native="doSearch" clearable placeholder="根据承办单位名称进行查询"
|
|
v-model="pageForm.unitName">
|
|
</el-input>
|
|
</div>
|
|
<div class="btn-group tool-button">
|
|
<el-button @click="doSearch()" icon="el-icon-search" slot="append"
|
|
type="primary"></el-button>
|
|
</div>
|
|
<div class="pull-right offscreen-right">
|
|
<el-button @click="openAdd" type="primary"><i class="ti-plus"></i>增补承办单位</el-button>
|
|
</div>
|
|
</el-card>
|
|
|
|
<el-card class="mt10" shadow="never">
|
|
<el-table :data="tableData" height="722" highlight-current-row ref="underTakeTable">
|
|
<el-table-column label="序号" width="60px">
|
|
<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" label="承办单位编码" prop="unitCode"
|
|
width="120px"></el-table-column>
|
|
<el-table-column align="center" header-align="center" label="承办单位名称" prop="unitName"
|
|
width="200px"></el-table-column>
|
|
<el-table-column align="center" header-align="center" label="分管校领导及联系电话"
|
|
prop="leader" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" header-align="center" label="负责人及联系电话"
|
|
prop="principal" show-overflow-tooltip></el-table-column>
|
|
<el-table-column align="center" header-align="center" label="是否启用" prop="isEnable"
|
|
width="100px">
|
|
<template scope="{row}">
|
|
<el-switch @change="switchChange(row)" active-color="#13ce66"
|
|
inactive-color="#ff4949" v-model="row.isEnable">
|
|
</el-switch>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" fixed="right" header-align="center" label="操作"
|
|
width="120px">
|
|
<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:'leader',data:row}">设置分管校领导
|
|
</el-dropdown-item>
|
|
<el-dropdown-item :command="{type:'principal',data:row}">设置负责人
|
|
</el-dropdown-item>
|
|
<el-dropdown-item :command="{type:'edit',data:row}">编辑</el-dropdown-item>
|
|
<el-dropdown-item :command="{type:'delete',data:row}" v-if="!row.isEnable">
|
|
删除
|
|
</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--#include("/layouts/pagination.html"){}#-->
|
|
</el-card>
|
|
|
|
|
|
</div>
|
|
|
|
<div style="padding: 5px 10px" v-if="node.level==2">
|
|
<el-tabs @tab-click="handleTabClick" type="card" v-model="activeName">
|
|
<el-tab-pane label="分管校领导" name="one"></el-tab-pane>
|
|
<el-tab-pane label="负责人" name="two"></el-tab-pane>
|
|
</el-tabs>
|
|
<el-table :data="adminTableData" highlight-current-row size="small" style="width: 100%;">
|
|
<el-table-column label="序号" width="60px">
|
|
<template scope="scope"><span>{{scope.$index+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="操作">
|
|
<template scope="{row}">
|
|
<el-button @click="removeAdmin(row)" circle icon="el-icon-delete" plain size="mini"
|
|
type="danger">
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-row class="el-pagination-container" style="text-align: right;margin-top: 20px">
|
|
<span style="color: red">{{butTitle}}</span>
|
|
<el-button @click="openAdmin(adminPageForm,adminPageForm.flag)" circle size="medium"
|
|
type="primary">
|
|
<i class="el-icon-plus"></i>
|
|
</el-button>
|
|
</el-row>
|
|
</div>
|
|
</template>
|
|
</tree-layout>
|
|
</guava>
|
|
|
|
|
|
<el-dialog :visible.sync="dialogVisible" title="增补承办单位" width="50%">
|
|
<el-form :model="formData" :rules="formRules" label-width="120px" ref="addForm">
|
|
<el-form-item label="承办单位编码" prop="unitCode">
|
|
<el-input placeholder="请输入承办单位编码" v-model="formData.unitCode"></el-input>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="承办单位名称" prop="unitName">
|
|
<el-input placeholder="请输入承办单位名称" v-model="formData.unitName"></el-input>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="是否启用" prop="isEnable">
|
|
<el-radio-group v-model="formData.isEnable">
|
|
<el-radio-button :label="true">是</el-radio-button>
|
|
<el-radio-button :label="false">否</el-radio-button>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form>
|
|
<span class="dialog-footer" slot="footer">
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
<el-button :loading="subLoading" @click="operation" type="primary">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
|
|
<el-dialog :title="title" :visible.sync="adminDialogVisible" width="55%">
|
|
<div style="width: 100%;">
|
|
<el-transfer :data="adminData" :filter-method="adminFilterMethod"
|
|
:props="{key: 'id',label: 'name'}"
|
|
:titles="['单位成员', '管理员']"
|
|
filterable
|
|
v-model="adminFormData.adminValue">
|
|
</el-transfer>
|
|
</div>
|
|
|
|
<span class="dialog-footer" slot="footer">
|
|
<el-button @click="adminDialogVisible = false">取 消</el-button>
|
|
<el-button :loading="adminSubLoading" @click="doAdmin" type="primary">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
const vue = new Vue({
|
|
el: '#app',
|
|
mixins: [initTableMixins],
|
|
components: {
|
|
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue')
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
butTitle: '添加分管校领导',
|
|
filterText: '',
|
|
activeName: 'one',
|
|
subLoading: false,
|
|
dialogVisible: false,
|
|
treeData: [],
|
|
node: {
|
|
level: 1
|
|
},
|
|
formData: {
|
|
isEnable: true
|
|
},
|
|
checkData: {},
|
|
adminSubLoading: false,
|
|
adminDialogVisible: false,
|
|
adminFormData: {
|
|
adminValue: [],
|
|
flag: true
|
|
},
|
|
adminData: [],
|
|
adminTableData: [],
|
|
adminPageForm: {
|
|
flag: true
|
|
},
|
|
defaultProps: {
|
|
children: 'childrens',
|
|
label: 'unitName',
|
|
disabled: 'disabled'
|
|
},
|
|
formRules: {
|
|
unitCode: [{required: true, message: '请输入承办单位编码', trigger: ['blur', 'change']}],
|
|
unitName: [{required: true, message: '请输入承办单位名称', trigger: ['blur', 'change']}],
|
|
isEnable: [{required: true, message: '请选择是否启用', trigger: ['blur', 'change']}],
|
|
},
|
|
}
|
|
},
|
|
watch: {
|
|
filterText(val) {
|
|
this.$refs.tree.filter(val);
|
|
}
|
|
},
|
|
methods: {
|
|
dropdownCommand(command) {
|
|
const {type, data} = command
|
|
if (type === 'leader') {
|
|
this.title = '设置分管校领导'
|
|
this.openAdmin(data, true)
|
|
} else if (type === 'principal') {
|
|
this.title = '设置负责人'
|
|
this.openAdmin(data, false)
|
|
} else if (type === 'edit') {
|
|
this.openEdit(data)
|
|
} else if (type === 'delete') {
|
|
this.doDelete(data.id)
|
|
}
|
|
},
|
|
filterNode(value, data) {
|
|
if (!value) return true;
|
|
return data.unitName.indexOf(value) !== -1
|
|
return false
|
|
},
|
|
adminFilterMethod(query, item) {
|
|
return item.username.indexOf(query) > -1;
|
|
},
|
|
handleNodeClick(data, node) {
|
|
this.node = node
|
|
this.checkData = data
|
|
this.adminPageForm.id = data.id
|
|
this.adminPageForm.unitCode = data.unitCode
|
|
this.adminPageForm.flag = this.activeName === 'one'
|
|
this.adminPageData()
|
|
},
|
|
handleTabClick(tab) {
|
|
this.butTitle = tab.name === 'one' ? '添加分管校领导' : '添加负责人'
|
|
this.adminPageForm.flag = tab.name === 'one'
|
|
this.adminPageData()
|
|
},
|
|
removeAdmin(row) {
|
|
this.$confirm('确定要移除该管理员吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
callback: async (a, b) => {
|
|
if ("confirm" === a) {
|
|
const resp = await $.post(loc() + "/removeAdmin", {
|
|
unitId: this.adminPageForm.id,
|
|
userId: row.id,
|
|
roleId: row.roleid
|
|
})
|
|
|
|
requestLaterFun(resp, () => {
|
|
this.$notify.success({title: '成功', message: resp.msg});
|
|
this.adminPageData()
|
|
}, () => {
|
|
this.$notify.error({title: '失败', message: resp.msg});
|
|
})
|
|
}
|
|
}
|
|
});
|
|
},
|
|
async adminPageData() {
|
|
const resp = await $.post(loc() + "/adminPageData", this.adminPageForm)
|
|
requestLaterFun(resp, () => {
|
|
this.adminTableData = resp.data;
|
|
}, () => {
|
|
console.log(resp)
|
|
this.$notify.error({title: '失败', message: resp.msg});
|
|
})
|
|
},
|
|
openAdd() {
|
|
this.formData = {}
|
|
this.$set(this.formData, "isEnable", true)
|
|
this.resetForm()
|
|
},
|
|
openEdit(data) {
|
|
this.formData = data
|
|
this.resetForm()
|
|
},
|
|
async openAdmin(row, flag) {
|
|
const {id, unitCode} = row
|
|
this.adminFormData.unitId = id
|
|
this.adminFormData.flag = flag
|
|
|
|
const {data} = await $.get(loc() + "/findUserAndAdmin", {id, unitCode, flag})
|
|
if (data) {
|
|
this.adminData = data.data
|
|
this.adminFormData.adminValue = data.value.map(v => {
|
|
return v.id
|
|
})
|
|
}
|
|
this.adminDialogVisible = true
|
|
},
|
|
async doAdmin() {
|
|
this.adminSubLoading = true
|
|
const data = clone(this.adminFormData)
|
|
data.adminValue = JSON.stringify(data.adminValue)
|
|
const resp = await $.post(loc() + "/setAdmin", data)
|
|
|
|
requestLaterFun(resp, () => {
|
|
this.adminDialogVisible = false
|
|
this.pageData()
|
|
this.adminPageData()
|
|
this.$notify.success({title: '成功', message: resp.msg});
|
|
}, () => {
|
|
this.$notify.error({title: '失败', message: resp.msg});
|
|
}, () => {
|
|
this.adminSubLoading = false
|
|
})
|
|
},
|
|
resetForm() {
|
|
this.dialogVisible = true
|
|
if (this.$refs['addForm']) {
|
|
this.$refs['addForm'].resetFields()
|
|
}
|
|
},
|
|
async switchChange(data) {
|
|
this.formData = data
|
|
const resp = await $.post(loc() + "/doEdit", {"data": JSON.stringify(this.formData)})
|
|
requestLaterFun(resp, () => {
|
|
this.$notify.success({title: '成功', message: resp.msg});
|
|
}, () => {
|
|
this.$notify.error({title: '失败', message: resp.msg});
|
|
}, () => {
|
|
this.undertakeUnitTree()
|
|
})
|
|
},
|
|
async operation() {
|
|
let method = this.formData.id ? "/doEdit" : "/doAdd"
|
|
this.$refs["addForm"].validate(async (valid) => {
|
|
if (valid) {
|
|
this.subLoading = true
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '正在提交...',
|
|
spinner: 'el-icon-loading',
|
|
background: COVER_LAYER_COLOR
|
|
});
|
|
const resp = await $.post(loc() + method, {"data": JSON.stringify(this.formData)})
|
|
|
|
requestLaterFun(resp, () => {
|
|
this.dialogVisible = false
|
|
this.pageData()
|
|
this.$notify.success({title: '成功', message: resp.msg});
|
|
}, () => {
|
|
this.$notify.error({title: '失败', message: resp.msg});
|
|
}, () => {
|
|
loading.close()
|
|
this.subLoading = false
|
|
})
|
|
}
|
|
});
|
|
},
|
|
doDelete(id) {
|
|
this.$confirm('确定要删除吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
callback: async (a, b) => {
|
|
if ("confirm" == a) {
|
|
const resp = await $.post(loc() + "/doDelete", {id})
|
|
|
|
requestLaterFun(resp, () => {
|
|
this.$notify.success({title: '成功', message: resp.msg});
|
|
this.undertakeUnitTree()
|
|
}, () => {
|
|
this.$notify.error({title: '失败', message: resp.msg});
|
|
})
|
|
}
|
|
}
|
|
});
|
|
},
|
|
async undertakeUnitTree() {
|
|
const {data} = await $.get(loc() + "/undertakeUnitTree")
|
|
this.treeData = [data]
|
|
this.pageData()
|
|
}
|
|
},
|
|
async created() {
|
|
await this.undertakeUnitTree()
|
|
}
|
|
})
|
|
</script>
|
|
<!--#
|
|
}
|
|
#--> |