Merge remote-tracking branch 'origin/development'
This commit is contained in:
commit
02fc8cd80b
@ -318,3 +318,65 @@ function add_log($type, $param_id = '', $param = [])
|
||||
$data['create_time'] = time();
|
||||
Db::name('AdminLog')->strict(false)->field(true)->insert($data);
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getModelTime')) {
|
||||
/**
|
||||
* @param BaseQuery $model
|
||||
* @param string $section
|
||||
* @param string $prefix
|
||||
* @param string $field
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020-04-29
|
||||
*/
|
||||
function getModelTime( $model, string $section, $prefix = 'create_time', $field = '-',$time = '')
|
||||
{
|
||||
if (!isset($section)) return $model;
|
||||
switch ($section) {
|
||||
case 'today':
|
||||
$model->whereBetween($prefix, [date('Y-m-d H:i:s', strtotime('today')), date('Y-m-d H:i:s', strtotime('tomorrow -1second'))]);
|
||||
break;
|
||||
case 'week':
|
||||
$model->whereBetween($prefix, [date('Y-m-d H:i:s', strtotime('this week 00:00:00')), date('Y-m-d H:i:s', strtotime('next week 00:00:00 -1second'))]);
|
||||
break;
|
||||
case 'month':
|
||||
$model->whereBetween($prefix, [date('Y-m-d H:i:s', strtotime('first Day of this month 00:00:00')), date('Y-m-d H:i:s', strtotime('first Day of next month 00:00:00 -1second'))]);
|
||||
break;
|
||||
case 'year':
|
||||
$model->whereBetween($prefix, [date('Y-m-d H:i:s', strtotime('this year 1/1')), date('Y-m-d H:i:s', strtotime('next year 1/1 -1second'))]);
|
||||
break;
|
||||
case 'yesterday':
|
||||
$model->whereBetween($prefix, [date('Y-m-d H:i:s', strtotime('yesterday')), date('Y-m-d H:i:s', strtotime('today -1second'))]);
|
||||
break;
|
||||
case 'quarter':
|
||||
list($startTime, $endTime) = getMonth();
|
||||
$model = $model->where($prefix, '>', $startTime);
|
||||
$model = $model->where($prefix, '<', $endTime);
|
||||
break;
|
||||
case 'lately7':
|
||||
$model = $model->where($prefix, 'between', [date('Y-m-d', strtotime("-7 day")), date('Y-m-d H:i:s')]);
|
||||
break;
|
||||
case 'lately30':
|
||||
$model = $model->where($prefix, 'between', [date('Y-m-d', strtotime("-30 day")), date('Y-m-d H:i:s')]);
|
||||
break;
|
||||
default:
|
||||
if (strstr($section, $field) !== false) {
|
||||
list($startTime, $endTime) = explode($field, $section);
|
||||
if (strlen($startTime) == 4) {
|
||||
$model->whereBetweenTime($prefix, date('Y-m-d H:i:s', strtotime($section)), date('Y-m-d H:i:s', strtotime($section . ' +1day -1second')));
|
||||
} else {
|
||||
if ($startTime == $endTime) {
|
||||
$model = $model->whereBetweenTime($prefix, date('Y-m-d 0:0:0', strtotime($startTime)), date('Y-m-d 23:59:59', strtotime($endTime)));
|
||||
} else if(strpos($startTime, ':')) {
|
||||
$model = $model->whereBetweenTime($prefix, $startTime, $endTime);
|
||||
} else {
|
||||
$model = $model->whereBetweenTime($prefix, date('Y-m-d H:i:s', strtotime($startTime)), date('Y-m-d H:i:s', strtotime($endTime . ' +1day -1second')));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -381,5 +381,97 @@ class Api extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function tongji(){
|
||||
$mmm = $www = [];
|
||||
$post = get_params();
|
||||
|
||||
//镇农产品需求量分析(事业单位、企业、居民)
|
||||
$date = 'month';
|
||||
$num_5 = Db::connect('shop')->table('eb_store_order')
|
||||
->field('from_unixtime(unix_timestamp(create_time),\'%m-%d\') as time, count(DISTINCT order_id) as total')
|
||||
->group('time')
|
||||
->order('time ASC')
|
||||
->whereBetween('create_time', [date('Y-m-d H:i:s', strtotime('first Day of this month 00:00:00')), date('Y-m-d H:i:s', strtotime('first Day of next month 00:00:00 -1second'))])
|
||||
->select()->toarray();
|
||||
$day_time = array_column($num_5,'time');
|
||||
$total = array_column($num_5,'total');
|
||||
|
||||
//农产品市场行情分析、显示
|
||||
$list['num_6'] = 6;
|
||||
//农产品市内需求量
|
||||
$list['num_7'] = 7;
|
||||
|
||||
$visitUser = $this->dateVisitUserNum($date, '');
|
||||
$orderUser = $this->orderUserNum($date, null, '');
|
||||
$orderPrice = $this->orderPrice($date, null, '');
|
||||
$payOrderUser = $this->orderUserNum($date, 1, '');
|
||||
$payOrderPrice = $this->orderPrice($date, 1, '');
|
||||
// halt($payOrderUser);
|
||||
// $userRate = $payOrderUser ? bcdiv($payOrderPrice, $payOrderUser, 2) : 0;
|
||||
// $orderRate = $visitUser ? bcdiv($orderUser, $visitUser, 2) : 0;
|
||||
// $payOrderRate = $orderUser ? bcdiv($payOrderUser, $orderUser, 2) : 0;
|
||||
|
||||
$result = compact('day_time','total','visitUser', 'orderUser', 'orderPrice', 'payOrderUser', 'payOrderPrice');
|
||||
$result = ['data' => $result];
|
||||
return table_assign(0, '', $result);
|
||||
|
||||
}
|
||||
|
||||
public function dateVisitUserNum($date, $merId = null)
|
||||
{
|
||||
return Db::connect('shop')->table('eb_user_visit')->alias('A')->join('eb_store_product B', 'A.type_id = B.product_id')->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'A.create_time');
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('B.mer_id', $merId);
|
||||
})->where('A.type', 'product')->group('uid')->count();
|
||||
}
|
||||
|
||||
public function orderUserNum($date, $paid = null, $merId = null)
|
||||
{
|
||||
return Db::connect('shop')->table('eb_store_order')->when($paid, function ($query, $paid) {
|
||||
$query->where('paid', $paid);
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($date, function ($query, $date) use ($paid) {
|
||||
if (!$paid) {
|
||||
getModelTime($query, $date);
|
||||
// $query->where(function ($query) use ($date) {
|
||||
// $query->where(function ($query) use ($date) {
|
||||
// $query->where('paid', 1);
|
||||
// getModelTime($query, $date, 'pay_time');
|
||||
// })->whereOr(function ($query) use ($date) {
|
||||
// $query->where('paid', 0);
|
||||
// getModelTime($query, $date);
|
||||
// });
|
||||
// });
|
||||
} else
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->group('uid')->count();
|
||||
}
|
||||
|
||||
public function orderPrice($date, $paid = null, $merId = null)
|
||||
{
|
||||
return Db::connect('shop')->table('eb_store_order')->when($paid, function ($query, $paid) {
|
||||
$query->where('paid', $paid);
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($date, function ($query, $date) use ($paid) {
|
||||
if (!$paid) {
|
||||
$query->where(function ($query) use ($date) {
|
||||
$query->where(function ($query) use ($date) {
|
||||
$query->where('paid', 1);
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->whereOr(function ($query) use ($date) {
|
||||
$query->where('paid', 0);
|
||||
getModelTime($query, $date);
|
||||
});
|
||||
});
|
||||
} else
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->sum('pay_price');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
160
app/admin/controller/nk/Analysis.php
Normal file
160
app/admin/controller/nk/Analysis.php
Normal file
@ -0,0 +1,160 @@
|
||||
<?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 = $www = [];
|
||||
$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'] = $www['d.village_id'] = $find['village_id'];
|
||||
} elseif ($find['auth_range'] == 2) {
|
||||
$mmm['b.street_id'] = $www['d.street_id'] = $find['street_id'];
|
||||
} elseif ($find['auth_range'] == 3) {
|
||||
$mmm['b.area_id'] = $www['d.area_id'] = $find['area_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($post) {
|
||||
if (isset($post['area_id']) && !empty($post['area_id'])) {
|
||||
$mmm['b.area_id'] = $www['d.area_id'] = $post['area_id'];
|
||||
}
|
||||
if (isset($post['street_id']) && !empty($post['street_id'])) {
|
||||
$mmm['b.street_id'] = $www['d.street_id'] = $post['street_id'];
|
||||
}
|
||||
if (isset($post['village_id']) && !empty($post['village_id'])) {
|
||||
$mmm['b.village_id'] = $www['d.village_id'] = $post['village_id'];
|
||||
}
|
||||
// if (isset($post['brigade_id']) && !empty($post['brigade_id'])) {
|
||||
// $mmm['b.brigade_id'] = $www['d.brigade_id'] = $post['brigade_id'];
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
$map[] = ['a.status','=',1];
|
||||
$map[] = ['a.is_del','=',0];
|
||||
//企业农产品销量
|
||||
$list['num_2'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->join('eb_store_order c','a.mer_id = c.mer_id')->where($mmm)->where($map)->where('c.is_del',0)->where('c.paid',1)->count();
|
||||
|
||||
//本镇已录入的商户
|
||||
$list['num_4'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($mmm)->where($map)->count();
|
||||
|
||||
//加工企业和品牌企业数量
|
||||
$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_3'] = Db::connect('shop')->table('eb_user')->alias('a')->join('eb_nk_user b','a.uid = b.user_id')->join('eb_store_order c','a.uid = c.uid')->join('nk_lihaink_cn.fa_szxc_information_useraddress d','b.n_user_id = d.user_id')->where($www)->where('a.status',1)->where('c.is_del',0)->where('c.paid',1)->count();
|
||||
|
||||
//镇农产品需求量分析(事业单位、企业、居民)
|
||||
//农产品市场行情分析、显示
|
||||
//农产品市内需求量
|
||||
|
||||
$result = ['data' => $list];
|
||||
return table_assign(0, '', $result);
|
||||
}
|
||||
//权限组信息
|
||||
$mmm = $www = [];
|
||||
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'] = $www['d.village_id'] = $user_address['village_id'];
|
||||
} elseif ($user_address['auth_range'] == 2) {
|
||||
$mmm['b.street_id'] = $www['d.street_id'] = $user_address['street_id'];
|
||||
} elseif ($user_address['auth_range'] == 3) {
|
||||
$mmm['b.area_id'] = $www['d.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];
|
||||
//企业农产品销量
|
||||
$list['num_2'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->join('eb_store_order c','a.mer_id = c.mer_id')->where($mmm)->where($map)->where('c.is_del',0)->where('c.paid',1)->count();
|
||||
|
||||
//本镇已录入的商户
|
||||
$list['num_4'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($mmm)->where($map)->count();
|
||||
|
||||
//加工企业和品牌企业数量
|
||||
$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_3'] = Db::connect('shop')->table('eb_user')->alias('a')->join('eb_nk_user b','a.uid = b.user_id')->join('eb_store_order c','a.uid = c.uid')->join('nk_lihaink_cn.fa_szxc_information_useraddress d','b.n_user_id = d.user_id')->where($www)->where('a.status',1)->where('c.is_del',0)->where('c.paid',1)->count();
|
||||
|
||||
//镇农产品需求量分析(事业单位、企业、居民)
|
||||
//农产品市场行情分析、显示
|
||||
//农产品市内需求量
|
||||
View::assign('data', $list);
|
||||
|
||||
View::assign('arealist', $select);
|
||||
View::assign('is_admin', $is_admin);
|
||||
View::assign('url', $this->url);
|
||||
return view();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
210
app/admin/controller/nk/Farmers.php
Normal file
210
app/admin/controller/nk/Farmers.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
168
app/admin/controller/nk/Maturity.php
Normal file
168
app/admin/controller/nk/Maturity.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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 '正常';
|
||||
|
210
app/admin/controller/nk/Vegetable.php
Normal file
210
app/admin/controller/nk/Vegetable.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
376
app/admin/view/nk/analysis/index.html
Normal file
376
app/admin/view/nk/analysis/index.html
Normal file
@ -0,0 +1,376 @@
|
||||
{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;
|
||||
}
|
||||
.dashboard-num table {width: 100%;}
|
||||
.dashboard-num td {text-align: center; padding: 16px 0; width: 20%;border-left: 1px solid #f1f1f1; position: relative;}
|
||||
.dashboard-num td:nth-child(1) { border-left: none}
|
||||
.dashboard-num .num-title { padding-bottom: 10px; color: #999;}
|
||||
.dashboard-num .blue {font-size: 20px; font-weight: 300;}
|
||||
.dashboard-num td .badge {position: absolute;top: 0; right: 0;}
|
||||
.dashboard-num td .badge span { padding: 2px 4px; font-size: 12px; border-radius: 0 0 0 4px;}
|
||||
.dashboard-total td {border-top: 1px solid #f1f1f1}
|
||||
.dashboard-logs .layui-timeline-item {padding-bottom: 1px;}
|
||||
.info-td { width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
|
||||
.info-td {width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
|
||||
.layui-card-body .layui-timeline-title {
|
||||
padding-bottom: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
.layui-card-body .layui-timeline-item {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
</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>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
<div class="layui-card">
|
||||
<div id="chartView" style="width: 100%;height:300px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card">
|
||||
<div id="chartView2" style="width: 100%;height:500px;"></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 src="https://cdn.staticfile.org/echarts/5.3.0/echarts.min.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)
|
||||
|
||||
}
|
||||
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(searcharea)', function(data) {
|
||||
tool.get("/admin/nk.analysis/index", data.field, function (res) {
|
||||
let data = res.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);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
get_view_data();
|
||||
}
|
||||
var chartView = echarts.init(document.getElementById('chartView'));
|
||||
var chartView2 = echarts.init(document.getElementById('chartView2'));
|
||||
function get_view_data() {
|
||||
$.ajax({
|
||||
url: "/admin/api/tongji",
|
||||
type: 'post',
|
||||
data: {},
|
||||
success: function (e) {
|
||||
if (e.code == 0) {
|
||||
var data_first = e.data.day_time;
|
||||
var data_second = e.data.total;
|
||||
var visitUser = e.data.visitUser;
|
||||
var payOrderUser = e.data.payOrderUser;
|
||||
var orderUser = e.data.orderUser;
|
||||
var myDate = new Date();
|
||||
var nowHour = myDate.getHours(); //获取当前小时数(0-23)
|
||||
var xData = [];
|
||||
var yData1 = [];
|
||||
var yData2 = [];
|
||||
|
||||
ops = {
|
||||
title: {
|
||||
text: '订单量数据'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: data_first
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '订单量',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: data_second
|
||||
}
|
||||
]
|
||||
};
|
||||
chartView.setOption(ops);
|
||||
|
||||
option = {
|
||||
title: {
|
||||
text: '成交用户'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c}'
|
||||
},
|
||||
legend: {
|
||||
data: ['访问', '下单', '支付']
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '用户',
|
||||
type: 'funnel',
|
||||
left: '10%',
|
||||
top: 60,
|
||||
bottom: 60,
|
||||
width: '80%',
|
||||
min: 0,
|
||||
max: 100,
|
||||
minSize: '0%',
|
||||
maxSize: '100%',
|
||||
sort: 'descending',
|
||||
gap: 2,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside'
|
||||
},
|
||||
labelLine: {
|
||||
length: 10,
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
type: 'solid'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
borderColor: '#fff',
|
||||
borderWidth: 1
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
fontSize: 20
|
||||
}
|
||||
},
|
||||
data: [
|
||||
{ value: payOrderUser, name: '支付' },
|
||||
{ value: orderUser, name: '下单' },
|
||||
{ value: visitUser, name: '访问' }
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
chartView2.setOption(option);
|
||||
|
||||
setTimeout(function () {
|
||||
window.onresize = function () {
|
||||
chartView.resize();
|
||||
myChart.resize();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
124
app/admin/view/nk/farmers/add.html
Normal file
124
app/admin/view/nk/farmers/add.html
Normal 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}
|
||||
<!-- /脚本 -->
|
132
app/admin/view/nk/farmers/edit.html
Normal file
132
app/admin/view/nk/farmers/edit.html
Normal 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}
|
||||
<!-- /脚本 -->
|
156
app/admin/view/nk/farmers/index.html
Normal file
156
app/admin/view/nk/farmers/index.html
Normal 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}
|
||||
<!-- /脚本 -->
|
67
app/admin/view/nk/farmers/read.html
Normal file
67
app/admin/view/nk/farmers/read.html
Normal 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}
|
||||
<!-- /脚本 -->
|
99
app/admin/view/nk/maturity/add.html
Normal file
99
app/admin/view/nk/maturity/add.html
Normal 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}
|
||||
<!-- /脚本 -->
|
108
app/admin/view/nk/maturity/edit.html
Normal file
108
app/admin/view/nk/maturity/edit.html
Normal 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}
|
||||
<!-- /脚本 -->
|
139
app/admin/view/nk/maturity/index.html
Normal file
139
app/admin/view/nk/maturity/index.html
Normal 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}
|
||||
<!-- /脚本 -->
|
57
app/admin/view/nk/maturity/read.html
Normal file
57
app/admin/view/nk/maturity/read.html
Normal 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}
|
||||
<!-- /脚本 -->
|
@ -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',
|
||||
|
@ -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: '文章表列表',
|
||||
@ -220,7 +234,11 @@
|
||||
disabled: group_access == 2 || group_access==4 ? true : false,
|
||||
on: function (data) {
|
||||
var arr = data.arr;
|
||||
village(arr[0]['code'])
|
||||
if(arr.length > 0){
|
||||
village(arr[0]['code']);
|
||||
}else{
|
||||
village();
|
||||
}
|
||||
},
|
||||
})
|
||||
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||
|
124
app/admin/view/nk/vegetable/add.html
Normal file
124
app/admin/view/nk/vegetable/add.html
Normal 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}
|
||||
<!-- /脚本 -->
|
132
app/admin/view/nk/vegetable/edit.html
Normal file
132
app/admin/view/nk/vegetable/edit.html
Normal 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}
|
||||
<!-- /脚本 -->
|
156
app/admin/view/nk/vegetable/index.html
Normal file
156
app/admin/view/nk/vegetable/index.html
Normal 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}
|
||||
<!-- /脚本 -->
|
68
app/admin/view/nk/vegetable/read.html
Normal file
68
app/admin/view/nk/vegetable/read.html
Normal 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}
|
||||
<!-- /脚本 -->
|
1267
public/static/assets/js/addrHelper.js
Normal file
1267
public/static/assets/js/addrHelper.js
Normal file
File diff suppressed because it is too large
Load Diff
4
public/static/assets/js/jquery.min.js
vendored
Normal file
4
public/static/assets/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user