diff --git a/application/admin/controller/Warehouse.php b/application/admin/controller/Warehouse.php new file mode 100644 index 0000000..3c3d2a8 --- /dev/null +++ b/application/admin/controller/Warehouse.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\Warehouse; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/lang/zh-cn/warehouse.php b/application/admin/lang/zh-cn/warehouse.php new file mode 100644 index 0000000..ea1fc59 --- /dev/null +++ b/application/admin/lang/zh-cn/warehouse.php @@ -0,0 +1,11 @@ + '地址名称', + 'Linkname' => '联系人', + 'Linkphone' => '联系电话', + 'Address' => '地址', + 'Deletetime' => '删除时间', + 'Createtime' => '创建时间', + 'Updatetime' => '更新时间' +]; diff --git a/application/admin/model/Warehouse.php b/application/admin/model/Warehouse.php new file mode 100644 index 0000000..c492b64 --- /dev/null +++ b/application/admin/model/Warehouse.php @@ -0,0 +1,40 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/warehouse/add.html b/application/admin/view/warehouse/add.html new file mode 100644 index 0000000..9f0a742 --- /dev/null +++ b/application/admin/view/warehouse/add.html @@ -0,0 +1,33 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/warehouse/edit.html b/application/admin/view/warehouse/edit.html new file mode 100644 index 0000000..276dc0f --- /dev/null +++ b/application/admin/view/warehouse/edit.html @@ -0,0 +1,33 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/warehouse/index.html b/application/admin/view/warehouse/index.html new file mode 100644 index 0000000..aeab4da --- /dev/null +++ b/application/admin/view/warehouse/index.html @@ -0,0 +1,29 @@ +
+ {:build_heading()} + +
+ +
+
diff --git a/application/admin/view/warehouse/recyclebin.html b/application/admin/view/warehouse/recyclebin.html new file mode 100644 index 0000000..c38cfc4 --- /dev/null +++ b/application/admin/view/warehouse/recyclebin.html @@ -0,0 +1,25 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/public/assets/js/backend/warehouse.js b/public/assets/js/backend/warehouse.js new file mode 100644 index 0000000..7b9d147 --- /dev/null +++ b/public/assets/js/backend/warehouse.js @@ -0,0 +1,116 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'warehouse/index' + location.search, + add_url: 'warehouse/add', + edit_url: 'warehouse/edit', + del_url: 'warehouse/del', + multi_url: 'warehouse/multi', + import_url: 'warehouse/import', + table: 'warehouse', + } + }); + + 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: 'linkname', title: __('Linkname'), operate: 'LIKE'}, + {field: 'linkphone', title: __('Linkphone'), operate: 'LIKE'}, + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + recyclebin: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + 'dragsort_url': '' + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: 'warehouse/recyclebin' + location.search, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), align: 'left'}, + { + field: 'deletetime', + title: __('Deletetime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'operate', + width: '140px', + title: __('Operate'), + table: table, + events: Table.api.events.operate, + buttons: [ + { + name: 'Restore', + text: __('Restore'), + classname: 'btn btn-xs btn-info btn-ajax btn-restoreit', + icon: 'fa fa-rotate-left', + url: 'warehouse/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'warehouse/destroy', + refresh: true + } + ], + 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; +});