From 282fd00654a0e777cdbca700fe6488d04fec6be8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 28 二月 2020 15:41:15 +0800 Subject: [PATCH] 2020-02-28 --- src/tabviews/formtab/index.jsx | 61 +++++++++++++++++++++++++----- 1 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index d08edbd..9d11941 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -94,9 +94,6 @@ let _arrField = [config.setting.primaryKey] // 瀛楁闆� , 榛樿娣诲姞涓婚敭 - // if (this.props.param && this.props.param.arr_field) { // 浣跨敤鏄剧ず鍒楀瓧娈垫煡璇� - // _arrField = this.props.param.arr_field - // } else { config.groups.forEach(group => { group.sublist.forEach(item => { if (!item.field) return @@ -105,7 +102,6 @@ }) }) _arrField = _arrField.join(',') - // } // 鏉冮檺杩囨护 if (this.props.menuType !== 'HS') { @@ -122,16 +118,30 @@ actions: config.action, arr_field: _arrField, primaryId: this.props.param.primaryId || '', - data: config.setting.datatype === 'query' ? null : this.props.param.data, + data: this.props.param.data || null, BIDs: { - mainTable: this.props.param.primaryId || '', - mainTabledata: config.setting.datatype === 'query' ? '' : this.props.param.data + mainTable: config.setting.onload === 'true' ? (this.props.param.primaryId || '') : '', + mainTabledata: config.setting.onload === 'true' ? (config.setting.datatype === 'query' ? '' : this.props.param.data) : '' } }, () => { this.improveSelectOption(config.groups) - if (config.setting.datatype === 'query' && this.props.param.primaryId) { - this.loadmaindata() + if (config.setting.datatype === 'query' && config.setting.onload === 'true') { + if (!this.props.param.primaryId) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌涓婚敭ID锛�', + duration: 10 + }) + } else { + this.loadmaindata() + } + } else if (config.setting.datatype !== 'query' && (!this.props.param.primaryId || !this.props.param.data)) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌涓昏〃鏁版嵁锛�', + duration: 10 + }) } }) } else { @@ -262,7 +272,7 @@ * @description 涓昏〃鏁版嵁鍔犺浇 */ async loadmaindata () { - const { setting, BIDs } = this.state + const { setting, BIDs, config } = this.state if (setting.datatype !== 'query') { notification.warning({ @@ -290,6 +300,12 @@ if (_data) { _primaryId = _data[setting.primaryKey] || '' + } else { + notification.warning({ + top: 92, + message: '鏈煡璇㈠埌鏁版嵁淇℃伅锛�', + duration: 10 + }) } this.setState({ @@ -301,6 +317,31 @@ mainTabledata: _data } }) + + if (_data && (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc))) { + let keys = Object.keys(_data) + let emptys = [] + + if (!keys.includes(config.setting.primaryKey)) { + emptys.push(config.setting.primaryKey) + } + + config.groups.forEach(group => { + group.sublist.forEach(item => { + if (!keys.includes(item.field)) { + emptys.push(item.field + '(' + item.label + ')') + } + }) + }) + + if (emptys.length > 0) { + notification.warning({ + top: 92, + message: '鏈煡璇㈠埌' + emptys.join(', ') + '瀛楁淇℃伅锛�', + duration: 10 + }) + } + } } else { notification.error({ top: 92, -- Gitblit v1.8.0