优化业务流程代码

完善删除子号功能代码
dev
曾超新 5 years ago
parent 96238e8ecc
commit b2c0272b18
  1. 265
      frontend/controllers/CarController.php
  2. 31
      frontend/controllers/InsurerController.php
  3. 1
      frontend/controllers/PhoneCenterController.php
  4. 27
      frontend/controllers/SystemController.php
  5. 11
      frontend/views/car/info.php
  6. 4
      frontend/views/car/order-add.php
  7. 1
      frontend/views/insurer/info.php
  8. 4
      frontend/views/insurer/my-list-info.php
  9. 1
      frontend/views/insurer/my-list.php
  10. 4
      frontend/views/insurer/office-mng-edit.php
  11. 4
      frontend/views/insurer/original-mng-edit.php
  12. 25
      frontend/views/permissions/permission.php
  13. 14
      frontend/views/phone-center/sub-index.php
  14. 95
      frontend/views/system/edit.php
  15. 158
      frontend/views/system/ip.php
  16. 32
      frontend/views/user/edit.php

@ -1312,248 +1312,6 @@ class CarController extends BaseController
]);
}
// public function actionInfoRenewal()
// {
// $request = Yii::$app->request;
// $id = $request->get('id',0);
// $type = $request->get('type',0);
// $car_man = $request->get('car_man');
// $phone = $request->get('phone');
// $car_no = $request->get('car_no');
// $page = $request->get('page',1);
// $sort_key = $request->get('sort_key','appointment_t.pdate');
// $sort_value = $request->get('sort_value','ASC');
// $next_index = $request->get('next_index',0);
// $back_params = $request->get('back_params');
// $my_path = $this->my->group?$this->my->group->getPath():'';
//
// $car_info = CarT::findOne(['id'=>$id]);
// $order_info = $car_info->getOrders()->orderBy('id DESC')->one();
// if(!$order_info) {
// $user_id = 0;
// if($car_info->location == 2) {
// $b_info = CarBT::findOne(['id'=>$car_info->id]);
// $user_id = $b_info->user_id;
// }
// if($car_info->location == 3) {
// $c_info = CarCT::findOne(['id'=>$car_info->id]);
// $user_id = $c_info->user_id;
// }
// if($car_info->location == 4) {
// $d_info = CarDT::findOne(['id'=>$car_info->id]);
// $user_id = $d_info->user_id;
// }
// $order_info = new OrderT();
// $order_info->car_id = $car_info->id;
// $order_info->car_no = $car_info->car_no;
// $order_info->engine_no = $car_info->engine_no;
// $order_info->car_frame_no = $car_info->car_frame_no;
// $order_info->car_man = $car_info->car_man;
// $order_info->user_id = $user_id;
// $order_info->status_id = 1;
// $order_info->id_man = $car_info->car_man;
// $order_info->link_man = $car_info->car_man;
// $order_info->link_phone = $car_info->phone;
// $order_info->save();
// }
// $insurer_type_items = InsurerTypeT::find()->all();
// $insurer_company_items = InsurerCompanyT::find()->all();
// $insurer_company2_items = InsurerCompany2T::find()->all();
// $pay_type_items = PayTypeT::find()->all();
// $car_use_items = CarUseT::find()->all();
// $car_type_items = CarTypeT::find()->all();
// $brand_items = BrandT::find()->all();
// $series_items = SeriesT::find()
// ->where('brand_id='.intval($car_info->brand_id))
// ->all();
// $displacement_items = DisplacementT::find()
// ->where('series_id='.intval($car_info->series_id))
// ->all();
// $direction_items = DirectionT::find()
// ->all();
// $range_items = RangeT::find()
// ->all();
// $city_items = CityT::find()
// ->all();
// $district_items = DistrictT::find()
// ->orderBy('order_id ASC')
// ->all();
// $gift_items = GiftT::find()
// ->where('type_id=1')
// ->all();
// $success_items = InvalidT::getTree(1);
// $failure_items = InvalidT::getTreeXubao(2);
//
// //下一辆
// $next_id = 0;
// if($type == 1) {
// $query = AppointmentT::find()
// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
// ->where('appointment_t.is_first=1 and car_t.location=4')
// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"');
//
// $user_ids = $this->getChildrenUserIDs();
// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
//
// if($car_man != '') {
// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
// }
// if($phone != '') {
// $query = $query->andWhere('car_t.phone="'.$phone.'"');
// }
// if($car_no != '') {
// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
// }
// if($sort_key != '') {
// $query = $query->orderBy($sort_key.' '.$sort_value);
// }
// $next_item = $query->offset($next_index)->one();
// if($next_item) {
// $next_id = $next_item->car_id;
// }
// $next_index++;
// }
// if($type == 2) {
// $query = AppointmentT::find()
// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
// ->where('appointment_t.is_first=0 and car_t.location=4')
// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"');
//
// $user_ids = $this->getChildrenUserIDs();
// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
//
// if($car_man != '') {
// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
// }
// if($phone != '') {
// $query = $query->andWhere('car_t.phone="'.$phone.'"');
// }
// if($car_no != '') {
// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
// }
// if($sort_key != '') {
// $query = $query->orderBy($sort_key.' '.$sort_value);
// }
// $next_item = $query->offset($next_index)->one();
// if($next_item) {
// $next_id = $next_item->car_id;
// }
// $next_index++;
// }
// if($type == 3) {
// $query = AppointmentT::find()
// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
// ->where('appointment_t.is_first=0 and car_t.location=4');
//
// $user_ids = $this->getChildrenUserIDs();
// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
//
// if($car_man != '') {
// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
// }
// if($phone != '') {
// $query = $query->andWhere('car_t.phone="'.$phone.'"');
// }
// if($car_no != '') {
// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
// }
// if($sort_key != '') {
// $query = $query->orderBy($sort_key.' '.$sort_value);
// }
// $next_item = $query->offset($next_index)->one();
// if($next_item) {
// $next_id = $next_item->car_id;
// }
// $next_index++;
// }
// if($type == 4) {
// $query = OrderT::find()
// ->where('status_id=1 and return_status_id>0')
// ->orderBy('submit_date DESC, id DESC');
// $user_items = $this->my->getChildren();
// $user_ids[] = $this->my->id;
// if($user_items) {
// foreach($user_items as $user_item) {
// $user_ids[] = $user_item->id;
// }
// }
// $query = $query->andWhere(['in','user_id',$user_ids]);
// if($car_man != '') {
// $query = $query->andWhere('car_man="'.$car_man.'"');
// }
// if($phone != '') {
// $query = $query->andWhere('link_phone="'.$phone.'"');
// }
// if($car_no != '') {
// $query = $query->andWhere('car_no="'.$car_no.'"');
// }
// $next_item = $query->offset($next_index)->one();
// if($next_item) {
// $next_id = $next_item->car_id;
// }
// $next_index++;
// }
//
//// $gift_type_items = GiftType2T::find()->all();
// $gift_group_items = GiftGroupT::find()
// ->where('is_free=0')
// ->all();
// $gift_free_group_items = GiftGroupT::find()
// ->where('is_free=1')
// ->all();
// //获取礼品数据
// $sel_gifts = array();
// $tmp_items = OrderGiftT::find()
// ->where('order_id='.$order_info->id)
// ->all();
// foreach($tmp_items as $item) {
// $sel_gifts[$item->group_id] = $item;
// }
//
// $list = MeetT::getAllData(1);
//
// $business_group = BusinessGroupT::find()->all();
//
// return $this->render('info-renewal',[
// 'type' => $type,
// 'car_info' => $car_info,
// 'insurer_type_items' => $insurer_type_items,
// 'order_info' => $order_info,
// 'insurer_company_items' => $insurer_company_items,
// 'insurer_company2_items' => $insurer_company2_items,
// 'pay_type_items' => $pay_type_items,
// 'car_use_items' => $car_use_items,
// 'car_type_items' => $car_type_items,
// 'brand_items' => $brand_items,
// 'series_items' => $series_items,
// 'displacement_items' => $displacement_items,
// 'direction_items' => $direction_items,
// 'range_items' => $range_items,
// 'city_items' => $city_items,
// 'district_items' => $district_items,
// 'gift_items' => $gift_items,
// 'success_items' => $success_items,
// 'failure_items' => $failure_items,
// 'next_id' => $next_id,
// 'list' => $list,
// 'next_index' => $next_index,
// 'car_man' => $car_man,
// 'car_no' => $car_no,
// 'phone' => $phone,
// 'page' => $page,
// 'sort_key' => $sort_key,
// 'sort_value' => $sort_value,
// 'back_params' => $back_params,
//// 'gift_type_items' => $gift_type_items,
// 'gift_group_items' => $gift_group_items,
// 'gift_free_group_items' => $gift_free_group_items,
// 'sel_gifts' => $sel_gifts,
// 'my_path' => $my_path,
// 'business_group' => $business_group,
// 'business_group_id' => $this->my->business_group_id,
// ]);
// }
public function actionInfoRenewal()
{
$request = Yii::$app->request;
@ -2331,7 +2089,7 @@ class CarController extends BaseController
//保单信息
$order_id = $request->post('id', 0);
$email = $request->post('email');
$company2_id = $request->post('company2_id');
$company_id = $request->post('company_id');
$insurer1_begin_date = $request->post('insurer1_begin_date');
$insurer2_begin_date = $request->post('insurer2_begin_date');
$order_remark = $request->post('order_remark');
@ -2417,7 +2175,7 @@ class CarController extends BaseController
$order_info->link_man_type = $link_man_type;
$order_info->link_man_number = $link_man_number;
$order_info->company2_id = $company2_id;
$order_info->company_id = $company_id;
if($order_info->status_id != $status_id) {
if($order_info->return_status_id > 0) {
$order_info->status_id = $order_info->return_status_id;
@ -2537,6 +2295,7 @@ class CarController extends BaseController
}
//处理策略
$gift_counts = [];
OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and status=0');
//礼品
foreach($gift_ids as $gift_str) {
@ -2558,6 +2317,15 @@ class CarController extends BaseController
if (!$row->save()) {
throw new \Exception(print_r($row->getErrors(), true));
}
if(!isset($gift_counts[$zhongjigift_item->id])) {
$gift_counts[$zhongjigift_item->id] = 1;
} else {
$gift_counts[$zhongjigift_item->id] += 1;
}
if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) {
$result['msg'] = '礼品数量超限,请重新选择';
return $result;
}
}
}
//礼券
@ -2580,6 +2348,15 @@ class CarController extends BaseController
if (!$row->save()) {
throw new \Exception(print_r($row->getErrors(), true));
}
if(!isset($gift_counts[$zhongjigift_item->id])) {
$gift_counts[$zhongjigift_item->id] = 1;
} else {
$gift_counts[$zhongjigift_item->id] += 1;
}
if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) {
$result['msg'] = '礼券数量超限,请重新选择';
return $result;
}
}
}

@ -618,7 +618,7 @@ class InsurerController extends BaseController
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$row['company_name'] = $item->company2?$item->company2->name:'';
$row['company_name'] = $item->company?$item->company->name:'';
$row['factory_model'] = $item->car?$item->car->factory_model:'';
$row['user_name'] = $item->user?$item->user->getShowName():'';
$row['status_name'] = $item->status->name;
@ -742,7 +742,7 @@ class InsurerController extends BaseController
$total1_rate = $request->post('total1_rate','0.00');
$total2_rate = $request->post('total2_rate','0.00');
$pay_no = $request->post('pay_no',0);
$company_id = $request->post('company_id',0);
$company2_id = $request->post('company2_id',0);
if($total1_rate == '') {
$result['msg'] = '请输入商业跟单手续费!';
@ -752,7 +752,7 @@ class InsurerController extends BaseController
$result['msg'] = '请输入交强跟单手续费!';
return $result;
}
if($company_id == 0) {
if($company2_id == 0) {
$result['msg'] = '请选择保险公司!';
return $result;
}
@ -772,7 +772,7 @@ class InsurerController extends BaseController
$old_status_id = $order_info->status_id;
$order_info->total1_rate = $total1_rate;
$order_info->total2_rate = $total2_rate;
$order_info->company_id = $company_id;
$order_info->company2_id = $company2_id;
$order_info->pay_no = $pay_no;
$order_info->status_id = $status_id;
@ -1101,7 +1101,7 @@ class InsurerController extends BaseController
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$row['company_name'] = $item->company->name;
$row['company_name'] = $item->company2->name;
$row['user_name'] = $item->user?$item->user->getShowName():'';
$row['status_name'] = $item->status->name;
$row['pay_type'] = ($item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':'').'&nbsp;'.($item->payType?$item->payType->name:'');
@ -1340,6 +1340,7 @@ class InsurerController extends BaseController
//更新保险日期
$car_info->insurer1_date = $order_info->insurer1_end_date;
$car_info->insurer2_date = $order_info->insurer2_end_date;
$car_info->company = $order_info->company->name;
//续保次数
$car_info->xubao_num=intval($car_info->xubao_num)+1;
if(!$car_info->save()) {
@ -5022,7 +5023,7 @@ class InsurerController extends BaseController
$result['msg'] = '正本还没有生成,不能确认礼品';
return $result;
}
$gift_counts = [];
$tran = OrderT::getDb()->beginTransaction();
try {
// OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and gift_src is null');
@ -5049,6 +5050,15 @@ class InsurerController extends BaseController
throw new \Exception(print_r($row->getErrors(), true));
}
$order_gift_id = $row->id;
if(!isset($gift_counts[$zhongjigift_item->id])) {
$gift_counts[$zhongjigift_item->id] = 1;
} else {
$gift_counts[$zhongjigift_item->id] += 1;
}
if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) {
$result['msg'] = '礼品数量超限,请重新选择';
return $result;
}
}
//生成礼品图片
if($gift_item) {
@ -5077,6 +5087,15 @@ class InsurerController extends BaseController
throw new \Exception(print_r($row->getErrors(), true));
}
$order_gift_id = $row->id;
if(!isset($gift_counts[$zhongjigift_item->id])) {
$gift_counts[$zhongjigift_item->id] = 1;
} else {
$gift_counts[$zhongjigift_item->id] += 1;
}
if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) {
$result['msg'] = '礼券数量超限,请重新选择';
return $result;
}
}
//生成礼券图片
if($gift_item) {

@ -500,7 +500,6 @@ public function actionDownload(){
$result['msg'] = '删除成功';
}
$tran->commit();
} catch(\Exception $e) {
$tran->rollBack();

@ -20,6 +20,8 @@ class SystemController extends \yii\web\Controller
public $my = null;
public $web = null;
private $_STATE = 1;
public $enableCsrfValidation = false;
public $layout = 'blue-main';
public function init()
{
@ -94,8 +96,11 @@ class SystemController extends \yii\web\Controller
* @author liukangle
*
*/
public function actionIp(){
public function actionIp() {
return $this->render('ip');
}
public function actionIpJson(){
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$name = $request->get('name');
$ips = SysIpT::find();
@ -103,12 +108,16 @@ class SystemController extends \yii\web\Controller
$ips = $ips->andWhere(['like','city_name',$name]);
}
$ips = $ips->andWhere('status ='.$this->_STATE);
$data = $ips->orderBy('id ASC')->all();
return $this->render('ip',[
'info' => $data,
'name' => $name,
]);
$items = $ips->orderBy('id ASC')->all();
$data = [];
$data['total'] = count($items);
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$data['rows'][] = $row;
}
return $data;
}
/**
@ -181,7 +190,7 @@ class SystemController extends \yii\web\Controller
* @author liukangle
*
*/
public function actionDel()
public function actionDelete()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;

@ -230,6 +230,17 @@ use \common\libs\MyLib;
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
var o = {};
function orderFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="viewOrder(' + row.id + ')">');
opStr.push('<i class="fa fa-file-o" title="详情"></i>');
opStr.push('</a>');
return opStr.join(' ');
}
function viewOrder(id) {
window.open('/insurer/info?id=' + id);
}
function searchOrders() {
$('#orderTable').bootstrapTable('destroy');
$('#orderTable').bootstrapTable({

@ -95,12 +95,12 @@ use common\models\PriceT;
</td>
<th class="bg-warning">保险公司</th>
<td>
<select name="company2_id" id="company2_id" class="form-control">
<select name="company_id" id="company_id" class="form-control">
<option value="0">---请选择---</option>
<?php
foreach($insurer_company_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $order_info->company2_id)
if($item->id == $order_info->company_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}

@ -296,6 +296,7 @@ use common\models\PriceT;
o['order_id'] = '<?=$order_info->id?>';
o['limit'] = params['limit'];
o['offset'] = params['offset'];
return o;
}
});
return false;

@ -75,7 +75,7 @@ use common\models\PriceT;
<th class="bg-warning" nowrap>交强起保日期</th>
<td><?=$order_info->insurer2_begin_date?></td>
<th class="bg-warning">保险公司</th>
<td><?=$order_info->company2->name?></td>
<td><?=$order_info->company->name?></td>
<th class="bg-warning">车辆使用性质</th>
<td><?=$order_info->car->carUse->name?></td>
</tr>
@ -282,7 +282,7 @@ use common\models\PriceT;
item.gifts.forEach(function(sub_item, sub_index) {
<?php if($order_info->gift_status == 0) { ?>
html += '<div class="checkbox checkbox-inline">';
html += '<input type="checkbox" id="gift_' + item.id + '_' + sub_item.id + '" name="gift_ids[]" value="' + item.id + '-' + sub_item.id + '"';
html += '<input type="checkbox" id="gift_' + item.id + '_' + sub_item.id + '" name="quan_ids[]" value="' + item.id + '-' + sub_item.id + '"';
if(sub_item.selected == 1)
html += ' checked ';
html += '>';

@ -37,7 +37,6 @@ use \common\libs\MyLib;
<th width="50" data-field="id">ID</th>
<th data-field="car_man">车主</th>
<th data-field="submit_date">提单日期</th>
<th data-field="send_date">送单日期</th>
<th data-field="car_no">车牌</th>
<th data-field="factory_model">车型</th>
<th data-field="total_all">共计签单</th>

@ -208,12 +208,12 @@ use common\models\PriceT;
<tr>
<th class="bg-warning text-danger">内勤保险公司</th>
<td>
<select name="company_id" id="company_id" class="form-control">
<select name="company2_id" id="company2_id" class="form-control">
<option value="0">---请选择---</option>
<?php
foreach($insurer_company2_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $order_info->company_id)
if($item->id == $order_info->company2_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}

@ -75,7 +75,7 @@ use common\models\PriceT;
<th class="bg-warning" nowrap>交强起保日期</th>
<td><?=$order_info->insurer2_begin_date?></td>
<th class="bg-warning">保险公司</th>
<td><?=$order_info->company2->name?></td>
<td><?=$order_info->company->name?></td>
<th class="bg-warning">车辆使用性质</th>
<td><?=$order_info->car->carUse->name?></td>
</tr>
@ -207,7 +207,7 @@ use common\models\PriceT;
</tr>
<tr>
<th class="bg-warning">内勤保险公司</th>
<td><?=$order_info->company->name?></td>
<td><?=$order_info->company2->name?></td>
<th class="bg-warning">缴费单号</th>
<td><?=$order_info->pay_no?></td>
</tr>

@ -18,7 +18,7 @@ use \common\libs\MyLib;
<div class="row">
<div class="col-md-12">
<label class="i-checks">
<input type="checkbox" name="menu_ids[]" value="<?=$item->id?>" <?=in_array($item->id, $menu_ids)?'checked':''?>><i></i> <?=$item->name?>
<input type="checkbox" class="parent_checkbox" name="menu_ids[]" value="<?=$item->id?>" <?=in_array($item->id, $menu_ids)?'checked':''?>><i></i> <?=$item->name?>
</label>
</div>
</div>
@ -28,7 +28,7 @@ use \common\libs\MyLib;
<div class="row">
<div class="col-md-12">
<label class="i-checks">
<input type="checkbox" name="menu_ids[]" value="<?=$sub_item->id?>" <?=in_array($sub_item->id, $menu_ids)?'checked':''?>><i></i> <?=$sub_item->name?>
<input type="checkbox" class="sub_checkbox" name="menu_ids[]" value="<?=$sub_item->id?>" <?=in_array($sub_item->id, $menu_ids)?'checked':''?>><i></i> <?=$sub_item->name?>
</label>
</div>
</div>
@ -67,6 +67,27 @@ use \common\libs\MyLib;
}
},'json');
});
//处理自动选择功能
$('.parent_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().parent().parent().next().find('.sub_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');
} else {
$(subs[i]).prop('checked', '');
}
}
});
$('.sub_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().parent().parent().prev().find('.parent_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');
}
}
});
});
</script>
<?php $this->endBlock(); ?>

@ -71,10 +71,16 @@ use \common\libs\MyLib;
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/phone-center/sub-delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
$.get('/phone/ax-unbind',{id:id},function(obj){
if(obj.success){
$.post('/phone-center/sub-delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
} else {
parent.layer.msg(obj.msg);
}
},'json');
}, function(){
//
});

@ -1,48 +1,69 @@
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="theFrm">
<input type="hidden" name="id" value="<?=$info->id?>">
<tr>
<td width="100" height="25" class="td_bg">城市</td>
<td height="25" class="td_bg">
<input name="city_name" type="text" id="city_name" value="<?= $info->city_name ?>" style="width:400px;"/>
</td>
</tr>
<tr>
<td width="100" height="25" class="td_bg">IP</td>
<td height="25" class="td_bg">
<input name="ip" type="text" id="ip" value="<?= $info->ip ?>" style="width:400px;"/>
</td>
</tr>
</form>
<tr>
<td height="22" colspan="2" align="center" class="td_bg">
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/>
&nbsp;&nbsp;
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
</td>
</tr>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="row">
<div class="col-sm-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=intval($info->id)?>">
<div class="form-group">
<label class="col-sm-1 control-label">城市</label>
<div class="col-sm-6">
<input type="text" name="city_name" value="<?=$info->city_name?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">IP</label>
<div class="col-sm-6">
<input type="text" name="ip" value="<?=$info->ip?>" class="form-control">
</div>
</div>
<div>
<div class="row">
<div class="col-sm-5 col-sm-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong><?=$info ? '保 存':'添 加'?></strong>
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$("#submit-btn").click(function(){
if(confirm('是否确认提交?')) {
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/system/ip-save',params,function(obj){
alert(obj.msg);
if(obj.success) {
$('#back-btn').click();
parent.layer.msg('保存成功');
parent.refreshList();
layer_close();
} else {
parent.layer.msg(data.msg);
}
},'json');
}
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/system/ip';
}, function(){
//
});
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -1,76 +1,98 @@
<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
$(function(){
$('#add-btn').click(function(){
edit(0);
});
$("#search-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/system/ip?" + params;
});
});
//编辑
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>外网IP管理</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th width="50" data-field="id">ID</th>
<th data-field="city_name">城市</th>
<th data-field="ip">IP</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="编辑"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
opStr.push('<i class="fa fa-trash" title="删除"></i>');
opStr.push('</a>');
return opStr.join(' ');
}
function create() {
title = '新增IP';
layer_show(title, '/system/edit?id=0');
}
function edit(id) {
window.location.href = '/system/edit?id=' + id;
var title = '编辑IP';
layer_show(title, '/system/edit?id=' + id);
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/system/del',{id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
parent.layer.confirm('是否确认删除?', {
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/system/delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
}, function(){
//
});
}
</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="searchForm">
<tr>
<td class="td_bg">
名称:<input name="name" type="text" value="<?= $name ?>">
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加">
</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<?php
if($info){
?>
<tr>
<td width="10%" align="center" align="center" class="bg_tr" nowrap>序列号</td>
<td width="30%" align="center" align="center" class="bg_tr">城市</td>
<td width="20%" align="center" align="center" class="bg_tr">IP</td>
<td width="40%" align="center" class="bg_tr">操作</td>
</tr>
<?php
foreach($info as $index => $item){
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg" nowrap ><?= $index+1 ?></td>
<td align="left" class="td_bg" nowrap ><?= $item->city_name ?></td>
<td align="left" class="td_bg" nowrap ><?= $item->ip ?></td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0);" onclick="edit(<?= $item->id ?>)">修改</a>]
[<a href="javascript:void(0);" onclick="del(<?= $item->id ?>)">删除</a>]
</td>
</tr>
<?php
}
?>
<?php
}else{
?>
<tr>没有查到数据</tr>
<?php
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/system/ip-json",
pagination: false,
sidePagination: 'server',
queryParams: function(params) {
return params;
}
});
}
?>
</table>
$(function() {
search();
});
</script>
<?php $this->endBlock(); ?>

@ -171,7 +171,7 @@ use \common\libs\MyLib;
<td width="100" height="25" class="bg_tr">
<?php
echo '<label class="i-checks">';
echo '<input class="checkbox" type="checkbox" name="permissions[]" value="'.$permission->id.'"';
echo '<input class="parent_checkbox" type="checkbox" name="permissions[]" value="'.$permission->id.'"';
if($info->getPermissions()->where('id='.$permission->id)->count() > 0)
echo ' checked ';
echo '>'.$permission->name;
@ -185,7 +185,7 @@ use \common\libs\MyLib;
echo '<tr>';
echo '<td width="100">';
echo '<label class="i-checks">';
echo '<input class="checkbox" type="checkbox" name="menus[]" value="'.$parent_menu->id.'"';
echo '<input class="sub_checkbox" type="checkbox" name="menus[]" value="'.$parent_menu->id.'"';
if($info->getMenus()->where('id='.$parent_menu->id)->count() > 0)
echo ' checked ';
echo '>' . $parent_menu->name;
@ -197,7 +197,7 @@ use \common\libs\MyLib;
->all();
foreach ($child_menus as $child_menu) {
echo '<label class="i-checks">';
echo '<input class="checkbox" type="checkbox" name="menus[]" value="'.$child_menu->id.'"';
echo '<input class="sub_checkbox" type="checkbox" name="menus[]" value="'.$child_menu->id.'"';
if($info->getMenus()->where('id='.$child_menu->id)->count() > 0)
echo ' checked ';
echo '>' . $child_menu->name;
@ -236,10 +236,6 @@ use \common\libs\MyLib;
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
$(function () {
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});
$('.input-group.date').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
@ -261,6 +257,28 @@ use \common\libs\MyLib;
},'json');
}
});
//处理自动选择功能
$('.parent_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().next().find('.sub_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');
} else {
$(subs[i]).prop('checked', '');
}
}
});
$('.sub_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().parent().parent().parent().parent().prev().find('.parent_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');
}
}
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

Loading…
Cancel
Save