WIN-2308041133\Administrator 8 months ago
parent
commit
f68fe5a2a4
1 changed files with 67 additions and 0 deletions
  1. 67 0
      public/assets/js/backend/platform/platform.js

+ 67 - 0
public/assets/js/backend/platform/platform.js

@@ -0,0 +1,67 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'platform/platform/index',
+                    add_url: 'platform/platform/add',
+                    edit_url: 'platform/platform/edit',
+                    del_url: 'platform/platform/del',
+                    multi_url: 'platform/platform/multi',
+                    table: 'platform',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'user.id',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id'),align: 'left',align: 'left', sortable: true},
+                        {field: 'name', title: __('第三方平台名称'), align: 'left',operate: 'LIKE'},
+                        {field: 'company', title: __('所属公司'),align: 'left', operate: 'LIKE'},
+                        {field: 'url', title: __('网址'),align: 'left', operate: 'LIKE'},
+                        {field: 'createtime', title: __('添加时间'),align: 'left', formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
+                        // {field: 'type', title: __('是否使用'),align: 'left', formatter: Controller.api.formatter.type, searchList: {1: __('未使用'), 2:__('已使用')}},
+                        // {field: 'user.nickname', title: __('使用人'),align: 'left', operate: 'LIKE'},
+                        // {field: 'uid', title: __('使用人ID'),align: 'left', operate: 'LIKE'},
+                        // {field: 'stime', title: __('使用时间'),align: 'left',formatter: Table.api.formatter.datetime, operate: 'LIKE'},
+                        //
+                        {field: 'status', title: __('Status'),align: 'left',  formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
+                        {field: 'operate', title: __('Operate'),align: 'left', 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]"));
+            },
+            // formatter: {
+            //     paytype: function (value) {
+            //         return value==2 ? '<span class="label label-danger">' + __("已支付") + '</span>': '<span class="label label-default">'+ __('未支付')+ '</span>';
+            //     },
+            //     type: function (value) {
+            //         return value==2 ? '<span class="label label-danger">' + __("已使用") + '</span>': '<span class="label label-default">'+ __('未使用')+ '</span>';
+            //     }
+            // }
+        }
+    };
+    return Controller;
+});