| | |
| | | let _declarefields = [] |
| | | |
| | | // 获取字段键值对 |
| | | if (formdata) { |
| | | formdata.forEach(form => { |
| | | if (form.type === 'text') { // 特殊字段替换 |
| | | form.value = form.value.replace(/^(\s*)@appkey@(\s*)$/ig, appkey) |
| | | form.value = form.value.replace(/^(\s*)@SessionUid@(\s*)$/ig, sessionUid) |
| | | form.value = form.value.replace(/^(\s*)@bid@(\s*)$/ig, BID) |
| | | } |
| | | formdata && formdata.forEach(form => { |
| | | if (form.type === 'text') { // 特殊字段替换 |
| | | form.value = form.value.replace(/^(\s*)@appkey@(\s*)$/ig, appkey) |
| | | form.value = form.value.replace(/^(\s*)@SessionUid@(\s*)$/ig, sessionUid) |
| | | form.value = form.value.replace(/^(\s*)@bid@(\s*)$/ig, BID) |
| | | } |
| | | |
| | | _formFieldValue[form.key] = form.value |
| | | let _key = form.key.toLowerCase() |
| | | _formFieldValue[form.key] = form.value |
| | | let _key = form.key.toLowerCase() |
| | | |
| | | if (!_initvars.includes(_key)) { |
| | | _initvars.push(_key) |
| | | if (!_initvars.includes(_key)) { |
| | | _initvars.push(_key) |
| | | |
| | | if (form.type === 'number') { |
| | | let val = form.value |
| | | if (typeof(val) !== 'number') { |
| | | val = parseFloat(val) |
| | | if (isNaN(val)) { |
| | | val = 0 |
| | | } |
| | | if (form.type === 'number') { |
| | | let val = form.value |
| | | if (typeof(val) !== 'number') { |
| | | val = parseFloat(val) |
| | | if (isNaN(val)) { |
| | | val = 0 |
| | | } |
| | | _initfields.push(`@${_key}=${val}`) |
| | | } else { |
| | | _initfields.push(`@${_key}='${form.value}'`) |
| | | } |
| | | _initfields.push(`@${_key}=${val}`) |
| | | } else { |
| | | _initfields.push(`@${_key}='${form.value}'`) |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | if (form.fieldlen && form.fieldlen > 2048) { |
| | | form.fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${form.fieldlen})` |
| | | |
| | | if (form.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | } else if (form.type === 'number') { |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } |
| | | |
| | | _declarefields.push(`@${_key} ${_type}`) |
| | | if (form.fieldlen && form.fieldlen > 2048) { |
| | | form.fieldlen = 'max' |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let _type = `nvarchar(${form.fieldlen})` |
| | | |
| | | if (form.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | } else if (form.type === 'number') { |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } |
| | | |
| | | _declarefields.push(`@${_key} ${_type}`) |
| | | } |
| | | }) |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce') { |
| | |
| | | |
| | | // 单号生成,使用上级id(BID)或列表数据,声明变量(检验) |
| | | let _billcodesSql = '' |
| | | if (verify.billcodes && verify.billcodes.length > 0) { |
| | | if (formdata && verify.billcodes && verify.billcodes.length > 0) { |
| | | let keys = formdata.map(item => item.key.toLowerCase()) // 表单字段 |
| | | |
| | | verify.billcodes.forEach(item => { |
| | | if (!keys.includes(item.field.toLowerCase())) return // 表单中不含单号生成字段 |
| | | |
| | | let _ModularDetailCode = '' |
| | | let _lpline = '' |
| | | if (item.TypeCharOne === 'Lp') { |