288 lines
13 KiB
HTML
288 lines
13 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<base href="/servicecity/">
|
|
<meta charset="utf-8">
|
|
<meta name="renderer" content="webkit">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
|
<style>
|
|
.layui-form-select dl {height: 150px !important;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="">
|
|
<div class="layui-card">
|
|
<div class="layui-card-body" style="padding: 15px;">
|
|
<form class="layui-form" lay-filter="dataForm">
|
|
<div class="row">
|
|
<div class="layui-inline layui-form" id="areaSelectBox"></div>
|
|
<script id="areaSelectTemplate" type="text/html">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>所属街镇</label>
|
|
<div class="layui-input-block" style="margin-left: 130px;">
|
|
<select id="areaId" name="areaId" lay-filter="areaChange" lay-verify="required">
|
|
<option value="">选择街镇</option>
|
|
{{# for(var i = 0, item; item = d[i++];) { }}
|
|
<option value="{{item.dictId}}">{{item.dictName}}</option>
|
|
{{# } }}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</script>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="layui-inline layui-form" id="communityBox"></div>
|
|
<script id="communityTemplate" type="text/html">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>所属社区(村)</label>
|
|
<div class="layui-input-block" style="margin-left: 130px;">
|
|
<select id="communityId" name="communityId" lay-filter="communityChange" lay-verify="required">
|
|
<option value="">选择社区(村)</option>
|
|
{{# for(var i = 0, item; item = d[i++];) { }}
|
|
<option value="{{item.communityId}}">{{item.communityName}}</option>
|
|
{{# } }}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</script>
|
|
</div>
|
|
<div class="row">
|
|
<div class="layui-inline layui-form" id="parentGridBox"></div>
|
|
<script id="parentGridTemplate" type="text/html">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>上级网格长</label>
|
|
<div class="layui-input-block" style="margin-left: 130px;">
|
|
<select id="communityBossParentId" name="communityBossParentId" lay-filter="communityBossParentChange" lay-verify="required">
|
|
<option value="">选择上级网格长</option>
|
|
{{# for(var i = 0, item; item = d[i++];) { }}
|
|
<option value="{{item.communityBossId}}" data-community-boss-parent-user-id="{{item.communityBossUserId}}">
|
|
{{item.communityBossName}}
|
|
</option>
|
|
{{# } }}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</script>
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width: 100px;"><span style="color: #cc0000">*</span>选择人员</label>
|
|
<div class="layui-input-block" style="margin-left: 130px;">
|
|
<input type="text" name="communityBossName" id="communityBossName" placeholder="点击选择人员"
|
|
class="layui-input" style="cursor: pointer" lay-verify="required">
|
|
<input type="hidden" name="communityBossUserId" id="communityBossUserId" value="">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item layui-form-text">
|
|
<label class="layui-form-label" style="width: 100px;">补充描述信息</label>
|
|
<div class="layui-input-block" style="margin-left: 130px;">
|
|
<textarea name="gridSummary" placeholder="补充描述信息" class="layui-textarea"></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item layui-layout-admin">
|
|
<div class="layui-input-block">
|
|
<div class="layui-footer" style="left: 0;">
|
|
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
|
|
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
|
<script type="text/javascript">
|
|
layui.config({
|
|
base: 'assets/layuiadmin/' //静态资源所在路径
|
|
}).extend({
|
|
index: 'lib/index' //主入口模块
|
|
}).use(['index', 'form', 'laytpl'], function () {
|
|
var $ = layui.$;
|
|
var form = layui.form;
|
|
var laytpl = layui.laytpl;
|
|
var communityBossId = top.restAjax.params(window.location.href).communityBossId;
|
|
|
|
var communityBossLevel = 3;
|
|
$('.layui-card').height($(window).height());
|
|
|
|
var formObject = {
|
|
communityBossUserId: null,
|
|
communityBossUsername: null,
|
|
communityBossName: null,
|
|
communityBossParentUserId: '0',
|
|
communityBossParentName: null,
|
|
communityBossLevel: communityBossLevel,
|
|
areaId: null,
|
|
areaName: null,
|
|
communityId: null,
|
|
communityName: null,
|
|
districtId: null,
|
|
districtName: null,
|
|
buildingId: null,
|
|
buildingName: null,
|
|
gridSummary: null
|
|
};
|
|
|
|
function init() {
|
|
top.restAjax.get(top.restAjax.path('api/communityboss/getcommunityboss/{communityBossId}', [communityBossId]), {}, null, function (code, data) {
|
|
var dataFormData = {};
|
|
for (var i in data) {
|
|
dataFormData[i] = data[i];
|
|
}
|
|
|
|
initAreaSelect(dataFormData['areaId'], function () {
|
|
initCommunitySelect(dataFormData['areaId'], dataFormData['communityId'], function () {
|
|
initCommunityBossParentSelect(dataFormData['communityId'], dataFormData['communityBossParentId']);
|
|
});
|
|
});
|
|
form.val('dataForm', dataFormData);
|
|
form.render();
|
|
}, function (code, data) {
|
|
top.dialog.msg(data.msg);
|
|
});
|
|
|
|
};
|
|
init();
|
|
|
|
// 初始化街镇
|
|
function initAreaSelect(selectValue, callback) {
|
|
top.restAjax.get(top.restAjax.path('api/dict/listdict/9d179f05-3ea0-48f7-853c-d3b7124b791c', []), {}, null, function (code, data, args) {
|
|
laytpl(document.getElementById('areaSelectTemplate').innerHTML).render(data, function (html) {
|
|
document.getElementById('areaSelectBox').innerHTML = html;
|
|
});
|
|
form.val('dataForm', {areaId: selectValue});
|
|
form.render();
|
|
callback();
|
|
}, function (code, data) {
|
|
top.dialog.msg(data.msg);
|
|
});
|
|
}
|
|
|
|
// 选择街道
|
|
form.on('select(areaChange)', function (data) {
|
|
initCommunitySelect(data.value);
|
|
initCommunityBossParentSelect();
|
|
});
|
|
|
|
// 初始化社区
|
|
function initCommunitySelect(areaId, selectValue, callback) {
|
|
if (!areaId) {
|
|
laytpl(document.getElementById('parentGridTemplate').innerHTML).render([], function (html) {
|
|
document.getElementById('parentGridBox').innerHTML = html;
|
|
});
|
|
form.render();
|
|
return;
|
|
}
|
|
top.restAjax.get(top.restAjax.path('api/community/listcommunity?areaId={areaId}', [areaId]), {}, null, function (code, data, args) {
|
|
laytpl(document.getElementById('communityTemplate').innerHTML).render(data, function (html) {
|
|
document.getElementById('communityBox').innerHTML = html;
|
|
});
|
|
form.val('dataForm', {communityId: selectValue});
|
|
form.render();
|
|
callback()
|
|
}, function (code, data) {
|
|
top.dialog.msg(data.msg);
|
|
});
|
|
}
|
|
|
|
// 选择社区
|
|
form.on('select(communityChange)', function (data) {
|
|
initCommunityBossParentSelect(data.value);
|
|
});
|
|
|
|
// 初始化上级网格长
|
|
function initCommunityBossParentSelect(communityId, selectValue) {
|
|
var areaId = $('#areaId').val();
|
|
if(!areaId) {
|
|
if (!communityId) {
|
|
laytpl(document.getElementById('parentGridTemplate').innerHTML).render([], function (html) {
|
|
document.getElementById('parentGridBox').innerHTML = html;
|
|
});
|
|
form.render();
|
|
return;
|
|
}
|
|
}
|
|
top.restAjax.get(top.restAjax.path('api/communityboss/listcommunityboss', []),
|
|
{
|
|
areaId: $('#areaId').val(),
|
|
communityId: communityId ? communityId : '',
|
|
communityBossLevel: communityBossLevel - 1
|
|
}, null, function (code, data, args) {
|
|
laytpl(document.getElementById('parentGridTemplate').innerHTML).render(data, function (html) {
|
|
document.getElementById('parentGridBox').innerHTML = html;
|
|
});
|
|
form.val('dataForm', {communityBossParentId: selectValue});
|
|
form.val('dataForm', {communityBossParentId: selectValue});
|
|
form.render();
|
|
}, function (code, data) {
|
|
top.dialog.msg(data.msg);
|
|
});
|
|
}
|
|
|
|
// 选择人员-按钮绑定
|
|
$(document).on('click', '#communityBossName', function () {
|
|
selectGridUser();
|
|
});
|
|
|
|
// 选择人员
|
|
function selectGridUser() {
|
|
top.dialog.dialogData.selectedUserIds = $('#communityBossUserId').val();
|
|
layer.open({
|
|
type: 2,
|
|
title: '选择人员',
|
|
closeBtn: 0,
|
|
area: ['45%', '95%'],
|
|
shadeClose: false,
|
|
anim: 2,
|
|
content: top.restAjax.path('route/communityboss/select-grid-user.html', []),
|
|
end: function () {
|
|
var selectedUsers = top.dialog.dialogData.selectedUsers;
|
|
if (selectedUsers.length == 0) {
|
|
$('#communityBossUserId').val('');
|
|
$('#communityBossName').val('');
|
|
}
|
|
if (selectedUsers.length > 0) {
|
|
$('#communityBossUserId').val(selectedUsers[0].userId);
|
|
$('#communityBossName').val(selectedUsers[0].userName + '[' + selectedUsers[0].userUsername + ']');
|
|
}
|
|
top.dialog.dialogData.selectedUserIds = '';
|
|
top.dialog.dialogData.selectedUsers = [];
|
|
}
|
|
});
|
|
}
|
|
|
|
form.on('submit(submitForm)', function (formData) {
|
|
top.dialog.confirm(top.dataMessage.commit, function (index) {
|
|
top.dialog.close(index);
|
|
formData.field['communityBossLevel'] = communityBossLevel;
|
|
formData.field['communityBossParentUserId'] = $('#communityBossParentId').find('option:selected').data().communityBossParentUserId;
|
|
formData.field['areaName'] = $('#areaId').find('option:selected').text();
|
|
top.restAjax.put(top.restAjax.path('api/communityboss/updatecommunityboss/{communityBossId}', [communityBossId]), formData.field, null, function (code, data) {
|
|
top.dialog.msg("修改完成");
|
|
closeBox();
|
|
}, function (code, data) {
|
|
top.dialog.msg(data.msg);
|
|
});
|
|
});
|
|
return false;
|
|
});
|
|
|
|
function closeBox() {
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
}
|
|
|
|
$('.close').on('click', function () {
|
|
closeBox();
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |