1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'productticket/index' + location.search,
- add_url: 'productticket/add',
- edit_url: 'productticket/edit',
- del_url: 'productticket/del',
- multi_url: 'productticket/multi',
- import_url: 'productticket/import',
- table: 'product_ticket',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'name', title: __('Name'), operate: 'LIKE'},
- {field: 'price', title: __('Price'), operate:'BETWEEN'},
- {field: 'roadtype', title: __('Roadtype'), searchList: {"1":__('Roadtype 1'),"2":__('Roadtype 2'),"3":__('Roadtype 3')}, formatter: Table.api.formatter.normal},
- {field: 'road_id', title: __('Road_id')},
- {field: 'road.roadname', title: __('Road.roadname'), operate: 'LIKE'},
- {field: 'product_id', title: __('Product_id')},
- {field: 'is_qudao', title: __('Is_qudao'), searchList: {"0":__('Is_qudao 0'),"1":__('Is_qudao 1')}, formatter: Table.api.formatter.normal},
- {field: 'product.name', title: __('Product.name'), operate: 'LIKE'},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
- $("#c-road_id").data("params", function (obj) {
- return {
- custom: {product_id: $("#c-product_id").val()}
- };
- });
- $(document).on("change","#c-product_id",function(){
- $("#c-road_id").selectPageClear();
- })
|