网格员管理功能完成

This commit is contained in:
wenc000 2020-03-27 01:01:17 +08:00
parent 727b3658b5
commit 7ce35c04d8
12 changed files with 558 additions and 299 deletions

View File

@ -26,7 +26,7 @@ import java.util.Map;
* @ClassName: GridPersonnelController
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-25 23:55
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "网格人员接口")

View File

@ -24,7 +24,7 @@ import java.util.Map;
* @ClassName: GridPersonnelAppController
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-25 23:55
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "网格人员接口")

View File

@ -24,7 +24,7 @@ import java.util.Map;
* @ClassName: GridPersonnelResourceController
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-25 23:55
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "网格人员接口")

View File

@ -15,7 +15,7 @@ import java.util.Map;
* @ClassName: IGridPersonnelDao
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-25 23:55
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
@Repository

View File

@ -4,11 +4,10 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: GridPersonnelDTO
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-25 23:55
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
@ApiModel
@ -18,6 +17,8 @@ public class GridPersonnelDTO {
private String gridPersonnelId;
@ApiModelProperty(name = "userId", value = "用户ID")
private String userId;
@ApiModelProperty(name = "userName", value = "用户名称")
private String userName;
@ApiModelProperty(name = "area1", value = "1级区域")
private String area1;
@ApiModelProperty(name = "area1DictionaryName", value = "1级区域字典名称")
@ -56,8 +57,12 @@ public class GridPersonnelDTO {
private String leaderUserIdJoinByLeaderUserId;
@ApiModelProperty(name = "isGridOperatorJoinByLeaderUserId", value = "领导ID的是否网格员")
private String isGridOperatorJoinByLeaderUserId;
@ApiModelProperty(name = "levelJoinByLeaderUserId", value = "领导ID的级别")
private String levelJoinByLeaderUserId;
@ApiModelProperty(name = "isGridOperator", value = "是否网格员")
private Integer isGridOperator;
@ApiModelProperty(name = "level", value = "级别")
private Integer level;
public String getGridPersonnelId() {
return gridPersonnelId == null ? "" : gridPersonnelId;
@ -66,6 +71,7 @@ public class GridPersonnelDTO {
public void setGridPersonnelId(String gridPersonnelId) {
this.gridPersonnelId = gridPersonnelId;
}
public String getUserId() {
return userId == null ? "" : userId;
}
@ -74,6 +80,14 @@ public class GridPersonnelDTO {
this.userId = userId;
}
public String getUserName() {
return userName == null ? "" : userName.trim();
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getArea1() {
return area1 == null ? "" : area1;
}
@ -89,6 +103,7 @@ public class GridPersonnelDTO {
public void setArea1DictionaryName(String area1DictionaryName) {
this.area1DictionaryName = area1DictionaryName;
}
public String getArea2() {
return area2 == null ? "" : area2;
}
@ -104,6 +119,7 @@ public class GridPersonnelDTO {
public void setArea2DictionaryName(String area2DictionaryName) {
this.area2DictionaryName = area2DictionaryName;
}
public String getArea3() {
return area3 == null ? "" : area3;
}
@ -119,6 +135,7 @@ public class GridPersonnelDTO {
public void setArea3DictionaryName(String area3DictionaryName) {
this.area3DictionaryName = area3DictionaryName;
}
public String getArea4() {
return area4 == null ? "" : area4;
}
@ -134,6 +151,7 @@ public class GridPersonnelDTO {
public void setArea4DictionaryName(String area4DictionaryName) {
this.area4DictionaryName = area4DictionaryName;
}
public String getArea5() {
return area5 == null ? "" : area5;
}
@ -149,6 +167,7 @@ public class GridPersonnelDTO {
public void setArea5DictionaryName(String area5DictionaryName) {
this.area5DictionaryName = area5DictionaryName;
}
public String getLeaderUserId() {
return leaderUserId == null ? "" : leaderUserId;
}
@ -221,6 +240,14 @@ public class GridPersonnelDTO {
this.isGridOperatorJoinByLeaderUserId = isGridOperatorJoinByLeaderUserId;
}
public String getLevelJoinByLeaderUserId() {
return levelJoinByLeaderUserId == null ? "" : levelJoinByLeaderUserId;
}
public void setLevelJoinByLeaderUserId(String levelJoinByLeaderUserId) {
this.levelJoinByLeaderUserId = levelJoinByLeaderUserId;
}
public Integer getIsGridOperator() {
return isGridOperator == null ? 0 : isGridOperator;
}
@ -229,5 +256,13 @@ public class GridPersonnelDTO {
this.isGridOperator = isGridOperator;
}
public Integer getLevel() {
return level == null ? 0 : level;
}
public void setLevel(Integer level) {
this.level = level;
}
}

View File

@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
* @ClassName: GridPersonnelVO
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-25 23:55
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
@ApiModel
@ -34,6 +34,9 @@ public class GridPersonnelVO {
@ApiModelProperty(name = "isGridOperator", value = "是否网格员")
@CheckNumberAnnotation(name = "是否网格员")
private Integer isGridOperator;
@ApiModelProperty(name = "level", value = "级别")
@CheckNumberAnnotation(name = "级别")
private Integer level;
public String getUserId() {
return userId == null ? "" : userId;
@ -99,5 +102,13 @@ public class GridPersonnelVO {
this.isGridOperator = isGridOperator;
}
public Integer getLevel() {
return level == null ? 0 : level;
}
public void setLevel(Integer level) {
this.level = level;
}
}

View File

@ -17,7 +17,7 @@ import java.util.Map;
* @ClassName: IGridPersonnelService
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-25 23:55
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
public interface IGridPersonnelService {

View File

@ -24,7 +24,7 @@ import java.util.*;
* @ClassName: GridPersonnelServiceImpl
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-25 23:55
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
@Service

View File

@ -5,6 +5,7 @@
<resultMap id="gridPersonnelDTO" type="com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO">
<id column="grid_personnel_id" property="gridPersonnelId"/>
<result column="user_id" property="userId"/>
<result column="user_name" property="userName"/>
<result column="area1" property="area1"/>
<result column="area1_dictionary_name" property="area1DictionaryName"/>
<result column="area2" property="area2"/>
@ -24,7 +25,9 @@
<result column="area5_join_by_leader_user_id" property="area5JoinByLeaderUserId"/>
<result column="leader_user_id_join_by_leader_user_id" property="leaderUserIdJoinByLeaderUserId"/>
<result column="is_grid_operator_join_by_leader_user_id" property="isGridOperatorJoinByLeaderUserId"/>
<result column="level_join_by_leader_user_id" property="levelJoinByLeaderUserId"/>
<result column="is_grid_operator" property="isGridOperator"/>
<result column="level" property="level"/>
</resultMap>
<!-- 新增网格人员 -->
@ -39,6 +42,7 @@
area5,
leader_user_id,
is_grid_operator,
level,
creator,
gmt_create,
modifier,
@ -54,6 +58,7 @@
#{area5},
#{leaderUserId},
#{isGridOperator},
#{level},
#{creator},
#{gmtCreate},
#{modifier},
@ -105,6 +110,9 @@
</if>
<if test="isGridOperator != null">
is_grid_operator = #{isGridOperator},
</if>
<if test="level != null">
level = #{level},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
@ -123,6 +131,7 @@
t1.area5,
t1.leader_user_id,
t1.is_grid_operator,
t1.level,
t1.grid_personnel_id
FROM
gen_grid_personnel t1
@ -149,15 +158,8 @@
t1.area5,
GROUP_CONCAT(DISTINCT dt5.dictionary_name) area5_dictionary_name,
t1.leader_user_id,
jt1.user_id user_id_join_by_leader_user_id,
jt1.area1 area1_join_by_leader_user_id,
jt1.area2 area2_join_by_leader_user_id,
jt1.area3 area3_join_by_leader_user_id,
jt1.area4 area4_join_by_leader_user_id,
jt1.area5 area5_join_by_leader_user_id,
jt1.leader_user_id leader_user_id_join_by_leader_user_id,
jt1.is_grid_operator is_grid_operator_join_by_leader_user_id,
t1.is_grid_operator,
t1.level,
t1.grid_personnel_id
FROM
gen_grid_personnel t1
@ -194,13 +196,13 @@
LEFT JOIN
gen_grid_personnel jt1
ON
t1.leader_user_id = jt1.grid_personnel_id
t1.leader_user_id = jt1.user_id
AND
jt1.is_delete = 0
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
<!-- 这里添加检索关键字 -->
</if>
<if test="startTime != null and startTime != ''">
AND
@ -217,6 +219,30 @@
#{gridPersonnelIds[${index}]}
</foreach>
</if>
<if test="level != null">
AND
t1.level = #{level}
</if>
<if test="area1 != null and area1 != ''">
AND
t1.area1 = #{area1}
</if>
<if test="area2 != null and area2 != ''">
AND
t1.area2 = #{area2}
</if>
<if test="area3 != null and area3 != ''">
AND
t1.area3 = #{area3}
</if>
<if test="area4 != null and area4 != ''">
AND
t1.area4 = #{area4}
</if>
<if test="area5 != null and area5 != ''">
AND
t1.area5 = #{area5}
</if>
GROUP BY
t1.user_id,
t1.area1,
@ -233,7 +259,9 @@
jt1.area5,
jt1.leader_user_id,
jt1.is_grid_operator,
jt1.level,
t1.is_grid_operator,
t1.level,
t1.grid_personnel_id
</select>

View File

@ -51,7 +51,6 @@
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
@ -65,7 +64,8 @@
var laydate = layui.laydate;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/gridpersonnel/listpagegridpersonnel';
var level = top.restAjax.params(window.location.href).level;
var tableUrl = 'api/gridpersonnel/listpagegridpersonnel?level='+ level;
// 初始化表格
function initTable() {
@ -85,13 +85,22 @@
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'userId', width: 150, title: '用户ID', align:'center',
{field: 'userId', width: 150, title: '网格员', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
var selectArray = rowData.split(',');
var value = '';
for(var i = 0, item = selectArray[i]; item = selectArray[i++];) {
var info = item.split('|');
if(value.length > 0) {
value += ',';
}
value += info[3];
}
return value;
}
},
{field: 'area1DictionaryName', width: 150, title: '1级区域字典名称', align:'center',
@ -139,85 +148,22 @@
return rowData;
}
},
{field: 'leaderUserId', width: 150, title: '领导ID', align:'center',
{field: 'leaderUserId', width: 150, title: '上级领导', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'userIdJoinByLeaderUserId', width: 150, title: '领导ID的用户ID', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
var selectArray = rowData.split(',');
var value = '';
for(var i = 0, item = selectArray[i]; item = selectArray[i++];) {
var info = item.split('|');
if(value.length > 0) {
value += ',';
}
value += info[3];
}
return rowData;
}
},
{field: 'area1JoinByLeaderUserId', width: 150, title: '领导ID的1级区域', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'area2JoinByLeaderUserId', width: 150, title: '领导ID的2级区域', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'area3JoinByLeaderUserId', width: 150, title: '领导ID的3级区域', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'area4JoinByLeaderUserId', width: 150, title: '领导ID的4级区域', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'area5JoinByLeaderUserId', width: 150, title: '领导ID的5级区域', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'leaderUserIdJoinByLeaderUserId', width: 150, title: '领导ID的领导ID', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'isGridOperatorJoinByLeaderUserId', width: 150, title: '领导ID的是否网格员', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
return value;
}
},
{field: 'isGridOperator', width: 150, title: '是否网格员', align:'center',
@ -229,6 +175,15 @@
return rowData;
}
},
{field: 'level', width: 100, title: '级别', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData + '级';
}
},
]],
page: true,
parseData: function(data) {
@ -316,7 +271,7 @@
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/gridpersonnel/save-gridpersonnel.html', []),
content: top.restAjax.path('route/gridpersonnel/save-gridpersonnel.html?level={level}', [level]),
end: function() {
reloadTable();
}
@ -334,7 +289,7 @@
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/gridpersonnel/update-gridpersonnel.html?gridPersonnelId={gridPersonnelId}', [checkDatas[0].gridPersonnelId]),
content: top.restAjax.path('route/gridpersonnel/update-gridpersonnel.html?gridPersonnelId={gridPersonnelId}&level={level}', [checkDatas[0].gridPersonnelId, level]),
end: function() {
reloadTable();
}

View File

@ -22,16 +22,17 @@
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">用户ID</label>
<label class="layui-form-label">用户</label>
<div class="layui-input-block">
<input type="text" id="userId" name="userId" class="layui-input" value="" placeholder="请输入用户ID" lay-verify="required">
<input type="hidden" id="userId" name="userId" value="">
<input type="text" id="userIdSelectUser" class="layui-input" placeholder="请选择用户" data-name="userId" readonly style="cursor:pointer;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">1级区域</label>
<div class="layui-input-block layui-form" id="area1SelectTemplateBox" lay-filter="area1SelectTemplateBox"></div>
<script id="area1SelectTemplate" type="text/html">
<select id="area1" name="area1">
<select id="area1" name="area1" lay-filter="area1">
<option value="">请选择1级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -43,7 +44,7 @@
<label class="layui-form-label">2级区域</label>
<div class="layui-input-block layui-form" id="area2SelectTemplateBox" lay-filter="area2SelectTemplateBox"></div>
<script id="area2SelectTemplate" type="text/html">
<select id="area2" name="area2">
<select id="area2" name="area2" lay-filter="area2">
<option value="">请选择2级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -51,11 +52,11 @@
</select>
</script>
</div>
<div class="layui-form-item">
<div id="area3Box" class="layui-form-item" style="display: none;">
<label class="layui-form-label">3级区域</label>
<div class="layui-input-block layui-form" id="area3SelectTemplateBox" lay-filter="area3SelectTemplateBox"></div>
<script id="area3SelectTemplate" type="text/html">
<select id="area3" name="area3">
<select id="area3" name="area3" lay-filter="area3">
<option value="">请选择3级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -63,11 +64,11 @@
</select>
</script>
</div>
<div class="layui-form-item">
<div id="area4Box" class="layui-form-item" style="display: none;">
<label class="layui-form-label">4级区域</label>
<div class="layui-input-block layui-form" id="area4SelectTemplateBox" lay-filter="area4SelectTemplateBox"></div>
<script id="area4SelectTemplate" type="text/html">
<select id="area4" name="area4">
<select id="area4" name="area4" lay-filter="area4">
<option value="">请选择4级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -75,7 +76,7 @@
</select>
</script>
</div>
<div class="layui-form-item">
<div id="area5Box" class="layui-form-item" style="display: none;">
<label class="layui-form-label">5级区域</label>
<div class="layui-input-block layui-form" id="area5SelectTemplateBox" lay-filter="area5SelectTemplateBox"></div>
<script id="area5SelectTemplate" type="text/html">
@ -87,22 +88,23 @@
</select>
</script>
</div>
<div class="layui-form-item">
<label class="layui-form-label">领导ID</label>
<div id="leaderUserIdBox" class="layui-form-item" style="display: none;">
<label class="layui-form-label">上级领导</label>
<div class="layui-input-block layui-form" id="leaderUserIdJoinTemplateBox" lay-filter="leaderUserIdJoinTemplateBox"></div>
<script id="leaderUserIdJoinTemplate" type="text/html">
<select name="leaderUserId">
<option value="">选择领导ID</option>
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.gridPersonnelId}}">{{item.userId}}</option>
<option value="{{item.userId}}">{{item.userId.split('\|')[3]}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item">
<div class="layui-form-item" pane>
<label class="layui-form-label">是否网格员</label>
<div class="layui-input-block">
<input type="number" id="isGridOperator" name="isGridOperator" class="layui-input" value="0" placeholder="请输入是否网格员" lay-verify="required">
<input type="radio" name="isGridOperator" value="0" title="否" checked>
<input type="radio" name="isGridOperator" value="1" title="是">
</div>
</div>
<div class="layui-form-item layui-layout-admin">
@ -117,7 +119,6 @@
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
@ -129,8 +130,7 @@
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
var level = top.restAjax.params(window.location.href).level;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
@ -145,114 +145,146 @@
});
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
// 初始化用户ID选择人员
function initUserIdSelectUser() {
$(document.body).on('click', '#userIdSelectUser', function() {
var name = this.dataset.name;
var selectedUsers = [];
var selectDepartmentUser = $('#'+ name).val().split(',');
for(var selectDepartmentUserIndex = 0, item = selectDepartmentUser[selectDepartmentUserIndex]; item = selectDepartmentUser[selectDepartmentUserIndex++];) {
var userInfo = item.split('|');
selectedUsers.push({
userId: userInfo[0],
departmentId: userInfo[1]
});
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
top.dialog.dialogData.selectedUsers = selectedUsers;
top.dialog.open({
url: top.restAjax.path('route/tree/treeuser', []),
title: '选择组织部门人员',
width: '500px',
height: '500px',
onClose: function() {
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
if(selectedUsers != null && selectedUsers.length == 1) {
var selectedUsersVal = '';
var showSelectedUsersVal = '';
for(var j = 0, selectUser = selectedUsers[j]; selectUser = selectedUsers[j++];) {
if(selectedUsersVal.length > 0) {
selectedUsersVal += ',';
}
if(showSelectedUsersVal.length > 0) {
showSelectedUsersVal += ',';
}
selectedUsersVal += (selectUser.userId +'|'+ selectUser.departmentId +'|'+ selectUser.userName +'|'+ selectUser.userTitle);
showSelectedUsersVal += selectUser.userName;
}
$('#'+ name).val(selectedUsersVal);
$('#'+ name +'SelectUser').val(showSelectedUsersVal);
} else if(selectedUsers != null && selectedUsers.length > 1) {
top.dialog.msg('只能选择一位人员');
} else {
$('#'+ name).val('');
$('#'+ name +'SelectUser').val('');
}
}
});
});
}
// 初始化视频
function initVideo(fileName, data) {
for(var i = 0, item; item = data[i++];) {
var player = new ckplayer({
container: '#'+ fileName + i,
variable: 'player',
flashplayer: false,
video: {
file: 'route/file/downloadfile/true/'+ item.fileId,
type: 'video/mp4'
}
});
}
// 初始化选择框、单选、复选模板
function initSelectRadioCheckboxTemplate(templateId, templateBoxId, data, callback) {
laytpl(document.getElementById(templateId).innerHTML).render(data, function(html) {
document.getElementById(templateBoxId).innerHTML = html;
});
form.render('select', templateBoxId);
}
// 初始化1级区域下拉选择
function initArea1Select() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area1SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area1SelectTemplateBox').innerHTML = html;
});
form.render('select', 'area1SelectTemplateBox');
initSelectRadioCheckboxTemplate('area1SelectTemplate', 'area1SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化2级区域下拉选择
function initArea2Select() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area2SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area2SelectTemplateBox').innerHTML = html;
});
form.render('select', 'area2SelectTemplateBox');
function initArea2Select(area1) {
if(!area1) {
initSelectRadioCheckboxTemplate('area2SelectTemplate', 'area2SelectTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area2SelectTemplate', 'area2SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化3级区域下拉选择
function initArea3Select() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area3SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area3SelectTemplateBox').innerHTML = html;
});
form.render('select', 'area3SelectTemplateBox');
function initArea3Select(area2) {
$('#area3Box').show();
if(!area2) {
initSelectRadioCheckboxTemplate('area3SelectTemplate', 'area3SelectTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area3SelectTemplate', 'area3SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化4级区域下拉选择
function initArea4Select() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area4SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area4SelectTemplateBox').innerHTML = html;
});
form.render('select', 'area4SelectTemplateBox');
function initArea4Select(area3) {
$('#area4Box').show();
if(!area3) {
initSelectRadioCheckboxTemplate('area4SelectTemplate', 'area4SelectTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area4SelectTemplate', 'area4SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化5级区域下拉选择
function initArea5Select() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area5SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area5SelectTemplateBox').innerHTML = html;
});
form.render('select', 'area5SelectTemplateBox');
function initArea5Select(area4) {
$('#area5Box').show();
if(!area4) {
initSelectRadioCheckboxTemplate('area5SelectTemplate', 'area5SelectTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area5SelectTemplate', 'area5SelectTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化领导ID联表
function initLeaderUserIdJoinTable(){
top.restAjax.get(top.restAjax.path('api/gridpersonnel/listgridpersonnel', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('leaderUserIdJoinTemplate').innerHTML).render(data, function(html) {
document.getElementById('leaderUserIdJoinTemplateBox').innerHTML = html;
});
form.render('select', 'leaderUserIdJoinTemplateBox');
function initLeaderUserIdJoinTable() {
$('#leaderUserIdBox').show();
var params = {};
if($('#area5').val()) {
params.area5 = $('#area5').val();
} else if($('#area4').val()) {
params.area4 = $('#area4').val();
} else if($('#area3').val()) {
params.area3 = $('#area3').val();
} else if($('#area2').val()) {
params.area2 = $('#area2').val();
} else if($('#area1').val()) {
params.area1 = $('#area1').val();
} else {
initSelectRadioCheckboxTemplate('leaderUserIdJoinTemplate', 'leaderUserIdJoinTemplateBox', []);
return;
}
top.restAjax.get(top.restAjax.path('api/gridpersonnel/listgridpersonnel', []), params, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('leaderUserIdJoinTemplate', 'leaderUserIdJoinTemplateBox', data);
}, function(code, data) {
top.dialog.msg(data.msg);
});
@ -262,12 +294,19 @@
// 初始化内容
function initData() {
top.restAjax.get(top.restAjax.path('api/gridpersonnel/getcurrentuseridinfo', []), {}, null, function(code, data) {
initUserIdSelectUser();
initArea1Select();
initArea2Select();
initArea3Select();
initArea4Select();
initArea5Select();
initLeaderUserIdJoinTable();
if(level > 1) {
initArea3Select();
if(level > 2) {
initArea4Select();
if(level > 3) {
initArea5Select();
}
}
initLeaderUserIdJoinTable();
}
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
@ -283,6 +322,7 @@
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
formData.field.level = level;
top.restAjax.post(top.restAjax.path('api/gridpersonnel/savegridpersonnel', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
@ -311,6 +351,55 @@
closeBox();
});
// area1 选择事件
form.on('select(area1)', function(data) {
initArea2Select(data.value);
if(level > 1) {
initArea3Select(data.value);
if(level > 2) {
initArea4Select(data.value);
if(level > 3) {
initArea5Select(data.value);
}
}
initLeaderUserIdJoinTable();
}
});
// area2 选择事件
form.on('select(area2)', function(data) {
if(level > 1) {
initArea3Select(data.value);
if(level > 2) {
initArea4Select(data.value);
if(level > 3) {
initArea5Select(data.value);
}
}
initLeaderUserIdJoinTable();
}
});
// area3 选择事件
form.on('select(area3)', function(data) {
if(level > 2) {
initArea4Select(data.value);
if(level > 3) {
initArea5Select(data.value);
}
initLeaderUserIdJoinTable();
}
});
// area4 选择事件
form.on('select(area4)', function(data) {
if(level > 3) {
initArea5Select(data.value);
initLeaderUserIdJoinTable();
}
});
// area5 选择事件
form.on('select(area5)', function(data) {
initLeaderUserIdJoinTable();
});
// 校验
form.verify({
});

View File

@ -22,16 +22,17 @@
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">用户ID</label>
<label class="layui-form-label">用户</label>
<div class="layui-input-block">
<input type="text" id="userId" name="userId" class="layui-input" value="" placeholder="请输入用户ID" lay-verify="required">
<input type="hidden" id="userId" name="userId" value="">
<input type="text" id="userIdSelectUser" class="layui-input" placeholder="请选择用户" data-name="userId" readonly style="cursor:pointer;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">1级区域</label>
<div class="layui-input-block layui-form" id="area1SelectTemplateBox" lay-filter="area1SelectTemplateBox"></div>
<script id="area1SelectTemplate" type="text/html">
<select id="area1" name="area1">
<select id="area1" name="area1" lay-filter="area1">
<option value="">请选择1级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -43,7 +44,7 @@
<label class="layui-form-label">2级区域</label>
<div class="layui-input-block layui-form" id="area2SelectTemplateBox" lay-filter="area2SelectTemplateBox"></div>
<script id="area2SelectTemplate" type="text/html">
<select id="area2" name="area2">
<select id="area2" name="area2" lay-filter="area2">
<option value="">请选择2级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -51,11 +52,11 @@
</select>
</script>
</div>
<div class="layui-form-item">
<div id="area3Box" class="layui-form-item" style="display: none;">
<label class="layui-form-label">3级区域</label>
<div class="layui-input-block layui-form" id="area3SelectTemplateBox" lay-filter="area3SelectTemplateBox"></div>
<script id="area3SelectTemplate" type="text/html">
<select id="area3" name="area3">
<select id="area3" name="area3" lay-filter="area3">
<option value="">请选择3级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -63,11 +64,11 @@
</select>
</script>
</div>
<div class="layui-form-item">
<div id="area4Box" class="layui-form-item" style="display: none;">
<label class="layui-form-label">4级区域</label>
<div class="layui-input-block layui-form" id="area4SelectTemplateBox" lay-filter="area4SelectTemplateBox"></div>
<script id="area4SelectTemplate" type="text/html">
<select id="area4" name="area4">
<select id="area4" name="area4" lay-filter="area4">
<option value="">请选择4级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -75,11 +76,11 @@
</select>
</script>
</div>
<div class="layui-form-item">
<div id="area5Box" class="layui-form-item" style="display: none;">
<label class="layui-form-label">5级区域</label>
<div class="layui-input-block layui-form" id="area5SelectTemplateBox" lay-filter="area5SelectTemplateBox"></div>
<script id="area5SelectTemplate" type="text/html">
<select id="area5" name="area5">
<select id="area5" name="area5" lay-filter="area5">
<option value="">请选择5级区域</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
@ -87,22 +88,23 @@
</select>
</script>
</div>
<div class="layui-form-item">
<label class="layui-form-label">领导ID</label>
<div id="leaderUserIdBox" class="layui-form-item" style="display: none;">
<label class="layui-form-label">上级领导</label>
<div class="layui-input-block layui-form" id="leaderUserIdJoinTemplateBox" lay-filter="leaderUserIdJoinTemplateBox"></div>
<script id="leaderUserIdJoinTemplate" type="text/html">
<select name="leaderUserId">
<option value="">选择领导ID</option>
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.gridPersonnelId}}">{{item.userId}}</option>
<option value="{{item.userId}}">{{item.userId.split('\|')[3]}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item">
<div class="layui-form-item" pane>
<label class="layui-form-label">是否网格员</label>
<div class="layui-input-block">
<input type="number" id="isGridOperator" name="isGridOperator" class="layui-input" value="0" placeholder="请输入是否网格员" lay-verify="required">
<input type="radio" name="isGridOperator" value="0" title="否">
<input type="radio" name="isGridOperator" value="1" title="是">
</div>
</div>
<div class="layui-form-item layui-layout-admin">
@ -117,7 +119,6 @@
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
@ -129,11 +130,9 @@
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var level = top.restAjax.params(window.location.href).level;
var gridPersonnelId = top.restAjax.params(window.location.href).gridPersonnelId;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
@ -147,122 +146,172 @@
});
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
// 初始化用户ID选择人员
function initUserIdSelectUser() {
var showSelectedUsersVal = '';
var selectDepartmentUser = $('#userId').val().split(',');
for(var selectDepartmentUserIndex = 0, selectDepartmentUserItem = selectDepartmentUser[selectDepartmentUserIndex]; selectDepartmentUserItem = selectDepartmentUser[selectDepartmentUserIndex++];) {
var userInfo = selectDepartmentUserItem.split('|');
if(showSelectedUsersVal.length > 0) {
showSelectedUsersVal += ',';
}
return;
showSelectedUsersVal += userInfo[2];
}
$('#userIdSelectUser').val(showSelectedUsersVal);
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
$(document.body).on('click', '#userIdSelectUser', function() {
var name = this.dataset.name;
var selectedUsers = [];
var selectDepartmentUser = $('#'+ name).val().split(',');
for(var selectDepartmentUserIndex = 0, item = selectDepartmentUser[selectDepartmentUserIndex]; item = selectDepartmentUser[selectDepartmentUserIndex++];) {
var userInfo = item.split('|');
selectedUsers.push({
userId: userInfo[0],
departmentId: userInfo[1]
});
}
}, function(code, data) {
top.dialog.msg(data.msg);
top.dialog.dialogData.selectedUsers = selectedUsers;
top.dialog.open({
url: top.restAjax.path('route/tree/treeuser', []),
title: '选择组织部门人员',
width: '500px',
height: '500px',
onClose: function() {
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
if(selectedUsers != null && selectedUsers.length > 0) {
var selectedUsersVal = '';
var showSelectedUsersVal = '';
for(var j = 0, selectUser = selectedUsers[j]; selectUser = selectedUsers[j++];) {
if(selectedUsersVal.length > 0) {
selectedUsersVal += ',';
}
if(showSelectedUsersVal.length > 0) {
showSelectedUsersVal += ',';
}
selectedUsersVal += (selectUser.userId +'|'+ selectUser.departmentId +'|'+ selectUser.userName +'|'+ selectUser.userTitle);
showSelectedUsersVal += selectUser.userName;
}
$('#'+ name).val(selectedUsersVal);
$('#'+ name +'SelectUser').val(showSelectedUsersVal);
} else {
$('#'+ name).val('');
$('#'+ name +'SelectUser').val('');
}
}
});
});
}
// 初始化视频
function initVideo(fileName, data) {
for(var i = 0, item; item = data[i++];) {
var player = new ckplayer({
container: '#'+ fileName + i,
variable: 'player',
flashplayer: false,
video: {
file: 'route/file/downloadfile/true/'+ item.fileId,
type: 'video/mp4'
}
});
}
// 初始化选择框、单选、复选模板
function initSelectRadioCheckboxTemplate(templateId, templateBoxId, data, callback) {
laytpl(document.getElementById(templateId).innerHTML).render(data, function(html) {
document.getElementById(templateBoxId).innerHTML = html;
});
form.render('select', templateBoxId);
callback();
}
// 初始化1级区域下拉选择
function initArea1Select(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area1SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area1SelectTemplateBox').innerHTML = html;
initSelectRadioCheckboxTemplate('area1SelectTemplate', 'area1SelectTemplateBox', data, function() {
var selectObj = {};
selectObj['area1'] = selectValue;
form.val('dataForm', selectObj);
});
form.render('select', 'area1SelectTemplateBox');
var selectObj = {};
selectObj['area1'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化2级区域下拉选择
function initArea2Select(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area2SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area2SelectTemplateBox').innerHTML = html;
function initArea2Select(area1, selectValue, callback) {
if(!area1) {
initSelectRadioCheckboxTemplate('area2SelectTemplate', 'area2SelectTemplateBox', [], function() {
var selectObj = {};
selectObj['area2'] = selectValue;
form.val('dataForm', selectObj);
callback();
});
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area2SelectTemplate', 'area2SelectTemplateBox', data, function() {
var selectObj = {};
selectObj['area2'] = selectValue;
form.val('dataForm', selectObj);
callback();
});
form.render('select', 'area2SelectTemplateBox');
var selectObj = {};
selectObj['area2'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化3级区域下拉选择
function initArea3Select(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area3SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area3SelectTemplateBox').innerHTML = html;
function initArea3Select(area2, selectValue, callback) {
$('#area3Box').show();
if(!area2) {
initSelectRadioCheckboxTemplate('area3SelectTemplate', 'area3SelectTemplateBox', [], function() {
var selectObj = {};
selectObj['area3'] = selectValue;
form.val('dataForm', selectObj);
callback();
});
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area3SelectTemplate', 'area3SelectTemplateBox', data, function() {
var selectObj = {};
selectObj['area3'] = selectValue;
form.val('dataForm', selectObj);
callback();
});
form.render('select', 'area3SelectTemplateBox');
var selectObj = {};
selectObj['area3'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化4级区域下拉选择
function initArea4Select(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area4SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area4SelectTemplateBox').innerHTML = html;
function initArea4Select(area3, selectValue, callback) {
$('#area4Box').show();
if(!area3) {
initSelectRadioCheckboxTemplate('area4SelectTemplate', 'area4SelectTemplateBox', [], function() {
var selectObj = {};
selectObj['area4'] = '';
form.val('dataForm', selectObj);
callback();
});
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area4SelectTemplate', 'area4SelectTemplateBox', data, function() {
var selectObj = {};
selectObj['area4'] = selectValue;
form.val('dataForm', selectObj);
callback();
});
form.render('select', 'area4SelectTemplateBox');
var selectObj = {};
selectObj['area4'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化5级区域下拉选择
function initArea5Select(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('area5SelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('area5SelectTemplateBox').innerHTML = html;
function initArea5Select(area4, selectValue) {
$('#area5Box').show();
if(!area4) {
initSelectRadioCheckboxTemplate('area5SelectTemplate', 'area5SelectTemplateBox', [], function() {
var selectObj = {};
selectObj['area5'] = '';
form.val('dataForm', selectObj);
});
return;
}
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
initSelectRadioCheckboxTemplate('area5SelectTemplate', 'area5SelectTemplateBox', data, function() {
var selectObj = {};
selectObj['area5'] = selectValue;
form.val('dataForm', selectObj);
});
form.render('select', 'area5SelectTemplateBox');
var selectObj = {};
selectObj['area5'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
@ -270,16 +319,32 @@
// 初始化领导ID联表
function initLeaderUserIdJoinTable(joinValue){
top.restAjax.get(top.restAjax.path('api/gridpersonnel/listgridpersonnel', []), {}, null, function(code, data) {
laytpl(document.getElementById('leaderUserIdJoinTemplate').innerHTML).render(data, function(html) {
document.getElementById('leaderUserIdJoinTemplateBox').innerHTML = html;
$('#leaderUserIdBox').show();
var params = {};
if($('#area5').val()) {
params.area5 = $('#area5').val();
} else if($('#area4').val()) {
params.area4 = $('#area4').val();
} else if($('#area3').val()) {
params.area3 = $('#area3').val();
} else if($('#area2').val()) {
params.area2 = $('#area2').val();
} else if($('#area1').val()) {
params.area1 = $('#area1').val();
} else {
initSelectRadioCheckboxTemplate('leaderUserIdJoinTemplate', 'leaderUserIdJoinTemplateBox', [], function() {
var formSelectData = {};
formSelectData['leaderUserId'] = joinValue;
form.val('dataForm', formSelectData);
});
return;
}
top.restAjax.get(top.restAjax.path('api/gridpersonnel/listgridpersonnel', []), params, null, function(code, data) {
initSelectRadioCheckboxTemplate('leaderUserIdJoinTemplate', 'leaderUserIdJoinTemplateBox', data, function() {
var formSelectData = {};
formSelectData['leaderUserId'] = joinValue;
form.val('dataForm', formSelectData);
});
form.render('select', 'leaderUserIdJoinTemplateBox');
// 初始化选择
var formSelectData = {};
formSelectData['gridPersonnel'] = joinValue;
form.val('dataForm', formSelectData);
}, function(code, data) {
top.dialog.msg(data.msg);
});
@ -292,16 +357,36 @@
top.restAjax.get(top.restAjax.path('api/gridpersonnel/getgridpersonnelbyid/{gridPersonnelId}', [gridPersonnelId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i];
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initUserIdSelectUser();
initArea1Select(data['area1']);
initArea2Select(data['area2']);
initArea3Select(data['area3']);
initArea4Select(data['area4']);
initArea5Select(data['area5']);
initLeaderUserIdJoinTable(data['leaderUserId']);
initArea2Select(data['area1'], data['area2'], function() {
if(level == 2) {
initLeaderUserIdJoinTable(data['leaderUserId']);
}
});
if(level > 1) {
initArea3Select(data['area2'], data['area3'], function() {
if(level == 3) {
initLeaderUserIdJoinTable(data['leaderUserId']);
}
});
if(level > 2) {
initArea4Select(data['area3'], data['area4'], function() {
if(level == 4) {
initLeaderUserIdJoinTable(data['leaderUserId']);
}
});
if(level > 3) {
initArea5Select(data['area4'], data['area5']);
}
}
}
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
@ -317,6 +402,7 @@
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
formData.field.level = level;
top.restAjax.put(top.restAjax.path('api/gridpersonnel/updategridpersonnel/{gridPersonnelId}', [gridPersonnelId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,
@ -345,6 +431,61 @@
closeBox();
});
$('.close').on('click', function() {
closeBox();
});
// area1 选择事件
form.on('select(area1)', function(data) {
initArea2Select(data.value, null, function() {});
if(level > 1) {
initArea3Select(data.value, null, function() {});
if(level > 2) {
initArea4Select(data.value, null, function() {});
if(level > 3) {
initArea5Select(data.value, null, function() {});
}
}
initLeaderUserIdJoinTable();
}
});
// area2 选择事件
form.on('select(area2)', function(data) {
if(level > 1) {
initArea3Select(data.value, null, function() {});
if(level > 2) {
initArea4Select(data.value, null, function() {});
if(level > 3) {
initArea5Select(data.value, null, function() {});
}
}
initLeaderUserIdJoinTable();
}
});
// area3 选择事件
form.on('select(area3)', function(data) {
if(level > 2) {
initArea4Select(data.value, null, function() {});
if(level > 3) {
initArea5Select(data.value, null, function() {});
}
initLeaderUserIdJoinTable();
}
});
// area4 选择事件
form.on('select(area4)', function(data) {
if(level > 3) {
initArea5Select(data.value, null, function() {});
initLeaderUserIdJoinTable();
}
});
// area5 选择事件
form.on('select(area5)', function(data) {
initLeaderUserIdJoinTable();
});
// 校验
form.verify({
});