app/views/educode_sales/subjects/index.html.erb in educode_sales-1.10.49 vs app/views/educode_sales/subjects/index.html.erb in educode_sales-1.10.58

- old
+ new

@@ -8,19 +8,19 @@ <div class="layui-inline" id="ID-laydate-range"> <input type="text" class="layui-input" name="time" id="ID-laydate-demo" placeholder="yyyy-MM-dd"> </div> </div> <div class="layui-inline"> - <label class="layui-form-label" style="width: 120px">实践课程名称</label> + <label class="layui-form-label" style="width: 130px">实践课程名称</label> <div class="layui-input-inline"> <input type="text" class="layui-input" name="subjects_name"> </div> </div> <div class="layui-inline"> - <label class="layui-form-label" style="width: 120px">实践项目名称</label> + <label class="layui-form-label" style="width: 120px">商机名称</label> <div class="layui-input-inline"> - <input type="text" class="layui-input" name="shixun"> + <input type="text" class="layui-input" name="business_name"> </div> </div> <div class="layui-inline" style="margin-left: 20px"> <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置 </button> @@ -52,11 +52,11 @@ </script> <script type="text/html" id="statusBar"> {{# if(d.public === 2){ }} <span>已公开</span> - {{# } else if(d.public === 0){ }} + {{# } else if(d.status === 0){ }} <span>编辑中</span> {{# } else if(d.status === 1){ }} <span>审核中</span> {{# } else if(d.status === 2) { }} <span>已发布</span> @@ -65,10 +65,14 @@ <script type="text/html" id="link_shixuns"> <a lay-event="link_shixuns" style="color: deepskyblue">{{= d.shixun_progress }}</a> </script> +<script type="text/html" id="link_subject"> + <a target='_blank' style='color: #1E9FFF' href='<%=@url %>/paths/{{=d.identifier}}'>{{=d.s_name}}</a> +</script> + <script> layui.use(['form', 'table', 'miniPage', 'element', 'laydate', 'dropdown'], function () { var laydate = layui.laydate, form = layui.form, table = layui.table, @@ -92,11 +96,12 @@ }, { field: 's_name', title: '实践课程名称', align: 'center', - minWidth: 200 + minWidth: 200, + templet: '#link_subject' }, { field: 'shixun_progress', title: '实践项目数(已完成数)', align: 'center', @@ -113,11 +118,11 @@ { field: 'status', title: '状态', minWidth: 50, align: 'center', - templet: '#statusBar' + // templet: '#statusBar' }, { field: 'b_name', title: '商机名称', minWidth: 200, @@ -148,22 +153,26 @@ align: "center", fixed: 'right' } ] ] - + var tableDataCount = 0 table.render({ elem: '#table', where: {q: form.val()}, url: '/missions/subjects', cellMinWidth: 80, + title: '实践课程列表', toolbar: '#bussinessBar', defaultToolbar: [], cols: cols_table, limit: 10, limits: [10, 15, 20, 30, 40, 50, 60, 70, 80, 90], - page: true + page: true, + done:function (res, curr, count){ + tableDataCount = count; + } }) var sort = {}, search = {}; // 监听搜索操作 form.on('submit(search_bussiness_courses)', function (data) { search = data.field @@ -189,11 +198,11 @@ var edit = layer.open({ title: '编辑实践课程', type: 1, shade: 0.2, maxmin: true, - shadeClose: true, + shadeClose: false, area: [openWH[0] + 'px', openWH[1] + 'px'], offset: [openWH[2] + 'px', openWH[3] + 'px'], content: content }); $(window).on("resize", function () { @@ -207,22 +216,33 @@ var edit = layer.open({ title: data.s_name + ' - 实践项目列表', type: 1, shade: 0.2, maxmin: true, - shadeClose: true, + shadeClose: false, area: [openWH[0] + 'px', openWH[1] + 'px'], offset: [openWH[2] + 'px', openWH[3] + 'px'], content: content }); $(window).on("resize", function () { }); return false; } }); + // 重置 + form.on('submit(reset_business_search)', function (data) { + table.reload('table', { + page: { + curr: 1 + }, + where: {q: {}} + }, 'data'); + $(".layui-form")[0].reset(); + form.render() + return false; + }); - table.on('toolbar(table)', function (obj) { // 新增按钮监听 if (obj.event === 'add') { var content = miniPage.getHrefContent('/missions/subjects/new'); @@ -231,17 +251,35 @@ var edit = layer.open({ title: '添加实践课程', type: 1, shade: 0.2, maxmin: true, - shadeClose: true, + shadeClose: false, area: [openWH[0] + 'px', openWH[1] + 'px'], offset: [openWH[2] + 'px', openWH[3] + 'px'], content: content }); $(window).on("resize", function () { }); return false; + }else if(obj.event === 'list'){ + table.reload('table',{ + page: 1, + limit:tableDataCount, //加载所有数据 + done:function (){ + //导出所有数据 + table.exportFile("table",false,"xls"); + //恢复数据分页显示 + table.reload('table',{ + page: 1, + limit:20, + done:function (res, curr, count){ + tableDataCount = count; + } + }) + + } + }) } }); }); </script> \ No newline at end of file