From d1f19b794216b37417e114b71c1cd7a2ac3d7748 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 02 三月 2023 01:14:29 +0800 Subject: [PATCH] 2023-03-02 --- src/tabviews/zshare/mutilform/index.jsx | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 31e52f0..445b601 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -35,17 +35,19 @@ data: PropTypes.any, // 琛ㄦ牸鏁版嵁 BID: PropTypes.any, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 + unload: PropTypes.any, // 涓嬫媺鑿滃崟涓嶅姞杞芥暟鎹� inputSubmit: PropTypes.func // input鍥炶溅鎻愪氦 } state = { formlist: [], // 琛ㄥ崟椤� + ID: '' } record = {} componentDidMount () { - const { action } = this.props + const { action, unload } = this.props let data = {} let BData = {} @@ -300,7 +302,7 @@ }) } else if (item.regular === 'email') { _rules.push({ - pattern: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/, + pattern: /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/, message: item.regularText || '璇锋纭緭鍏ラ偖绠卞湴鍧�' }) } @@ -505,7 +507,9 @@ this.record = record - this.setState({ formlist }, () => { + this.setState({ formlist, ID: this.props.data ? this.props.data.$$uuid || '' : '' }, () => { + if (unload) return + if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) { setTimeout(() => { MKEmitter.emit('mkFC', 'focus', fieldMap.get(action.setting.focus).uuid) @@ -541,6 +545,10 @@ if (item.database === 'sso') { let sql = _sso + item.base_sql _sso = '' + + sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) + sql = sql.replace(/@BID@/ig, `'${BID}'`) + if (debug) { console.info(sql) } @@ -548,6 +556,10 @@ } else { let sql = _sql + item.base_sql _sql = '' + + sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) + sql = sql.replace(/@BID@/ig, `'${BID}'`) + if (debug) { console.info(sql) } @@ -561,8 +573,7 @@ LText: localItems.join(' union all '), obj_name: '', arr_field: '', - table_type: 'Y', - BID: BID || '' + table_type: 'Y' } if (param.LText) { @@ -596,8 +607,7 @@ LText: mainItems.join(' union all '), obj_name: '', arr_field: '', - table_type: 'Y', - BID: BID || '' + table_type: 'Y' } if (mainparam.LText) { @@ -657,9 +667,11 @@ func: 'sPC_Get_SelectedList', LText: _sql + form.base_sql, obj_name: form.field, - arr_field: form.arr_field, - BID: this.props.BID || '' + arr_field: form.arr_field } + + param.LText = param.LText.replace(/@ID@/ig, `'${this.state.ID || ''}'`) + param.LText = param.LText.replace(/@BID@/ig, `'${this.props.BID || ''}'`) if (debug) { console.info(param.LText) @@ -712,6 +724,7 @@ if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = [] let map = new Map() + let all = false result[item.field].forEach(cell => { let _cell = { key: Utils.getuuid() , ParentID: ''} @@ -722,12 +735,26 @@ if (item.type !== 'checkcard') { _cell.value = cell[item.valueField] _cell.label = cell[item.valueText] + '' - if (!_cell.label || map.has(_cell.ParentID + _cell.value)) return + if (map.has(_cell.ParentID + _cell.value)) return + if (!_cell.label) { + if (!all) { + _cell.label = '鍏ㄩ儴' + all = true + } else { + return + } + } map.set(_cell.ParentID + _cell.value, 0) } else { _cell.$value = cell[item.cardValField] _cell = {..._cell, ...cell} + + if (item.urlField) { + _cell.$url = cell[item.urlField] || '' + } else if (item.colorField) { + _cell.$color = cell[item.colorField] || '' + } if (map.has(_cell.ParentID + _cell.$value)) return @@ -868,6 +895,7 @@ formlist.forEach((item, index) => { if (item.hidden) return + if (item.empty === 'hidden' && item.options.length === 0) return if (item.type === 'split') { fields.push( -- Gitblit v1.8.0