| | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | | let setting = {..._config.setting, ..._config.wrap, style: {}} |
| | | setting.tableId = Utils.getuuid() |
| | | |
| | | if (_config.setting.sync === 'true' && data) { |
| | | _data = data[_config.dataName] || [] |
| | |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | let _columns = [] |
| | | // let signAdd = false |
| | | _config.cols.forEach(column => { |
| | | if (column.Hide === 'true') return |
| | | if (column.type === 'index') { |
| | | column.field = '$Index' |
| | | column.type = 'text' |
| | | } |
| | | |
| | | // if (setting.addable === 'true' && column.type !== 'action' && !signAdd) { |
| | | // column.addable = true |
| | | // signAdd = true |
| | | // } |
| | | |
| | | if (column.marks && column.marks.length === 0) { |
| | | column.marks = '' |
| | | } |
| | | |
| | | column.tableId = setting.tableId |
| | | |
| | | if (column.type === 'text' && column.editable === 'true' && column.editType === 'select') { |
| | | column.options = column.options || [] |
| | | column.options = column.options.filter(cell => { |
| | | cell.value = cell.Value |
| | | cell.label = cell.Text |
| | | |
| | | return !cell.Hide |
| | | }) |
| | | } |
| | | |
| | | if (column.type === 'custom') { |
| | | column.elements = column.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | |
| | | } else if (column.type === 'action') { |
| | | column.operations = column.elements |
| | | } |
| | | |
| | | _columns.push(column) |
| | | }) |
| | | |
| | | // if (setting.delable !== 'false') { |
| | | // if (_columns[_columns.length - 1] && _columns[_columns.length - 1].type !== 'action') { |
| | | // _columns[_columns.length - 1].delable = true |
| | | // } else if (_columns[_columns.length - 2] && _columns[_columns.length - 2].type !== 'action') { |
| | | // _columns[_columns.length - 2].delable = true |
| | | // } |
| | | // } |
| | | |
| | | if (setting.color) { |
| | | setting.style.color = setting.color |
| | |
| | | setting: setting, |
| | | searchlist: _config.search, |
| | | actions: _config.action, |
| | | columns: _config.cols, |
| | | columns: _columns, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | search: Utils.initMainSearch(_config.search) // 搜索条件初始化(含有时间格式,需要转化) |
| | | }, () => { |