Files
UNION_NJUST/target/classes/views/platform/proposal/basics/undertake.html
T
2026-09-23 09:38:39 +08:00

492 lines
21 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. 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>
.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;
}
.filter-tree {
height: calc(100% - 70px);
overflow-y: scroll;
}
.custom-tree-node {
white-space: nowrap;
width: 90%;
}
.custom-tree-node .v-node {
text-overflow: ellipsis;
overflow: hidden;
}
.filter-tree::-webkit-scrollbar {
width: 4px;
}
.filter-tree::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
opacity: 0.2;
background: gray;
}
.filter-tree::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 0;
background: lightgrey;
}
</style>
<div id="app" v-cloak>
<guava>
<!-- <tree-layout>-->
<!-- <template #tree>-->
 
<div style="display: flex;max-height:calc(100vh - 70px);height:calc(100vh - 70px);overflow: hidden ">
<div style="width: 300px;margin-right: 10px;background-color: #fff">
<div style="padding: 15px;">
<el-input placeholder="输入单位名称进行过滤" v-model="filterText"></el-input>
</div>
<el-tree class="filter-tree" :data="treeData" :props="defaultProps"
default-expand-all :filter-node-method="filterNode" ref="tree"
highlight-current accordion @node-click="handleNodeClick">
<div :title="data.unitName" 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.unitName }}
</div>
<div v-if="node.level==2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.unitName==data.unitName"></i>
<i class="el-icon-help" v-else></i>
&emsp;{{ data.unitName }}
</div>
</div>
</el-tree>
</div>
<div style="max-height:calc(100vh - 70px);height: 100%;width: calc(100% - 310px)">
<div style="width: 100%;height: 100%;overflow-y: scroll" v-if="node.level==1">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-input placeholder="根据承办单位名称进行查询" clearable v-model="pageForm.unitName"
@keyup.enter.native="doSearch">
</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 type="primary" @click="openAdd"><i class="ti-plus"></i>增补承办单位</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table :data="tableData" 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 label="承办单位编码" prop="unitCode" header-align="center" align="center"
width="120px"></el-table-column>
<el-table-column label="承办单位名称" prop="unitName" header-align="center" align="center"
width="200px"></el-table-column>
<el-table-column label="分管校领导及联系电话" prop="leader" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="负责人及联系电话" prop="principal" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="是否启用" prop="isEnable" header-align="center" align="center"
width="100px">
<template scope="{row}">
<el-switch @change="switchChange(row)" v-model="row.isEnable"
active-color="#13ce66" inactive-color="#ff4949">
</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 v-if="node.level==2" style="padding: 5px 10px">
<el-tabs v-model="activeName" type="card" @tab-click="handleTabClick">
<el-tab-pane label="分管校领导" name="one"></el-tab-pane>
<el-tab-pane label="负责人" name="two"></el-tab-pane>
</el-tabs>
<el-table highlight-current-row :data="adminTableData" 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 label="职工号" prop="loginname" align="center"></el-table-column>
<el-table-column label="姓名" prop="username" align="center"></el-table-column>
<el-table-column label="性别" prop="sex" align="center"></el-table-column>
<el-table-column label="联系方式" prop="mobile" align="center"></el-table-column>
<el-table-column label="操作" align="center">
<template scope="{row}">
<el-button plain type="danger" size="mini" icon="el-icon-delete" circle
@click="removeAdmin(row)">
</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>
</div>
</div>
<!-- </template>-->
<!-- </tree-layout>-->
</guava>
<el-dialog title="增补承办单位" :visible.sync="dialogVisible" width="50%">
<el-form ref="addForm" :model="formData" :rules="formRules" label-width="120px">
<el-form-item label="承办单位编码" prop="unitCode">
<el-input v-model="formData.unitCode" placeholder="请输入承办单位编码"></el-input>
</el-form-item>
<el-form-item label="承办单位名称" prop="unitName">
<el-input v-model="formData.unitName" placeholder="请输入承办单位名称"></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 slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="operation" :loading="subLoading">确 定</el-button>
</span>
</el-dialog>
<el-dialog :title="title" :visible.sync="adminDialogVisible" width="55%">
<div style="width: 100%;">
<el-transfer :titles="['单位成员', '管理员']" filterable
:props="{key: 'id',label: 'name'}"
:filter-method="adminFilterMethod"
v-model="adminFormData.adminValue"
:data="adminData">
</el-transfer>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="adminDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAdmin" :loading="adminSubLoading">确 定</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>
<!--#
}
#-->