You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
530 lines
24 KiB
530 lines
24 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title></title>
|
|
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
|
|
<link rel="stylesheet" href="../../../component/ztree/zTreeStyle.css">
|
|
<style>
|
|
.require-star {
|
|
position: absolute;
|
|
width: 3px;
|
|
height: 14px;
|
|
background-color: #ea4335;
|
|
top: 12px;
|
|
right: 8px;
|
|
border-radius: 1.5px;
|
|
}
|
|
|
|
.input-width {
|
|
max-width: 470px
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<form class="layui-form" action="">
|
|
<div class="mainBox">
|
|
|
|
<fieldset class="layui-elem-field" style="background-color: #E6F7F6;margin: 10px 20px 10px 20px;">
|
|
<div class="layui-field-box" style="padding: 5px 15px 1px 15px !important;">
|
|
<label class="layui-form-label"
|
|
style="width: auto !important;font-weight: bolder;padding: 1px !important;color: #16BAAA;"></span>上级任务要求</label>
|
|
<div class="layui-form-item" style="margin-bottom: 1px !important;">
|
|
<label class="layui-form-label"
|
|
style="width: auto !important;font-weight: bolder;"></span>填报要求:</label>
|
|
<div class="layui-input-block" style="margin-left: 90px !important;padding-top: 9px;"
|
|
id="sjtbyq">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item" style="margin-bottom: 1px !important;margin-top: -8px !important;">
|
|
<label class="layui-form-label"
|
|
style="width: auto !important;font-weight: bolder;"></span>截止时间:</label>
|
|
<div class="layui-input-block" style="margin-left: 90px !important;padding-top: 9px;"
|
|
id="sjjzrq">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item" style="margin-bottom: 1px !important;margin-top: -8px !important;">
|
|
<label class="layui-form-label"
|
|
style="width: auto !important;font-weight: bolder;"></span>发布对象:</label>
|
|
<div class="layui-input-block" style="margin-left: 90px !important;padding-top: 9px;" id="fbdx">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
|
|
|
|
<div class="main-container" style="margin-top: 20px;margin-bottom: 0;">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width: 100px !important;"></span>本级填报要求:</label>
|
|
<div class="layui-input-block" style="margin-left: 90px !important;">
|
|
<textarea name="memo" placeholder="请输入填报要求" class="layui-textarea input-width"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width: 100px !important;"><span
|
|
class="require-star"></span>本级截止日期:</label>
|
|
<div class="layui-input-block" style="margin-left: 90px !important;">
|
|
<input type="text" class="layui-input input-width" lay-verify="required" name="deadline_time"
|
|
id="endDate" placeholder="请选择截止日期">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item" style="margin-bottom: 0 !important;">
|
|
<label class="layui-form-label" style="width: 100px !important;"><span
|
|
class="require-star"></span>选择范围:</label>
|
|
<div class="layui-input-block" style="margin-left: 134px !important;">
|
|
<div class="layui-tab layui-tab-brief">
|
|
<ul class="layui-tab-title" style="border-bottom-style:none">
|
|
<li class="layui-this">快捷选择</li>
|
|
<li>按教师选择</li>
|
|
<span id="class_select" hidden>
|
|
<li>按班级选择</li>
|
|
</span>
|
|
<li>按指定分组选</li>
|
|
</ul>
|
|
<div class="layui-tab-content">
|
|
|
|
<div class="layui-tab-item layui-show">
|
|
<span>
|
|
<input type="checkbox" id="syjs" lay-skin="tag" title="所有教师" class="kj1">
|
|
</span>
|
|
<span id="stu_all" hidden>
|
|
<input type="checkbox" id="syxx" lay-skin="tag" title="所有学生" class="kj1">
|
|
</span>
|
|
<div id="njView" style="margin-top: 10px;">
|
|
</div>
|
|
<script id="njScript" type="text/html">
|
|
{{# layui.each(d, function(index, item){ }}
|
|
<input type="checkbox" id="{{item.nj_id}}" lay-skin="tag" title="{{item.nj_name}}" class="kj2">
|
|
{{# }); }}
|
|
</script>
|
|
</div>
|
|
|
|
|
|
<div class="layui-tab-item ">
|
|
<div style="display: flex;align-items:flex-end;margin-bottom: 10px;">
|
|
<div class="layui-input-inline" style="width: auto;">
|
|
<div class="layui-btn-container tag" lay-filter="orgs" lay-allowclose="true"
|
|
style="border-style:dashed;border-width:1px;border-color: #CCCCCC;height: 100px;width: 714px;padding: 10px;overflow: auto;">
|
|
</div>
|
|
</div>
|
|
<div class="layui-input-inline" style="width: auto;">
|
|
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs"
|
|
lay-on="saveGroup">保存到分组</button>
|
|
</div>
|
|
</div>
|
|
<div class="layui-row layui-col-space10">
|
|
<div class="layui-col-md3">
|
|
<div class="grid-demo" style="border: 1px solid #EEEEEE;height: 375px;">
|
|
<div class='ztree' id='mytree' style="margin: 10px;"></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-md9">
|
|
<div class="grid-demo grid-demo-bg1"
|
|
style="border: 1px solid #EEEEEE;height: 375px;">
|
|
<div class="layui-table-tool"
|
|
style="min-height: 38px !important;width: 580px;">
|
|
<div class="layui-input-group">
|
|
<input type="text" id="person_name" placeholder="请输入教师姓名"
|
|
class="layui-input" lay-affix="clear" lay-filter="clear">
|
|
<div class="layui-input-split layui-input-suffix"
|
|
style="cursor: pointer;" lay-on="search">
|
|
<i class="layui-icon layui-icon-search"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<table id="data-table"></table>
|
|
<script type="text/html" id="select-enable">
|
|
<input type="checkbox" id="{{d.person_id}}" lay-skin="switch" lay-text="已选|未选" lay-filter="switchEnable"
|
|
{{ d.sw == true ? "checked" : "" }}>
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<span id="stu_all" hidden>
|
|
<div id="class_tab" class="layui-tab-item">
|
|
3
|
|
</div>
|
|
</span>
|
|
|
|
<div class="layui-tab-item">
|
|
<div id="tableDiv" style="width: 650px;">
|
|
<table id="group-table"></table>
|
|
<script type="text/html" id="group-bar">
|
|
<button type="button" class="pear-btn pear-btn-danger pear-btn-xs" lay-event="delGroup">
|
|
<i class="layui-icon layui-icon-delete"></i> 删除
|
|
</button>
|
|
</script>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bottom">
|
|
<div class="button-container" style="left: 15px !important">
|
|
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="publish">
|
|
<i class="layui-icon layui-icon-release"></i>
|
|
发布
|
|
</button>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
<script src="../../../component/layui/layui.js"></script>
|
|
<script src="../../../component/pear/pear.js"></script>
|
|
|
|
<script src="../../../admin/js/jquery-3.6.0.min.js"></script>
|
|
<script src="../../../component/ztree/jquery.ztree.core-3.5.min.js"></script>
|
|
<script src="../../../component/ztree/jquery.ztree.exedit-3.5.min.js"></script>
|
|
<script>
|
|
layui.use(['tag'], function () {
|
|
var form = layui.form;
|
|
var $ = layui.jquery;
|
|
var laydate = layui.laydate;
|
|
var tab = layui.tab;
|
|
var util = layui.util;
|
|
var tag = layui.tag;
|
|
var table = layui.table;
|
|
var laytpl = layui.laytpl;
|
|
|
|
var orgId = "";
|
|
|
|
var personIds = [];
|
|
var classIds = [];
|
|
var publishData = {}
|
|
|
|
var jobId = GetQueryString("job_id");
|
|
|
|
$.ajax({
|
|
url: "/QingLong/collect/getJob?job_id=" + jobId,
|
|
async: false,
|
|
type: 'GET',
|
|
success: function (res) {
|
|
$("#sjtbyq").html(res.memo);
|
|
var sjjzrq = res.deadline_time.split(" ")[0];
|
|
$("#sjjzrq").html(sjjzrq);
|
|
if (res.target_type_id == 1) {
|
|
$("#fbdx").html("机构单位 ");
|
|
} else {
|
|
$("#fbdx").html("人员");
|
|
}
|
|
|
|
laydate.render({
|
|
elem: '#endDate',
|
|
max: sjjzrq,
|
|
min: 0
|
|
});
|
|
|
|
}, error: function (xhr, status, error) {
|
|
layer.msg("获取数据异常!", {
|
|
icon: 2,
|
|
time: 1000
|
|
});
|
|
}
|
|
});
|
|
|
|
//学部
|
|
$.ajax({
|
|
type: "GET",
|
|
async: false,
|
|
url: "/QingLong/collect/getSchoolNjList",
|
|
success: function (res) {
|
|
if (res.data.length > 0) {
|
|
$("#class_select").show();
|
|
$("#stu_all").show();
|
|
$("#class_tab").show();
|
|
var njTpl = njScript.innerHTML;
|
|
var njView = document.getElementById('njView');
|
|
laytpl(njTpl).render(res.data, function (html) {
|
|
njView.innerHTML = html;
|
|
});
|
|
form.render();
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
form.on('submit(publish)', function (data) {
|
|
|
|
var checkStatus = table.checkStatus('groupTable');
|
|
var groupIds = checkStatus.data.map(function (item) {
|
|
return item.group_id;
|
|
});
|
|
|
|
var allTeacher = 0;
|
|
var allStudent = 0;
|
|
|
|
$('input[type="checkbox"][class="kj1"]').each(function () {
|
|
var isChecked = $(this).prop('checked');
|
|
var checkboxText = $(this).attr('id');
|
|
if (isChecked) {
|
|
if (checkboxText == 'syjs') {
|
|
allTeacher = 1;
|
|
} else if (checkboxText == 'syxx') {
|
|
allStudent = 1;
|
|
}
|
|
}
|
|
});
|
|
|
|
var njCheckedIds = Array.from(document.querySelectorAll('.kj2:checked')).map(function (checkbox) {
|
|
return checkbox.id;
|
|
});
|
|
|
|
publishData.job_id = jobId;
|
|
publishData.allTeacher = allTeacher;
|
|
publishData.allSutdent = allStudent;
|
|
publishData.njIds = njCheckedIds.join(",");
|
|
publishData.personIds = personIds.join(",");
|
|
publishData.classIds = classIds.join(",");
|
|
publishData.groupIds = groupIds.join(",");
|
|
publishData.deadline_time = data.field.deadline_time;
|
|
publishData.memo = data.field.memo;
|
|
|
|
console.log(publishData);
|
|
|
|
|
|
$.ajax({
|
|
url: '/QingLong/collect/ForwardJob',
|
|
type: 'post',
|
|
data: publishData,
|
|
success: function (result) {
|
|
if (result.success) {
|
|
layer.msg("发布成功!", {
|
|
icon: 1,
|
|
time: 1000
|
|
}, function () {
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
parent.refresh();
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 2000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
|
|
|
|
var ztreeSetting = {
|
|
view: {
|
|
selectedMulti: false
|
|
},
|
|
data: {
|
|
simpleData: {
|
|
enable: true,
|
|
idKey: "org_id",
|
|
pIdKey: "parent_id",
|
|
rootPId: "0"
|
|
},
|
|
key: {
|
|
name: "org_name"
|
|
}
|
|
},
|
|
callback: {
|
|
onClick: zTreeOnClick,
|
|
}
|
|
};
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
async: false,
|
|
url: '/QingLong/collect/getOrgList',
|
|
dataType: "json",
|
|
success: function (res) {
|
|
if (res.code == 0) {
|
|
var orgIdArr = res.data.filter(item => item.parent_id === "0").map(item => item.org_id);
|
|
orgId = orgIdArr.join(',');
|
|
var zTreeObj = $.fn.zTree.init($("#mytree"), ztreeSetting, res.data);
|
|
zTreeObj.expandAll(true);
|
|
|
|
}
|
|
}
|
|
});
|
|
|
|
renderPersonTable();
|
|
|
|
function renderPersonTable() {
|
|
table.render({
|
|
elem: '#data-table',
|
|
id: 'myTable',
|
|
url: '/QingLong/collect/getOrgPersonList',
|
|
where: {
|
|
org_id: orgId,
|
|
keyword: $("#person_name").val()
|
|
},
|
|
// height: '374',
|
|
width: '610',
|
|
page: {
|
|
limit: 5
|
|
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
|
, prev: "上一页"
|
|
, next: "下一页"
|
|
},
|
|
cols: [[
|
|
{ title: '序号', align: 'center', width: "5%", type: 'numbers' },
|
|
{ title: '教师姓名', field: 'person_name', align: 'center' },
|
|
{ title: '性别', field: 'xb_name', align: 'center', width: "20%" },
|
|
{ title: '操作', align: 'center', width: "25%", templet: '#select-enable' }
|
|
]],
|
|
skin: 'line',
|
|
// toolbar: '#table-toolbar',
|
|
defaultToolbar: [],
|
|
parseData: function (res) {
|
|
var data = res.data;
|
|
for (var i = 0; i < data.length; i++) {
|
|
if (data[i].xb == 1) {
|
|
data[i].xb_name = "男";
|
|
} else {
|
|
data[i].xb_name = "女";
|
|
}
|
|
}
|
|
return res;
|
|
},
|
|
done: function (res, curr, count) {
|
|
var options = this;
|
|
|
|
// 获取当前行数据
|
|
table.getRowData = function (tableId, elem) {
|
|
var index = $(elem).closest('tr').data('index');
|
|
return table.cache[tableId][index] || {};
|
|
};
|
|
|
|
form.on('switch(switchEnable)', function (obj) {
|
|
var data = table.getRowData(options.id, this);
|
|
if (obj.elem.checked) {
|
|
tag.add('orgs', { text: data.person_name, id: data.person_id });
|
|
personIds.push(data.person_id);
|
|
}
|
|
else {
|
|
tag.delete('orgs', data.person_id);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function zTreeOnClick(event, treeId, treeNode) {
|
|
orgId = treeNode.org_id;
|
|
renderPersonTable();
|
|
}
|
|
|
|
tag.on('delete(orgs)', function (data) {
|
|
var personId = data.elem.prevObject.prevObject[0].getAttribute("lay-id");
|
|
personIds = personIds.filter(item => item !== personId);
|
|
var switchElem = $('#' + personId);
|
|
switchElem.prop('checked', false);
|
|
form.render();
|
|
});
|
|
|
|
util.on({
|
|
search: function () {
|
|
renderPersonTable();
|
|
},
|
|
saveGroup: function () {
|
|
if (Array.isArray(personIds) && personIds.length === 0) {
|
|
layer.msg("请先选择人员!", {
|
|
icon: 2,
|
|
time: 1500
|
|
});
|
|
} else {
|
|
layer.open({
|
|
type: 2,
|
|
title: '保存分组',
|
|
shadeClose: true,
|
|
shade: 0,
|
|
area: ['600px', '200px'],
|
|
content: '../org/save_group.html?bureau_ids=' + personIds.join(",")
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
form.on('input-affix(clear)', function (data) {
|
|
renderPersonTable();
|
|
});
|
|
|
|
//分组表格
|
|
table.render({
|
|
elem: '#group-table',
|
|
id: 'groupTable',
|
|
url: '/QingLong/collect/listGroup',
|
|
cols: [[
|
|
{ type: 'checkbox', width: "5%" },
|
|
{ title: '序号', align: 'center', width: "5%", type: 'numbers' },
|
|
{ title: '分组名称', field: 'group_name', align: 'center' },
|
|
{ title: '操作', toolbar: '#group-bar', align: 'center', width: "25%" }
|
|
]],
|
|
page: {
|
|
limit: 5
|
|
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
|
, prev: "上一页"
|
|
, next: "下一页"
|
|
},
|
|
skin: 'line',
|
|
defaultToolbar: []
|
|
});
|
|
|
|
table.on('tool(groupTable)', function (obj) {
|
|
if (obj.event === 'delGroup') {
|
|
layer.confirm('确定要删除吗?', {
|
|
icon: 3,
|
|
title: '提示'
|
|
}, function (index) {
|
|
$.ajax({
|
|
url: '/QingLong/collect/delGroup',
|
|
type: 'post',
|
|
data: { group_id: obj.data.group_id },
|
|
success: function (result) {
|
|
if (result.success) {
|
|
layer.msg("删除成功!", {
|
|
icon: 1,
|
|
time: 1000
|
|
}, function () {
|
|
groupTableReload()
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 2000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
|
|
function groupTableReload() {
|
|
table.reloadData('groupTable', {
|
|
scrollPos: false
|
|
});
|
|
}
|
|
|
|
function GetQueryString(name, istop) {
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
var r = window.location.search.substr(1).match(reg);
|
|
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
|
|
|
|
if (r != null) return unescape(r[2]);
|
|
return null;
|
|
}
|
|
});
|
|
</script>
|
|
<script>
|
|
</script>
|
|
</body>
|
|
|
|
</html> |