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.

137 lines
5.7 KiB

{% extends 'baseBZPForm.html' %}
{% block content %}
{% load static %}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<input name="UserId" type="hidden" value="{% firstof user.UserId '' %}" />
<input name="BarCode" type="hidden" value="" />
<input name="Birthday" type="hidden" value="" />
<input name="QQ" type="hidden" value="" />
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="RoleId">
{% for role in all_role_json_list%}
{% if role.RoleId == user.RoleId %}
<option selected="selected" value="{{role.RoleId}}">{{role.RoleName}}</option>
{% else %}
<option value="{{role.RoleId}}">{{role.RoleName}}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">工号</label>
<div class="layui-input-inline">
<input type="text" name="UserCode" value="{% firstof user.UserCode '' %}" lay-verify="required" placeholder="请输入工号" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">姓名</label>
<div class="layui-input-inline">
<input type="text" name="realName" value="{% firstof user.RealName '' %}" lay-verify="required" placeholder="请输入姓名" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="Mobile" value="{% firstof user.Mobile '' %}" placeholder="请输入手机号" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="Email" value="{% firstof user.Email '' %}" placeholder="请输入邮箱" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">性别:</label>
<div class="layui-input-block">
{% if user.Sex != 0 %}
<input type="radio" name="Sex" value="1" title="男" checked>
<input type="radio" name="Sex" value="0" title="女">
{% else %}
<input type="radio" name="Sex" value="1" title="男">
<input type="radio" name="Sex" value="0" title="女" checked>
{% endif %}
</div>
</div>
<div class="layui-form-item" style="display: none;">
<label class="layui-form-label">签名图片</label>
<div class="layui-input-inline">
<input name="SignUrl" readonly id="SignUrl"
placeholder="签名图片地址" value="{% firstof user.SignUrl '' %}" class="layui-input">
</div>
<div class="layui-input-inline layui-btn-container" style="width: auto;">
<button type="button" class="layui-btn layui-btn-primary"
id="btnUploadSignature">
<i class="layui-icon">&#xe67c;</i>上传签名图片
</button>
<button class="layui-btn layui-btn-primary" id="btnViewPicture"
layadmin-event="avartatPreview">查看当前签名</button>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<textarea name="Description" placeholder="请输入内容"
class="layui-textarea">{% firstof user.Description '' %}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">账号状态</label>
<div class="layui-input-inline">
{% if user.IsEnabled != 0 %}
<input type="checkbox" checked lay-filter="switch" name="IsEnabled" lay-skin="switch" lay-text="启用|禁用">
{% else %}
<input type="checkbox" lay-filter="switch" name="IsEnabled" lay-skin="switch" lay-text="启用|禁用">
{% endif %}
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
</div>
</div>
<script>
layui.use('form', function () {
var form = layui.form;
form.render(); //刷新select选择框渲染
});
var index = parent.layer.getFrameIndex(window.name);
layui.use(['index', 'form'], function () {
var form = layui.form;
form.on('submit(LAY-user-front-submit)', function(obj){
var fieldData= obj.field;
fieldData= $.extend({IsEnabled:0},fieldData);
fieldData.IsEnabled=fieldData.IsEnabled=='on'? 1:0;
//提交修改
$.post("{% url 'user:saveUserData' %}", fieldData, function (obj) {
if (obj.status == 1) {
msg("保存成功", function () {
parent.layer.close(index);
});
}
else {
msg("保存失败 " + obj.message);
}
});
return false;
});
$("#btnViewPicture").click(function () {
layer.photos({
photos: { "data": [{ "src": $("#SignUrl").val()}] }
, offset: 'auto'
});
});
})
</script>
{% endblock %}