| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <!DOCTYPE HTML>
- <html xmlns:th="http://www.thymeleaf.org"
- xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
- layout:decorate="~{admin/common/common}">
- <head>
- <title>编辑内容</title>
- </head>
- <body layout:fragment="content">
- <article class="page-container">
- <form class="form form-horizontal" id="form-content-edit">
- <input type="hidden" th:name="id" th:id="uid" th:value="${user.id}"/>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>账号:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" th:value="${user.nick_name}" th:id="nick_name"
- placeholder="请输入用户名" th:name="nick_name"/>
- </div>
- </div>
- <!--<div class="row cl">-->
- <!--<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>邮箱地址:</label>-->
- <!--<div class="formControls col-xs-8 col-sm-9">-->
- <!--<input type="text" class="input-text" value="" th:value="${user.email}" placeholder="请输入邮箱地址"-->
- <!--th:name="email"/>-->
- <!--</div>-->
- <!--</div>-->
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系人:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" value="" th:value="${user.user_name}" placeholder="请输入联系人"
- th:name="user_name"/>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系电话:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="text" class="input-text" placeholder="请输入联系电话" th:value="${user.phone}"
- th:name="phone"/>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>用户类型:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select th:id="user_type" class="select" th:name="user_type" required onchange="controlShow(this);">
- <option value="">--请选择--</option>
- <option value="0" th:selected="${user.user_type==0}" >政府用户</option>
- <option value="4" th:selected="${user.user_type==4}" >街道用户</option>
- <option value="1" th:selected="${user.user_type==1}" >园区用户</option>
- </select>
- </span>
- </div>
- </div>
- <div class="row cl select_role_government" th:if="${user.user_type==0}" >
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>角色:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <select id="select_role_government" class="roleSelect" th:name="roleIds" multiple="multiple">
- <option th:each="item : ${governmentRoles}" th:value="${item.id}">
- [[*{item.name}]]
- </option>
- </select>
- </div>
- </div>
- <div class="row cl select_role_street" th:if="${user.user_type==4}">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>角色:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <select id="select_role_street" class="roleSelect" th:name="roleIds" multiple="multiple">
- <option th:each="item : ${streetRoles}" th:value="${item.id}" >
- [[*{item.name}]]
- </option>
- </select>
- </div>
- </div>
- <div th:hidden="${user.user_type==1}" >
- <div class="row cl select_department_id" th:hidden="${user.user_type==4}" >
- <label class="form-label col-xs-4 col-sm-2">所属部门:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <select id="department_select" th:name="department_id" class="input-text">
- <option value="">--请选择--</option>
- <option th:each="item : ${departments}" th:selected="${user.department_id==item.id}"
- th:value="${item.id}">
- [[*{item.name}]]
- </option>
- </select>
- </div>
- </div>
- </div>
- <div class="row cl select_street_id" th:hidden="${user.user_type==0}">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>所属街道:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select th:id="select_street_id" class="select" th:name="street_id"
- onchange="selectStreet(this);">
- <option value="">--请选择--</option>
- <option value="" th:unless="${item.is_start}" disabled th:selected="*{item.id==user.street_id}" th:each="item : ${streets}" th:value="${item.id}" th:text="${item.name}">
- <option value="" th:if="${item.is_start}" th:selected="*{item.id==user.street_id}" th:each="item : ${streets}" th:value="${item.id}" th:text="${item.name}">
- </select>
- <input name="street_name" id="select_street_name" type="hidden" th:value="${user.street_name}"/>
- </span>
- </div>
- </div>
- <div class="row cl select_build_id" th:hidden="!${user.user_type==1}">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>所属园区:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select th:id="select_build_id" class="select" th:name="build_id"
- onchange="selectBuild(this);">
- <option value="">--请选择--</option>
- <option value="" th:unless="${item.is_start}" disabled th:each="item : ${builds}" th:selected="*{item.id==user.build_id}" th:value="${item.id}" th:text="${item.name}">
- <option value="" th:if="${item.is_start}" th:each="item : ${builds}" th:selected="*{item.id==user.build_id}" th:value="${item.id}" th:text="${item.name}">
- </select>
- <input name="build_name" id="select_build_name" th:value="${user.build_name}" type="hidden"/>
- </span>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span>是否管理员:</span></label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="radio" name="is_admin" th:checked="${user.is_admin==false }" value="false">否</input>
- <input type="radio" name="is_admin" th:checked="${user.is_admin==true }" value="true">是</input>
- </div>
- </div>
- <div class="row cl">
- <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
- <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont"></i>保存</button>
- <button onClick="removeIframe();" class="btn btn-default radius" type="button"> 取消 </button>
- </div>
- </div>
- </form>
- </article>
- <script type="text/javascript" th:src="@{/js/super/user/user_edit.js}"></script>
- <script th:inline="javascript">
- /**
- * 取消
- */
- function removeIframe() {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- }
- function controlShow(obj) {
- //政府用户0,街道用户4,园区用户1
- var val = $.trim($(obj).val());
- $("#select_build_name").val('');
- $("#select_build_id").val('');
- $("#select_street_name").val('');
- $("#select_street_id").val('');
- $("#select_street_id").attr("required", false);
- $("#select_build_id").attr("required", false);
- $(".select_role_government").hide();
- $(".select_role_street").hide();
- if (val == 4) {
- $("#select_street_id").attr("required", true);
- $(".select_street_id").show();
- $(".select_build_id").hide();
- $(".select_department_id").hide();
- $(".select_role_street").show();
- } else if (val == 0 || val == '') {
- $(".select_street_id").hide();
- $(".select_build_id").hide();
- $(".select_department_id").show();
- $(".select_role_government").show();
- } else if (val == 1) {
- $("#select_street_id").attr("required", true);
- $("#select_build_id").attr("required", true);
- $(".select_street_id").show();
- $(".select_build_id").show();
- var html = '';
- html += "<option value=''>--请选择--</option>";
- $("#select_build_id").html(html);
- }
- }
- function selectStreet(obj) {
- $("#select_street_name").val('');
- $("#select_build_name").val('');
- $("#select_street_name").val($(obj).find("option:selected").html());
- $("#select_build_id").html("");
- if($("#user_type").val()==1){
- var html = '';
- html += "<option value=''>--请选择--</option>";
- if ($(obj).val()) {
- $.ajax({
- type: "GET",
- dataType: "json",
- url: pagePath + "/admin/user/findBuildsByStreet/" + $(obj).val(),
- success: function (result) {
- if (result.success) {
- $.each(result.obj, function (index, item) {
- if(item.is_start){
- html += "<option value=" + item.id + ">" + item.name + "</option>";
- }else{
- html += "<option disabled value=" + item.id + ">" + item.name + "</option>";
- }
- });
- $("#select_build_id").html(html);
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }else{
- $("#select_build_id").html(html);
- }
- }
- }
- function selectBuild(obj) {
- $("#select_build_name").val($(obj).find("option:selected").html());
- }
-
- $(window).load(function () {
- initDepartmentSelect();
- initRoleSelect();
- });
-
- function initDepartmentSelect() {
- $("#department_select").select2({
- width: '100%',
- language: {
- noResults: function (params) {
- return "暂无数据";
- }
- }
- });
- }
- function initRoleSelect() {
- $("#select_role_street").select2({
- width: '100%',
- language: {
- noResults: function (params) {
- return "暂无数据";
- }
- }
- });
- $("#select_role_government").select2({
- width: '100%',
- language: {
- noResults: function (params) {
- return "暂无数据";
- }
- }
- });
- var userType = [[${user.user_type}]];
- if(userType == "4"){
- $("#select_role_street").val([[${user.roleIds}]]).trigger("change");
- }else{
- $("#select_role_government").val([[${user.roleIds}]]).trigger("change");
- }
- }
-
- </script>
- </body>
- </html>
|