From 682a74e858e5a6cd24d36183931d3afafd6443d7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 31 三月 2021 10:56:48 +0800 Subject: [PATCH] 2021-03-31 --- src/templates/zshare/modalform/index.jsx | 50 +++++++++ src/views/menudesign/menuform/index.scss | 6 + src/templates/modalconfig/index.scss | 3 src/assets/css/viewstyle.scss | 3 src/views/pcdesign/menuform/index.scss | 6 + src/tabviews/zshare/mutilform/index.scss | 6 + src/templates/zshare/formconfig.jsx | 2 src/tabviews/custom/components/table/normal-table/index.jsx | 19 ++- src/menu/components/form/normal-form/index.jsx | 24 ++++ src/templates/modalconfig/dragelement/index.scss | 12 + src/tabviews/zshare/mutilform/index.jsx | 8 src/templates/modalconfig/index.jsx | 17 +++ src/menu/modalconfig/index.jsx | 19 +++ src/tabviews/subtable/index.jsx | 20 ++- src/views/mobdesign/menuform/index.scss | 6 + src/tabviews/commontable/index.jsx | 19 ++- src/templates/modalconfig/dragelement/card.jsx | 35 ------ src/views/mobdesign/index.jsx | 6 18 files changed, 183 insertions(+), 78 deletions(-) diff --git a/src/assets/css/viewstyle.scss b/src/assets/css/viewstyle.scss index 33e7094..25b7155 100644 --- a/src/assets/css/viewstyle.scss +++ b/src/assets/css/viewstyle.scss @@ -373,6 +373,9 @@ .mk-water-mark { color: $color4; } + .mk-form-split-line { + color: $color6; + } } body.hidden-split-line #root { // 鍘婚櫎鐧诲綍椤靛垎鍓茬嚎 diff --git a/src/menu/components/form/normal-form/index.jsx b/src/menu/components/form/normal-form/index.jsx index 590fe46..f609d62 100644 --- a/src/menu/components/form/normal-form/index.jsx +++ b/src/menu/components/form/normal-form/index.jsx @@ -45,7 +45,8 @@ visible: false, editform: null, formlist: null, - sqlVerifing: false + sqlVerifing: false, + standardform: null } UNSAFE_componentWillMount () { @@ -429,8 +430,9 @@ group.fields.push(newcard) - this.setState({group}) - this.handleForm(newcard) + this.setState({group}, () => { + this.handleForm(newcard) + }) } editModalCancel = () => { @@ -453,6 +455,7 @@ value: '', text: '绌�' }] + let standardform = null _inputfields = group.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color') _tabfields = group.fields.filter(item => _form.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) @@ -460,7 +463,11 @@ let uniq = new Map() uniq.set(_form.field, true) - group.fields.forEach(item => { + let index = null + group.fields.forEach((item, i) => { + if (_form.uuid === item.uuid) { + index = i + } if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return if (item.field && !uniq.has(item.field)) { uniq.set(item.field, true) @@ -475,6 +482,13 @@ }) } }) + if (index !== null) { + if (index === 0) { + standardform = group.fields[index + 1] || null + } else { + standardform = group.fields[index - 1] || null + } + } card.columns.forEach(col => { if (col.field && !uniq.has(col.field)) { @@ -493,6 +507,7 @@ } this.setState({ + standardform, visible: true, editform: _form, formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, false) @@ -673,6 +688,7 @@ card={this.state.editform} formlist={this.state.formlist} inputSubmit={this.handleSubmit} + standardform={this.state.standardform} wrappedComponentRef={(inst) => this.formRef = inst} /> </Modal> diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 06f94c0..631bffc 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -53,7 +53,8 @@ sources: null, // 琛ㄥ崟绫诲瀷 sqlVerifing: false, // sql楠岃瘉 openEdition: '', // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� - showField: false // 鏄剧ず琛ㄥ崟瀛楁鍊� + showField: false, // 鏄剧ず琛ㄥ崟瀛楁鍊� + standardform: null } /** @@ -120,6 +121,7 @@ value: '', text: '绌�' }] + let standardform = null _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color') _tabfields = config.fields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) @@ -127,7 +129,11 @@ let uniq = new Map() uniq.set(card.field, true) - config.fields.forEach(item => { + let index = null + config.fields.forEach((item, i) => { + if (card.uuid === item.uuid) { + index = i + } if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return if (item.field && !uniq.has(item.field)) { uniq.set(item.field, true) @@ -142,6 +148,13 @@ }) } }) + if (index !== null) { + if (index === 0) { + standardform = config.fields[index + 1] || null + } else { + standardform = config.fields[index - 1] || null + } + } componentConfig.columns.forEach(col => { if (col.field && !uniq.has(col.field)) { @@ -160,6 +173,7 @@ } this.setState({ + standardform, visible: true, card: card, formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, !!this.props.editTab) @@ -462,6 +476,7 @@ card={this.state.card} formlist={this.state.formlist} inputSubmit={this.handleSubmit} + standardform={this.state.standardform} wrappedComponentRef={(inst) => this.formRef = inst} /> </Modal> diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 12d7f02..aed2a1b 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -717,8 +717,9 @@ let result = await Api.genericInterface(param) if (result.status) { let data = fromJS(this.state.data).toJS() + let selectedData = fromJS(this.state.selectedData).toJS() if (result.data && result.data[0]) { - let _data = result.data[0] + let _data = result.data[0] || {} if (absFields.length) { absFields.forEach(field => { @@ -728,18 +729,23 @@ _data[field] = Math.abs(_data[field]) }) } + _data.$$uuid = _data[setting.primaryKey] || '' + _data.$$BID = BID || '' try { data = data.map(item => { - if (item[setting.primaryKey] === _data[setting.primaryKey]) { + if (item.$$uuid === _data.$$uuid) { _data.key = item.key - _data.$$uuid = _data[setting.primaryKey] || '' - _data.$$BID = BID || '' - return _data } else { return item } + }) + selectedData = selectedData.map(item => { + if (_data.$$uuid === item.$$uuid) { + return _data + } + return item }) } catch { console.warn('鏁版嵁鏌ヨ閿欒') @@ -747,7 +753,8 @@ } this.setState({ - data: data, + data, + selectedData, loading: false }) } else { diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 516709b..86035b3 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -227,19 +227,25 @@ let result = await Api.genericInterface(param) if (result.status) { let data = fromJS(this.state.data).toJS() + let selectedData = fromJS(this.state.selectedData).toJS() if (result.data && result.data[0]) { - let _data = result.data[0] - + let _data = result.data[0] || {} + _data.$$uuid = _data[setting.primaryKey] || '' + _data.$$BID = BID || '' try { data = data.map(item => { - if (item[setting.primaryKey] === _data[setting.primaryKey]) { + if (item.$$uuid === _data.$$uuid) { _data.key = item.key - _data.$$uuid = _data[setting.primaryKey] || '' - _data.$$BID = BID || '' return _data } else { return item } + }) + selectedData = selectedData.map(item => { + if (_data.$$uuid === item.$$uuid) { + return _data + } + return item }) } catch { console.warn('鏁版嵁鏌ヨ閿欒') @@ -247,7 +253,8 @@ } this.setState({ - data: data, + data, + selectedData, loading: false }) } else { diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 6d806fc..3b7bd4c 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -656,8 +656,9 @@ let result = await Api.genericInterface(param) if (result.status) { let data = fromJS(this.state.data).toJS() + let selectedData = fromJS(this.state.selectedData).toJS() if (result.data && result.data[0]) { - let _data = result.data[0] + let _data = result.data[0] || {} if (absFields.length) { absFields.forEach(field => { @@ -668,17 +669,23 @@ }) } + _data.$$uuid = _data[setting.primaryKey] || '' + _data.$$BID = BID || '' + try { data = data.map(item => { - if (item[setting.primaryKey] === _data[setting.primaryKey]) { + if (item.$$uuid === _data.$$uuid) { _data.key = item.key - _data.$$uuid = _data[setting.primaryKey] || '' - _data.$$BID = BID || '' - return _data } else { return item } + }) + selectedData = selectedData.map(item => { + if (_data.$$uuid === item.$$uuid) { + return _data + } + return item }) } catch { console.warn('鏁版嵁鏌ヨ閿欒') @@ -686,7 +693,8 @@ } this.setState({ - data: data, + data, + selectedData, loading: false }) } else { diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index bd8f48f..fff93ba 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -232,7 +232,7 @@ formlist }, () => { if (action.setting && action.setting.focus) { - this.selectInput(action.setting.focus, 'init') + this.selectInput(action.setting.focus) } // 鐢ㄦ潵鏇存柊state锛岄槻姝㈠彈鎺ц〃鍗曞垵濮嬫椂涓嶆樉绀� this.setState({ @@ -242,7 +242,7 @@ }) } - selectInput = (selectId, type) => { + selectInput = (selectId) => { try { let _form = document.getElementById('main-form-box') let _inputs = _form.getElementsByTagName('input') @@ -250,7 +250,7 @@ _inputs.forEach(input => { if (!input || input.id !== selectId) return - if (input.className === 'ant-select-search__field' && type !== 'init') { + if (input.className === 'ant-select-search__field') { let div = input.parentNode while (div && div.parentNode) { div = div.parentNode @@ -711,7 +711,7 @@ if (item.type === 'split') { fields.push( <Col span={24} key={index}> - <p>{item.label}</p> + <p className="mk-form-split-line">{item.label}</p> </Col> ) } else if (item.type === 'hint') { diff --git a/src/tabviews/zshare/mutilform/index.scss b/src/tabviews/zshare/mutilform/index.scss index 16b0fa7..1020caf 100644 --- a/src/tabviews/zshare/mutilform/index.scss +++ b/src/tabviews/zshare/mutilform/index.scss @@ -5,6 +5,8 @@ display: inline-block; float: none; vertical-align: top; + padding-left: 1.2%!important; + padding-right: 1.2%!important; } .ant-form-item-label .anticon-question-circle { color: #c49f47; @@ -89,7 +91,9 @@ } p { color: #1890ff; - border-bottom: 1px solid #d9d9d9; + font-size: 15px; + padding-left: 10px; + border-bottom: 1px solid #e9e9e9; } .ant-input-disabled { color: rgba(0, 0, 0, 0.65)!important; diff --git a/src/templates/modalconfig/dragelement/card.jsx b/src/templates/modalconfig/dragelement/card.jsx index eb4e2ae..f1eb64d 100644 --- a/src/templates/modalconfig/dragelement/card.jsx +++ b/src/templates/modalconfig/dragelement/card.jsx @@ -62,29 +62,6 @@ selectval = card.emptyText || '绌�' } } - // let labelCol = 'ant-col-sm-8' - // let wrapCol = 'ant-col-sm-16' - // let isEntireLine = false - - // if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) { - // isEntireLine = true - // } - - // if (isEntireLine) { - // if (cols === '2') { - // labelCol = 'ant-col-sm-4' - // wrapCol = 'ant-col-sm-20' - // } else if (cols === '3') { - // labelCol = 'ant-col-cuslabel' - // wrapCol = 'ant-col-cuswrap' - // } else if (cols === '4') { - // labelCol = 'ant-col-sm-2' - // wrapCol = 'ant-col-sm-22' - // } - // if (card.hidelabel === 'true') { - // wrapCol = 'ant-col-sm-24' - // } - // } let formItem = null if (card.type === 'text') { @@ -157,21 +134,11 @@ required={card.required === 'true'} extra={card.extra || null} labelCol={card.labelwidth ? {style: {width: card.labelwidth + '%'}} : null} + wrapperCol={card.labelwidth ? {style: {width: (100 - card.labelwidth) + '%'}} : null} > {formItem} {showField ? <div className="field-name">{card.field}</div> : ''} </Form.Item>} - {/* <div className="ant-row ant-form-item"> - {card.hidelabel !== 'true' ? <div className={'ant-col ant-form-item-label ant-col-xs-24 ' + labelCol}> - {card.label ? <label className={card.required === 'true' ? 'required' : ''}>{card.tooltip ? - <Icon type="question-circle" /> : null} - {card.label}</label> : null} - </div> : null} - <div className={'ant-col ant-form-item-control-wrapper ant-col-xs-24 ' + wrapCol}> - {formItem} - {showField ? card.field : ''} - </div> - </div> */} </div> </div> </Popover> diff --git a/src/templates/modalconfig/dragelement/index.scss b/src/templates/modalconfig/dragelement/index.scss index e8fcd2e..abe8176 100644 --- a/src/templates/modalconfig/dragelement/index.scss +++ b/src/templates/modalconfig/dragelement/index.scss @@ -15,14 +15,18 @@ } .modal-fields-row { padding-bottom: 35px; - .ant-col { - padding-left: 12px; - padding-right: 12px; - } >.ant-col { display: inline-block; float: none; vertical-align: top; + padding-left: 1.2%; + padding-right: 1.2%; + } + .split-line { + color: #1890ff; + font-size: 15px; + padding-left: 10px; + border-bottom: 1px solid #e9e9e9; } .ant-form-item { cursor: move; diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 3c44a2e..c1b02f2 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -205,6 +205,7 @@ value: '', text: '绌�' }] + let standardform = null _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color') _tabfields = config.fields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) @@ -212,7 +213,11 @@ let uniq = new Map() uniq.set(card.field, true) - config.fields.forEach(item => { + let index = null + config.fields.forEach((item, i) => { + if (card.uuid === item.uuid) { + index = i + } if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return if (item.field && !uniq.has(item.field)) { uniq.set(item.field, true) @@ -227,6 +232,14 @@ }) } }) + + if (index !== null) { + if (index === 0) { + standardform = config.fields[index + 1] || null + } else { + standardform = config.fields[index - 1] || null + } + } if (subTabConfig) { subTabConfig.columns.forEach(col => { @@ -269,6 +282,7 @@ } this.setState({ + standardform, visible: true, card: card, formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, !!this.props.editTab) @@ -684,6 +698,7 @@ card={this.state.card} formlist={this.state.formlist} inputSubmit={this.handleSubmit} + standardform={this.state.standardform} wrappedComponentRef={(inst) => this.formRef = inst} /> </Modal> diff --git a/src/templates/modalconfig/index.scss b/src/templates/modalconfig/index.scss index ede7fb0..24849c9 100644 --- a/src/templates/modalconfig/index.scss +++ b/src/templates/modalconfig/index.scss @@ -183,9 +183,6 @@ > .ant-row { min-height: 120px; } - .ant-row .ant-col-6 { - padding: 0 12px!important; - } .ant-row.ant-form-item .ant-col { padding: 0; } diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 1da9bb4..d592fe9 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2439,7 +2439,7 @@ precision: 1, label: '鍚嶇О瀹藉害', initVal: card.labelwidth || 33.3, - tooltip: '鍚嶇О鍗犳嵁琛ㄥ崟瀹藉害鐨勭櫨鍒嗘瘮銆傛敞锛氬瓨鍦ㄥ鍒楄〃鍗曟椂锛屽綋鍓嶈〃鍗曞鏋滄兂瑕佸崰鎹暣琛屽彲鍙傜収浠ヤ笅姣斾緥锛屼袱鍒楋紙16.3锛夈�佷笁鍒楋紙10.5锛夈�佸洓鍒楋紙8.3锛�', + tooltip: '鍚嶇О鍗犳嵁琛ㄥ崟瀹藉害鐨勭櫨鍒嗘瘮銆傛敞锛氬瓨鍦ㄥ鍒楄〃鍗曟椂锛屽綋鍓嶈〃鍗曞鏋滄兂瑕佸崰鎹暣琛屽彲鍙傜収浠ヤ笅姣斾緥锛屼袱鍒楋紙16.2锛夈�佷笁鍒楋紙10.5锛夈�佸洓鍒楋紙7.7锛�', required: true }, { diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 414a00e..7345e71 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -32,7 +32,7 @@ hint: ['label', 'type', 'blacklist', 'message', 'span', 'labelwidth'], split: ['label', 'type'], brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'span', 'labelwidth', 'tooltip', 'extra', 'encryption'], - funcvar: [], + funcvar: ['span', 'labelwidth'], linkMain: ['readonly', 'required', 'hidden', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra'] } @@ -40,6 +40,7 @@ static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� formlist: PropTypes.any, + standardform: PropTypes.any, card: PropTypes.object, inputSubmit: PropTypes.any } @@ -57,7 +58,6 @@ UNSAFE_componentWillMount () { let formlist = fromJS(this.props.formlist).toJS() - let type = '' let resourceType = '' let supField = '' @@ -364,6 +364,50 @@ }) } + changeVal = (val, type) => { + if (type !== 'span' || ![24, 12, 8, 6].includes(val)) return + + const { standardform } = this.props + + if (!standardform || ![24, 12, 8, 6].includes(standardform.span) || !standardform.labelwidth) return + + let labelwidth = null + + if (standardform.span === val) { + labelwidth = standardform.labelwidth + } else if (standardform.span > val) { + labelwidth = 33.3 + } else { + switch(standardform.span) { + case 12: + labelwidth = 16.2 + break; + case 8: + if (val === 12) { + labelwidth = 21.6 + } else { + labelwidth = 10.5 + } + break; + case 6: + if (val === 8) { + labelwidth = 24.3 + } else if (val === 12) { + labelwidth = 15.8 + } else { + labelwidth = 7.7 + } + break; + default: + } + } + + + if (labelwidth) { + this.props.form.setFieldsValue({labelwidth}) + } + } + handleSubmit = (e) => { e.preventDefault() @@ -437,7 +481,7 @@ message: this.props.dict['form.required.input'] + item.label + '!' } ] - })(<InputNumber min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/>)} + })(<InputNumber onChange={(value) => this.changeVal(value, item.key)} min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/>)} </Form.Item> </Col> ) diff --git a/src/views/menudesign/menuform/index.scss b/src/views/menudesign/menuform/index.scss index 71a1a33..fb20291 100644 --- a/src/views/menudesign/menuform/index.scss +++ b/src/views/menudesign/menuform/index.scss @@ -7,4 +7,10 @@ .ant-input-number { width: 100%; } + .ant-form-item { + height: 50px; + .ant-form-explain { + font-size: 12px; + } + } } \ No newline at end of file diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index bd6570b..63d48bd 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -416,7 +416,7 @@ components: [], viewType: 'menu', style: { - backgroundColor: '#ffffff', backgroundImage: '', paddingLeft: '20px', paddingRight: '20px' + backgroundColor: '#ffffff', backgroundImage: '' } } } @@ -778,7 +778,7 @@ EasyCode: '', Template: 'webPage', TypeCharOne: sessionStorage.getItem('kei_no'), - Typename: 'pc', + Typename: 'mob', MenuName: config.MenuName || '', PageParam: JSON.stringify({Template: 'webPage'}), open_edition: config.open_edition, @@ -848,7 +848,7 @@ EasyCode: '', Template: item.type, TypeCharOne: sessionStorage.getItem('kei_no'), - Typename: 'pc', + Typename: 'mob', MenuName: item.name || '', PageParam: JSON.stringify({Template: item.type}), open_edition: item.open_edition || '', diff --git a/src/views/mobdesign/menuform/index.scss b/src/views/mobdesign/menuform/index.scss index 71a1a33..fb20291 100644 --- a/src/views/mobdesign/menuform/index.scss +++ b/src/views/mobdesign/menuform/index.scss @@ -7,4 +7,10 @@ .ant-input-number { width: 100%; } + .ant-form-item { + height: 50px; + .ant-form-explain { + font-size: 12px; + } + } } \ No newline at end of file diff --git a/src/views/pcdesign/menuform/index.scss b/src/views/pcdesign/menuform/index.scss index 71a1a33..fb20291 100644 --- a/src/views/pcdesign/menuform/index.scss +++ b/src/views/pcdesign/menuform/index.scss @@ -7,4 +7,10 @@ .ant-input-number { width: 100%; } + .ant-form-item { + height: 50px; + .ant-form-explain { + font-size: 12px; + } + } } \ No newline at end of file -- Gitblit v1.8.0