@@ -64,6 +64,7 @@ class GoodsSku extends Backend
{
$row=$this->model->find($ids);
$this->assign('row',$row);
+ $this->assign('ids',$ids);
if($this->request->isGet()){
return $this->fetch();
}else{
@@ -77,8 +78,7 @@ class GoodsSku extends Backend
if($data['fx_per']<0){
$this->error('比例不能小于0');
}
- $row['fx_per']=$data['fx_per'];
- $row->save();
+ $this->model->whereIn('id',$data['ids'])->update(['fx_per'=>$data['fx_per']]);
$this->success();
@@ -12,4 +12,5 @@
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
+ <input type="hidden" name="row[ids]" value="{$ids}">
</form>
@@ -7,7 +7,7 @@
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
-
+ <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('goods_sku/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
@@ -37,6 +37,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// 为表格绑定事件
Table.api.bindevent(table);
+
+ $('.btn-edit').click(function (){
+ let rows=table.bootstrapTable('getSelections')
+ if(rows.length){
+ let ids=[]
+ rows.forEach(item=>{
+ ids.push(item.id)
+ })
+ Fast.api.open(`${$.fn.bootstrapTable.defaults.extend.edit_url}?ids=${ids.join(',')}`,'批量编辑')
+ }
},
add: function () {
Controller.api.bindevent();