| | |
| | | <link rel="stylesheet" href="./css/xadmin.css"> |
| | | <script src="./lib/layui/layui.js" charset="utf-8"></script> |
| | | <link rel="stylesheet" href="./css/theme3049.min.css"> |
| | | <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="./js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="./js/xadmin.js"></script> |
| | | <script src="js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="./js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | |
| | | </div> |
| | | </#list> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <button id="search" class="layui-btn" lay-submit="" lay-filter="sreach"> |
| | | <button id="search" class="layui-btn" lay-submit="" lay-filter="search"> |
| | | <i class="layui-icon"></i></button> |
| | | </div> |
| | | </form> |
| | |
| | | </body> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <#if addPagePath??> |
| | | <button class="layui-btn" onclick="xadmin.open('添加${title}','${addPagePath}',500,580)"><i |
| | | class="layui-icon"></i>添加 |
| | | </button> |
| | | |
| | | </#if> |
| | | <#if deleteApi??> |
| | | <button class="layui-btn layui-btn-danger" lay-event="delete"> |
| | | <i class="layui-icon"></i> |
| | | 删除 |
| | | </button> |
| | | </#if> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="deleteContainer"> |
| | | <script type="text/html" id="optContainer"> |
| | | <div class="layui-btn-container"> |
| | | <!-- <a title='恢复' onclick='member_resume(this,{{d.LAY_INDEX }}, {{d.id}})' href='javascript:;'> --> |
| | | <!--<i class="layui-icon"></i>--> |
| | | <!--</a>--> |
| | | |
| | | <#if updatePagePath??> |
| | | <a title="修改" onclick="xadmin.open('修改${title}','${updatePagePath}?id={{d.id}}',500,580)" href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | </#if> |
| | | <#if deleteApi??> |
| | | <a title="删除" onclick="member_del(this,{{d.LAY_INDEX }},'{{d.id}}')" href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | </#if> |
| | | </div> |
| | | </script> |
| | | |
| | |
| | | 10003 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="imgshow"> |
| | | <!-- 这里的checked的状态只是演示 --> |
| | | <img src="{{d.}}"/> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.id== |
| | | 10003 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | <#if deleteApi??> |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.delete(obj, index, id); |
| | | }); |
| | | } |
| | | </#if> |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | var tableIns = null; |
| | | $(function () { |
| | | |
| | | |
| | | //渲染表格 |
| | | function rederTable() { |
| | | tableIns = table.render({ |
| | | elem: '#table_list', |
| | | url: url, |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 120, sort: true, title: "ID"}, |
| | | {fixed: 'right', width: 80, title: "操作", toolbar: '#deleteContainer'}], |
| | | page: true, |
| | | parseData: |
| | | function (res) { //res 即为原始返回的数据 |
| | | if (res.code != 0) |
| | | return; |
| | | if (res.data.list == null) |
| | | return; |
| | | console.log(res.data.list) |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.count, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | var app = new Vue({ |
| | | el: "#app", |
| | |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#table_list', |
| | | url: ${listApi}, |
| | | url: "${listApi}", |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 120, sort: true, title: "ID"}, |
| | | {fixed: 'right', width: 80, title: "操作", toolbar: '#deleteContainer'}], |
| | | cols: [[{type: 'checkbox', title: "ID"}, |
| | | <#list showFileds as field > |
| | | <#if field.showType=='TEXT'> |
| | | {field: '${field.identifier}', width: 120, sort: false, title: "${field.title}"}, |
| | | <#elseif field.showType=='SWITCH'> |
| | | {field: '${field.identifier}', width: 120, sort: false, title: "${field.title}",templet:function(res){ |
| | | if(res.${field.identifier}){ |
| | | return " <input type=\"checkbox\" checked='true' disabled lay-skin=\"switch\""; |
| | | }else{ |
| | | return " <input type=\"checkbox\" disabled lay-skin=\"switch\""; |
| | | } |
| | | } |
| | | }, |
| | | <#elseif field.showType=='IMG'> |
| | | {field: '${field.identifier}', width: 120, sort: false, title: "${field.title}",templet:function(res){ |
| | | return "<img src='"+res.${field.identifier}+"' style='height:50px;'>"; |
| | | } |
| | | }, |
| | | <#else> |
| | | {field: '${field.identifier}', template:"<img src='{{d.${field.identifier}}}'>", width: 120, sort: false, title: "${field.title}"}, |
| | | </#if> |
| | | </#list> |
| | | {fixed: 'right', width: 80, title: "操作", toolbar: '#optContainer'}]], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | if (res.code != 0) |
| | |
| | | "count": res.data.count, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | }, |
| | | error: function (e, msg) { |
| | | ksapp.tableError(e) |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | tableIns.on('toolbar(app)', |
| | | table.on('toolbar(app)', |
| | | function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch (obj.event) { |
| | |
| | | }); |
| | | |
| | | break; |
| | | } |
| | | ; |
| | | }; |
| | | }); |
| | | //请求搜索表单中需要的数据 |
| | | <#if preRequestList??&&(preRequestList?size>0)> |
| | |
| | | }); |
| | | }, |
| | | } |
| | | } |
| | | }) |
| | | ; |
| | | } |
| | | ) |
| | | ; |
| | | }); |
| | | app.init(); |
| | | }); |
| | | |
| | | </script> |
| | | |