From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 02 八月 2022 11:42:43 +0800 Subject: [PATCH] Merge branch 'develop' --- src/templates/zshare/modalform/index.jsx | 111 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 96 insertions(+), 15 deletions(-) diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 0fca860..da963fa 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -21,22 +21,24 @@ const modalTypeOptions = { text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl'], number: ['initval', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom'], - select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'], + select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'], checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'arrange', 'marginTop', 'marginBottom'], - radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'setAll', 'emptyText', 'splitline', 'arrange', 'marginTop', 'marginBottom'], - checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'width', 'multiple', 'splitline', 'marginTop', 'marginBottom'], + radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'setAll', 'emptyText', 'splitline', 'arrange', 'marginTop', 'marginBottom'], + checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'width', 'multiple', 'splitline', 'marginTop', 'marginBottom'], multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'], - link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkField', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'], + link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkField', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'], fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'splitline', 'marginTop', 'marginBottom'], switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'], date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'splitline', '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', 'count', 'placeholder', 'marginTop', 'marginBottom', 'enterReplace'], + cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'separator'], color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'], rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'rateCount', 'character', 'place'], hint: ['label', 'field', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'], split: ['label', 'type', 'marginTop', 'marginBottom', 'splitline'], + 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'], funcvar: ['span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'], linkMain: ['readonly', 'required', 'hidden', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'] @@ -119,7 +121,7 @@ reRequired.field = true - if (type === 'hint' || type === 'split') { + if (['hint', 'split', 'formula'].includes(type)) { reRequired.field = false shows = fromJS(modalTypeOptions[type]).toJS() } @@ -161,24 +163,48 @@ shows.push('linkField') reRequired.linkField = false } + if (['select', 'link', 'radio'].includes(type)) { + if (this.record.declare === 'nvarchar') { + shows.push('fieldlength') + } else if (this.record.declare === 'decimal') { + shows.push('decimal') + } + } } else if (type === 'checkcard') { + reRequired.fields = false if (this.record.display === 'picture') { if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� - shows.push('options', 'ratio') + shows.push('options', 'fields', 'picratio') } else if (this.record.resourceType === '1') { // 鏁版嵁婧� - shows.push('dataSource', 'cardValField', 'urlField', 'orderBy', 'orderType', 'disableField', 'database', 'ratio') + shows.push('dataSource', 'cardValField', 'fields', 'urlField', 'orderBy', 'orderType', 'disableField', 'database', 'picratio') + } + } else if (this.record.display === 'color') { + if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� + shows.push('options', 'fields') + } else if (this.record.resourceType === '1') { // 鏁版嵁婧� + shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database') } } else { + reRequired.fields = true if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� - shows.push('options', 'fields', 'backgroundColor', 'borderColor') + shows.push('options', 'fields', 'selectStyle') } else if (this.record.resourceType === '1') { // 鏁版嵁婧� - shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'backgroundColor', 'borderColor') + shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle') + } + if (this.record.selectStyle === 'custom') { + shows.push('backgroundColor') } } if (this.record.multiple === 'false') { - shows.push('linkSubField') + shows.push('linkSubField', 'declare') + if (this.record.declare === 'nvarchar') { + shows.push('fieldlength') + } else if (this.record.declare === 'decimal') { + shows.push('decimal') + } } else { + shows.push('fieldlength') reTooltip.initval = '娣诲姞澶氫釜鍒濆鍊艰浣跨敤閫楀彿鍒嗛殧銆�' } @@ -209,13 +235,43 @@ } } + if (type === 'cascader') { + if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� + shows.push('options', 'topmark', 'linkSubField') + } else if (this.record.resourceType === '1') { // 鏁版嵁婧� + shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database', 'topmark', 'linkField', 'linkSubField') + } + reTypes.linkField = 'text' + reTooltip.linkField = '鐢ㄤ簬鏋勫缓鏁版嵁缁撴瀯銆�' + reOptions.resourceType = [{ + value: '0', + text: '鑷畾涔�' + }, { + value: '1', + text: '鏁版嵁婧�' + }, { + value: '2', + text: '鐪佸競鍖�' + }] + } else { + reTooltip.linkField = '' + reTypes.linkField = 'select' + reOptions.resourceType = [{ + value: '0', + text: '鑷畾涔�' + }, { + value: '1', + text: '鏁版嵁婧�' + }] + } + if (['multiselect', 'checkbox'].includes(type)) { reTooltip.initval = '娣诲姞澶氫釜鍒濆鍊艰浣跨敤閫楀彿鍒嗛殧銆�' } else if (['select', 'link', 'radio'].includes(type)) { reTooltip.initval = '浣跨敤$first琛ㄧず榛樿閫夋嫨绗竴椤广��' } - if (this.record.supField) { + if (this.record.supField && !['hint', 'split', 'formula'].includes(type)) { shows.push('supvalue') } @@ -274,6 +330,16 @@ if (value === 'linkMain') { this.record.hidden = 'true' _fieldval.hidden = 'true' + } + + if (this.record.type === 'cascader' && value !== 'cascader') { + this.record.linkField = '' + _fieldval.linkField = '' + + if (this.record.resourceType === '2') { + this.record.resourceType = '0' + _fieldval.resourceType = '0' + } } if (this.record.options.length > 0) { @@ -468,7 +534,11 @@ if (item.type === 'text') { rules = [ - { required: item.required, message: dict['form.required.input'] + item.label + '!' } + { required: item.required, message: dict['form.required.input'] + item.label + '!' }, + { + pattern: /^[^']*$/ig, + message: '涓嶅彲浣跨敤鑻辨枃鐘舵�佺殑鍗曞紩鍙凤紒' + } ] if (item.key === 'field') { rules.push({ @@ -536,7 +606,7 @@ ] initVal = item.initVal - content = <Radio.Group onChange={(e) => {this.optionChange(item.key, e.target.value)}}> + content = <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.optionChange(item.key, e.target.value)}}> {item.options.map(option => { return ( <Radio key={option.value} value={option.value}>{option.text}</Radio> @@ -571,11 +641,16 @@ let linkSubFields = this.record.linkSubField || [] if (type !== 'checkcard') { - if (!['select', 'radio', 'link'].includes(type)) { + if (!['select', 'radio', 'link', 'cascader'].includes(type)) { linkSubFields = [] } if (type === 'radio' && this.record.linkField) { type = 'link' + } else if (type === 'cascader') { + type = 'link' + if (this.record.resourceType === '2') { // 鑷畾涔夎祫婧� + linkSubFields = [] + } } content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/> } else { @@ -590,10 +665,16 @@ } else if (item.type === 'fields') { span = 24 className = 'text-area' + rules = [ + { required: item.required, message: '璇锋坊鍔�' + item.label + '!' } + ] - content = <FieldsTable dict={this.props.dict} onChange={this.changeField}/> + content = <FieldsTable onChange={this.changeField}/> } else if (item.type === 'color') { className = 'color-form-item' + rules = [ + { required: item.required, message: dict['form.required.select'] + item.label + '!' } + ] content = <ColorSketch allowClear={true}/> } else if (item.type === 'icon') { -- Gitblit v1.8.0