# Conflicts:
#	app/admin/controller/Index.php
#	app/admin/view/index/main.html
This commit is contained in:
彭桃 2023-02-04 18:02:10 +08:00
commit e52e1fa1c3
8 changed files with 249 additions and 279 deletions

View File

@ -133,6 +133,7 @@ class Index extends BaseController
->alias('u')
->where($where)
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.land_area');
// 荒地面积
$sum_waste_land_area = Db::table('fa_szxc_information_useraddress')
->alias('u')
@ -145,6 +146,12 @@ class Index extends BaseController
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.breed_area');
$hd_num = $sum_waste_land_area - $breed_area;
$waste_land_area = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.waste_land_area');
View::assign(
[
'totaluser' => $num,//User::where($whe)->count(),// 总用户数
@ -158,6 +165,7 @@ class Index extends BaseController
'nation_h_num' => $nation_h_num,
'work_num' => $work_num,
'land_area_num' => $land_area_num,
'waste_land_area' => $waste_land_area,
'sum_218' => $sum_218,
'sum_217' => $sum_217,
'sum_216' => $sum_216,

View File

@ -65,46 +65,36 @@ class Village extends BaseController
{
if (request()->isAjax()) {
$params= get_params();
if (isset($params['is_hot']) && $params['is_hot']=='on'){
if (!empty($params['is_hot'])&&$params['is_hot']=='on'){
$params['is_hot']=1;
}else{
$params['is_hot']=0;
}
if (isset($params['is_tourism']) && $params['is_tourism']=='on'){
if (!empty($params['is_tourism'])&&$params['is_tourism']=='on'){
$params['is_tourism']=1;
}else{
$params['is_tourism']=0;
}
// 组装地址名
if ($params['area_id'] != '') {
$area_name = Db::table('fa_geo_area')->where('area_code', $params['area_id'])->value('area_name');
}
if ($params['street_id'] != '') {
$street_name = Db::table('fa_geo_street')->where('street_code', $params['street_id'])->value('street_name');
}
if ($params['village_id'] != '') {
$village = Db::table('fa_geo_village')->where('village_code', $params['village_id'])->find();
$params['village_id']=$village['village_id'];
}
$address_name = $area_name . $street_name . $village['village_name'] ;
$params['address'] = $address_name;
$area_code=Db::table('fa_geo_area')->where('area_code',$params['area_id'])->value('area_name');
$street_code=Db::table('fa_geo_street')->where('street_code',$params['street_id'])->value('street_name');
$village_id=Db::table('fa_geo_village')->where('village_id',$params['village_id'])->value('village_name');
$params['address']='泸州市'.$area_code.$street_code.$village_id;
$params['createtime']=time();
$res=Db::table('fa_szxc_village')->strict(false)->field(true)->insertGetId($params);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
}
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
}
}
/**
* 修改
*/
@ -112,33 +102,20 @@ class Village extends BaseController
{
$params= get_params();
if (request()->isAjax()) {
if (isset($params['is_hot']) && $params['is_hot']=='on'){
if (!empty($params['is_hot'])&&$params['is_hot']=='on'){
$params['is_hot']=1;
}else{
$params['is_hot']=0;
}
if (isset($params['is_tourism']) && $params['is_tourism']=='on'){
if (!empty($params['is_tourism'])&&$params['is_tourism']=='on'){
$params['is_tourism']=1;
}else{
$params['is_tourism']=0;
}
// 组装地址名
if ($params['area_id'] != '') {
$area_name = Db::table('fa_geo_area')->where('area_code', $params['area_id'])->value('area_name');
}
if ($params['street_id'] != '') {
$street_name = Db::table('fa_geo_street')->where('street_code', $params['street_id'])->value('street_name');
}
if ($params['village_id'] != '') {
$village = Db::table('fa_geo_village')->where('village_code', $params['village_id'])->find();
$params['village_id']=$village['village_id'];
}
$address_name = $area_name . $street_name . $village['village_name'] ;
$params['address'] = $address_name;
$area_code=Db::table('fa_geo_area')->where('area_code',$params['area_id'])->value('area_name');
$street_code=Db::table('fa_geo_street')->where('street_code',$params['street_id'])->value('street_name');
$village_id=Db::table('fa_geo_village')->where('village_id',$params['village_id'])->value('village_name');
$params['address']='泸州市'.$area_code.$street_code.$village_id;
$res=Db::table('fa_szxc_village')->where('id',$params['id'])->strict(false)->field(true)->update($params);
if ($res){
return to_assign();
@ -147,13 +124,12 @@ class Village extends BaseController
}
}
$detail = Db::table('fa_szxc_village')->where('id',$params['id'])->find();
$detail['village_code'] = Db::table('fa_geo_village')->where('village_id', $detail['village_id'])->value('village_code');
View::assign('detail', $detail);
View::assign('url', $this->url);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
View::assign('detail', $detail);
View::assign('url', $this->url);
return view();
}
/**
@ -176,7 +152,7 @@ class Village extends BaseController
$param= get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$type = isset($param['type']) ? $param['type'] : 0;
$res = Db::table('fa_szxc_village')->where('id',$id)->delete();
$res = Db::table('fa_szxc_village')->where('id',$id)->update(['status'=>$type]);
if ($res){
return to_assign();
}else{

View File

@ -24,7 +24,7 @@
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<div class="layui-row layui-col-space12">
<div class="layui-row layui-col-space12">
<div class="">
<div class="layui-row layui-col-space12">
<div class="layui-col-md12">
@ -85,6 +85,10 @@
<div class="num-title">土地总面积</div>
<div class="blue">{$land_area_num}</div>
</td>
<td>
<div class="num-title">荒地</div>
<div class="blue">{$waste_land_area}</div>
</td>
<td>
<div class="num-title">农田水利</div>
<div class="blue">{$sum_218}</div>
@ -97,10 +101,6 @@
<div class="num-title">养殖</div>
<div class="blue">{$sum_216}</div>
</td>
<td>
<div class="num-title">荒地面积</div>
<div class="blue">{$sum_waste_land_area}</div>
</td>
</tr>
<tr>
<td>
@ -125,10 +125,11 @@
<div class="layui-card">
<div id="chartYear" style="width: 100%;height:240px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
<!-- /主体 -->

View File

@ -51,7 +51,7 @@
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传图片</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="150" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="img" value="" lay-verify="required">
<input type="hidden" name="img" value="">
</div>
</div>
</td>

View File

@ -51,7 +51,7 @@
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传图片</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="{$detail.img}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="150" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="img" value="{$detail.img}" lay-verify="required">
<input type="hidden" name="img" value="{$detail.img}">
</div>
</div>
</td>

View File

@ -15,43 +15,6 @@
<form class="layui-form p-4">
<h3 class="pb-3">添加内容</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">区域<font>*</font></td>
<td colspan="3">
<div class="layui-form-item">
<label class="layui-form-label">区县</label>
<div class="layui-input-block">
{if {:session('gougu_admin')['group_access']==1}
<select name="area_id" lay-filter="area_id" lay-verify="required">
{volist name='street' id='vo'}
<option value="{$vo.code}">{$vo.name}</option>
{/volist}
</select>
{else /}
{volist name='street' id='vo'}
{if $address.area_id==$vo.code}
<input type="text" value="{$vo.name}" autocomplete="off" class="layui-input" disabled>
{/if}
{/volist}
{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">标题<font>*</font></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
@ -85,11 +48,43 @@
<img src=""
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
width="100" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="images" value="" lay-verify="required">
<input type="hidden" name="images" value="">
</div>
</div>
</td>
</tr>
{if {:session('gougu_admin')['group_access']==1}
<tr>
<td style="width: 20%">
<div class="layui-form-item">
<label class="layui-form-label">区县</label>
<div class="layui-input-block">
<select name="area_id" lay-filter="area_id" lay-verify="required">
{volist name='street' id='vo'}
<option value="{$vo.code}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
</td>
<td >
<div class="layui-form-item">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
<td >
<div class="layui-form-item">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
</td>
</tr>
{/if}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
</tr>
@ -115,8 +110,7 @@
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}"
var area_id = ""
var street_id = ""
function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker;
@ -134,19 +128,6 @@
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
if (area_id != 0) {
street(area_id)
}
if (street_id != 0) {
village(street_id)
}
form.on('select(area_id)', function (data) {
street(data.value)
});
@ -154,14 +135,13 @@
var demo1 = xmSelect.render({
name: 'street_id',
el: '#demo1',
initValue: [street_id],
prop: {
name: 'name',
value: 'code',
},
data: [],
radio: true,
disabled: group_access == 2 ? true : false,
on: function (data) {
var arr = data.arr;
village(arr[0]['code'])
@ -177,14 +157,13 @@
var demo2 = xmSelect.render({
name: 'village_id',
el: '#demo2',
initValue: [],
prop: {
name: 'name',
value: 'code',
value: 'id',
},
data: [],
radio: true,
disabled: group_access == 2 ? true : false,
})
$.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({
@ -192,7 +171,11 @@
})
});
}
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.introduce = tinyMCE.editors['container_content'].getContent();

View File

@ -15,43 +15,6 @@
<form class="layui-form p-4">
<h3 class="pb-3">编辑文章表</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">区域<font>*</font></td>
<td colspan="3">
<div class="layui-form-item">
<label class="layui-form-label">区县</label>
<div class="layui-input-block">
{if {:session('gougu_admin')['group_access']==1}
<select name="area_id" lay-filter="area_id" lay-verify="required">
{volist name='street' id='vo'}
<option value="{$vo.code}">{$vo.name}</option>
{/volist}
</select>
{else /}
{volist name='street' id='vo'}
{if $address.area_id==$vo.code}
<input type="text" value="{$vo.name}" autocomplete="off" class="layui-input" disabled>
{/if}
{/volist}
{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">标题<font>*</font></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
@ -90,6 +53,45 @@
</div>
</td>
</tr>
<tr>
<td style="width: 20%">
<div class="layui-form-item">
<label class="layui-form-label">区县</label>
<div class="layui-input-block">
{if {:session('gougu_admin')['group_access']==1}
<select name="area_id" lay-filter="area_id" lay-verify="required">
{volist name='street' id='vo'}
<option value="{$vo.code}">{$vo.name}</option>
{/volist}
</select>
{else /}
{volist name='street' id='vo'}
{if $address.area_id==$vo.code}
<input type="text" value="{$vo.name}" autocomplete="off" class="layui-input" disabled>
{/if}
{/volist}
{/if}
</div>
</div>
</td>
<td >
<div class="layui-form-item">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
<td >
<div class="layui-form-item">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
</td>
</tr>
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
</tr>
@ -114,9 +116,10 @@
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}"
var area_id = "{$detail.area_id}"
var street_id = "{$detail.street_id}"
var group_access = "{:session('gougu_admin')['group_access']}"
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker;
@ -135,18 +138,13 @@
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
if (area_id != 0) {
street(area_id)
}
if (street_id != 0) {
village(street_id)
}
form.on('select(area_id)', function (data) {
street(data.value)
});
@ -154,14 +152,14 @@
var demo1 = xmSelect.render({
name: 'street_id',
el: '#demo1',
initValue: [street_id],
initValue: ["{$detail.street_id}"],
prop: {
name: 'name',
value: 'code',
},
data: [],
radio: true,
disabled: group_access == 2 ? true : false,
on: function (data) {
var arr = data.arr;
village(arr[0]['code'])
@ -177,14 +175,14 @@
var demo2 = xmSelect.render({
name: 'village_id',
el: '#demo2',
initValue: ["{$detail.village_code}"],
prop: {
name: 'name',
value: 'code',
value: 'id',
},
data: [],
initValue: ["{$detail.village_id}"],
radio: true,
disabled: group_access == 2 ? true : false,
})
$.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({
@ -192,11 +190,15 @@
})
});
}
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.introduce = tinyMCE.editors['container_content'].getContent();
if (data.field.introduce == '') {
data.field.content = tinyMCE.editors['container_content'].getContent();
if (data.field.content == '') {
layer.msg('请先完善文章内容');
return false;
}

View File

@ -142,13 +142,13 @@ class Userinfo extends BaseController
$post['address_name'] = $area_name.$street_name.$village.$brigade_name;
// 更新用户表
$header = Request::header('x-Token');
if(isset($header['x-token']) && !empty($header['x-token'])){
$phone['mobile'] = $post['phone']??'';
Db::table('fa_user')->where($where)->update($phone);
}else{
$post['phone'] = $user['mobile']??'';
}
// $header = Request::header('x-Token');
// if(isset($header['x-token']) && !empty($header['x-token'])){
// $phone['mobile'] = $post['phone']??'';
// Db::table('fa_user')->where($where)->update($phone);
// }else{
// $post['phone'] = $user['mobile']??'';
// }
//写入用户信息表
$data['user_id'] = $userid;