Files
im/plugin/admin/public/js/thali.js
T

106 lines
3.8 KiB
JavaScript
Raw Normal View History

2025-12-24 16:59:05 +08:00
define(['table', 'upload','form'], function (Table,Upload,Form) {
var thali = {
//Do setup work hereAction
index: function () {
window.statuskOption= Config.statusList;
Table.api.init({
extend: {
index_url: 'thali/select',
add_url: 'thali/insert',
edit_url: 'thali/update',
del_url: 'thali/delete',
multi_url: 'thali/multi',
//dragsort_url: 'thali/weigh',
table: 'thali',
}
});
var table = $("#table");
var tableOptions = {
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
commonSearch: false,
search: false,
columns: [
[
{checkbox: true},
{
field: 'id',
title: 'ID',
filter: "number",
sortable: true // 是否排序
},
{
title: "名称",
field: "title",
filter: "string",
},
{
title: "价格",
field: "price",
filter: "number",
formatter:function(v){
return Table.api.formatter.number(v)+'元';
}
},
{
2026-02-21 08:21:05 +08:00
title: "月折扣",
field: "month_discount",
filter: "number"
2025-12-24 16:59:05 +08:00
},
{
2026-02-21 08:21:05 +08:00
title: "季折扣",
field: "quarter_discount",
filter: "number"
2025-12-24 16:59:05 +08:00
},
{
2026-02-21 08:21:05 +08:00
title: "年折扣",
field: "year_discount",
filter: "number"
2025-12-24 16:59:05 +08:00
},
{
title: "状态",
field: "status",
sortable: true,
formatter:Table.api.formatter.status,
searchList:window.statuskOption,
operate:false,
filter: "select",
filterOption:"statuskOption"
},
{
title: "创建时间",
field: "created_at",
visible: false,
},
{
title: "更新时间",
field: "updated_at",
visible: false,
},
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
};
// 初始化表格
table.bootstrapTable(tableOptions);
// 为表格绑定事件
Table.api.bindevent(table);
},
update:function(){
this.bindevent();
},
insert:function(){
this.bindevent();
},
bindevent:function(){
Config['upload_url'] = 'files/upload';
var form = $('form');
var that = this;
Form.api.bindevent(form)
}
};
return thali
});