如何使用微信公众号做网站,怎么建设电影网站,做婚介网站可行性报告模板,湖南省建筑信息网效果#xff1a; 思路#xff1a;
1、最外层的表格先渲染#xff0c;在done回调中向每个tr后面插入一个用来嵌套子级表格的tr。
tr的class和table的id需要用索引 i 关联 //向每一行tr后面追加显示子table的trlet trEles $(.layui-table-view[lay-idlist] tbody tr 思路
1、最外层的表格先渲染在done回调中向每个tr后面插入一个用来嵌套子级表格的tr。
tr的class和table的id需要用索引 i 关联 //向每一行tr后面追加显示子table的trlet trEles $(.layui-table-view[lay-idlist] tbody tr);for (let i 0; i trEles.length; i) {let childTr tr classchildTR${i1}td/tdtd colspan16 div classchild-table-itemtable idchildTable${i 1}/table/div/td/tr;$(trEles[i]).after(childTr);}
2、插入完成后再渲染所有的子级表格
//渲染表格for (let i 0; i trEles.length; i) {table.render({elem: #childTable${i 1}, height: 300, url: /hkj/Acount/GetSalaryList //数据接口, method: POST, where: {lsh: tabData[i].lsh,ListMark: jqgrid}, even: true, page: true //开启分页, cols: [[ //表头{ field: NAME, title: 姓名}, { field: DeptName, title: 部门 }, { field: BS, title: 基本工资 }, { field: PS, title: 岗位工资 }, { field: PB, title: 绩效工资 }, { field: SS, title: 工龄工资 }, { field: PA, title: 通讯补贴 }, { field: TA, title: 交通补贴 }, { field: MA, title: 餐费补贴 }, { field: OA, title: 其他补贴 }, { field: THP, title: 实发工资 }]], request: {pageName: pageIndex //页码的参数名称默认page, limitName: pageSize //每页数据量的参数名默认limit}, parseData: function (res) { //res 即为原始返回的数据return {code: 0, //解析接口状态msg: 加载成功, //解析提示文本count: res.records || 0, //解析数据长度data: res.rows //解析数据列表};}})} 3、最后监听箭头显示和隐藏对应的表格 //点击箭头隐藏或显示$(.showOrHide).click(function () {let classStr $(this).attr(class);let index $(this).data(index);if (classStr.indexOf(layui-icon-triangle-r) -1) {//显示$(this).removeClass(layui-icon-triangle-r);$(this).addClass(layui-icon-triangle-d);$(.childTR${index}).show();} else {//隐藏$(this).removeClass(layui-icon-triangle-d);$(this).addClass(layui-icon-triangle-r);$(.childTR${index}).hide();}})
完整代码
layui.use(table, function () {let table layui.table;//第一个实例mainTable table.render({elem: #list, height: full-100, url: /hkj/Acount/GetData //数据接口, method: POST, where: {month: searchMonth,jybz: jybz,dataName: gz,ListMark: jqgrid},even:true, page: true //开启分页, cols: [[ //表头{field: id, title: , width: 30, templet: function (d) {return i classlayui-icon layui-icon-triangle-d main-color main-cursor showOrHide data-index${d.LAY_INDEX}/i;}}, { field: yfs1, title: 管理费用,minWidth:70 }, { field: yfs2, title: 销售费用, minWidth: 70 }, { field: yfs3, title: 研发费用, minWidth: 70 }, { field: yfs4, title: 生产车间费, minWidth:90 }, { field: yfs6, title: 生产管理费, minWidth: 90 }, { field: sb, title: 代扣社保, minWidth: 70 }, { field: gjj, title: 代扣公积金, minWidth: 90 }, { field: gs, title: 代扣个税, minWidth: 70 }, { field: qt, title: 其他代扣, minWidth: 70 }, { field: sfgz, title: 实发银行, minWidth: 70 }, { field: sfgz_xj, title: 实发现金, minWidth: 70 }, { field: yfs5, title: 办公室, minWidth: 70 }, { field: credenceNum, title: 凭证号, minWidth: 60 }, {field: bzxx, title: 备注, minWidth: 50, templet: function (d) {return span stylecolor:red;${d.bzxx}/span;}}, {field: url, title: excel, minWidth: 50, templet: function (d) {return a target_blank href${d.url} classmain-color main-hover查看/a;}}, {field: lsh, title: 操作, minWidth: 210, templet: function (rowObiect) {let str ;let b ;if (!rowObiect.credenceNum) {if (rowObiect.bzxx.indexOf([) ! -1) {let a rowObiect.bzxx.split([)[1];b a.split(])[0];}str a classlayui-btn layui-btn-xs del_public addKM data-subjkey b data-name data-id rowObiect.ID 添加为科目/a;str a classlayui-btn layui-btn-xs del_public pzPreview data-id rowObiect.ID 生成凭证/a;} else {str a classlayui-btn layui-btn-xs del_public lookPZ data-id rowObiect.credenceNum 查看凭证/a;}str a stylecolor:#fff classlayui-btn layui-btn-danger layui-btn-xs del_public delete-btn data-id rowObiect.lsh 删除/areturn str}}]], request: {pageName: pageIndex //页码的参数名称默认page, limitName: pageSize //每页数据量的参数名默认limit}, parseData: function (res) { //res 即为原始返回的数据return {code: res.Status ? 0 : -1, //解析接口状态msg: res.Message, //解析提示文本count: res.Data.records || 0, //解析数据长度data: res.Data.rows //解析数据列表};}, done: function (res, curr, count) {let tabData res.data || [];//向每一行tr后面追加显示子table的trlet trEles $(.layui-table-view[lay-idlist] tbody tr);for (let i 0; i trEles.length; i) {let childTr tr classchildTR${i1}td/tdtd colspan16 div classchild-table-itemtable idchildTable${i 1}/table/div/td/tr;$(trEles[i]).after(childTr);}//渲染表格for (let i 0; i trEles.length; i) {table.render({elem: #childTable${i 1}, height: 300, url: /hkj/Acount/GetSalaryList //数据接口, method: POST, where: {lsh: tabData[i].lsh,ListMark: jqgrid}, even: true, page: true //开启分页, cols: [[ //表头{ field: NAME, title: 姓名}, { field: DeptName, title: 部门 }, { field: BS, title: 基本工资 }, { field: PS, title: 岗位工资 }, { field: PB, title: 绩效工资 }, { field: SS, title: 工龄工资 }, { field: PA, title: 通讯补贴 }, { field: TA, title: 交通补贴 }, { field: MA, title: 餐费补贴 }, { field: OA, title: 其他补贴 }, { field: THP, title: 实发工资 }]], request: {pageName: pageIndex //页码的参数名称默认page, limitName: pageSize //每页数据量的参数名默认limit}, parseData: function (res) { //res 即为原始返回的数据return {code: 0, //解析接口状态msg: 加载成功, //解析提示文本count: res.records || 0, //解析数据长度data: res.rows //解析数据列表};}})}//点击箭头隐藏或显示$(.showOrHide).click(function () {let classStr $(this).attr(class);let index $(this).data(index);if (classStr.indexOf(layui-icon-triangle-r) -1) {//显示$(this).removeClass(layui-icon-triangle-r);$(this).addClass(layui-icon-triangle-d);$(.childTR${index}).show();} else {//隐藏$(this).removeClass(layui-icon-triangle-d);$(this).addClass(layui-icon-triangle-r);$(.childTR${index}).hide();}})}});});
文章转载自: http://www.morning.tjpmf.cn.gov.cn.tjpmf.cn http://www.morning.qpzjh.cn.gov.cn.qpzjh.cn http://www.morning.nkjkh.cn.gov.cn.nkjkh.cn http://www.morning.jhtrb.cn.gov.cn.jhtrb.cn http://www.morning.qywfw.cn.gov.cn.qywfw.cn http://www.morning.xnyfn.cn.gov.cn.xnyfn.cn http://www.morning.seoqun.com.gov.cn.seoqun.com http://www.morning.rbbyd.cn.gov.cn.rbbyd.cn http://www.morning.clpdm.cn.gov.cn.clpdm.cn http://www.morning.llmhq.cn.gov.cn.llmhq.cn http://www.morning.plcyq.cn.gov.cn.plcyq.cn http://www.morning.gwtbn.cn.gov.cn.gwtbn.cn http://www.morning.hffjj.cn.gov.cn.hffjj.cn http://www.morning.srrrz.cn.gov.cn.srrrz.cn http://www.morning.drgmr.cn.gov.cn.drgmr.cn http://www.morning.tygn.cn.gov.cn.tygn.cn http://www.morning.qjldz.cn.gov.cn.qjldz.cn http://www.morning.npfkw.cn.gov.cn.npfkw.cn http://www.morning.wtcd.cn.gov.cn.wtcd.cn http://www.morning.hbxnb.cn.gov.cn.hbxnb.cn http://www.morning.brwwr.cn.gov.cn.brwwr.cn http://www.morning.wnzgm.cn.gov.cn.wnzgm.cn http://www.morning.mrfr.cn.gov.cn.mrfr.cn http://www.morning.dbnpz.cn.gov.cn.dbnpz.cn http://www.morning.tnyanzou.com.gov.cn.tnyanzou.com http://www.morning.qbmjf.cn.gov.cn.qbmjf.cn http://www.morning.yltnl.cn.gov.cn.yltnl.cn http://www.morning.nmhpq.cn.gov.cn.nmhpq.cn http://www.morning.sh-wj.com.cn.gov.cn.sh-wj.com.cn http://www.morning.ljyqn.cn.gov.cn.ljyqn.cn http://www.morning.qdzqf.cn.gov.cn.qdzqf.cn http://www.morning.rswfj.cn.gov.cn.rswfj.cn http://www.morning.jrrqs.cn.gov.cn.jrrqs.cn http://www.morning.kpcxj.cn.gov.cn.kpcxj.cn http://www.morning.rhsr.cn.gov.cn.rhsr.cn http://www.morning.lfttb.cn.gov.cn.lfttb.cn http://www.morning.ymfzd.cn.gov.cn.ymfzd.cn http://www.morning.mtbsd.cn.gov.cn.mtbsd.cn http://www.morning.xphls.cn.gov.cn.xphls.cn http://www.morning.plkrl.cn.gov.cn.plkrl.cn http://www.morning.bzcjx.cn.gov.cn.bzcjx.cn http://www.morning.mmplj.cn.gov.cn.mmplj.cn http://www.morning.zwgrf.cn.gov.cn.zwgrf.cn http://www.morning.nclbk.cn.gov.cn.nclbk.cn http://www.morning.wwznd.cn.gov.cn.wwznd.cn http://www.morning.yrmgh.cn.gov.cn.yrmgh.cn http://www.morning.xkzr.cn.gov.cn.xkzr.cn http://www.morning.xqcst.cn.gov.cn.xqcst.cn http://www.morning.hsksm.cn.gov.cn.hsksm.cn http://www.morning.dqgbx.cn.gov.cn.dqgbx.cn http://www.morning.tmtrl.cn.gov.cn.tmtrl.cn http://www.morning.shawls.com.cn.gov.cn.shawls.com.cn http://www.morning.mwhqd.cn.gov.cn.mwhqd.cn http://www.morning.jfbbq.cn.gov.cn.jfbbq.cn http://www.morning.ktblf.cn.gov.cn.ktblf.cn http://www.morning.sgbk.cn.gov.cn.sgbk.cn http://www.morning.fmdvbsa.cn.gov.cn.fmdvbsa.cn http://www.morning.dxqwm.cn.gov.cn.dxqwm.cn http://www.morning.hrypl.cn.gov.cn.hrypl.cn http://www.morning.ptzbg.cn.gov.cn.ptzbg.cn http://www.morning.dfmjm.cn.gov.cn.dfmjm.cn http://www.morning.lbpqk.cn.gov.cn.lbpqk.cn http://www.morning.mjkqj.cn.gov.cn.mjkqj.cn http://www.morning.wnkqt.cn.gov.cn.wnkqt.cn http://www.morning.rqsr.cn.gov.cn.rqsr.cn http://www.morning.prls.cn.gov.cn.prls.cn http://www.morning.jtsdk.cn.gov.cn.jtsdk.cn http://www.morning.ltkzb.cn.gov.cn.ltkzb.cn http://www.morning.qwgct.cn.gov.cn.qwgct.cn http://www.morning.zjrnq.cn.gov.cn.zjrnq.cn http://www.morning.gwtbn.cn.gov.cn.gwtbn.cn http://www.morning.c7624.cn.gov.cn.c7624.cn http://www.morning.ksggl.cn.gov.cn.ksggl.cn http://www.morning.nbqwt.cn.gov.cn.nbqwt.cn http://www.morning.njftk.cn.gov.cn.njftk.cn http://www.morning.bxfy.cn.gov.cn.bxfy.cn http://www.morning.kljhr.cn.gov.cn.kljhr.cn http://www.morning.rbkml.cn.gov.cn.rbkml.cn http://www.morning.mswkd.cn.gov.cn.mswkd.cn http://www.morning.qyhcm.cn.gov.cn.qyhcm.cn