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.

165 lines
6.4 KiB

<title>{% extends 'base.html' %}
{% block content %}
{% load static %}
<style type="text/css">
.todo-list li {
width: 255px;
float: left;
margin-right: 8px;
padding-right: 2px;
}
.layui-form-checkbox[lay-skin=primary] {
height: 30px !important;
line-height: 30px !important;
}
</style>
<div class="ibox float-e-margins">
<form class="layui-form form-horizontal myForm" action="" role="form">
<div class="ibox-content" style="height:500px">
<div>
<!-- <h2 style="float:left">用户列表</h2> -->
<input class="form-control" type="hidden" id="ClientId" value="{{ ClientId }}" />
<!-- <div class="input-group" style="width:300px; float:right">
<input type="text" class="layui-input" id="searchValue" name="searchValue" value="{{ searchValue }}" placeholder="搜索用户名称、工号">
<div class="input-group-btn">
<button type="button" id="btnTableSearch" class="layui-btn">
搜索
</button>
</div>
</div> -->
<div class="input-group" style="width:300px; float:left">
<span class="input-group-addon"> &nbsp;&nbsp;抽屉:</span>
<select data-placeholder="选择抽屉..." id="cabinetCellSelect" name="city" lay-verify="">
<option value="1">1层左侧</option>
<option value="2">1层右侧</option>
<option value="3">2层左侧</option>
<option value="4">2层右侧</option>
<option value="5">3层左侧</option>
<option value="6">3层右侧</option>
<option value="7">4层左侧</option>
<option value="8">4层右侧</option>
<option value="9">5层左侧</option>
<option value="10">5层右侧</option>
<option value="11">6层左侧</option>
<option value="12">6层右侧</option>
</select>
</div>
<div style="clear:both"></div>
<div id="all_checked" style="margin-bottom: 20px;margin-top: 5px;">
<input type="checkbox" lay-skin="primary" class="power i-checks" title="全选">
</div>
</div>
<input class="form-control" type="hidden" id="UserId" value="@ViewBag.UserId" />
<div class="layui-input-block" style="margin-left: 0;">
{% for user in user_list %}
<input type="checkbox" name="{{ user.UserId }}" value="{{ user.UserId }}" lay-skin="primary" title="{{ user.RealName }}({{ user.UserCode }})" class="power i-checks" style="height: 100px;">
{% endfor %}
</div>
<div style="margin-left: 35%; padding-bottom: 20px; margin-top: 20px;">
<button class="layui-btn" type="submit" id="saveData" style="margin-right: 50px;">保存内容</button>
<button class="layui-btn" type="button" id="closeForm" style="margin-left: 50px;">关闭</button>
</div>
</div>
</form>
</div>
<script src="{% static 'js/utils.js' %}"></script>
<script src="{% static 'js/warning.js' %}"></script>
<script type="text/javascript">
let cType = false
layui.use('form', function () {
var form = layui.form;
form.render(); //刷新select选择框渲染
//各种基于事件的操作,下面会有进一步介绍
});
var index = parent.layer.getFrameIndex(window.name);
$(function () {
$('#all_checked').click(function () {
if (cType) {
$('.i-checks').prop('checked', false)
cType = false
layui.use('form', function () {
var form = layui.form;
form.render(); //刷新select选择框渲染
//各种基于事件的操作,下面会有进一步介绍
});
} else {
$('.i-checks').prop('checked', true)
cType = true
layui.use('form', function () {
var form = layui.form;
form.render(); //刷新select选择框渲染
//各种基于事件的操作,下面会有进一步介绍
});
}
})
// $("#searchValue").keyup(function () {
// var user_list = "{{user_list}}"
// console.log($(this).text().indexOf($("#searchValue").val()) == -1)
// console.log($(this).text().indexOf($("#searchValue").val()))
// $(".layui-input-block").each(function () {
// if ($(this).text().indexOf($("#searchValue").val()) == -1) {
// $(this).parent().hide();
// }
// else {
// $(this).parent().show();
// }
// })
// })
$(".myForm").submit(function () {
var loadIndex = layer.load(2);
var powerValue = "";
$(".power:checked").each(function (index, obj) {
if (powerValue != "") {
powerValue += ",";
}
powerValue += $(".power:checked").eq(index).val();
});
$.post('{% url 'cabinet:saveCellPowerData' %}', { clientId: $("#ClientId").val(),clientCellCode:$('#cabinetCellSelect').val(), powerValue: powerValue }, function (obj) {
layer.close(loadIndex);
if (obj.status == 1) {
msg("当前抽屉权限保存成功", function () {
});
}
else {
msg("保存失败");
}
});
return false;
});
$("#closeForm").click(function () {
parent.layer.close(index);
});
});
</script>
{% endblock %}