后台修改

This commit is contained in:
彭桃 2023-02-14 17:31:53 +08:00
parent 0873fa3e23
commit b767bff804
37 changed files with 506 additions and 6 deletions

View File

@ -52,6 +52,13 @@ class Accommodation extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Affairs extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Agrotechnical extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Announce extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -88,11 +88,27 @@ class Article extends BaseController
return to_assign(1, $e->getError());
}
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
if($this->adminInfo['position_id'] != 1) { //不是超级管理员
$param['county']=$adds['area_id'];
$param['township']=$adds['street_id'];
$param['village']=$adds['village_id'];
$param['user_id']=$adds['user_id'];
}else{
if(empty($param['county'])){
$param['county']=$adds['area_id'];
}
if(empty($param['township'])){
$param['township']=$adds['street_id'];
}
if(empty($param['village'])){
$param['village']=$adds['village_id'];
}
if(empty($param['user_id'])){
$param['user_id']=$adds['user_id'];
}
}
$param['view_time']=date('Y-m-d H:i:s');
$param['county']=$adds['area_id'];
$param['township']=$adds['street_id'];
$param['village']=$adds['village_id'];
$param['user_id']=$adds['user_id'];
if(empty($param['category_type'])){
$param['category_type'] = 0;
}
@ -117,6 +133,23 @@ class Article extends BaseController
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
if($this->adminInfo['position_id'] == 1) { //是超级管理员
if(empty($param['county'])){
$param['county']=$adds['area_id'];
}
if(empty($param['township'])){
$param['township']=$adds['street_id'];
}
if(empty($param['village'])){
$param['village']=$adds['village_id'];
}
if(empty($param['user_id'])){
$param['user_id']=$adds['user_id'];
}
}
$res=Db::table('fa_article')->where('id',$param['id'])->strict(false)->field(true)->update($param);
if ($res){
if(!empty($param['is_vote']) && $param['is_vote']==1){
@ -132,6 +165,13 @@ class Article extends BaseController
View::assign('editor', get_system_config('other','editor'));
if (!empty($detail)) {
View::assign('detail', $detail);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
}
else{
throw new \think\exception\HttpException(404, '找不到页面');

View File

@ -52,6 +52,13 @@ class Classroom extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Education extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Eliminate extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Farming extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Feedback extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Finance extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Fishing extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Food extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Government extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Heresy extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Industry extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Mediation extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Meeting extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
View::assign('is_vote', 1);
return view('nk/article/add');
}

View File

@ -52,6 +52,13 @@ class Party extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class People extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Policy extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Profile extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Recruit extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Regulation extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -3,6 +3,7 @@
namespace app\admin\controller\nk;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
/**
@ -49,6 +50,13 @@ class RuralWelfare extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Seekers extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Skills extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -61,6 +61,13 @@ class StreetElegant extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class System extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class SzxcNotice extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Townnews extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Transaction extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Travel extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -3,6 +3,7 @@
namespace app\admin\controller\nk;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
/**
@ -49,6 +50,13 @@ class Treasure extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -52,6 +52,13 @@ class Welfare extends BaseController
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
View::assign('users', $this->users);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view('nk/article/add');
}
}

View File

@ -39,6 +39,62 @@
</div>
</td>
</tr>
{if {:session('gougu_admin')['group_access']==1}
<tr>
<td class="layui-td-gray" style="vertical-align:top;">区县</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<select name="county" lay-filter="area_id" >
{volist name='street' id='vo'}
<option value="{$vo.code}" >{$vo.name}</option>
{/volist}
</select>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">街道/镇</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<div id="demo1" ></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">村/社区</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<div id="demo2" ></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">用户<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="user_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='users' id='vo'}
<option value="{$vo.user_id}" >{$vo.name}</option>
{/volist}
</select>
</div>
</td>
</tr>
{/if}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
</tr>
@ -59,10 +115,11 @@
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}"
function gouguInit() {
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
laydate.render({
@ -83,6 +140,58 @@
}
});
street();
village();
form.on('select(area_id)', function (data) {
street(data.value)
});
function street (id) {
var demo1 = xmSelect.render({
name: 'township',
el: '#demo1',
initValue: [],
prop: {
name: 'name',
value: 'code',
},
data: [],
radio: true,
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
})
});
}
function village (id) {
var demo2 = xmSelect.render({
name: 'village',
el: '#demo2',
initValue: [],
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
disabled: group_access == 2 ? true : false,
})
$.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({
data: result.data
})
});
}
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",

View File

@ -51,6 +51,59 @@
</div>
</td>
</tr>
{if {:session('gougu_admin')['group_access']==1}
<tr>
<td class="layui-td-gray" style="vertical-align:top;">区县</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<select name="county" lay-filter="area_id">
{volist name='street' id='vo'}
<option value="{$vo.code}" {if $detail.county==$vo.code} selected {/if}>{$vo.name}</option>
{/volist}
</select>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">街道/镇</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<div id="demo1" ></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">村/社区</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<div id="demo2" ></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">用户<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="user_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='users' id='vo'}
<option value="{$vo.user_id}" {if $detail.user_id==$vo.user_id} selected {/if}>{$vo.name}</option>
{/volist}
</select>
</div>
</td>
</tr>
{/if}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
</tr>
@ -72,6 +125,7 @@
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/xm-select.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit;
@ -80,7 +134,9 @@
} else {
moduleInit = ['tool', 'tagpicker', 'editormd'];
}
var group_access = "{:session('gougu_admin')['group_access']}";
var area_id = "{$detail.county}";
var street_id = "{$detail.township}";
function gouguInit() {
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
laydate.render({
@ -101,6 +157,61 @@
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
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: 'township',
el: '#demo1',
initValue: ["{$detail.township}"],
prop: {
name: 'name',
value: 'code',
},
data: [],
radio: true,
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
})
});
}
function village (id) {
var demo2 = xmSelect.render({
name: 'village',
el: '#demo2',
initValue: ["{$detail.village}"],
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
disabled: group_access == 2 ? true : false,
})
$.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({
data: result.data
})
});
}
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",