From 6d0137932fcc8f9848123743c1aad5cff8172d8a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 09 二月 2020 13:09:39 +0800 Subject: [PATCH] 2020-02-09 --- src/tabviews/tableshare/actionList/index.jsx | 60 ++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index a6f359b..5718b52 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -20,6 +20,7 @@ logcolumns: PropTypes.array, // 鏃ュ織涓樉绀哄垪 dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 + ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� triggerPopview: PropTypes.func // 寮圭獥鏍囩椤佃Е鍙� } @@ -235,7 +236,7 @@ _resolve() }) } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) { - let _params = data.map(cell => { + let _params = data.map((cell, index) => { let param = { func: 'sPC_TableData_InUpDe', BID: this.props.BID @@ -260,7 +261,11 @@ param.func = btn.innerFunc formdata.forEach(_data => { - param[_data.key] = _data.value + if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { + param[_data.key] = cell[_data.key] + } else { + param[_data.key] = _data.value + } }) if (setting.primaryKey) { @@ -346,18 +351,22 @@ _params.push(param) } else if (btn.Ot === 'required') { // 閫夋嫨澶氳锛屽惊鐜皟鐢� - - let _formparam = {} - if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟 - formdata.forEach(_data => { - _formparam[_data.key] = _data.value - }) - } - - _params = data.map(cell => { + _params = data.map((cell, index) => { let _cell = { BID: this.props.BID, } + + let _formparam = {} + if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟 + formdata.forEach(_data => { + if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { + _formparam[_data.key] = cell[_data.key] + } else { + _formparam[_data.key] = _data.value + } + }) + } + if (setting.primaryKey) { _cell[setting.primaryKey] = cell[setting.primaryKey] } @@ -788,6 +797,7 @@ } modelconfirm = () => { + const { BData } = this.props const { execAction, tabledata } = this.state let _this = this let _fields = [] @@ -801,11 +811,33 @@ } let result = _fields.map(item => { + let _readin = item.readin !== 'false' + let _initval = item.initval + + if (item.type === 'linkMain' || item.type === 'funcvar') { + _readin = false + } + + if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { + _initval = BData[item.field] + } else if (_readin && tabledata[0] && tabledata[0].hasOwnProperty(item.field)) { + _initval = tabledata[0][item.field] + } + + let _fieldlen = item.fieldlength || 50 + if (item.type === 'textarea' || item.type === 'fileupload') { + _fieldlen = item.fieldlength || 512 + } else if (item.type === 'number') { + _fieldlen = (item.decimal || item.decimal === 0) ? item.decimal : 18 + } + return { key: item.field, readonly: item.readonly === 'true', + readin: _readin, + fieldlen: _fieldlen, type: item.type, - value: item.initval + value: _initval } }) @@ -837,9 +869,9 @@ title = execAction.setting.title width = execAction.setting.width + 'vw' - if (execAction.setting.container === 'tab') { + if (execAction.setting.container === 'tab' && this.props.ContainerId) { width = execAction.setting.width + '%' - container = () => document.getElementById('commontable' + this.props.MenuID) + container = () => document.getElementById(this.props.ContainerId) } if (execAction.setting.clickouter === 'close') { -- Gitblit v1.8.0