From 36276e96db8e9633f4bd68257e4c80fa0efe8c1d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 02 十月 2024 22:40:26 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/utils/utils-custom.js | 89 ++++++++++++++++++++++++++++++++++++-------- 1 files changed, 73 insertions(+), 16 deletions(-) diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 5ddd8db..0aa4345 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -1950,6 +1950,33 @@ } if (['exec', 'prompt', 'pop', 'form', 'formSubmit'].includes(cell.OpenType)) { + if (cell.Ot !== 'requiredOnce' && ['pop', 'form'].includes(cell.OpenType) && cell.verify && cell.verify.uniques && cell.verify.uniques.length > 0) { + let forms = ['BID'] + + if (cell.OpenType === 'form') { + forms.push(cell.field) + } else if (cell.modal && cell.modal.fields.length > 0) { + cell.modal.fields.forEach(n => { + if (!n.field) return + forms.push(n.field) + }) + } + let emptys = [] + cell.verify.uniques.forEach(m => { + if (m.status === 'false') return + + m.field.split(',').forEach(n => { + if (!forms.includes(n)) { + emptys.push(n) + } + }) + }) + + if (emptys.length) { + errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濆敮涓�鎬ч獙璇佸瓧娈�${emptys.join('銆�')}锛屽湪琛ㄥ崟涓笉瀛樺湪锛乣}) + } + } + if (cell.OpenType === 'form' && cell.formType === 'count_line') return if (cell.intertype === 'system') { @@ -3056,7 +3083,7 @@ if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { let msg = getFormSql(cell, '鎼滅储') - sqls.push({uuid: cell.uuid, type: 'sForm', ...msg}) + sqls.push({uuid: md5(item.uuid + cell.uuid), type: 'sForm', ...msg}) } }) } @@ -3428,7 +3455,7 @@ type: item.type, isconst: item.constant === 'true' } - + if (_item.type === 'datemonth') { _item.type = 'text' } else if (_item.type === 'number' || _item.type === 'rate') { @@ -3698,6 +3725,7 @@ item.field.split(',').forEach((_field, index) => { let _key = _field.toLowerCase() let _val = '' + let _val2 = '' arr.push(_key) if (_key === 'bid') { // 琛ㄥ崟涓病鏈塨id鍒欎娇鐢ㄧ郴缁焍id鍙橀噺 @@ -3707,7 +3735,14 @@ } _fieldValue.push(`${_key}=${_val}`) - _value.push(`${_labels[index] || ''}锛�${_val || ''}`) + + if (_key === 'bid') { // 琛ㄥ崟涓病鏈塨id鍒欎娇鐢ㄧ郴缁焍id鍙橀噺 + _val2 = `' + ${BID} + '` + } else { + _val2 = `@mk_${_key}_mk@` + } + + _value.push(`${_labels[index] || ''}锛�${_val2}`) }) if (!arr.includes(primaryKey.toLowerCase())) { @@ -3797,11 +3832,7 @@ let _key = item.key.toLowerCase() keys.push(_key) - if (item.type === 'number' || item.type === 'rate') { - values.push('@mk_' + _key + '_mk@') - } else { - values.push(`'@mk_${_key}_mk@'`) - } + values.push('@' + _key) }) if (!keys.includes(primaryKey.toLowerCase())) { @@ -3845,11 +3876,7 @@ let _key = item.key.toLowerCase() _arr.push(_key) - if (item.type === 'number' || item.type === 'rate') { - _form.push(`${_key}=@mk_${_key}_mk@`) - } else { - _form.push(`${_key}='@mk_${_key}_mk@'`) - } + _form.push(_key + '=@' + _key) }) if (_actionType === 'audit') { @@ -4772,7 +4799,7 @@ // SELECT @appkey@,'sPC_Get_TableData',1,@menuname@,@UserID@,@username@,@fullname@,@SessionUid@,@LoginUID@ let sql = '' - if (item.setting.transact === 'true') { + if (item.setting.transact === 'true' && !/BEGIN\s+TRY\s+begin\s+TRAN/.test(_customScript)) { sql = `/* ${item.setting.$name} */ BEGIN TRY begin TRAN @@ -4781,9 +4808,38 @@ arr_field='${arr_field}',tabid='${tabid}',parid='${parid}',sub_name='${sub_name}',sub_field='${sub_field}' ` + let e_sql = `select ${_columns.map(col => col.field).join(',')} from (select ${_columns.map(col => /date/ig.test(col.datatype) ? `'1949-10-01' as ${col.field}` : `'0' as ${col.field}`).join(',')}) a where ${item.setting.primaryKey || 'ID'} != '0'` + if (DateCount) { + e_sql += ` + select 0 as total + ` + } + _tailScript = `${_tailScript} select @ErrorCode as ErrorCode,@retmsg as retmsg - ${callback} + + COMMIT TRAN + set NOCOUNT ON + RETURN + END TRY + BEGIN CATCH + ROLLBACK TRAN + DECLARE @ErrorMessage NVARCHAR(4000); + DECLARE @ErrorSeverity INT; + DECLARE @ErrorState INT; + + set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) + set @retmsg=ERROR_MESSAGE(); + select @ErrorMessage=ERROR_MESSAGE(), @ErrorSeverity=ERROR_SEVERITY(), @ErrorState=ERROR_STATE(); + + RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState); + END CATCH + + aaa: + ${e_sql} + select @ErrorCode as ErrorCode,@retmsg as retmsg + GOTO_RETURN: + ROLLBACK TRAN ` } else { sql = `/* ${item.setting.$name} */ @@ -4792,7 +4848,8 @@ ` _tailScript = `${_tailScript} - select @ErrorCode as ErrorCode,@retmsg as retmsg + aaa: + select @ErrorCode as ErrorCode,@retmsg as retmsg ` } -- Gitblit v1.8.0