汪总电商平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
4.2 KiB

"use strict";define(["jquery","bootstrap","backend","table","form"],function(e,t,a,r,i){var o={index:function(){r.api.init({extend:{index_url:"wanlshop/advert/index"+location.search,add_url:"wanlshop/advert/add",edit_url:"wanlshop/advert/edit",del_url:"wanlshop/advert/del",multi_url:"wanlshop/advert/multi",table:"wanlshop_advert"}});var t=e("#table");t.bootstrapTable({url:e.fn.bootstrapTable.defaults.extend.index_url,pk:"id",sortName:"weigh",columns:[[{checkbox:!0},{field:"id",title:__("Id")},{field:"module",title:__("Module"),searchList:{gys:__("Module gys")},formatter:r.api.formatter.normal},{field:"type",title:__("Type"),searchList:{video:__("Type video")},formatter:r.api.formatter.normal},{field:"user_name",title:'供应商'},{field:"views",title:__("已看次数")},{field:"status",title:__("Status"),searchList:{normal:__("Normal"),hidden:__("Hidden")},formatter:r.api.formatter.status},{field:"operate",title:__("Operate"),table:t,events:r.api.events.operate,formatter:r.api.formatter.operate}]]}),r.api.bindevent(t)},recyclebin:function(){r.api.init({extend:{dragsort_url:""}});var t=e("#table");t.bootstrapTable({url:"wanlshop/advert/recyclebin"+location.search,pk:"id",sortName:"id",columns:[[{checkbox:!0},{field:"id",title:__("Id")},{field:"deletetime",title:__("Deletetime"),operate:"RANGE",addclass:"datetimerange",formatter:r.api.formatter.datetime},{field:"operate",width:"130px",title:__("Operate"),table:t,events:r.api.events.operate,buttons:[{name:"Restore",text:__("Restore"),classname:"btn btn-xs btn-info btn-ajax btn-restoreit",icon:"fa fa-rotate-left",url:"wanlshop/advert/restore",refresh:!0},{name:"Destroy",text:__("Destroy"),classname:"btn btn-xs btn-danger btn-ajax btn-destroyit",icon:"fa fa-times",url:"wanlshop/advert/destroy",refresh:!0}],formatter:r.api.formatter.operate}]]}),r.api.bindevent(t)},select:function(){r.api.init({extend:{index_url:"wanlshop/advert/select"}});var t=[],i=e("#table");i.on("check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table",function(a,r){"check"==a.type||"uncheck"==a.type?r=[r]:t=[],e.each(r,function(e,r){if(a.type.indexOf("uncheck")>-1){var i=t.indexOf(r.id);i>-1&&t.splice(i,1)}else-1==t.indexOf(r.id)&&t.push(r.id)})}),i.bootstrapTable({url:e.fn.bootstrapTable.defaults.extend.index_url,sortName:"id",showToggle:!1,showExport:!1,columns:[[{field:"state",checkbox:!0},{field:"id",title:__("Id")},{field:"module",title:__("Module"),searchList:{open:__("Module open"),page:__("Module page"),category:__("Module category"),first:__("Module first"),other:__("Module other")},formatter:r.api.formatter.normal},{field:"type",title:__("Type"),searchList:{banner:__("Type banner"),image:__("Type image"),video:__("Type video")},formatter:r.api.formatter.normal},{field:"media",title:__("Media"),events:r.api.events.image,formatter:o.api.formatter.advertImg},{field:"startdate",title:__("Startdate"),operate:"RANGE",addclass:"datetimerange"},{field:"enddate",title:__("Enddate"),operate:"RANGE",addclass:"datetimerange"},{field:"operate",title:__("Operate"),events:{"click .btn-chooseone":function(e,t,r,i){var o=a.api.query("multiple");o="true"==o,Fast.api.close({id:r.id,multiple:o})}},formatter:function(){return'<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> '+__("Choose")+"</a>"}}]]}),e(document).on("click",".btn-choose-multi",function(){var e=a.api.query("multiple");e="true"==e,Fast.api.close({id:t.join(","),multiple:e})}),r.api.bindevent(i)},add:function(){e("#c-module").change(function(){"category"==e(this).val()?e("#category").show():e("#category").hide()}),o.api.bindevent()},edit:function(){"category"==e("#c-module").val()&&e("#category").show(),e("#c-module").change(function(){"category"==e(this).val()?e("#category").show():e("#category").hide()}),o.api.bindevent()},api:{bindevent:function(){i.api.bindevent(e("form[role=form]"))},formatter:{categorySearch:function(e,t,a){if(null==e)var r="系统";else var r='<a href="javascript:;" class="searchit" data-toggle="tooltip" title="" data-field="category.name" data-value="'+e+'" data-original-title="点击搜索'+e+'">'+e+"</a>";return r},advertImg:function(e,t,a){var a=e.lastIndexOf(".");return"mp4"==e.substr(a+1)?"-":'<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(e)+'"></a>'}}}};return o});