czl-web/pages/announcement/AnnouncementPersonView.html

174 lines
5.7 KiB
HTML

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="UTF-8">
<title>系统公告表单</title>
<link rel="stylesheet" href="../../layui-v2.8.18/layui/css/layui.css" media="all"/>
</head>
<style>
.layui-form-label {
position: relative;
float: left;
display: block;
padding: 9px 15px;
width: 100%;
font-weight: 400;
line-height: 20px;
text-align: right;
}
#commit {
position: fixed;
bottom: 20px;
right: 20px;
}
.layui-upload-list {
margin: 11px 0;
width: 84.5%;
margin-left: 2%;
}
.layui-form-select {
position: relative;
color: #5f5f5f;
width: 80%;
}
#changeType {
width: 160px;
margin-left: -12.5%;
height: 26px;
color: #1AA094;
border: 1px solid #dedede;
padding: 5px;
text-align: center;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
cursor: pointer;
}
.layui-this {
background: #17BAAA !important;
color: white !important;
}
.tox .tox-notification--warn, .tox .tox-notification--warning {
background-color: #fff5cc;
border-color: #fff0b3;
color: #222f3e;
display: none !important;
}
</style>
<body>
<form class="layui-form" action="" onsubmit="return false">
<div class="layui-form-item" style="margin-top: 1%;margin-left: 15%;">
<!-- 左侧组织架构树 -->
<ul id="orgTree" class="ztree"></ul>
</div>
</form>
</body>
</html>
<script type="text/html" id="fileBarDemo">
<a lay-event="download" style="color: #009688;cursor: pointer;font-size: 15px">下载</a>
</script>
<script src="../../js/jquery/jquery-3.6.0.js"></script>
<script src="../../layui-v2.8.18/layui/layui.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script src="../../js/common_methon.js"></script>
<script type="text/javascript" src="../../js/publicJs.js"></script>
<script type="text/javascript" src="../../js/select.js"></script>
<script type="text/javascript" src="../../js/my/permission.js"></script>
<script type="text/javascript" src="../../js/tinymce.min.js" referrerpolicy="origin"></script>
<script type="text/javascript">
layui.config({
base: '../../js/layuiModules/', // 第三方模块所在目录
version: 'v1.6.4' // 插件版本号
}).extend({
soulTable: 'notice,layNotify', // 模块
});
var id = localStorage.getItem("announcementId");
var form;
var table;
var tree;
var newData;
var notice;
var layNotify;
layui.use(['table', 'form', 'notice', 'layNotify','tree'], function () {
table = layui.table;
tree = layui.tree;
form = layui.form;
notice = layui.notice;
layNotify = layui.layNotify;
$.ajax({
type: 'post',
url: ctxPath + '/announcement/personTree',//数据接口
dataType: 'json', // 服务器返回数据类型
async: true,
data: {
id:id
},
success: function (data) {
personType = '0';
var result = [];
for (let i = 0; i < data.length; i++) {
if (data[i].level == '0') {
data[i].spread = true
result.push(data[i])
}
}
for (let i = 0; i < result.length; i++) {
result[i].children = []
for (let j = 0; j < data.length; j++) {
if (result[i].id == data[j].parentId) {
data[j].spread = true
result[i].children.push(data[j])
}
}
}
for (let i = 0; i < result.length; i++) {
//root
for (let k = 0; k < result[i].children.length; k++) {
//parent = 0
result[i].children[k].children = []
for (let j = 0; j < data.length; j++) {
if (result[i].children[k].id == data[j].parentId) {
data[j].spread = true
result[i].children[k].children.push(data[j])
}
}
}
}
for (let i = 0; i < result.length; i++) {
//root
for (let k = 0; k < result[i].children.length; k++) {
//parent = 0
for (let j = 0; j < result[i].children[k].children.length; j++) {
result[i].children[k].children[j].children = []
for (let l = 0; l < data.length; l++) {
if (result[i].children[k].children[j].id == data[l].parentId) {
data[l].spread = true
result[i].children[k].children[j].children.push(data[l])
}
}
}
}
}
tree.render({
elem: '#orgTree'
, data: result
, spread: true
, showLine: false // 是否开启连接线
, onlyIconControl: false
});
},
error: function (err) {
console.log("获取工程下拉列表出错:", err);
}
});
});
</script>