From 2b45840e53d250f517874bea495bffaeda172807 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 03 三月 2022 12:52:16 +0800 Subject: [PATCH] 2022-03-03 --- src/tabviews/custom/components/table/edit-table/index.jsx | 42 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index e598288..0018d0c 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -56,6 +56,7 @@ 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] || [] @@ -81,7 +82,36 @@ _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') { @@ -92,7 +122,17 @@ } 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 @@ -116,7 +156,7 @@ 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) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { -- Gitblit v1.8.0