分享按钮

fastadmin 框架的一些用法 (持续更新)

默认分类 / 10038人浏览 / 0人评论

后台 单选按钮的

{:build_radios('row[status]', ['1'=>__('开'), '2'=>__('关')])}

自定义分页数量

pageList:[10,20,50,100,'All'],

新增页面  引用js,css等

btn-dialog
buttons: [
{
name: 'addtabs',
       title: __('房型添加'),
       classname: 'btn btn-xs btn-warning  btn-dialog',
       icon: 'fa fa-plus',
       url: 'jiudian/addfangxing',
       // dropdown: '更多',//如果包含dropdown,将会以下拉列表的形式展示
       // click: function (data) {
       //     Layer.alert("点击按钮执行的事件");
       // }

   },

      #重构编辑,删除 

{

name: 'edit',

icon: 'fa fa-pencil',

title: __('Edit'),

extend: 'data-toggle="tooltip"',

classname: 'btn btn-xs btn-success btn-editone',

visible: function (row) {

return true;

},

hidden:function(row){

if(row.shop_id == 0){

return true;

}

}

},,

{

name: 'del',

icon: 'fa fa-trash',

title: __('Del'),

extend: 'data-toggle="tooltip"',

classname: 'btn btn-xs btn-danger btn-delone',

visible: function (row) {

return true;

},

hidden:function(row){

if(row.shop_id == 0){

return true;

}

}

}





],

addfangxing  页面名字

addfangxing:function(){
Controller.api.bindevent();
},

source 搜索

 data-field="typename"  data-source="huacategory/index"


不让分页 可以在后台对应js,初始化表格时加入下面

escape: false,
pagination: false,

Select 标签用法

或者

{:build_select('row[cid]', $category, $row['cid'], ['class'=>'form-control', 'required'=>''])}

添加 {:build_select('row[pid]', $typeData, 0, ['class'=>'form-control', 'required'=>''])}



Fast.api.open('general/profile/googleunbind','解绑谷歌令牌') 和 layer.open

$(document).on('click','#google-unbind-btn',function(){

layer.open({
title:'解绑谷歌令牌',
       type: 2,
       area: ['500px', '300px'],
       content: 'profile/googleunbind',
       end:function () {
window.location.reload()
}
})
//Fast.api.open('general/profile/googleunbind','解绑谷歌令牌');
})


列表时间只需要年月日

{field: 'test_date', title: __('Test_date'),formatter: Table.api.formatter.datetime, datetimeFormat: 'YYYY-MM-DD',operate: false},

操作后刷新页面

$('.btn-refresh').trigger('click');


接收数据为  [{'goods_id' => 1,'goods_num'=>1}]

* @ApiParams   (name="goods", type="array", required=true, description="服务  [{'goods_id' => 1,'goods_num'=>1}]" )

if (!is_array($data['goods'])) {
$goods = json_decode(html_entity_decode($data['goods']), 1);
}
if (empty($goods)) $this->error('当前服务不存在,无法下单!');

列表导出功能,能否只允许导出excel格式

exportTypes:['excel'],



感谢博主,喝杯咖啡~

请喝咖啡


感谢博主,喝杯咖啡~

心灵鸡汤

如果爱他,接受他的现在,别幻想他的改变。如果他能改,当然最好,不然,就想一想,你能不能接受。婚前的每一个缺点,婚后都会被放大。他抽烟,而你又爱他,就努力接受吧,婚后戒烟的男人太少了。其他缺点也是一样。