From 0a932e56960fc8d39eb9cb04e16cac2249445062 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 16 一月 2025 16:35:56 +0800 Subject: [PATCH] 2025-01-16 --- src/menu/debug/index.jsx | 112 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 84 insertions(+), 28 deletions(-) diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx index ab9eafd..d398ea2 100644 --- a/src/menu/debug/index.jsx +++ b/src/menu/debug/index.jsx @@ -292,6 +292,8 @@ components.forEach(item => { if (item.type === 'tabs') { item.subtabs.forEach(tab => { + if (tab.hide === 'true') return + let _mainSearch = mainSearch || [] if (appType !== 'mob') { @@ -385,7 +387,7 @@ getCols(item.cols) if (item.subtype === 'editable' && item.submit.intertype === 'system') { - let sql = this.getEditTableSql(item.submit, item.cols, item.columns) + let sql = this.getEditTableSql(item.submit, item.cols, item.columns, item.setting) children.push({label: '鎻愪氦', sql: sql}) } } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { @@ -635,9 +637,12 @@ if (!_prev) return _back let tbs = [] - _prev.replace(/\n|\r/g, ' ').split(/\sdeclare\s/ig).forEach(line => { - if (!/^\s*(@|#)[a-zA-Z0-9_]+\s+table\s+\(/ig.test(line)) return - let tb = line.match(/(@|#)[a-zA-Z0-9_]+\s+table\s+\(.+(\)|date|datetime)\s*\)/ig) + _prev.replace(/\/\*[^/*]+\*\//g, '').replace(/\n|\r/g, ' ').split(/\sdeclare\s+|\screate\s+table\s+/ig).forEach(line => { + if (/^\s*(@|#)[a-zA-Z0-9_]+\s+table\s+\(/ig.test(line)) { + line = line.replace(/\s+table\s+\(/, '(') + } + if (!/^\s*(@|#)[a-zA-Z0-9_]+\s*\(/ig.test(line)) return + let tb = line.match(/(@|#)[a-zA-Z0-9_]+\s*\(.+(\)|date|datetime)\s*\)/ig) if (tb && tb.length === 1) { tbs.push(tb[0]) @@ -649,7 +654,7 @@ if (!tbName) return - let content = tb.replace(/(@|#)[a-zA-Z0-9_]+\s+table\s+\(\s*/, '').replace(/\s*\)$/, '') + let content = tb.replace(/(@|#)[a-zA-Z0-9_]+\s*\(\s*/, '').replace(/\s*\)$/, '') content = content.replace(/decimal\(\s*\d+\s*,\s*\d+\s*\)/ig, 'decimal') let keys = [] @@ -752,7 +757,7 @@ }) // 闇�瑕佸0鏄庣殑鍙橀噺闆� - let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] + let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid', 'mk_submit_type'] // 涓婚敭瀛楁 let primaryKey = setting.primaryKey || 'id' @@ -845,6 +850,25 @@ }) } } + + if (formdata && formdata.findIndex(item => item.type === 'vercode') > -1) { + formdata.push({ + type: 'text', + fieldlen: 50, + writein: false, + key: 'mk_timestamp' + }, { + type: 'text', + fieldlen: 50, + writein: false, + key: 'mk_send_type' + }, { + type: 'text', + fieldlen: 50, + writein: false, + key: 'mk_n_id' + }) + } // 鑾峰彇瀛楁閿�煎 formdata && formdata.forEach(form => { let _key = form.key.toLowerCase() @@ -877,6 +901,8 @@ } else if (form.type === 'rate') { _type = `decimal(18,2)` } + + if (['appkey'].includes(_key)) return _declarefields.push(`@${_key} ${_type}`) } @@ -900,7 +926,7 @@ } } - if (!_vars.includes(_key)) { + if (!_vars.includes(_key) && !['appkey'].includes(_key)) { _vars.push(_key) _declarefields.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) } @@ -912,7 +938,7 @@ if (_declarefields) { _declarefields = ',' + _declarefields } - _sql = `Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@mk_deleted int,@bid nvarchar(50)${_declarefields} + _sql = `Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@mk_deleted int,@bid nvarchar(50),@mk_submit_type nvarchar(50)${_declarefields} ` let userName = 'User_Name' @@ -930,7 +956,7 @@ // 鍒濆鍖栧嚟璇佸強鐢ㄦ埛淇℃伅瀛楁 _sql += ` /* 鍑瘉鍙婄敤鎴蜂俊鎭垵濮嬪寲璧嬪�� */ - select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @mk_deleted=1, @bid='${BID}', @BillCode='', @ModularDetailCode='' + select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @mk_deleted=1, @bid='${BID}', @mk_submit_type='', @BillCode='', @ModularDetailCode='' ` // 琛ㄥ崟鍙橀噺璧嬪�� @@ -1140,17 +1166,26 @@ item.field.split(',').forEach((_field, index) => { let _key = _field.toLowerCase() let _val = '' + let _val2 = '' arr.push(_key) - if (_key === 'bid') { // 琛ㄥ崟涓病鏈塨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}'`) } @@ -1201,7 +1236,7 @@ let hasvoucher = false // 鍑瘉-鏄剧ず鍒椾腑閫夊彇,蹇呴』閫夎 - if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'requiredOnce') { + if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'notRequired') { let _voucher = verify.voucher hasvoucher = true @@ -1209,7 +1244,7 @@ _sql += ` /* 鍒涘缓鍑瘉 */ exec s_BVoucher_Create - @Bill ='0', + @Bill = @${_voucher.linkField}, @BVoucherType ='${_voucher.BVoucherType}', @VoucherTypeOne ='${_voucher.VoucherTypeOne}', @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', @@ -1759,7 +1794,7 @@ return sql } - getEditTableSql = (verify, cols, columns) => { + getEditTableSql = (verify, cols, columns, setting) => { let btn = verify let userName = sessionStorage.getItem('User_Name') || '' let fullName = sessionStorage.getItem('Full_Name') || '' @@ -1787,30 +1822,46 @@ let vals = [] let forms = [] - let _fields = {} - - columns.forEach(col => { - _fields[col.field] = col.datatype - }) + let _forms = {} + let index = 0 let getColumns = (cols) => { cols.forEach(item => { if (item.type === 'colspan') { getColumns(item.subcols) } else if (item.editable === 'true') { - forms.push({ - field: item.field, - type: item.type, - datatype: _fields[item.field] || 'nvarchar(50)' - }) + item.$sort = index + _forms[item.field] = item + index++ } }) } getColumns(cols) + columns.forEach(item => { + if (item.field === setting.primaryKey) return + + if (_forms[item.field]) { + let _item = {..._forms[item.field]} + if (_item.editType === 'date') { + _item.datatype = _item.declareType || 'datetime' + } else { + _item.datatype = item.datatype + } + + forms.push(_item) + } else { + forms.push({...item, $sort: 999}) + } + }) + + forms.sort((a, b) => a.$sort - b.$sort) + forms.forEach(col => { - if (col.type === 'number') { + if (/date/.test(col.datatype)) { + vals.push(`'1949-10-01'`) + } else if (col.type === 'number') { vals.push(`1`) } else { vals.push(`'mk'`) @@ -2018,6 +2069,11 @@ { reg: /@datam@/ig, value: `''` }, ] + let process = this.props.config.process === 'true' + if (process) { + regs.push({ reg: /@works_flow_code@/ig, value: `'1949-10-01 15:00:00'` }) + } + let sql = this.formatDataSource(item, regs) return sql -- Gitblit v1.8.0