var SbUseHistoryInfoTableEditRowObj = null
table.render({ elem: '#SbUseHistoryInfoTable', data: [], method: 'post', contentType: 'application/json;charset=UTF-8', cols: [ [ { checkbox: true, halign: 'center', align: 'center', width: 50 }, { title: '序号', type: 'numbers', align: 'center', halign: 'center', width: 50 }, { title: '项目', field: 'xm', align: 'center', halign: 'center', edit: 'text' }, { title: '时间', field: 'sj', align: 'center', halign: 'center', edit: 'text', event: 'inputDate', data_filed: 'date' }, { title: '状态', field: 'zt', align: 'center', halign: 'center', event: 'ztDropDown', templet: function (d) { var html = '' if (d.zt == '1') { html = "<option value='0'>使用中</option> <option value='1' selected='selected'>以归还</option>" } else { html = "<option value='0' selected='selected'>使用中</option> <option value='1'>以归还</option>" } return '<select lay-filter="zt" name="zt" >' + html + '</select>' } } ] ], limit: 10, even: true, where: {}, done: function (res, curr, count) { form.render('select') $('.layui-table-body, .layui-table-box, .layui-table-cell').css( 'overflow', 'visible' ) } })
form.on('select(zt)', function (data) { var oldData = table.cache['SbUseHistoryInfoTable'] SbUseHistoryInfoTableEditRowObj.update({ zt: data.value })
table.reload('SbUseHistoryInfoTable', { url: '', data: oldData, done: function () { $('.layui-table-body, .layui-table-box, .layui-table-cell').css( 'overflow', 'visible' ) } }) })
table.on('tool(SbUseHistoryInfoTable)', function (obj) { var newdata = {} if (obj.event === 'inputDate') { var field = $(this).data('field') laydate.render({ elem: this.firstChild, show: true, range: true, closeStop: this, type: 'datetime', format: 'yyyy-MM-dd HH:mm:ss', done: function (value, date) { newdata[field] = value obj.update(newdata) } }) } if (obj.event === 'ztDropDown') { SbUseHistoryInfoTableEditRowObj = obj } })
|