2023-03-21 15:50:55 +08:00

438 lines
10 KiB
HTML

{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<style>
.sm-st {
background: #fff;
padding: 20px;
border-radius: 3px;
margin-bottom: 20px;
box-shadow: 0 1px 0px rgba(0, 0, 0, 0.05);
}
.sm-st-icon {
width: 60px;
height: 60px;
display: inline-block;
line-height: 60px;
text-align: center;
font-size: 30px;
background: #eee;
border-radius: 5px;
float: left;
margin-right: 10px;
color: #fff;
}
.sm-st-info {
font-size: 12px;
padding-top: 2px;
}
.sm-st-info span {
display: block;
font-size: 24px;
font-weight: 600;
}
.col-sm-2{
width: 16%;
display: inline-block;
}
.panel{
background-color: #fff;
}
</style>
<div class="p-3 panel">
{if {:session('gougu_admin')['group_access']!=3}
<form class="layui-form gg-form-bar border-t border-x" style="display: inline-block;">
<div class="layui-input-inline" style="width:300px;">
<select name="area_id" class="form-control selectpicker" lay-filter="area_id">
{if $is_admin ==1}
<option value="">请选择</option>
{/if}
{volist name="arealist" id="vo"}
<option value="{$vo.area_code}">{$vo.area_name}</option>
{/volist}
</select>
</div>
<div class="layui-input-inline" style="width:300px;">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
<div class="layui-input-inline" style="width:300px;">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
<div class="layui-input-inline" style="width:300px;">
<label class="layui-form-label">大队</label>
<div class="layui-input-block">
<div id="demo3"></div>
</div>
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searcharea">提交</button>
</form>
{/if}
<form class="layui-form gg-form-bar border-t border-x" style="display: inline-block;">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入姓名" class="layui-input" autocomplete="off" />
</div>
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="phone" placeholder="请输入手机" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
</form>
<div class="panel" id="search_box">
</div>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">用户信息</a>
{if {:session('gougu_admin')['group_access']!=3}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="auths">权限管理</a>
{/if}
{notin name=":session('gougu_admin')['group_access']" value="2,3,4,5"}
<a class="layui-btn layui-btn-xs" lay-event="edit">信息维护</a>
{/notin}
{if {:session('gougu_admin')['group_access']==1}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
{/if}
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
const moduleInit = ['tool'];
var group_access = "{:session('gougu_admin')['group_access']}";
var area_id = "{$row.area_id}";
var street_id = "{$row.street_id}";
var auth_range = "{$row.auth_range}";
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
if (area_id != 0) {
street(area_id)
}
if (street_id != 0) {
village(street_id)
// brigade()
}
layui.pageTable = table.render({
elem: '#article',
title: '文章表列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
},{
field: 'group_name',
title: '角色组',
templet: '<div>{{ d.user.userGroup.group_name }}</div>',
},{
field: 'name',
title: '姓名',
align: 'center',
},{
field: 'phone',
title: '手机号',
align: 'center',
},{
field: 'user',
title: '头像',
align: 'center',
templet: function (d)
{
if(d.user.avatar)
{
return '<div><img src="{{ d.user.avatar }}" style="width:30px; height:30px;"></div>';
}else{
return '<div><img src="/static/admin/images/icon.png" style="width:30px; height:30px;"></div>';
}
}
},{
field: 'gender',
title: '性别',
align: 'center',
},{
field: 'count',
title: '家庭成员',
align: 'center',
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[4]}?id='+obj.data.user_id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.user_id);
}
else if (obj.event === 'auths') {
tool.side('/admin/nk.user/auths?id='+obj.data.user_id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.id }, callback);
layer.close(index);
});
}
return false;
});
form.on('select(area_id)', function (data) {
street(data.value)
});
function street (id) {
var demo1 = xmSelect.render({
name: 'street_id',
el: '#demo1',
prop: {
name: 'name',
value: 'code',
},
data: [],
radio: true,
initValue: ["{$row.street_id}"],
disabled: group_access == 2 || group_access==4 ? true : false,
on: function (data) {
var arr = data.arr;
if(arr.length > 0){
village(arr[0]['code']);
}else{
village();
}
},
})
$.get('/api/geo/street?pcode=' + id, function (result) {
demo1.update({
data: result.data
})
if("{$row.street_id}"!=''){
village("{$row.street_id}")
}
});
}
function village (id) {
var demo2 = xmSelect.render({
name: 'village_id',
el: '#demo2',
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
initValue: ["{$row.village_id}"],
disabled: group_access == 2 ? true : false,
})
var demo3 = xmSelect.render({
name: 'brigade_id',
el: '#demo3',
prop: {
name: 'brigade_name',
value: 'id',
},
data: [],
radio: true,
})
$.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({
data: result.data
})
});
$.get('/api/geo/brigade', function (result) {
demo3.update({
data: result.data
})
});
}
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id,
phone:data.field.phone
},
page: {
curr: 1
}
});
return false;
});
form.on('submit(searcharea)', function(data) {
layui.pageTable.reload({
where: {
area_id: data.field.area_id,
street_id: data.field.street_id,
village_id:data.field.village_id,
brigade_id:data.field.brigade_id
},
page: {
curr: 1
}
});
tool.get("/admin/nk.user/tongji", data.field, function (res) {
let data = res.data;
var html=`
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="old_num">`+data.old_num+`</span>
老人人数
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="children_num">`+data.children_num+`</span>
儿童人数
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="unmarried_man_num">`+data.unmarried_man_num+`</span>
未婚男
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="unmarried_woman_num">`+data.unmarried_woman_num+`</span>
未婚女
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="land_area_num">`+data.land_area_num+`</span>
土地总面积
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="sum_218">`+data.sum_218+`</span>
农田水利
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="sum_217">`+data.sum_217+`</span>
坑塘
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="sum_216">`+data.sum_216+`</span>
养殖
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="sum_215">`+data.sum_215+`</span>
牧草地
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="sum_214">`+data.sum_214+`</span>
林地
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="sum_70">`+data.sum_70+`</span>
耕地
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="sum_69">`+data.sum_69+`</span>
园地
</div>
</div>
</div>
`
$("#search_box").html(html)
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->