From cd14cfe4d574c3ddda341a36c76f98bc22438b44 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 17 一月 2025 10:08:49 +0800 Subject: [PATCH] 2025-01-17 --- src/utils/utils.js | 45 +++++++++++++++++++++++++++------------------ 1 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 0235f91..bc7e3d2 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1775,7 +1775,6 @@ let primaryId = param.ID let BID = param.BID || '' let verify = btn.verify || {} - let datavars = {} // 澹版槑鐨勫彉閲忥紝琛ㄥ崟鍙婃樉绀哄垪 let _actionType = null let _callbacksql = '' @@ -1825,7 +1824,6 @@ // 鑾峰彇瀛楁閿�煎 formdata && formdata.forEach(form => { let _key = form.key.toLowerCase() - datavars[_key] = form.value if (!_initvars.includes(_key)) { _initvars.push(_key) @@ -1880,14 +1878,12 @@ // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃) if (data && btn.Ot !== 'notRequired' && columns && columns.length > 0) { - datavars = {..._data, ...datavars} - const setField = (col) => { if (!col.field) return let _key = col.field.toLowerCase() if (!_initvars.includes(_key)) { - let _val = datavars.hasOwnProperty(_key) ? datavars[_key] : '' + let _val = _data.hasOwnProperty(_key) ? _data[_key] : '' if (col.datatype && /^date/ig.test(col.datatype) && !_val) { _val = '1949-10-01' @@ -2115,22 +2111,21 @@ verify.billcodes.forEach(item => { let _key = item.field.toLowerCase() - let _linkKey = item.linkField ? item.linkField.toLowerCase() : '' if (!keys.includes(_key)) return // 琛ㄥ崟涓笉鍚崟鍙风敓鎴愬瓧娈� let _lpline = '' if (item.TypeCharOne === 'Lp') { - if (_linkKey === 'bid' && BID) { // 鏇挎崲bid + if (/^BID$/ig.test(item.linkField)) { _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@BID@,48)` } else { - _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)` + _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${item.linkField},48)` } } else if (item.TypeCharOne === 'BN') { - if (_linkKey === 'bid' && BID) { // 鏇挎崲bid + if (/^BID$/ig.test(item.linkField)) { _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` } else { - _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)` + _lpline = `set @ModularDetailCode= 'BN'+ right(@${item.linkField},48)` } } else { _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)` @@ -2176,18 +2171,27 @@ item.field.split(',').forEach((_field, index) => { let _key = _field.toLowerCase() - let _val = datavars[_key] !== undefined ? datavars[_key] : '' + let _val = '' + let _val2 = '' arr.push(_key) - if (_key === 'bid' && !_val) { // 琛ㄥ崟涓病鏈塨id鍒欎娇鐢ㄧ郴缁焍id鍙橀噺 - _val = BID + if (_key === 'bid') { + _val = `'${BID}'` + } else { + _val = `@${_field}` } - - _fieldValue.push(`${_key}='${_val}'`) - _value.push(`${_labels[index] || ''}锛�${_val || ''}`) + + if (_key === 'bid') { + _val2 = BID + } else { + _val2 = `' + @${_field} + '` + } + + _fieldValue.push(`${_key}=${_val}`) + _value.push(`${_labels[index] || ''}锛�${_val2}`) }) - if (!arr.includes(primaryKey.toLowerCase())) { + if (!arr.includes(primaryKey.toLowerCase()) && btn.Ot !== 'notRequired') { _fieldValue.push(`${primaryKey} !='${primaryId}'`) } @@ -2240,13 +2244,18 @@ // 鍑瘉-鏄剧ず鍒椾腑閫夊彇,蹇呴』閫夎 if (verify.voucher && verify.voucher.enabled) { let _voucher = verify.voucher + let linkField = `@${_voucher.linkField}` + + if (/^BID$/ig.test(_voucher.linkField)) { + linkField = `'${BID}'` + } hasvoucher = true _sql += ` /* 鍒涘缓鍑瘉 */ exec s_BVoucher_Create - @Bill ='${_data[_voucher.linkField.toLowerCase()] || ''}', + @Bill = ${linkField}, @BVoucherType ='${_voucher.BVoucherType}', @VoucherTypeOne ='${_voucher.VoucherTypeOne}', @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', -- Gitblit v1.8.0