app/views/educode_sales/places/index.html.erb in educode_sales-0.6.1 vs app/views/educode_sales/places/index.html.erb in educode_sales-0.6.2
- old
+ new
@@ -1,5 +1,24 @@
+<div style="margin: 10px 10px 10px 10px">
+ <form class="layui-form layui-form-pane" lay-filter="search_teachers">
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label">渠道名称</label>
+ <div class="layui-input-inline">
+ <input type="text" name="name" autocomplete="off" class="layui-input">
+ </div>
+ </div>
+ <div class="layui-inline">
+ <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
+ </button>
+ <button type="submit" class="layui-btn layui-btn-primary" id="search_bt" lay-submit lay-filter="search_teachers">搜 索
+ </button>
+ </div>
+ </div>
+ </form>
+</div>
+
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="table-label">渠道列表</span>
<% if can? :create, EducodeSales::Place %>
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加渠道</button>
@@ -32,9 +51,54 @@
var $ = layui.jquery,
form = layui.form,
table = layui.table,
request = layui.request,
miniPage = layui.miniPage;
+
+
+
+ var sort = {}, search = {};
+ table.on('sort(place)', function (obj) {
+ sort.field = obj.field;
+ sort.order = obj.type;
+ table.reload('place', {
+ initSort: obj,
+ where: {
+ sort: sort,
+ q: search
+ }
+ });
+ })
+
+ // 监听搜索操作
+ form.on('submit(search_teachers)', function (data) {
+ search = data.field
+ table.reload('place', {
+ page: {
+ curr: 1
+ },
+ where: {q: search, sort: sort}
+ }, 'data');
+ return false;
+ });
+
+ form.on('submit(reset_business_search)', function (data) {
+ var field = data.field;
+ form.val('search_teachers', {
+ area: "",
+ date: "",
+ attitude: "",
+ name: "",
+ professional_title: "",
+ regist_at: "",
+ staff_id: "",
+ status: "",
+ school: "",
+ assist: "",
+ teacher_source: ""
+ });
+ return false;
+ });
table.render({
elem: '#place',
url: '/missions/places',
toolbar: '#toolbarDemo',
\ No newline at end of file