liche update for admin auto cars list batch do
This commit is contained in:
@@ -83,16 +83,18 @@ class Cars extends HD_Controller{
|
||||
if($attr_ids){
|
||||
$str_ids = implode(',', $attr_ids);
|
||||
$where_attr = array("id in ({$str_ids})" => null);
|
||||
$map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title');
|
||||
$map_attr = $this->auto_attr_model->map('id', '*', $where_attr, 'id desc', 0 , 0, 'id, title, type');
|
||||
}
|
||||
|
||||
//属性按'车型-车身颜色-内饰颜色'排序
|
||||
foreach($rows as $v){
|
||||
$attr_ids = explode('_', $v['attrs']);
|
||||
$attr_title = '';
|
||||
$arr = array();
|
||||
foreach($attr_ids as $attr_id){
|
||||
$attr_title .= $map_attr[$attr_id] . '-';
|
||||
$attr = $map_attr[$attr_id];
|
||||
$arr[$attr['type']] =$attr['title'];
|
||||
}
|
||||
$attr_title = trim($attr_title, '-');
|
||||
$attr_title = "{$arr[1]}-{$arr[0]}-{$arr[2]}";
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'brand_name' => $map_brand[$v['brand_id']],
|
||||
@@ -209,6 +211,7 @@ class Cars extends HD_Controller{
|
||||
'brand_id' => $brand_id,
|
||||
's_id' => $s_id,
|
||||
'attrs' => $attr,
|
||||
'status' => 1,
|
||||
'c_time' => time()
|
||||
);
|
||||
}
|
||||
@@ -271,10 +274,21 @@ class Cars extends HD_Controller{
|
||||
|
||||
function edit_status(){
|
||||
$id = $this->input->post('id');
|
||||
$field = $this->input->post('field');
|
||||
$value = $this->input->post('value');
|
||||
$status = $this->input->post('status');
|
||||
|
||||
if('status' == $field){
|
||||
$status = $value;
|
||||
}
|
||||
|
||||
$upd = array('status' => $status);
|
||||
$where = array('id' => $id);
|
||||
|
||||
if(is_numeric($id)){
|
||||
$where = array('id' => $id);
|
||||
} else {
|
||||
$where = array("id in ({$id})" => null);
|
||||
}
|
||||
|
||||
$ret = $this->auto_cars_model->update($upd, $where);
|
||||
if(!$ret){
|
||||
|
||||
@@ -41,17 +41,23 @@
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"><span>ID</span></th>
|
||||
<th width="5%">
|
||||
<label><input type="checkbox" data-check-target=".ids"></label>
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="15%"><span>品牌</span></th>
|
||||
<th width="15%"><span>车系</span></th>
|
||||
<th width="25%"><span>车型-车身-内饰</span></th>
|
||||
<th width="25%"><span>车型-车身颜色-内饰颜色</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
<th width=""><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in lists">
|
||||
<td>{{v.id}}</td>
|
||||
<td>
|
||||
<label><input type="checkbox" name="ids[]" class="ids" :value="v.id"/></label>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<td>{{v.brand_name}}</td>
|
||||
<td>{{v.sery_name}}</td>
|
||||
<td>{{v.attr_title}}</td>
|
||||
@@ -59,10 +65,10 @@
|
||||
<td>
|
||||
<a href="javascript:void(0);" :data-modal="'auto/cars/get?id='+v.id"
|
||||
class="am-btn am-btn-primary am-btn-xs">编辑</a>
|
||||
<a data-ajax="post" data-action="/auto/cars/edit_status" class="am-btn am-btn-danger am-btn-xs"
|
||||
:data-params-id="v.id" :data-params-status="0" v-if="1==v.status">关闭</a>
|
||||
<a data-ajax="post" data-action="/auto/cars/edit_status" class="am-btn am-btn-success am-btn-xs"
|
||||
:data-params-id="v.id" :data-params-status="1" v-if="0==v.status">开启</a>
|
||||
<a :data-update="v.id" data-action="/auto/cars/edit_status" class="am-btn am-btn-danger am-btn-xs"
|
||||
data-field="status" data-value="0" v-if="1==v.status">关闭</a>
|
||||
<a :data-update="v.id" data-action="/auto/cars/edit_status" class="am-btn am-btn-success am-btn-xs"
|
||||
data-field="status" data-value="1" v-if="0==v.status">开启</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -70,6 +76,15 @@
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
<label class="fl mr5"><input type="checkbox" data-check-target=".ids">全选</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select data-update-group="" data-list-target=".ids" data-action="/auto/cars/edit_status"
|
||||
data-field="status">
|
||||
<option value="">批量操作</option>
|
||||
<option value="0">关闭</option>
|
||||
<option value="1">开启</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
|
||||
Reference in New Issue
Block a user