后台农贸市场、蔬菜基地、产品情况、农产品结构

This commit is contained in:
彭桃 2023-02-06 17:40:56 +08:00
parent e52e1fa1c3
commit d44c1db4cf
22 changed files with 3638 additions and 2 deletions

View File

@ -0,0 +1,150 @@
<?php
namespace app\admin\controller\nk;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
/**
* 产品情况
*
* @icon fa fa-circle-o
*/
class Analysis extends BaseController
{
/**
* 构造函数
*/
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->url=[
'/admin/nk.analysis/index',
];
}
/**
* 数据列表
*/
public function index()
{
if (request()->isAjax()) {
$mmm = [];
$post = get_params();
//权限组信息
if ($this->adminInfo['group_access'] != 1) {
$find = Db::table('fa_szxc_information_useraddress')->where('admin_id', $this->adminInfo['id'])->find();
if ($find) {
if ($find['auth_range'] == 1) {
$mmm['b.village_id'] = $find['village_id'];
} elseif ($find['auth_range'] == 2) {
$mmm['b.street_id'] = $find['street_id'];
} elseif ($find['auth_range'] == 3) {
$mmm['b.area_id'] = $find['area_id'];
}
}
}
if ($post) {
if (isset($post['area_id']) && !empty($post['area_id'])) {
$mmm['b.area_id'] = $post['area_id'];
}
if (isset($post['street_id']) && !empty($post['street_id'])) {
$mmm['b.street_id'] = $post['street_id'];
}
if (isset($post['village_id']) && !empty($post['village_id'])) {
$mmm['b.village_id'] = $post['village_id'];
}
if (isset($post['brigade_id']) && !empty($post['brigade_id'])) {
$mmm['b.brigade_id'] = $post['brigade_id'];
}
}
//加工企业和品牌企业数量
$map[] = ['a.status','=',1];
$map[] = ['a.is_del','=',0];
$map[] = ['a.type_id','in','2,3'];
$list['num_1'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($mmm)->where($map)->count();
//企业农产品销量
$list['num_2'] = 2;
//企业通过我们平台采购的农产品
$list['num_3'] = 3;
//本镇已录入的商户
$list['num_4'] = 4;
//镇农产品需求量分析(事业单位、企业、居民)
$list['num_5'] = 5;
//农产品市场行情分析、显示
//农产品市内需求量
$result = ['data' => $list];
return table_assign(0, '', $result);
}
//权限组信息
$mmm = [];
if ($this->adminInfo['group_access'] != 1) { //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address) {
if ($user_address['auth_range'] == 1) {
$mmm['b.village_id'] = $user_address['village_id'];
} elseif ($user_address['auth_range'] == 2) {
$mmm['b.street_id'] = $user_address['street_id'];
} elseif ($user_address['auth_range'] == 3) {
$mmm['b.area_id'] = $user_address['area_id'];
}
if ($user_address['auth_range'] <=3 &&$user_address['auth_range'] >=1 ) {
$select = Db::table('fa_geo_area')->where('city_code', '510500')->where('area_code', $user_address['area_id'])->select();
} else {
$select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
}
View::assign('row', $user_address);
} else {
$user_address['area_id'] = '';
$user_address['street_id'] = '';
$user_address['village_id'] = '';
$user_address['auth_range'] = '1';
$select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
View::assign('row', $user_address);
}
$is_admin = 0;
} else {
$user_address['area_id'] = '';
$user_address['street_id'] = '';
$user_address['village_id'] = '';
$user_address['auth_range'] = '';
$select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
View::assign('row', $user_address);
$is_admin = 1;
}
//加工企业和品牌企业数量
$map[] = ['a.status','=',1];
$map[] = ['a.is_del','=',0];
$map[] = ['a.type_id','in','2,3'];
$list['num_1'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($mmm)->where($map)->count();
//企业农产品销量
$list['num_2'] = 2;
//企业通过我们平台采购的农产品
$list['num_3'] = 3;
//本镇已录入的商户
$list['num_4'] = 4;
//镇农产品需求量分析(事业单位、企业、居民)
$list['num_5'] = 5;
//农产品市场行情分析、显示
//农产品市内需求量
View::assign('data', $list);
View::assign('arealist', $select);
View::assign('is_admin', $is_admin);
View::assign('url', $this->url);
return view();
}
}

View File

@ -0,0 +1,210 @@
<?php
namespace app\admin\controller\nk;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
/**
* 农贸市场
*
* @icon fa fa-circle-o
*/
class Farmers extends BaseController
{
/**
* 构造函数
*/
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->url=[
'/admin/nk.farmers/index',
'/admin/nk.farmers/add',
'/admin/nk.farmers/edit',
'/admin/nk.farmers/del',
'/admin/nk.farmers/read',
];
}
/**
* 数据列表
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where[]= ['status','=',1];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['title','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = Db::table('cms_farm_product_market')
->where($where)
->count();
$list = Db::table('cms_farm_product_market')
->withAttr('area_id',function ($value,$data){
return Db::table('fa_geo_area')->where('area_code',$data['area_id'])->value('area_name');
})
->withAttr('street_id',function ($value,$data){
return Db::table('fa_geo_street')->where('street_code',$data['street_id'])->value('street_name');
})
->withAttr('village_id',function ($value,$data){
return Db::table('fa_geo_village')->where('village_id',$data['village_id'])->value('village_name');
})
->withAttr('status',function ($value,$data){
if($value == 1){
return '正常';
}else{
return '禁用';
}
})
->where($where)
->page($params['page'])
->limit($params['limit'])
->order('id desc')
->select();
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}
else{
return view('nk/farmers/index',['url'=>$this->url]);
}
}
public function add(){
if (request()->isAjax()) {
$param= get_params();
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
$param['area_id']=$adds['area_id'];
$param['street_id']=$adds['street_id'];
$param['village_id']=$adds['village_id'];
$param['add_time']=date('Y-m-d H:i:s');
$res=Db::table('cms_farm_product_market')->strict(false)->field(true)->insertGetId($param);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
return view();
}
}
public function edit(){
$param= get_params();
if (request()->isAjax()) {
$res=Db::table('cms_farm_product_market')->where('id',$param['id'])->strict(false)->field(true)->update($param);
if ($res){
return to_assign();
}else{
return to_assign(1, '操作失败,原因:'.$res);
}
}else{
$id = isset($param['id']) ? $param['id'] : 0;
$detail = Db::table('cms_farm_product_market')->where('id',$id)->find();
View::assign('editor', get_system_config('other','editor'));
if (!empty($detail)) {
View::assign('detail', $detail);
return view();
}
else{
throw new \think\exception\HttpException(404, '找不到页面');
}
}
}
/**
* 查看信息
*/
public function read()
{
$param= get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$detail = Db::table('cms_farm_product_market')->where('id',$id)->find();
if (!empty($detail)) {
View::assign('detail', $detail);
$farmers = Db::table('cms_manufacturer')->where('status',1)->select()->toArray();
foreach ($farmers as $k =>$v){
$farmers[$k]['juli'] = $this->getDistance($detail['lng'],$detail['lat'],$v['lng'],$v['lat'],2);
}
View::assign('farmers', $farmers);
return view();
}
else{
throw new \think\exception\HttpException(404, '找不到页面');
}
}
/**
* 计算两点地理坐标之间的距离
* @param Decimal $longitude1 起点经度
* @param Decimal $latitude1 起点纬度
* @param Decimal $longitude2 终点经度
* @param Decimal $latitude2 终点纬度
* @param Int $unit 单位 1: 2:公里
* @param Int $decimal 精度 保留小数位数
* @return Decimal
*/
function getDistance($longitude1, $latitude1, $longitude2, $latitude2, $unit=2, $decimal=2){
$EARTH_RADIUS = 6370.996; // 地球半径系数
$PI = 3.1415926;
$radLat1 = $latitude1 * $PI / 180.0;
$radLat2 = $latitude2 * $PI / 180.0;
$radLng1 = $longitude1 * $PI / 180.0;
$radLng2 = $longitude2 * $PI /180.0;
$a = $radLat1 - $radLat2;
$b = $radLng1 - $radLng2;
$distance = 2 * asin(sqrt(pow(sin($a/2),2) + cos($radLat1) * cos($radLat2) * pow(sin($b/2),2)));
$distance = $distance * $EARTH_RADIUS * 1000;
if($unit==2){
$distance = $distance / 1000;
}
return round($distance, $decimal);
}
/**
* 删除
*/
public function del()
{
$param= get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$type = isset($param['type']) ? $param['type'] : 0;
$res = Db::table('cms_farm_product_market')->where('id',$id)->delete();
if ($res){
return to_assign();
}else{
return to_assign(1, '操作失败,原因:'.$res);
}
}
}

View File

@ -0,0 +1,168 @@
<?php
namespace app\admin\controller\nk;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
/**
* 农产品成熟周期
*
* @icon fa fa-circle-o
*/
class Maturity extends BaseController
{
/**
* 构造函数
*/
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->url=[
'/admin/nk.maturity/index',
'/admin/nk.maturity/add',
'/admin/nk.maturity/edit',
'/admin/nk.maturity/del',
'/admin/nk.maturity/read',
];
}
/**
* 数据列表
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where[]= ['status','=',1];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['title','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = Db::table('cms_agriculture_products_traceability')
->where($where)
->count();
$list = Db::table('cms_agriculture_products_traceability')
->withAttr('status',function ($value,$data){
if($value == 1){
return '正常';
}else{
return '禁用';
}
})
->where($where)
->page($params['page'])
->limit($params['limit'])
->order('id desc')
->select();
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}
else{
return view('nk/maturity/index',['url'=>$this->url]);
}
}
public function add(){
if (request()->isAjax()) {
$param= get_params();
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
$param['area_id']=$adds['area_id'];
$param['street_id']=$adds['street_id'];
$param['village_id']=$adds['village_id'];
$param['add_time']=date('Y-m-d H:i:s');
$param['title'] = Db::table('fa_szxc_planting_type')->where('id',$param['szxc_planting_type_id'])->value('name');
$res=Db::table('cms_agriculture_products_traceability')->strict(false)->field(true)->insertGetId($param);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
$szxc_planting_type = Db::table('fa_szxc_planting_type')->select();
View::assign('szxc_planting_type', $szxc_planting_type);
return view();
}
}
public function edit(){
$param= get_params();
if (request()->isAjax()) {
$param['title'] = Db::table('fa_szxc_planting_type')->where('id',$param['szxc_planting_type_id'])->value('name');
$res=Db::table('cms_agriculture_products_traceability')->where('id',$param['id'])->strict(false)->field(true)->update($param);
if ($res){
return to_assign();
}else{
return to_assign(1, '操作失败,原因:'.$res);
}
}else{
$id = isset($param['id']) ? $param['id'] : 0;
$detail = Db::table('cms_agriculture_products_traceability')->where('id',$id)->find();
View::assign('editor', get_system_config('other','editor'));
if (!empty($detail)) {
View::assign('detail', $detail);
$szxc_planting_type = Db::table('fa_szxc_planting_type')->select();
View::assign('szxc_planting_type', $szxc_planting_type);
return view();
}
else{
throw new \think\exception\HttpException(404, '找不到页面');
}
}
}
/**
* 查看信息
*/
public function read()
{
$param= get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$detail = Db::table('cms_agriculture_products_traceability')->where('id',$id)->find();
if (!empty($detail)) {
View::assign('detail', $detail);
$szxc_planting_type = Db::table('fa_szxc_planting_type')->select();
View::assign('szxc_planting_type', $szxc_planting_type);
return view();
}
else{
throw new \think\exception\HttpException(404, '找不到页面');
}
}
/**
* 删除
*/
public function del()
{
$param= get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$type = isset($param['type']) ? $param['type'] : 0;
$res = Db::table('cms_agriculture_products_traceability')->where('id',$id)->delete();
if ($res){
return to_assign();
}else{
return to_assign(1, '操作失败,原因:'.$res);
}
}
}

View File

@ -71,6 +71,14 @@ class Products extends BaseController
->withAttr('village_id',function ($value,$data){
return Db::table('fa_geo_village')->where('village_id',$data['village_id'])->value('village_name');
})
->withAttr('maturity',function ($value,$data){
return $maturity = Db::table('cms_agriculture_products_traceability')->where('szxc_planting_type_id',$data['szxc_planting_type_id'])->value('content');
// if($maturity){
// return json_decode($maturity,true);
// }else{
// return '';
// }
})
->withAttr('status',function ($value,$data){
if($value == 1){
return '正常';

View File

@ -0,0 +1,210 @@
<?php
namespace app\admin\controller\nk;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
/**
* 蔬菜基地
*
* @icon fa fa-circle-o
*/
class Vegetable extends BaseController
{
/**
* 构造函数
*/
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->url=[
'/admin/nk.vegetable/index',
'/admin/nk.vegetable/add',
'/admin/nk.vegetable/edit',
'/admin/nk.vegetable/del',
'/admin/nk.vegetable/read',
];
}
/**
* 数据列表
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$where[]= ['status','=',1];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]= ['title','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where[] = ['village_id','=',$user_address['village_id']];
}elseif ($user_address['auth_range'] == 2){
$where[] = ['street_id','=',$user_address['street_id']];
}elseif ($user_address['auth_range'] == 3){
$where[] = ['area_id','=',$user_address['area_id']];
}else{
$where[] = ['village_id','=',$user_address['village_id']];
}
}else{
$where[] = ['village_id','=',''];
}
}
$total = Db::table('cms_manufacturer')
->where($where)
->count();
$list = Db::table('cms_manufacturer')
->withAttr('area_id',function ($value,$data){
return Db::table('fa_geo_area')->where('area_code',$data['area_id'])->value('area_name');
})
->withAttr('street_id',function ($value,$data){
return Db::table('fa_geo_street')->where('street_code',$data['street_id'])->value('street_name');
})
->withAttr('village_id',function ($value,$data){
return Db::table('fa_geo_village')->where('village_id',$data['village_id'])->value('village_name');
})
->withAttr('status',function ($value,$data){
if($value == 1){
return '正常';
}else{
return '禁用';
}
})
->where($where)
->page($params['page'])
->limit($params['limit'])
->order('id desc')
->select();
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}
else{
return view('nk/vegetable/index',['url'=>$this->url]);
}
}
public function add(){
if (request()->isAjax()) {
$param= get_params();
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
$param['area_id']=$adds['area_id'];
$param['street_id']=$adds['street_id'];
$param['village_id']=$adds['village_id'];
$param['add_time']=date('Y-m-d H:i:s');
$res=Db::table('cms_manufacturer')->strict(false)->field(true)->insertGetId($param);
if ($res){
return to_assign(0,'操作成功',['aid'=>$res]);
}
return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
return view();
}
}
public function edit(){
$param= get_params();
if (request()->isAjax()) {
$res=Db::table('cms_manufacturer')->where('id',$param['id'])->strict(false)->field(true)->update($param);
if ($res){
return to_assign();
}else{
return to_assign(1, '操作失败,原因:'.$res);
}
}else{
$id = isset($param['id']) ? $param['id'] : 0;
$detail = Db::table('cms_manufacturer')->where('id',$id)->find();
View::assign('editor', get_system_config('other','editor'));
if (!empty($detail)) {
View::assign('detail', $detail);
return view();
}
else{
throw new \think\exception\HttpException(404, '找不到页面');
}
}
}
/**
* 查看信息
*/
public function read()
{
$param= get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$detail = Db::table('cms_manufacturer')->where('id',$id)->find();
if (!empty($detail)) {
View::assign('detail', $detail);
$farmers = Db::table('cms_farm_product_market')->where('status',1)->select()->toArray();
foreach ($farmers as $k =>$v){
$farmers[$k]['juli'] = $this->getDistance($detail['lng'],$detail['lat'],$v['lng'],$v['lat'],2);
}
View::assign('farmers', $farmers);
return view();
}
else{
throw new \think\exception\HttpException(404, '找不到页面');
}
}
/**
* 计算两点地理坐标之间的距离
* @param Decimal $longitude1 起点经度
* @param Decimal $latitude1 起点纬度
* @param Decimal $longitude2 终点经度
* @param Decimal $latitude2 终点纬度
* @param Int $unit 单位 1: 2:公里
* @param Int $decimal 精度 保留小数位数
* @return Decimal
*/
function getDistance($longitude1, $latitude1, $longitude2, $latitude2, $unit=2, $decimal=2){
$EARTH_RADIUS = 6370.996; // 地球半径系数
$PI = 3.1415926;
$radLat1 = $latitude1 * $PI / 180.0;
$radLat2 = $latitude2 * $PI / 180.0;
$radLng1 = $longitude1 * $PI / 180.0;
$radLng2 = $longitude2 * $PI /180.0;
$a = $radLat1 - $radLat2;
$b = $radLng1 - $radLng2;
$distance = 2 * asin(sqrt(pow(sin($a/2),2) + cos($radLat1) * cos($radLat2) * pow(sin($b/2),2)));
$distance = $distance * $EARTH_RADIUS * 1000;
if($unit==2){
$distance = $distance / 1000;
}
return round($distance, $decimal);
}
/**
* 删除
*/
public function del()
{
$param= get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$type = isset($param['type']) ? $param['type'] : 0;
$res = Db::table('cms_manufacturer')->where('id',$id)->delete();
if ($res){
return to_assign();
}else{
return to_assign(1, '操作失败,原因:'.$res);
}
}
}

View File

@ -0,0 +1,236 @@
{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">
<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>
<div class="panel" id="search_box">
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="num_1">{$data.num_1}</span>
加工企业和品牌企业数量
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="num_2">{$data.num_2}</span>
企业农产品销量
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="num_3">{$data.num_3}</span>
企业通过我们平台采购量
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="num_4">{$data.num_4}</span>
本镇已录入的商户
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="sm-st clearfix">
<div class="sm-st-info">
<span id="num_5">{$data.num_5}</span>
镇农产品需求量分析
</div>
</div>
</div>
</div>
</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>
{/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()
}
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;
village(arr[0]['code'])
},
})
$.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(searcharea)', function(data) {
tool.get("/admin/nk.analysis/index", data.field, function (res) {
let data = res.data;
console.log(data);
$('#num_1').text(data.num_1);
$('#num_2').text(data.num_2);
$('#num_3').text(data.num_3);
$('#num_4').text(data.num_4);
$('#num_5').text(data.num_5);
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,124 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<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="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input"></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.farmers/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,132 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<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="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input" value="{$detail.title}"></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</td>
</tr>
</table>
<div class="pt-3">
<input type="hidden" name="id" value="{$detail.id}"/>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
layer.msg('上传失败');
return false;
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.farmers/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,156 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入标题" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
</form>
<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="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
</div>
</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><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area_id',
title: '区县',
align: 'center',
width:120,
},{
field: 'street_id',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village_id',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'title',
title: '标题',
align: 'center',
width:150,
},{
field: 'synopsis',
title: '简介',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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.id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.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('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,67 @@
{extend name="common/base"/}
{block name="style"}
<style>
.content-article img{max-width:88%!important; height:auto!important; margin:6px 0!important; border-radius:4px;}
.layui-td-gray{
width: 110px;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div 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="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input" value="{$detail.title}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,99 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<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-col-md6">
<select name="szxc_planting_type_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='szxc_planting_type' id='vo'}
<option value="{$vo.id}" >{$vo.name}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" id="container_content" name="content"></textarea>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container_content'].getContent();
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.products/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,108 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<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-col-md6">
<select name="szxc_planting_type_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='szxc_planting_type' id='vo'}
<option value="{$vo.id}" {if $detail.szxc_planting_type_id==$vo.id} selected {/if}>{$vo.name}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" id="container_content" name="content">{$detail.content}</textarea>
</td>
</tr>
</table>
<div class="pt-3">
<input type="hidden" name="id" value="{$detail.id}"/>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
layer.msg('上传失败');
return false;
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container_content'].getContent();
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.products/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,139 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入标题" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
</form>
<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="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
</div>
</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><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'title',
title: '农作物名称',
align: 'center',
width:150,
},{
field: 'content',
title: '内容',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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.id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.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('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,57 @@
{extend name="common/base"/}
{block name="style"}
<style>
.content-article img{max-width:88%!important; height:auto!important; margin:6px 0!important; border-radius:4px;}
.layui-td-gray{
width: 110px;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div 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-col-md6">
<select name="szxc_planting_type_id" lay-verify="required" lay-search="" disabled>
<option value="" >请选择</option>
{volist name='szxc_planting_type' id='vo'}
<option value="{$vo.id}" {if $detail.szxc_planting_type_id==$vo.id} selected {/if}>{$vo.name}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
{$detail.synopsis}
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
{$detail.content|raw}
</td>
</tr>
</table>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -18,7 +18,9 @@
<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="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
@ -89,6 +91,11 @@
title: '状态',
align: 'center',
width:100,
},{
field: 'maturity',
title: '成熟周期',
align: 'center',
width:100,
},{
fixed: 'right',
field: 'right',

View File

@ -46,7 +46,10 @@
<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">
<option value=""></option>
{if $is_admin ==1}
<option value="">请选择</option>
{/if}
{volist name="arealist" id="vo"}
<option value="{$vo.area_code}">{$vo.area_name}</option>
{/volist}
@ -113,9 +116,20 @@
<script src="/static/assets/js/xm-select.js"></script>
<script>
const moduleInit = ['tool'];
var group_access = "{:session('gougu_admin')['group_access']}"
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: '文章表列表',

View File

@ -0,0 +1,124 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<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="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input"></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.vegetable/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,132 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<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="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input" value="{$detail.title}"></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</td>
</tr>
</table>
<div class="pt-3">
<input type="hidden" name="id" value="{$detail.id}"/>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
layer.msg('上传失败');
return false;
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.vegetable/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,156 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入标题" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
</form>
<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="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
</div>
</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><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area_id',
title: '区县',
align: 'center',
width:120,
},{
field: 'street_id',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village_id',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'title',
title: '标题',
align: 'center',
width:150,
},{
field: 'synopsis',
title: '简介',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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.id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.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('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,68 @@
{extend name="common/base"/}
{block name="style"}
<style>
.content-article img{max-width:88%!important; height:auto!important; margin:6px 0!important; border-radius:4px;}
.layui-td-gray{
width: 110px;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div 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="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input" value="{$detail.title}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
}
</script>
{/block}
<!-- /脚本 -->

File diff suppressed because it is too large Load Diff

4
public/static/assets/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long