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.
yy_rms_39zhiyao_duizhao/templates/drug/disabled_user.html

168 lines
6.4 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<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;
}
</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="drugId" value="{{ drugId }}" />
<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 style="clear:both"></div>
<div id="all_checked">
<input type="checkbox" lay-skin="primary" name="{{ user.UserId }}" class="power i-checks"
>&nbsp;&nbsp;全选
</div>
</div>
<input class="form-control" type="hidden" id="UserId" value="@ViewBag.UserId" />
<ul class="todo-list m-t" style="height:280px;overflow-y:scroll">
{% for user in user_list %}
<li>
{% if user.UserId in disabled_user_list %}
<input type="checkbox" lay-skin="primary" name="{{ user.UserId }}" class="power i-checks"
checked>
{% else %}
<input type="checkbox" lay-skin="primary" name="{{ user.UserId }}" class="power i-checks">
{% endif %}
<span class="m-l-xs">{{ user.RealName }}({{ user.UserCode }})</span>
</li>
{% endfor %}
<!-- @*<li>
<input type="checkbox" value="" name="" class="i-checks" checked />
<span class="m-l-xs">药剂领用</span>
</li>
<li>
<input type="checkbox" value="" name="" class="i-checks" />
<span class="m-l-xs">药剂归还</span>
</li>*@ -->
</ul>
<div style="margin-left: 35%; padding-bottom: 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 () {
console.log()
$("#searchValue").keyup(function () {
$(".todo-list .m-l-xs").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 'drug:saveDisabledUser' %}', { drugId:$("#drugId").val(), powerValue:powerValue }, function (obj) {
layer.close(loadIndex);
if (obj.status == 1) {
msg("保存成功", function () {
parent.layer.close(index);
});
}
else {
msg("保存失败");
}
});
return false;
});
$("#closeForm").click(function () {
parent.layer.close(index);
});
$('#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选择框渲染
//各种基于事件的操作,下面会有进一步介绍
});
}
})
});
</script>
{% endblock %}
</title>
</head>
<body>
</body>
</html>