1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- function setAlign(sheet, headers) {
- const fuc = () => {
- headers.forEach(({ hAlign, vAlign }, index) => {
- sheetCommonObj.setAreaAlign(sheet.getRange(-1, index, -1, 1), hAlign, vAlign)
- });
- };
- sheetCommonObj.renderSheetFunc(sheet, fuc);
- }
- function setFormatter(sheet, headers) {
- const fuc = () => {
- headers.forEach(({ formatter }, index) => {
- if (formatter) {
- sheet.setFormatter(-1, index, formatter);
- }
- });
- };
- sheetCommonObj.renderSheetFunc(sheet, fuc);
- }
- function initSheet(dom, setting) {
- const workBook = sheetCommonObj.buildSheet(dom, setting);
- const sheet = workBook.getSheet(0);
- setAlign(sheet, setting.header);
- setFormatter(sheet, setting.header);
- return workBook;
- }
- function showData(sheet, data, headers, emptyRows) {
- const fuc = () => {
- sheet.setRowCount(data.length);
- data.forEach((item, row) => {
- headers.forEach(({ dataCode }, col) => {
- sheet.setValue(row, col, item[dataCode] || '');
- });
- });
- if (emptyRows) {
- sheet.addRows(data.length, emptyRows);
- }
- };
- sheetCommonObj.renderSheetFunc(sheet, fuc);
- }
- const TIME_OUT = 10000;
- const libID = window.location.search.match(/libID=([^&]+)/)[1];
- const UpdateType = {
- UPDATE: 'update',
- DELETE: 'delete',
- CREATE: 'create',
- };
- const DEBOUNCE_TIME = 200;
- const locked = lockUtil.getLocked();
|