From 1d395e6d750fe91082c99a15e355ab2841ed65c6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 04 一月 2024 17:49:21 +0800 Subject: [PATCH] 2024-01-04 --- src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 12 src/tabviews/custom/components/card/cardcellList/index.jsx | 2 src/components/mkPicture/index.jsx | 17 src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 99 ------ src/menu/components/table/base-table/columns/editColumn/index.jsx | 2 src/menu/components/chart/antv-dashboard/chartcompile/index.jsx | 195 +---------- src/menu/components/card/cardcellcomponent/index.jsx | 8 src/components/mkPicture/index.scss | 3 src/tabviews/zshare/normalTable/index.jsx | 2 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 9 src/menu/components/chart/antv-scatter/chartcompile/index.jsx | 187 +---------- src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx | 70 +-- src/menu/components/table/base-table/columns/editColumn/formconfig.jsx | 12 src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx | 129 ++----- /dev/null | 10 src/menu/components/card/cardcellcomponent/formconfig.jsx | 12 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 2 src/menu/components/chart/chart-custom/chartcompile/index.jsx | 6 src/tabviews/custom/components/share/normalTable/index.jsx | 2 src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx | 135 ++++---- src/menu/components/chart/antv-scatter/chartcompile/index.scss | 5 src/menu/components/chart/antv-dashboard/chartcompile/index.scss | 7 22 files changed, 255 insertions(+), 671 deletions(-) diff --git a/src/components/mkPicture/index.jsx b/src/components/mkPicture/index.jsx index e4b8f39..6ddb479 100644 --- a/src/components/mkPicture/index.jsx +++ b/src/components/mkPicture/index.jsx @@ -9,6 +9,7 @@ class MkPicture extends Component { static propTpyes = { style: PropTypes.object, + lostTip: PropTypes.bool, scale: PropTypes.bool, url: PropTypes.string, urls: PropTypes.array, @@ -20,24 +21,26 @@ } UNSAFE_componentWillMount() { - const { url } = this.props + const { url, lostTip } = this.props if (url) { this.setState({url: url, lost: false}) this.checkUrl(url) } else { - this.setState({url: LostPng, lost: true}) + this.setState({url: lostTip ? LostPng: '', lost: true}) } } UNSAFE_componentWillReceiveProps (nextProps) { + const { lostTip } = this.props + if (nextProps.url) { if (nextProps.url !== this.state.url) { this.setState({url: nextProps.url, lost: false}) this.checkUrl(nextProps.url) } } else { - this.setState({url: LostPng, lost: true}) + this.setState({url: lostTip ? LostPng: '', lost: true}) } } @@ -63,9 +66,15 @@ } render() { - const { style, scale, urls } = this.props + const { style, scale, urls, lostTip } = this.props const { url, lost } = this.state + if (!lostTip && !url) { + return ( + <div className="ant-mk-picture empty" style={style}></div> + ) + } + return ( <div className={'ant-mk-picture' + (scale ? ' scale' : '') + (lost ? ' lost' : '')} diff --git a/src/components/mkPicture/index.scss b/src/components/mkPicture/index.scss index 3d6e51e..8922f76 100644 --- a/src/components/mkPicture/index.scss +++ b/src/components/mkPicture/index.scss @@ -6,6 +6,9 @@ .ant-mk-picture.lost { background-size: contain!important; } +.ant-mk-picture.empty { + background: transparent!important; +} .ant-mk-picture.scale { cursor: zoom-in; } \ No newline at end of file diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 3d140fc..6e42aff 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -159,7 +159,12 @@ if (this.record.eleType === 'number') { _options.push('decimal', 'format') } - } else if (this.record.eleType === 'picture' || this.record.eleType === 'video') { + } else if (this.record.eleType === 'picture') { + _options.push('url') + if (this.record.noValue === 'show') { + _options.push('lostTip') + } + } else if (this.record.eleType === 'video') { _options.push('url') } else { _options.push('value') @@ -341,7 +346,7 @@ return item }) }) - } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType'].includes(key)) { + } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType', 'noValue'].includes(key)) { let _options = this.getOptions() this.setState({ diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 2f83093..f0464b2 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -675,6 +675,18 @@ }, { type: 'radio', + key: 'lostTip', + label: '鍥剧墖缂哄け', + initVal: card.lostTip || 'true', + tooltip: '鍥剧墖鍦板潃涓嶅瓨鍦ㄦ椂锛屾槸鍚︽彁绀哄浘鐗囦涪澶便��', + required: false, + options: [ + { value: 'true', text: '鎻愮ず' }, + { value: 'false', text: '涓嶆彁绀�' } + ] + }, + { + type: 'radio', key: 'alignItems', label: '鍨傜洿瀵归綈', initVal: card.alignItems || '', diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index f0249c1..b58ca78 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -245,6 +245,10 @@ } else if (_card.eleType === 'picture') { _card.style = style delete _card.style.backgroundImage + delete _card.style.paddingTop + delete _card.style.paddingBottom + delete _card.style.paddingLeft + delete _card.style.paddingRight } else { _card.style = style } @@ -415,6 +419,10 @@ res.innerHeight = res.barHeight + (res.displayValue === 'true' ? fontSize + 2 : 0) } else if (res.eleType === 'picture') { delete res.style.backgroundImage + delete res.style.paddingTop + delete res.style.paddingBottom + delete res.style.paddingLeft + delete res.style.paddingRight } return res diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index 3b9d0e8..f0b3e10 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -407,27 +407,11 @@ value: 'false', label: '闅愯棌' }] - // }, { - // type: 'radio', - // field: 'transpose', - // label: '鍙樻崲', - // initval: card.transpose || 'false', - // tooltip: '妯旱鍧愭爣杞翠氦鎹�', - // forbid: card.chartType === 'line', - // required: false, - // options: [{ - // value: 'true', - // label: '鏄�' - // }, { - // value: 'false', - // label: '鍚�' - // }] }, { type: 'radio', field: 'show', label: '鏄剧ず', initval: card.show || 'value', - // tooltip: '褰撲娇鐢ㄨ嚜瀹氫箟璁剧疆鏃讹紝鍙湪鏄剧ず锛堝��/%锛夊鍗曠嫭璁剧疆鏄剧ず绫诲瀷銆傛敞锛氳嚜瀹氫箟涓虹┖鏃朵娇鐢ㄦ澶勮缃��', required: false, options: [{ value: 'value', @@ -450,34 +434,6 @@ controlFields: [ {field: 'labelColor', values: ['true']} ] - // }, { - // type: 'radio', - // field: 'labelColor', - // label: '鏍囨敞棰滆壊', - // initval: card.labelColor || 'system', - // tooltip: '浣跨敤绯荤粺鑹叉椂锛屼娇鐢ㄨ壊绯婚�夐」璁剧疆鐨勭郴缁熼鑹诧紝浣跨敤鑷畾涔変负棰滆壊璁剧疆涓畾涔夌殑鍥惧舰棰滆壊銆�', - // required: false, - // options: [{ - // value: 'system', - // label: '绯荤粺' - // }, { - // value: 'custom', - // label: '鑷畾涔�' - // }] - // }, { - // type: 'radio', - // field: 'labelValue', - // label: '鏍囨敞鍊�', - // initval: card.labelValue || 'default', - // tooltip: '鏍囨敞鍊肩殑鏄剧ず瑙勫垯銆�', - // required: false, - // options: [{ - // value: 'default', - // label: '榛樿' - // }, { - // value: 'zero', - // label: '闅愯棌 0 鍊�' - // }], }, { type: 'radio', field: 'adjust', @@ -533,20 +489,6 @@ value: 'false', label: '涓嶆樉绀�' }] - // }, { - // type: 'radio', - // field: 'coordinate', - // label: '鍧愭爣', - // initval: card.coordinate || 'angle', - // required: false, - // forbid: card.chartType === 'line', - // options: [{ - // value: 'angle', - // label: '浜岀淮鍧愭爣' - // }, { - // value: 'polar', - // label: '鏋佸潗鏍�' - // }] }, { type: 'checkbox', field: 'axis', @@ -585,47 +527,6 @@ controlFields: [ {field: 'color', notNull: true}, ] - // }, { - // type: 'radio', - // field: 'grid', - // label: '缃戞牸绾�', - // initval: card.grid || 'show', - // required: false, - // options: [{ - // value: 'show', - // label: '鏄剧ず' - // }, { - // value: 'hidden', - // label: '闅愯棌' - // }] - // }, { - // type: 'radio', - // field: 'y_line', - // label: 'y杞磋竟绾�', - // initval: card.y_line || 'hidden', - // tooltip: '鍥惧舰宸︿晶鎴栧彸渚х殑杈圭嚎銆�', - // required: false, - // options: [{ - // value: 'show', - // label: '鏄剧ず' - // }, { - // value: 'hidden', - // label: '闅愯棌' - // }] - // }, { - // type: 'radio', - // field: 'download', - // label: '瀵煎嚭鍥剧墖', - // initval: card.download || 'forbid', - // required: false, - // forbid: appType === 'mob', - // options: [{ - // value: 'forbid', - // label: '绂佺敤' - // }, { - // value: 'enable', - // label: '鍚敤' - // }] }, { type: 'radio', field: 'empty', diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx index b54089c..748ad3f 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx @@ -20,24 +20,24 @@ return [ { type: 'text', - key: 'title', + field: 'title', label: '鏍囬', - initVal: card.title, + initval: card.title, required: false }, { type: 'text', - key: 'name', + field: 'name', label: '缁勪欢鍚嶇О', - initVal: card.name, + initval: card.name, tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', required: true }, { type: 'number', - key: 'width', + field: 'width', label: '瀹藉害', - initVal: card.width, + initval: card.width, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', min: 1, max: 24, @@ -46,43 +46,42 @@ }, { type: 'styleInput', - key: 'height', + field: 'height', label: '鍥捐〃楂樺害', - initVal: card.height, + initval: card.height, tooltip: '鍥捐〃缁樺浘鍖哄煙鐨勯珮搴︼紝涓嶅寘鎷爣棰樺強鍐呭杈硅窛銆�', required: true, options: ['px', 'vh', 'vw'] }, { type: 'radio', - key: 'permission', + field: 'permission', label: '鏉冮檺楠岃瘉', - initVal: card.permission || 'false', + initval: card.permission || 'false', required: false, options: [ - {value: 'true', text: '鍚敤'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, ], forbid: !appType || ispop || isprint }, { type: 'radio', - key: 'cacheLocal', + field: 'cacheLocal', label: '鏈湴缂撳瓨', - initVal: card.cacheLocal || 'true', + initval: card.cacheLocal || 'true', required: false, options: [ - {value: 'true', text: '缁ф壙鑿滃崟'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, ], forbid: ispop || isprint }, { - type: 'select', - key: 'blacklist', + type: 'multiselect', + field: 'blacklist', label: '榛戝悕鍗�', - initVal: card.blacklist || [], - multi: true, + initval: card.blacklist || [], required: false, options: roleList, forbid: !!appType || isprint @@ -101,24 +100,24 @@ return [ { type: 'text', - key: 'label', + field: 'label', label: '鎸囨爣鍚嶇О', - initVal: card.label || '', + initval: card.label || '', required: false }, { type: 'select', - key: 'valueField', + field: 'valueField', label: '鏄剧ず鍊�', - initVal: card.valueField || '', + initval: card.valueField || '', required: true, options: yfields }, { type: 'number', - key: 'maxValue', + field: 'maxValue', label: '鏈�澶у��', - initVal: card.maxValue || 100, + initval: card.maxValue || 100, tooltip: '浠〃鐩樻渶澶у埢搴﹀��', min: 0, max: 999999, @@ -127,9 +126,9 @@ }, { type: 'number', - key: 'tickInterval', + field: 'tickInterval', label: '闂撮殧', - initVal: card.tickInterval || 10, + initval: card.tickInterval || 10, tooltip: '浠〃鐩樺埢搴﹂棿闅斿�笺��', min: 0, max: 999999, @@ -138,56 +137,58 @@ }, { type: 'radio', - key: 'percent', + field: 'percent', label: '鐧惧垎鐜�', - initVal: card.percent || 'true', + initval: card.percent || 'true', required: false, options: [{ value: 'true', - text: '浣跨敤' + label: '浣跨敤' }, { value: 'false', - text: '涓嶄娇鐢�' + label: '涓嶄娇鐢�' }] // }, { // type: 'radio', - // key: 'download', + // field: 'download', // label: '瀵煎嚭鍥剧墖', - // initVal: card.download || 'forbid', + // initval: card.download || 'forbid', // required: false, // forbid: appType === 'mob', // options: [{ // value: 'forbid', - // text: '绂佺敤' + // label: '绂佺敤' // }, { // value: 'enable', - // text: '鍚敤' + // label: '鍚敤' // }] }, // { // type: 'radio', - // key: 'empty', + // field: 'empty', // label: '绌哄�奸殣钘�', - // initVal: card.empty || 'show', + // initval: card.empty || 'show', // tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', // required: false, // options: [ - // {value: 'show', text: '鍚�'}, - // {value: 'hidden', text: '鏄�'}, + // {value: 'show', label: '鍚�'}, + // {value: 'hidden', label: '鏄�'}, // ], // }, { type: 'color', - key: 'tickColor', + field: 'tickColor', label: '鍒诲害绾�', - initVal: card.tickColor || '#CBCBCB', + initval: card.tickColor || '', + allowClear: true, required: false }, { type: 'color', - key: 'labelColor', + field: 'labelColor', label: '鎸囨爣棰滆壊', - initVal: card.labelColor || '#545454', + initval: card.labelColor || '', + allowClear: true, required: false } ] @@ -206,25 +207,25 @@ return [ { type: 'select', - key: 'labelField', + field: 'labelField', label: '鎸囨爣', - initVal: card.labelField || '', + initval: card.labelField || '', required: true, options: xfields }, { type: 'select', - key: 'valueField', + field: 'valueField', label: '鍊�', - initVal: card.valueField || '', + initval: card.valueField || '', required: true, options: yfields }, { type: 'number', - key: 'maxValue', + field: 'maxValue', label: '鏈�澶у��', - initVal: card.maxValue || 100, + initval: card.maxValue || 100, min: 0, max: 999999, decimal: 1, @@ -232,9 +233,9 @@ }, { type: 'number', - key: 'radius', + field: 'radius', label: '澶栫幆', - initVal: card.radius || 75, + initval: card.radius || 75, tooltip: '鍥惧舰鎵�鍗犲尯鍩熺殑鐧惧垎鐜囥��', min: 30, max: 100, @@ -243,9 +244,9 @@ }, { type: 'number', - key: 'fontSize', + field: 'fontSize', label: '瀛椾綋澶у皬', - initVal: card.fontSize || 28, + initval: card.fontSize || 28, min: 12, max: 300, decimal: 0, @@ -253,44 +254,46 @@ }, { type: 'radio', - key: 'percent', + field: 'percent', label: '鐧惧垎鐜�', - initVal: card.percent || 'true', + initval: card.percent || 'true', required: false, options: [{ value: 'true', - text: '浣跨敤' + label: '浣跨敤' }, { value: 'false', - text: '涓嶄娇鐢�' + label: '涓嶄娇鐢�' }] // }, { // type: 'radio', - // key: 'download', + // field: 'download', // label: '瀵煎嚭鍥剧墖', - // initVal: card.download || 'forbid', + // initval: card.download || 'forbid', // required: false, // forbid: appType === 'mob', // options: [{ // value: 'forbid', - // text: '绂佺敤' + // label: '绂佺敤' // }, { // value: 'enable', - // text: '鍚敤' + // label: '鍚敤' // }] }, { type: 'color', - key: 'backColor', + field: 'backColor', label: '鑳屾櫙鑹�', - initVal: card.backColor || '#ebedf0', + initval: card.backColor || '', + allowClear: true, required: false }, { type: 'color', - key: 'labelColor', + field: 'labelColor', label: '瀛椾綋棰滆壊', - initVal: card.labelColor || '#8c8c8c', + initval: card.labelColor || '', + allowClear: true, required: false } ] diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx b/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx index 71f4cc1..e1d3c40 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx @@ -1,19 +1,18 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Modal, Form, Row, Col, Select, Radio, Tooltip, Input, InputNumber, notification, Tabs, Button } from 'antd' -import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons' +import { Modal, Form, notification, Tabs, Button } from 'antd' +import { EditOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' import { getBaseForm, getOptionForm, getRadioOptionForm } from './formconfig' import asyncComponent from '@/utils/asyncComponent' -import ColorSketch from '@/mob/colorsketch' import './index.scss' const { TabPane } = Tabs const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) -const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform')) +const ModalForm = asyncComponent(() => import('@/components/normalform/modalform')) class LineChartDrawerForm extends Component { static propTpyes = { @@ -61,156 +60,20 @@ }) } - getFields() { - const { formlist } = this.state - const { getFieldDecorator } = this.props.form - const fields = [] - - if (!formlist) { - return fields - } - - formlist.forEach((item, index) => { - if (item.hidden || item.forbid) return - - if (item.type === 'text') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'number') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺 - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Select mode={item.multi ? 'multiple' : ''}> - {item.options.map((option, index) => - <Select.Option key={index} value={option.field}> - {option.label} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'radio') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Radio.Group disabled={item.readonly}> - {item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - })} - </Radio.Group> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'color') { - fields.push( - <Col span={12} key={index} className="color-col"> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal - })( - <ColorSketch /> - )} - </Form.Item> - </Col> - ) - } - }) - return fields - } - onSubmit = () => { const { config } = this.props const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _plot = {...plot, ...values} - - this.setState({ - plot: _plot, - visible: false - }) - - this.props.plotchange({...config, plot: _plot}) - } + this.normalRef.handleConfirm().then(values => { + let _plot = {...plot, ...values} + + this.setState({ + plot: _plot, + visible: false + }) + + this.props.plotchange({...config, plot: _plot}) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -236,15 +99,13 @@ const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _plot = {...plot, ...values} + this.normalRef.handleConfirm().then(values => { + let _plot = {...plot, ...values} - this.setState({ - plot: _plot, - view: tab - }) - } + this.setState({ + plot: _plot, + view: tab + }) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -295,20 +156,10 @@ render() { const { config } = this.props - const { visible, plot, colorColumns, view, baseFormlist } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 6 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 18 } - } - } + const { visible, plot, colorColumns, view, baseFormlist, formlist } = this.state return ( - <div className="line-chart-drawer-form"> + <div className="dashboard-chart-drawer-form"> <EditOutlined title="缂栬緫" onClick={this.showDrawer} /> <Modal wrapClassName="mk-pop-modal" @@ -322,12 +173,10 @@ {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null} <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}> <TabPane tab="缁勪欢璁剧疆" key="base"> - <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> + <ModalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> <TabPane tab="鍥捐〃璁剧疆" key="normal"> - <Form {...formItemLayout}> - <Row gutter={16}>{this.getFields()}</Row> - </Form> + <ModalForm formlist={formlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.normalRef = inst}/> </TabPane> {plot ? <TabPane tab="棰滆壊璁剧疆" key="color"> <div> diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/index.scss b/src/menu/components/chart/antv-dashboard/chartcompile/index.scss index 9707fbb..c6b58b1 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/index.scss +++ b/src/menu/components/chart/antv-dashboard/chartcompile/index.scss @@ -1,15 +1,10 @@ -.line-chart-drawer-form { +.dashboard-chart-drawer-form { display: inline-block; > .anticon-edit { color: #1890ff; } } .menu-chart-edit-box { - .color-sketch-block { - position: relative; - top: 5px; - width: 240px; - } .color-add { float: right; margin-bottom: 10px; diff --git a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx index bf6ed7b..66afe79 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx @@ -20,24 +20,24 @@ return [ { type: 'text', - key: 'title', + field: 'title', label: '鏍囬', - initVal: card.title, + initval: card.title, required: false }, { type: 'text', - key: 'name', + field: 'name', label: '缁勪欢鍚嶇О', - initVal: card.name, + initval: card.name, tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', required: true }, { type: 'number', - key: 'width', + field: 'width', label: '瀹藉害', - initVal: card.width, + initval: card.width, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', min: 1, max: 24, @@ -46,43 +46,42 @@ }, { type: 'styleInput', - key: 'height', + field: 'height', label: '鍥捐〃楂樺害', - initVal: card.height, + initval: card.height, tooltip: '鍥捐〃缁樺浘鍖哄煙鐨勯珮搴︼紝涓嶅寘鎷爣棰樺強鍐呭杈硅窛銆�', required: true, options: ['px', 'vh', 'vw'] }, { type: 'radio', - key: 'permission', + field: 'permission', label: '鏉冮檺楠岃瘉', - initVal: card.permission || 'false', + initval: card.permission || 'false', required: false, options: [ - {value: 'true', text: '鍚敤'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, ], forbid: !appType || ispop || isprint }, { type: 'radio', - key: 'cacheLocal', + field: 'cacheLocal', label: '鏈湴缂撳瓨', - initVal: card.cacheLocal || 'true', + initval: card.cacheLocal || 'true', required: false, options: [ - {value: 'true', text: '缁ф壙鑿滃崟'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, ], forbid: ispop || isprint }, { - type: 'select', - key: 'blacklist', + type: 'multiselect', + field: 'blacklist', label: '榛戝悕鍗�', - initVal: card.blacklist || [], - multi: true, + initval: card.blacklist || [], required: false, options: roleList, forbid: !!appType || isprint @@ -103,126 +102,90 @@ return [ { type: 'select', - key: 'gender', + field: 'gender', label: '绫诲瀷', - initVal: card.gender || '', + initval: card.gender || '', required: true, options: xfields }, { type: 'select', - key: 'Xaxis', + field: 'Xaxis', label: 'X-杞�', - initVal: card.Xaxis || '', + initval: card.Xaxis || '', required: true, options: columns }, { type: 'select', - key: 'Yaxis', + field: 'Yaxis', label: 'Y-杞�', - initVal: card.Yaxis || '', + initval: card.Yaxis || '', required: true, options: yfields }, { type: 'radio', - key: 'shape', + field: 'shape', label: '褰㈢姸', - initVal: card.shape || 'circle', + initval: card.shape || 'circle', required: false, options: [{ value: 'circle', - text: 'circle' + label: '鍦嗗舰' }, { value: 'square', - text: 'square' + label: '鏂瑰舰' }] }, { type: 'radio', - key: 'tooltip', + field: 'tooltip', label: '鎮诞鎻愮ず', - initVal: card.tooltip || 'true', + initval: card.tooltip || 'true', required: false, options: [{ value: 'true', - text: '鏄剧ず' + label: '鏄剧ず' }, { value: 'false', - text: '闅愯棌' + label: '闅愯棌' }] - // }, { - // type: 'radio', - // key: 'download', - // label: '瀵煎嚭鍥剧墖', - // initVal: card.download || 'forbid', - // required: false, - // forbid: appType === 'mob', - // options: [{ - // value: 'forbid', - // text: '绂佺敤' - // }, { - // value: 'enable', - // text: '鍚敤' - // }] }, { type: 'radio', - key: 'empty', + field: 'empty', label: '绌哄�奸殣钘�', - initVal: card.empty || 'show', + initval: card.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, options: [ - {value: 'show', text: '鍚�'}, - {value: 'hidden', text: '鏄�'}, + {value: 'show', label: '鍚�'}, + {value: 'hidden', label: '鏄�'}, ], }, { type: 'text', - key: 'Xunit', + field: 'Xunit', label: 'X杞村崟浣�', - initVal: card.Xunit || '', + initval: card.Xunit || '', required: false }, { type: 'text', - key: 'Yunit', + field: 'Yunit', label: 'Y杞村崟浣�', - initVal: card.Yunit || '', + initval: card.Yunit || '', required: false }, { type: 'color', - key: 'color', - label: '鑹茬郴', - initVal: card.color || 'rgba(0, 0, 0, 0.65)', - tooltip: '鍧愭爣杞存彁绀烘枃瀛楀強绀轰緥鐨勯鑹层��', + field: 'lineColor', + label: '鍧愭爣杞撮鑹�', + initval: card.lineColor || '', + tooltip: '鍧愭爣杞寸嚎鐨勯鑹层��', + allowClear: true, required: false } - // , { - // type: 'select', - // key: 'interaction', - // label: '浜や簰鏁堟灉', - // initVal: card.interaction || [], - // multi: true, - // required: false, - // forbid: appType === 'mob', - // options: [ - // { value: 'element-active', label: '鍏冪礌鑱氱劍' }, - // { value: 'element-selected', label: '鍏冪礌閫変腑锛堝閫夛級' }, - // { value: 'element-single-selected', label: '鍏冪礌閫変腑锛堝崟閫夛級' }, - // // { value: 'active-region', label: '鑳屾櫙妗�' }, - // { value: 'view-zoom', label: '瑙嗗浘缂╂斁' }, - // { value: 'element-highlight', label: '鍏冪礌楂樹寒' }, - // { value: 'element-highlight-by-color', label: '鍚岃壊鍏冪礌楂樹寒' }, - // { value: 'element-highlight-by-x', label: '鍚孹杞村厓绱犻珮浜�' }, - // { value: 'legend-filter', label: '鍥句緥杩囨护' }, - // { value: 'legend-active', label: '鍥句緥鑱氱劍' }, - // { value: 'legend-highlight', label: '鍥句緥楂樹寒' }, - // { value: 'brush', label: '閫夋杩囨护' }, - // ] - // } ] } diff --git a/src/menu/components/chart/antv-scatter/chartcompile/index.jsx b/src/menu/components/chart/antv-scatter/chartcompile/index.jsx index 4d829ba..307f6b6 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-scatter/chartcompile/index.jsx @@ -1,16 +1,15 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Modal, Form, Row, Col, Select, Radio, Tooltip, Input, InputNumber, Tabs } from 'antd' -import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons' +import { Modal, Form, Tabs } from 'antd' +import { EditOutlined } from '@ant-design/icons' import { getBaseForm, getOptionForm } from './formconfig' import asyncComponent from '@/utils/asyncComponent' -import ColorSketch from '@/mob/colorsketch' import './index.scss' const { TabPane } = Tabs -const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform')) +const ModalForm = asyncComponent(() => import('@/components/normalform/modalform')) class LineChartDrawerForm extends Component { static propTpyes = { @@ -39,156 +38,20 @@ }) } - getFields() { - const { formlist } = this.state - const { getFieldDecorator } = this.props.form - const fields = [] - - if (!formlist) { - return fields - } - - formlist.forEach((item, index) => { - if (item.hidden || item.forbid) return - - if (item.type === 'text') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'number') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺 - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Select mode={item.multi ? 'multiple' : ''}> - {item.options.map((option, index) => - <Select.Option key={index} value={option.field || option.value}> - {option.label || option.text} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'radio') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Radio.Group disabled={item.readonly}> - {item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - })} - </Radio.Group> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'color') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal - })( - <ColorSketch /> - )} - </Form.Item> - </Col> - ) - } - }) - return fields - } - onSubmit = () => { const { config } = this.props const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _plot = {...plot, ...values} + this.normalRef.handleConfirm().then(values => { + let _plot = {...plot, ...values} - this.setState({ - plot: _plot, - visible: false - }) + this.setState({ + plot: _plot, + visible: false + }) - this.props.plotchange({...config, plot: _plot}) - } + this.props.plotchange({...config, plot: _plot}) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -208,13 +71,11 @@ const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - this.setState({ - plot: {...plot, ...values}, - view: tab - }) - } + this.normalRef.handleConfirm().then(values => { + this.setState({ + plot: {...plot, ...values}, + view: tab + }) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -228,17 +89,7 @@ render() { const { config } = this.props - const { view, visible, baseFormlist } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 6 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 18 } - } - } + const { view, visible, baseFormlist, formlist } = this.state return ( <div className="line-chart-drawer-form"> @@ -255,12 +106,10 @@ {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null} <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}> <TabPane tab="缁勪欢璁剧疆" key="base"> - <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> + <ModalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> <TabPane tab="鍥捐〃璁剧疆" key="normal"> - <Form {...formItemLayout}> - <Row gutter={16}>{this.getFields()}</Row> - </Form> + <ModalForm formlist={formlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.normalRef = inst}/> </TabPane> </Tabs> </Modal> diff --git a/src/menu/components/chart/antv-scatter/chartcompile/index.scss b/src/menu/components/chart/antv-scatter/chartcompile/index.scss index 5518e39..7100c66 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/index.scss +++ b/src/menu/components/chart/antv-scatter/chartcompile/index.scss @@ -5,11 +5,6 @@ } } .menu-chart-edit-box { - .color-sketch-block { - position: relative; - top: 5px; - width: 240px; - } .color-add { float: right; margin-bottom: 10px; diff --git a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx index 724fe6a..7294517 100644 --- a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx @@ -20,35 +20,35 @@ return [ { type: 'text', - key: 'title', + field: 'title', label: '鏍囬', - initVal: card.title, + initval: card.title, required: false }, { type: 'text', - key: 'name', + field: 'name', label: '缁勪欢鍚嶇О', - initVal: card.name, + initval: card.name, tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', required: true }, { type: 'radio', - key: 'chartType', + field: 'chartType', label: '鍥捐〃绫诲瀷', - initVal: card.chartType || 'antv', + initval: card.chartType || 'antv', required: true, options: [ - { value: 'antv', text: 'antv' }, - { value: 'echarts', text: 'echarts' } + { value: 'antv', label: 'antv5.0' }, + { value: 'echarts', label: 'echarts' } ] }, { type: 'number', - key: 'width', + field: 'width', label: '瀹藉害', - initVal: card.width, + initval: card.width, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', min: 1, max: 24, @@ -57,67 +57,45 @@ }, { type: 'styleInput', - key: 'height', + field: 'height', label: '鍥捐〃楂樺害', - initVal: card.height, + initval: card.height, tooltip: '鍥捐〃缁樺浘鍖哄煙鐨勯珮搴︼紝涓嶅寘鎷爣棰樺強鍐呭杈硅窛銆�', required: true, options: ['px', 'vh', 'vw'] }, { type: 'radio', - key: 'permission', + field: 'permission', label: '鏉冮檺楠岃瘉', - initVal: card.permission || 'false', + initval: card.permission || 'false', required: false, options: [ - {value: 'true', text: '鍚敤'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, ], forbid: !appType || ispop || isprint }, { type: 'radio', - key: 'cacheLocal', + field: 'cacheLocal', label: '鏈湴缂撳瓨', - initVal: card.cacheLocal || 'true', + initval: card.cacheLocal || 'true', required: false, options: [ - {value: 'true', text: '缁ф壙鑿滃崟'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, ], forbid: ispop || isprint }, { - type: 'select', - key: 'blacklist', + type: 'multiselect', + field: 'blacklist', label: '榛戝悕鍗�', - initVal: card.blacklist || [], - multi: true, + initval: card.blacklist || [], required: false, options: roleList, forbid: !!appType || isprint - }, - // { - // type: 'cascader', - // key: 'linkmenu', - // label: '鍏宠仈鑿滃崟', - // initVal: card.linkmenu || [], - // tooltip: '鍦ㄤ娇鐢ㄦ煴褰㈠浘涓旀湭鍚敤鑷畾涔夎缃椂鏈夋晥銆�', - // required: false, - // forbid: appType === 'pc' || appType === 'mob', - // options: menulist - // }, - // { - // type: 'select', - // key: 'linkmenu', - // label: '鍏宠仈鑿滃崟', - // initVal: card.linkmenu || '', - // tooltip: '鍙屽嚮鏌辩姸鍥撅紝浼氭墦寮�鍏宠仈鐨勮彍鍗曘��', - // required: false, - // forbid: appType !== 'pc', - // options: menulist - // }, - + } ] } \ No newline at end of file diff --git a/src/menu/components/chart/chart-custom/chartcompile/index.jsx b/src/menu/components/chart/chart-custom/chartcompile/index.jsx index 5ab0fa2..562c075 100644 --- a/src/menu/components/chart/chart-custom/chartcompile/index.jsx +++ b/src/menu/components/chart/chart-custom/chartcompile/index.jsx @@ -9,7 +9,7 @@ // import './index.scss' const { TabPane } = Tabs -const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform')) +const ModalForm = asyncComponent(() => import('@/components/normalform/modalform')) const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) class CustomChartDrawerForm extends Component { @@ -104,10 +104,10 @@ {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null} <Tabs activeKey={view} onChange={this.changeTab}> <TabPane tab="缁勪欢璁剧疆" key="base"> - <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> + <ModalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> {plot ? <TabPane tab="JS" key="JS"> - {plot.chartType === 'antv' ? <div>鍏ュ弬锛欳hart銆� DataSet銆� wrap锛坉om鑺傜偣锛夈�乨ata銆� config</div> : <div>鍏ュ弬锛歟charts銆� DataSet銆� wrap锛坉om鑺傜偣锛夈�� data銆� config</div>} + {plot.chartType === 'antv' ? <div>鍏ュ弬锛欳hart銆� chartId锛坉om鑺傜偣id锛夈�乨ata銆� config</div> : <div>鍏ュ弬锛歟charts銆� chartId锛坉om鑺傜偣id锛夈�� data銆� config</div>} <CodeMirror mode="text/javascript" theme="cobalt" value={plot.script} onChange={this.onChange} /> </TabPane> : null} </Tabs> diff --git a/src/menu/components/share/normalform/index.jsx b/src/menu/components/share/normalform/index.jsx deleted file mode 100644 index 56c3f9a..0000000 --- a/src/menu/components/share/normalform/index.jsx +++ /dev/null @@ -1,150 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Tooltip, InputNumber, Select, Radio, Cascader } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' - -import asyncComponent from '@/utils/asyncComponent' -import './index.scss' - -const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) -const StyleInput = asyncComponent(() => import('@/components/normalform/modalform/styleInput')) - -class SettingForm extends Component { - static propTpyes = { - formlist: PropTypes.array, // 琛ㄥ崟 - inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 - } - - state = { - formlist: [], - } - - UNSAFE_componentWillMount() { - const { formlist } = this.props - - this.setState({formlist: fromJS(formlist).toJS()}) - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - optionChange = (item, val) => { - if (item.key === 'click') { - this.setState({formlist: fromJS(this.state.formlist).toJS().map(cell => { - if (!['menu', 'menuType', 'open', 'joint', 'menus'].includes(cell.key)) return cell - - if (val === 'menu') { - cell.hidden = !['menu', 'open', 'joint'].includes(cell.key) - } else if (val === 'menus') { - cell.hidden = !['menuType', 'open', 'joint', 'menus'].includes(cell.key) - } else { - cell.hidden = true - } - - return cell - })}) - } - } - - getFields() { - const { formlist } = this.state - const { getFieldDecorator } = this.props.form - - const fields = [] - - formlist.forEach((item, index) => { - if (item.hidden || item.forbid) return - - let content = null - let label = item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> : item.label - - if (item.type === 'text') { - content = (<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit}/>) - } else if (item.type === 'number') { - content = (<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.handleSubmit}/>) - } else if (item.type === 'styleInput') { - content = (<StyleInput config={item}/>) - } else if (item.type === 'select') { - content = (<Select mode={item.multi ? 'multiple' : ''}> - {item.options.map((option, index) => - <Select.Option key={index} value={option.field || option.value}> - {option.label || option.text} - </Select.Option> - )} - </Select>) - } else if (item.type === 'radio') { - content = (<Radio.Group onChange={(e) => this.optionChange(item, e.target.value)}> - {item.options.map(option => { - return ( - <Radio key={option.value} value={option.field || option.value}>{option.label || option.text}</Radio> - ) - })} - </Radio.Group>) - } else if (item.type === 'cascader') { - content = (<Cascader options={item.options} placeholder=""/>) - } else if (item.type === 'table') { - content = (<MKTable columns={item.columns || []} actions={item.actions || []}/>) - } - - if (!content) return - - fields.push( - <Col span={item.span || 12} key={index}> - <Form.Item label={label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: item.required, - message: (item.type === 'select' || item.type === 'cascader' ? '璇烽�夋嫨' : '璇疯緭鍏�') + item.label + '!' - } - ] - })(content)} - </Form.Item> - </Col> - ) - }) - - return fields - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <div className="plot-base-wrap"> - <Form {...formItemLayout}><Row gutter={16}>{this.getFields()}</Row></Form> - </div> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/components/share/normalform/index.scss b/src/menu/components/share/normalform/index.scss deleted file mode 100644 index 4b2bfcd..0000000 --- a/src/menu/components/share/normalform/index.scss +++ /dev/null @@ -1,10 +0,0 @@ -.plot-base-wrap { - .ant-col-24 { - .ant-form-item-label { - width: 16.5%; - } - .ant-form-item-control-wrapper { - width: 83.5%; - } - } -} \ No newline at end of file diff --git a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx index afb5789..44db9f8 100644 --- a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx @@ -401,6 +401,18 @@ }, { type: 'radio', + key: 'lostTip', + label: '鍥剧墖缂哄け', + initVal: card.lostTip || 'true', + tooltip: '鍥剧墖鍦板潃涓嶅瓨鍦ㄦ椂锛屾槸鍚︽彁绀哄浘鐗囦涪澶便��', + required: false, + options: [ + { value: 'true', text: '鎻愮ず' }, + { value: 'false', text: '涓嶆彁绀�' } + ] + }, + { + type: 'radio', key: 'perspective', label: '瀛楁閫忚', initVal: card.perspective || '', diff --git a/src/menu/components/table/base-table/columns/editColumn/index.jsx b/src/menu/components/table/base-table/columns/editColumn/index.jsx index 3c5bc6b..e4494c0 100644 --- a/src/menu/components/table/base-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx @@ -13,7 +13,7 @@ number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'fieldlength', 'blacklist', 'nameField'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'prefix', 'postfix', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span', 'lostTip'], video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'fieldlength', 'blacklist', 'aspectRatio'], colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index ccd6013..b535832 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -361,6 +361,18 @@ }, { type: 'radio', + key: 'lostTip', + label: '鍥剧墖缂哄け', + initVal: card.lostTip || 'true', + tooltip: '鍥剧墖鍦板潃涓嶅瓨鍦ㄦ椂锛屾槸鍚︽彁绀哄浘鐗囦涪澶便��', + required: false, + options: [ + { value: 'true', text: '鎻愮ず' }, + { value: 'false', text: '涓嶆彁绀�' } + ] + }, + { + type: 'radio', key: 'perspective', label: '瀛楁閫忚', initVal: card.perspective || '', diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 8c88120..e2900f5 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -14,7 +14,7 @@ number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'blacklist', 'nameField'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span', 'lostTip'], video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'blacklist', 'aspectRatio'], colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index a958493..cd0962e 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -701,7 +701,7 @@ urls.forEach((u, i) => { contents.push(<div className={'ant-col ant-col-' + card.width} key={card.uuid + i} style={_style_} span={card.width}> <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> - <MkPicture style={_imagestyle} scale={scale} url={u} urls={urls}/> + <MkPicture style={_imagestyle} lostTip={card.lostTip !== 'false'} scale={scale} url={u} urls={urls}/> </div> </div>) }) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 01eacd8..115e30a 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -268,7 +268,7 @@ <div> {photos.map((url, i) => ( <Col key={i} span={col.span || 24}> - <MkPicture style={{paddingTop, backgroundSize: col.backgroundSize || 'cover'}} scale={scale} url={url} urls={photos}/> + <MkPicture lostTip={col.lostTip !== 'false'} style={{paddingTop, backgroundSize: col.backgroundSize || 'cover'}} scale={scale} url={url} urls={photos}/> </Col> ))} </div> diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 300e98e..44d6ab9 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -655,7 +655,7 @@ return ( <div className="picture-col"> {photos.map((url, i) => (<Col key={i} span={item.span || 24}> - <MkPicture style={style} scale={scale} url={url} urls={photos}/> + <MkPicture lostTip={item.lostTip !== 'false'} style={style} scale={scale} url={url} urls={photos}/> </Col>))} </div> ) -- Gitblit v1.8.0