From cd138edfe4d479e7689f4a7e466a81471b540d2e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 01 三月 2025 22:34:59 +0800 Subject: [PATCH] 2025-03-01 --- src/templates/zshare/modalform/index.jsx | 168 ++++++++++++++++++++++++++++++------------------------- 1 files changed, 91 insertions(+), 77 deletions(-) diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index ffe236a..63636ae 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -20,8 +20,8 @@ const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) const modalTypeOptions = { - text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'encryption', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl', 'inputType', 'constant'], - number: ['initval', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom'], + text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'encryption', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl', 'inputType', 'constant', 'mkfocus'], + number: ['initval', 'readonly', 'notZero', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom', 'mkfocus', 'format'], select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'], checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'arrange', 'marginTop', 'marginBottom'], radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'arrange', 'marginTop', 'marginBottom'], @@ -29,21 +29,21 @@ multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'dropdown'], link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkField', 'linkSubField', 'span', 'place', 'labelwidth', 'tooltip', 'extra', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'], fileupload: ['readonly', 'required', 'hidden', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'linkSubField', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom', 'maxSize'], - switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'linkSubField', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'], - check: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'checkTip'], - date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], - datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'place', 'marginTop', 'marginBottom'], + switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'linkSubField', 'tooltip', 'extra', 'enter', 'splitline', 'marginTop', 'marginBottom'], + check: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'splitline', 'marginTop', 'marginBottom', 'checkTip'], + date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], + datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'splitline', 'place', 'marginTop', 'marginBottom'], // datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'], textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'place', 'count', 'placeholder', 'marginTop', 'marginBottom'], cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'marginTop', 'marginBottom', 'separator'], color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'colorType', 'extra', 'marginTop', 'marginBottom'], rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'color', 'rateCount', 'character', 'place'], - hint: ['label', 'field', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'], - split: ['label', 'type', 'marginTop', 'marginBottom', 'splitline', 'splitctrl'], - formula: ['label', 'type', 'marginTop', 'marginBottom', 'splitline', 'span', 'labelwidth', 'formula', 'eval', 'postfix'], - brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'span', 'labelwidth', 'tooltip', 'extra', 'encryption', 'marginTop', 'marginBottom'], + hint: ['label', 'field', 'type', 'blacklist', 'supField', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'], + split: ['label', 'type', 'marginTop', 'marginBottom', 'splitline', 'splitctrl', 'supField', 'opacity'], + formula: ['label', 'type', 'marginTop', 'marginBottom', 'splitline', 'supField', 'span', 'labelwidth', 'formula', 'eval', 'postfix'], + brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'span', 'labelwidth', 'tooltip', 'interception', 'extra', 'encryption', 'marginTop', 'marginBottom', 'contHeidht'], funcvar: ['span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'], - linkMain: ['readonly', 'required', 'hidden','declare', 'span', 'labelwidth', 'tooltip', 'interception', 'extra', 'place', 'marginTop', 'marginBottom'], + linkMain: ['readonly', 'required', 'hidden','declare', 'span', 'labelwidth', 'tooltip', 'interception', 'extra', 'place', 'marginTop', 'marginBottom', 'verifyVal'], popSelect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'enter', 'dataSource', 'columns', 'primaryKey', 'order', 'controlField', 'laypage', 'onload', 'searchKey', 'showField', 'popWidth'], vercode: ['label', 'field', 'type', 'blacklist', 'supField', 'readonly', 'required', 'hidden', 'span', 'labelwidth', 'tooltip', 'marginTop', 'marginBottom', 'placeholder', 'enter', 'smsId', 'phoneField', 'sendType'] } @@ -51,7 +51,7 @@ class MainSearch extends Component { static propTpyes = { formlist: PropTypes.any, - standardform: PropTypes.any, + fields: PropTypes.array, card: PropTypes.object, inputSubmit: PropTypes.any } @@ -243,6 +243,9 @@ shows.push('unchecked') } } else if (['date', 'datemonth'].includes(type)) { + if (this.record.enter === 'tab' || this.record.enter === 'sub') { + shows.push('tabField') + } reOptions.initval = dateOptions[type] reTypes.initval = 'select' if (type === 'date') { @@ -254,6 +257,9 @@ } } } else if (type === 'switch' || type === 'check') { + if (this.record.enter === 'tab' || this.record.enter === 'sub') { + shows.push('tabField') + } reOptions.initval = [ {value: true, text: '寮�'}, {value: false, text: '鍏�'} @@ -286,6 +292,10 @@ if (this.record.encryption === 'false') { shows.push('enterReplace') } + if (this.record.interception === 'func') { + shows.push('func') + } + } else if (type === 'brafteditor') { if (this.record.interception === 'func') { shows.push('func') } @@ -358,7 +368,7 @@ reTooltip.initval = '浣跨敤$first琛ㄧず榛樿閫夋嫨绗竴椤广��' } - if (this.record.supField && !['hint', 'split', 'formula'].includes(type)) { + if (this.record.supField) { shows.push('supvalue') } @@ -415,12 +425,16 @@ if (value === 'brafteditor') { this.record.encryption = 'true' + this.record.interception = 'false' _fieldval.encryption = 'true' + _fieldval.interception = 'false' } if (value === 'linkMain') { this.record.hidden = 'true' + this.record.verifyVal = 'true' _fieldval.hidden = 'true' + _fieldval.verifyVal = 'true' } if (this.record.type === 'cascader' && value !== 'cascader') { @@ -531,18 +545,21 @@ changeVal = (val, type) => { if (type !== 'span' || ![24, 12, 8, 6].includes(val)) return - const { standardform } = this.props + const { card, fields } = this.props - if (!standardform || ![24, 12, 8, 6].includes(standardform.span) || !standardform.labelwidth) return + let index = fields.findIndex(item => card.uuid === item.uuid) + let stform = fields[index - 1] + + if (!stform || ![24, 12, 8, 6].includes(stform.span) || !stform.labelwidth) return let labelwidth = null - if (standardform.span === val) { - labelwidth = standardform.labelwidth - } else if (standardform.span > val) { + if (stform.span === val) { + labelwidth = stform.labelwidth + } else if (stform.span > val) { labelwidth = 33.3 } else { - switch(standardform.span) { + switch(stform.span) { case 12: labelwidth = 16.2 break; @@ -755,6 +772,7 @@ extra = <span className="add-resource-empty" onClick={this.handleEmpty}>绌�</span> } if (item.placeholder) { + className = 'show-public-var' extra = <><span className="resource-public-var">{item.placeholder}</span>{extra}</> } @@ -878,54 +896,54 @@ return fields } - transfer = (options) => { - if (options.length === 0) return options + // transfer = (options) => { + // if (options.length === 0) return options - let isNumber = true - options.forEach(item => { - if (!item.Value || isNaN(item.Value)) { - isNumber = false - } - }) + // let isNumber = true + // options.forEach(item => { + // if (!item.Value || isNaN(item.Value)) { + // isNumber = false + // } + // }) - if (isNumber) { - return options.map(item => { - item.Value = +item.Value - return item - }) - } else { - return options.map(item => { - item.Value = item.Value + '' - return item - }) - } - } + // if (isNumber) { + // return options.map(item => { + // item.Value = +item.Value + // return item + // }) + // } else { + // return options.map(item => { + // item.Value = item.Value + '' + // return item + // }) + // } + // } - transferCard = (options) => { - if (options.length === 0) return options + // transferCard = (options) => { + // if (options.length === 0) return options - let isNumber = true - options.forEach(item => { - if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.$value)) { - isNumber = false - } - }) + // let isNumber = true + // options.forEach(item => { + // if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.$value)) { + // isNumber = false + // } + // }) - if (isNumber) { - return options.map(item => { - item.$value = +item.$value - return item - }) - } else { - return options.map(item => { - item.$value = item.$value + '' - return item - }) - } - } + // if (isNumber) { + // return options.map(item => { + // item.$value = +item.$value + // return item + // }) + // } else { + // return options.map(item => { + // item.$value = item.$value + '' + // return item + // }) + // } + // } - handleConfirm = (fields) => { - const { card } = this.props + handleConfirm = () => { + const { card, fields } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { @@ -958,13 +976,17 @@ if (['multiselect', 'select', 'link', 'radio', 'checkbox'].includes(values.type)) { if (values.resourceType === '0') { values.options = values.options || [] + values.options = values.options.map(item => { + item.Value = item.Value + '' + return item + }) values.dataSource = '' let type = values.type if (values.type === 'radio' && values.linkField) { type = 'link' } - values.options = this.transfer(values.options) + // values.options = this.transfer(values.options) if (values.options.filter(op => op.Text === '').length > 0) { notification.warning({ @@ -1012,6 +1034,7 @@ let linkSubFields = values.linkSubField || [] values.options = values.options.map(m => { m.ParentID = m.ParentID || '' + m.$value = m.$value + '' linkSubFields.forEach(n => { m[n] = m[n] || '' @@ -1019,7 +1042,7 @@ return m }) - values.options = this.transferCard(values.options) + // values.options = this.transferCard(values.options) let type = values.type if (values.linkField) { @@ -1086,22 +1109,17 @@ window.GLOB.formId = card.uuid - if (['select', 'multiselect', 'link', 'checkbox', 'radio', 'checkcard'].includes(values.type) && values.resourceType === '1' && values.dataSource) { + if (['select', 'multiselect', 'link', 'checkbox', 'radio', 'checkcard'].includes(values.type) && values.resourceType === '1' && values.database !== 'sso' && values.dataSource) { let _option = Utils.getSelectQueryOptions(values) let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) ${_option.sql}` - // LoginUID|SessionUid|UserID|Appkey 宸叉浛鎹� - sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|time_id)@/ig, `'1949-10-01 15:00:00'`) - - let rduri = '' - if (window.GLOB.mainSystemApi && values.database === 'sso') { - rduri = window.GLOB.mainSystemApi - } + // LoginUID|SessionUid|UserID|Appkey|lang 宸叉浛鎹� + sql = sql.replace(/@\$|\$@/ig, '') resolve({values, loading: true, promise: () => new Promise((resolve, reject) => { - Api.sDebug(sql, rduri).then(result => { + Api.sDebug(sql).then(result => { if (result.status || result.ErrCode === '-2') { resolve() } else { @@ -1150,11 +1168,7 @@ sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) ${sql}` - sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) - sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) - sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) - sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) resolve({values, loading: true, promise: () => new Promise((resolve, reject) => { Api.sDebug(sql).then(result => { -- Gitblit v1.8.0