From 7b01bec1609710729a868093ad69484ebea82d80 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 20 十月 2020 10:16:26 +0800 Subject: [PATCH] 2020-10-20 --- src/templates/zshare/modalform/modaleditable/index.jsx | 26 +++++--------------------- 1 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/templates/zshare/modalform/modaleditable/index.jsx b/src/templates/zshare/modalform/modaleditable/index.jsx index f24e275..9b5f7d7 100644 --- a/src/templates/zshare/modalform/modaleditable/index.jsx +++ b/src/templates/zshare/modalform/modaleditable/index.jsx @@ -131,39 +131,30 @@ data = [] } - let _width = '40%' let fields = [] let dataItem = data[0] || '' - if (type === 'link') { - _width = '27%' - } else if (type === 'select') { - _width = Math.floor(80 / (linkSubFields.length + 2)) + '%' + if (type === 'select' || type === 'radio') { fields = linkSubFields.map(cell => { return { title: cell.label, dataIndex: cell.field, - width: _width, editable: true, datatype: dataItem && typeof(dataItem[cell.field]) === 'number' ? 'number' : 'string' } }) } - - let columns = [ { title: 'Value', dataIndex: 'Value', - width: _width, editable: true, datatype: dataItem && typeof(dataItem.Value) === 'number' ? 'number' : 'string' }, { title: 'Text', dataIndex: 'Text', - width: _width, editable: true, datatype: dataItem && typeof(dataItem.Text) === 'number' ? 'number' : 'string' }, @@ -171,6 +162,7 @@ { title: '鎿嶄綔', align: 'center', + width: '20%', dataIndex: 'operation', render: (text, record) => this.state.dataSource.length >= 1 ? ( @@ -193,7 +185,6 @@ columns.unshift({ title: 'ParentID', dataIndex: 'ParentID', - width: '27%', editable: true, datatype: dataItem && typeof(dataItem.ParentID) === 'number' ? 'number' : 'string' }) @@ -345,10 +336,9 @@ resetColumn = (type, linkSubFields) => { let dataSource = JSON.parse(JSON.stringify(this.state.dataSource)) - let _width = '40%' let fields = [] - if (type === 'select' && linkSubFields.length > this.state.linkSubFields) { + if ((type === 'select' || type === 'radio') && linkSubFields.length > this.state.linkSubFields) { let addcol = linkSubFields[linkSubFields.length - 1] dataSource = dataSource.map(data => { data[addcol.field] = data.Text @@ -358,15 +348,11 @@ let dataItem = dataSource ? dataSource[0] : '' - if (type === 'link') { - _width = '27%' - } else if (type === 'select') { - _width = Math.floor(80 / (linkSubFields.length + 2)) + '%' + if (type === 'select' || type === 'radio') { fields = linkSubFields.map(field => { return { title: field.label, dataIndex: field.field, - width: _width, editable: true, datatype: dataItem && typeof(dataItem[field.field]) === 'number' ? 'number' : 'string' } @@ -377,14 +363,12 @@ { title: 'Value', dataIndex: 'Value', - width: _width, editable: true, datatype: dataItem && typeof(dataItem.Value) === 'number' ? 'number' : 'string' }, { title: 'Text', dataIndex: 'Text', - width: _width, editable: true, datatype: dataItem && typeof(dataItem.Text) === 'number' ? 'number' : 'string' }, @@ -392,6 +376,7 @@ { title: '鎿嶄綔', align: 'center', + width: '20%', dataIndex: 'operation', render: (text, record) => this.state.dataSource.length >= 1 ? ( @@ -414,7 +399,6 @@ columns.unshift({ title: 'ParentID', dataIndex: 'ParentID', - width: '27%', editable: true, datatype: dataItem && typeof(dataItem.ParentID) === 'number' ? 'number' : 'string' }) -- Gitblit v1.8.0