layui.define(['index', 'api'], function (exports) { var $ = layui.$, admin = layui.admin; var obj = { addTr: function (listTableCols) { var html = ``; for (var key in listTableCols) { if (listTableCols.hasOwnProperty(key)) { var element = listTableCols[key]; if (element.toolbar) { html += `
`; } else { if (element.hide) { html += ``; } else { html += `
`; } } } } return html; }, addFormFiled: function (listTableCols) { var addField = {}; for (const key in listTableCols) { if (listTableCols.hasOwnProperty(key)) { const element = listTableCols[key]; if (!element.toolbar) { if (element.hide) { } else { var id = $(`.layui-table .add-${element.field} .${element.field}`); if (!$(id).val()) { showToolTips($(id)); return false } addField[element.field] = $(id).val(); } } } } return addField; }, editTr: function (listTableCols, data) { var html = ``; for (var key in listTableCols) { if (listTableCols.hasOwnProperty(key)) { var element = listTableCols[key]; if (element.toolbar) { html += `
`; } else { if (element.hide) { html += ` `; } else { html += `
`; } } } } return html; }, editFormFiled: function (listTableCols, data) { var editField = {}; var id = data.id; for (var key in listTableCols) { if (listTableCols.hasOwnProperty(key)) { var element = listTableCols[key]; if (!element.toolbar) { if (element.hide) { editField[element.field] = data[element.field]; } else { var id = $(`.layui-table .edit-${element.field} .${element.field}`); if (!$(id).val()) { showToolTips($(id)); return false } editField[element.field] = $(id).val(); } } } } return editField; } } exports('dynamicTr', obj); });