From aaa6ac0ea146ba9e26b1100b8be662b1d7ad8124 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 19 四月 2022 01:02:51 +0800
Subject: [PATCH] 2022-04-19

---
 src/menu/components/card/cardcellcomponent/dragaction/card.jsx   |   18 ++++
 src/menu/components/card/cardcellcomponent/formconfig.jsx        |   61 ++++++++++++++-
 src/tabviews/custom/components/card/cardcellList/index.jsx       |   40 ++++++++-
 src/tabviews/custom/components/group/normal-group/index.jsx      |    2 
 src/menu/components/card/cardcellcomponent/elementform/index.jsx |   47 ++++++++---
 src/menu/components/group/normal-group/index.jsx                 |    2 
 src/menu/components/group/normal-group/index.scss                |    9 ++
 src/menu/components/group/normal-group/options.jsx               |   12 +++
 src/tabviews/custom/components/card/data-card/index.jsx          |   10 ++
 src/tabviews/custom/components/group/normal-group/index.scss     |   11 ++
 src/menu/components/card/data-card/index.jsx                     |    2 
 11 files changed, 184 insertions(+), 30 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx
index 8dd92c0..480b17c 100644
--- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx
+++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx
@@ -75,6 +75,10 @@
       )
     } else if (card.eleType === 'text' || card.eleType === 'number') {
       let val = `${card.prefix || ''}${card.datatype === 'static' ? (card.value || '') : (card.field || '')}${card.postfix || ''}`
+      if (card.fixStyle === 'alone') {
+        let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight}
+        val = <><span style={_s}>{card.prefix || ''}</span>{`${card.datatype === 'static' ? (card.value || '') : (card.field || '')}`}<span style={_s}>{card.postfix || ''}</span></>
+      }
       return (
         <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div>
       )
@@ -142,15 +146,25 @@
         </div>
       )
     } else if (card.eleType === 'currentDate') {
+      let val = `${card.prefix || ''}${moment().format(card.dateFormat)}${card.postfix || ''}`
+      if (card.fixStyle === 'alone') {
+        let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight}
+        val = <><span style={_s}>{card.prefix || ''}</span>{moment().format(card.dateFormat)}<span style={_s}>{card.postfix || ''}</span></>
+      }
       return (
         <div className="ant-mk-date">
-          {`${card.prefix || ''}${moment().format(card.dateFormat)}${card.postfix || ''}`}
+          {val}
         </div>
       )
     } else if (card.eleType === 'formula') {
+      let val = `${card.prefix || ''}${card.formula}${card.postfix || ''}`
+      if (card.fixStyle === 'alone') {
+        let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight}
+        val = <><span style={_s}>{card.prefix || ''}</span>{card.formula}<span style={_s}>{card.postfix || ''}</span></>
+      }
       return (
         <div className="ant-mk-date">
-          {`${card.prefix || ''}${card.formula}${card.postfix || ''}`}
+          {val}
         </div>
       )
     }
diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
index 8495d20..5395ef5 100644
--- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -15,8 +15,8 @@
 
 const cardTypeOptions = {
   sequence: ['eleType', 'width'],
-  text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'noValue', 'bgImage'],
-  number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'noValue'],
+  text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'noValue', 'bgImage', 'fixStyle'],
+  number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'],
   picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'],
   video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'noValue'],
   icon: ['eleType', 'icon', 'datatype', 'width'],
@@ -24,8 +24,8 @@
   splitline: ['eleType', 'color', 'width', 'borderWidth'],
   barcode: ['eleType', 'datatype', 'width', 'barHeight', 'displayValue', 'interval', 'noValue'],
   qrcode: ['eleType', 'datatype', 'width', 'qrWidth', 'color', 'url', 'noValue'],
-  currentDate: ['eleType', 'width', 'dateFormat', 'prefix', 'postfix'],
-  formula: ['eleType', 'width', 'height', 'prefix', 'postfix', 'eval', 'formula'],
+  currentDate: ['eleType', 'width', 'dateFormat', 'prefix', 'postfix', 'fixStyle'],
+  formula: ['eleType', 'width', 'height', 'prefix', 'postfix', 'eval', 'formula', 'noValue', 'fixStyle'],
 }
 
 class MainSearch extends Component {
@@ -43,12 +43,13 @@
     datatype: '',
     showType: '',
     showInfo: 'false',
+    fixStyle: '',
     link: ''
   }
 
   UNSAFE_componentWillMount () {
     const { card, config } = this.props
-    let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo)
+    let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo, card.fixStyle || '')
     
     this.setState({
       link: card.link,
@@ -56,6 +57,7 @@
       datatype: card.datatype,
       showType: card.showType || 'line',
       showInfo: card.showInfo || 'false',
+      fixStyle: card.fixStyle || '',
       formlist: this.props.formlist.map(item => {
         item.hidden = !_options.includes(item.key)
 
@@ -99,7 +101,7 @@
     })
   }
 
-  getOptions = (eleType, datatype, link, showType, showInfo) => {
+  getOptions = (eleType, datatype, link, showType, showInfo, fixStyle) => {
     let _options = fromJS(cardTypeOptions[eleType]).toJS() // 閫夐」鍒楄〃
     
     if (['text', 'number', 'picture', 'slider', 'barcode', 'qrcode', 'video'].includes(eleType)) {
@@ -135,6 +137,9 @@
         _options.push('tooltip')
       }
     }
+    if (_options.includes('fixStyle') && fixStyle === 'alone') {
+      _options.push('fixSize', 'fixColor', 'fixLeft', 'fixRight')
+    }
 
     return _options
   }
@@ -147,10 +152,10 @@
    */
   selectChange = (key, value, option) => {
     const { card, config } = this.props
-    const { datatype, eleType, showType, showInfo } = this.state
+    const { datatype, eleType, showType, showInfo, fixStyle } = this.state
 
     if (key === 'eleType') {
-      let _options = this.getOptions(value, datatype, '', showType, showInfo)
+      let _options = this.getOptions(value, datatype, '', showType, showInfo, fixStyle)
       
       let _formlist = this.state.formlist.map(item => {
         item.hidden = !_options.includes(item.key)
@@ -193,6 +198,8 @@
           item.required = value !== 'qrcode'
         } else if (item.key === 'showInfo') {
           item.initVal = showInfo
+        } else if (item.key === 'fixStyle') {
+          item.initVal = fixStyle
         }
 
         return item
@@ -222,7 +229,7 @@
         this.props.form.setFieldsValue({value: option.props.title})
       }
     } else if (key === 'link') {
-      let _options = this.getOptions(eleType, datatype, value, showType, showInfo)
+      let _options = this.getOptions(eleType, datatype, value, showType, showInfo, fixStyle)
       this.setState({
         link: value,
         formlist: this.state.formlist.map(item => {
@@ -237,11 +244,11 @@
   }
 
   onChange = (e, key) => {
-    const { eleType, datatype, link, showType, showInfo } = this.state
+    const { eleType, datatype, link, showType, showInfo, fixStyle } = this.state
     let value = e.target.value
 
     if (key === 'datatype') {
-      let _options = this.getOptions(eleType, value, link, showType, showInfo)
+      let _options = this.getOptions(eleType, value, link, showType, showInfo, fixStyle)
 
       this.setState({
         datatype: value,
@@ -252,7 +259,7 @@
         })
       })
     } else if (key === 'link') {
-      let _options = this.getOptions(eleType, datatype, value, showType, showInfo)
+      let _options = this.getOptions(eleType, datatype, value, showType, showInfo, fixStyle)
       this.setState({
         link: value,
         formlist: this.state.formlist.map(item => {
@@ -264,7 +271,7 @@
         })
       })
     } else if (key === 'showInfo') {
-      let _options = this.getOptions(eleType, datatype, link, showType, value)
+      let _options = this.getOptions(eleType, datatype, link, showType, value, fixStyle)
       this.setState({
         showInfo: value,
         formlist: this.state.formlist.map(item => {
@@ -276,7 +283,19 @@
       this.setState({
         showType: value
       }, () => {
-        let _options = this.getOptions(eleType, datatype, link, value, showInfo)
+        let _options = this.getOptions(eleType, datatype, link, value, showInfo, fixStyle)
+        this.setState({
+          formlist: this.state.formlist.map(item => {
+            item.hidden = !_options.includes(item.key)
+            return item
+          })
+        })
+      })
+    } else if (key === 'fixStyle') {
+      this.setState({
+        fixStyle: value
+      }, () => {
+        let _options = this.getOptions(eleType, datatype, link, showType, showInfo, value)
         this.setState({
           formlist: this.state.formlist.map(item => {
             item.hidden = !_options.includes(item.key)
diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx
index 48c492b..c664528 100644
--- a/src/menu/components/card/cardcellcomponent/formconfig.jsx
+++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -47,11 +47,13 @@
     { value: 'dynamic', text: '鍔ㄦ��' },
     { value: 'static', text: '闈欐��' }
   ]
+  let tooltip = ''
   if (cardCell.$cardType === 'extendCard') {
-    card.datatype = 'static'
-    dataTypes = [
-      { value: 'static', text: '闈欐��' }
-    ]
+    // card.datatype = 'static'
+    // dataTypes = [
+    //   { value: 'static', text: '闈欐��' }
+    // ]
+    tooltip = '鍦ㄦ墿灞曞崱鐗囦腑锛屽姩鎬佹暟鎹樉绀哄�间负鑾峰彇鍒扮殑绗竴琛屾暟鎹��'
   }
 
   let forms = [
@@ -75,6 +77,7 @@
       key: 'datatype',
       label: '鏁版嵁绫诲瀷',
       initVal: card.datatype || 'static',
+      tooltip,
       required: true,
       options: dataTypes
     },
@@ -533,6 +536,56 @@
         { value: 'hide', text: '闅愯棌' }
       ]
     },
+    {
+      type: 'radio',
+      key: 'fixStyle',
+      label: '鍓嶅悗缂�',
+      initVal: card.fixStyle || '',
+      tooltip: '鍓嶇紑涓庡悗缂�锛屼娇鐢ㄤ笌鍐呭缁熶竴鐨勬牱寮忚繕鏄嫭绔嬫牱寮忋��',
+      required: false,
+      options: [
+        { value: '', text: '缁熶竴鏍峰紡' },
+        { value: 'alone', text: '鐙珛鏍峰紡' }
+      ]
+    },
+    {
+      type: 'number',
+      key: 'fixSize',
+      min: 10,
+      max: 100,
+      label: '瀛椾綋澶у皬',
+      initVal: card.fixSize || 14,
+      tooltip: '鍓嶇紑銆佸悗缂�鐨勫瓧浣撳ぇ灏忋��',
+      required: true
+    },
+    {
+      type: 'color',
+      key: 'fixColor',
+      label: '瀛椾綋棰滆壊',
+      initVal: card.fixColor || 'rgba(0, 0, 0, 0.65)',
+      tooltip: '鍓嶇紑銆佸悗缂�鐨勫瓧浣撻鑹层��',
+      required: true
+    },
+    {
+      type: 'number',
+      key: 'fixLeft',
+      min: 0,
+      max: 1000,
+      label: '宸﹁竟璺�',
+      initVal: card.fixLeft || 0,
+      tooltip: '鍓嶇紑銆佸悗缂�鐨勫乏杈硅窛銆�',
+      required: false
+    },
+    {
+      type: 'number',
+      key: 'fixRight',
+      min: 0,
+      max: 1000,
+      label: '鍙宠竟璺�',
+      initVal: card.fixRight || 0,
+      tooltip: '鍓嶇紑銆佸悗缂�鐨勫彸杈硅窛銆�',
+      required: false
+    },
   ]
 
   return forms
diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx
index 6634d0d..7c031be 100644
--- a/src/menu/components/card/data-card/index.jsx
+++ b/src/menu/components/card/data-card/index.jsx
@@ -435,7 +435,7 @@
       newcard = {
         uuid: Utils.getuuid(),
         $cardType: 'extendCard',
-        setting: { width: 6, type: 'simple', click: 'button'},
+        setting: { width: 6, type: 'simple', click: ''},
         style: {
           height,
           borderWidth: '1px', borderColor: '#e8e8e8',
diff --git a/src/menu/components/group/normal-group/index.jsx b/src/menu/components/group/normal-group/index.jsx
index 1b47f0b..509829e 100644
--- a/src/menu/components/group/normal-group/index.jsx
+++ b/src/menu/components/group/normal-group/index.jsx
@@ -179,7 +179,7 @@
     }
 
     return (
-      <div className={'menu-group-edit-box' + (paddingTop ? ' padding' : '')} style={_style} onClick={this.clickComponent} id={group.uuid}>
+      <div className={'menu-group-edit-box ' + (paddingTop ? 'padding ' : '') + (group.setting.layout || '')} style={_style} onClick={this.clickComponent} id={group.uuid}>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
             <NormalForm title="鍒嗙粍璁剧疆" width={700} update={this.updateWrap} getForms={this.getWrapForms}>
diff --git a/src/menu/components/group/normal-group/index.scss b/src/menu/components/group/normal-group/index.scss
index 54c6b75..63a4dd9 100644
--- a/src/menu/components/group/normal-group/index.scss
+++ b/src/menu/components/group/normal-group/index.scss
@@ -38,3 +38,12 @@
   z-index: 1;
   box-shadow: 0px 0px 4px #1890ff;
 }
+.menu-group-edit-box.flex {
+  >.group-shell-inner {
+    display: flex;
+    width: 100%;
+    >.mk-component-card {
+      flex: 1;
+    }
+  }
+}
diff --git a/src/menu/components/group/normal-group/options.jsx b/src/menu/components/group/normal-group/options.jsx
index 114af09..9c6f2e6 100644
--- a/src/menu/components/group/normal-group/options.jsx
+++ b/src/menu/components/group/normal-group/options.jsx
@@ -105,6 +105,18 @@
       forbid: !appType
     },
     {
+      type: 'radio',
+      field: 'layout',
+      label: '鍏冪礌甯冨眬',
+      initval: setting.layout || 'grid',
+      tooltip: '鍒嗙粍涓厓绱犵殑鎺掑垪鏂瑰紡',
+      required: false,
+      options: [
+        {value: 'grid', label: '鏍呮牸甯冨眬'},
+        {value: 'flex', label: '寮规�у竷灞�'},
+      ]
+    },
+    {
       type: 'multiselect',
       field: 'blacklist',
       label: '榛戝悕鍗�',
diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx
index 64352f0..4b3f375 100644
--- a/src/tabviews/custom/components/card/cardcellList/index.jsx
+++ b/src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -290,7 +290,12 @@
       }
 
       if (val !== '') {
-        val = `${card.prefix || ''}${val}${card.postfix || ''}`
+        if (card.fixStyle === 'alone') {
+          let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight}
+          val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></>
+        } else {
+          val = `${card.prefix || ''}${val}${card.postfix || ''}`
+        }
       }
 
       if (card.marks) {
@@ -366,7 +371,12 @@
       }
 
       if (val !== '') {
-        val = `${card.prefix || ''}${val}${card.postfix || ''}`
+        if (card.fixStyle === 'alone') {
+          let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight}
+          val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></>
+        } else {
+          val = `${card.prefix || ''}${val}${card.postfix || ''}`
+        }
       }
       
       if (card.marks) {
@@ -575,10 +585,20 @@
         </Col>
       )
     } else if (card.eleType === 'currentDate') {
+      let val = card.dateFormat ? moment().format(card.dateFormat) : ''
+      if (val !== '') {
+        if (card.fixStyle === 'alone') {
+          let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight}
+          val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></>
+        } else {
+          val = `${card.prefix || ''}${val}${card.postfix || ''}`
+        }
+      }
+
       return (
         <Col key={card.uuid} span={card.width}>
           <div className="ant-mk-date" style={card.style}>
-            {card.dateFormat ? `${card.prefix || ''}${moment().format(card.dateFormat)}${card.postfix || ''}` : null}
+            {val}
           </div>
         </Col>
       )
@@ -628,12 +648,22 @@
         val = _val === undefined ? '' : _val
       }
 
+      if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘�
+        return null
+      }
+
       if (val !== '') {
-        val = `${card.prefix || ''}${val}${card.postfix || ''}`
-        if (card.eval === 'false') {
+        if (val && typeof(val) === 'string') {
           val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, '&nbsp;')
           val = <span dangerouslySetInnerHTML={{__html: val}}></span>
         }
+
+        if (card.fixStyle === 'alone') {
+          let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight}
+          val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></>
+        } else {
+          val = `${card.prefix || ''}${val}${card.postfix || ''}`
+        }
       }
 
       if (card.marks) {
diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx
index 1e248d6..735190a 100644
--- a/src/tabviews/custom/components/card/data-card/index.jsx
+++ b/src/tabviews/custom/components/card/data-card/index.jsx
@@ -752,6 +752,12 @@
       }
     }
 
+    let extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'}
+
+    if (data && data[0]) {
+      extendData = {...extendData, ...data[0]}
+    }
+
     return (
       <div className="custom-data-card-box" style={config.style}>
         {loading ?
@@ -777,7 +783,7 @@
             {offset ? <Col span={offset} style={{height: '10px'}}> </Col> : null}
             {precards.map((item, index) => (
               <Col key={'pre' + index} className="extend-card" span={item.setting.width || 6}>
-                <CardItem card={item} cards={config} data={{$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'}}/>
+                <CardItem card={item} cards={config} data={extendData}/>
               </Col>
             ))}
             {data && data.map((item, index) => {
@@ -798,7 +804,7 @@
             })}
             {nextcards.map((item, index) => (
               <Col key={'next' + index} className="extend-card" span={item.setting.width || 6}>
-                <CardItem card={item} cards={config} data={{$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'}}/>
+                <CardItem card={item} cards={config} data={extendData}/>
               </Col>
             ))}
           </Row>
diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx
index 6faa6d9..19c4411 100644
--- a/src/tabviews/custom/components/group/normal-group/index.jsx
+++ b/src/tabviews/custom/components/group/normal-group/index.jsx
@@ -334,7 +334,7 @@
     const { printing } = this.state
 
     return (
-      <div className="normal-group-wrap" id={config.uuid} style={config.style}>
+      <div className={'normal-group-wrap ' + (config.setting.layout || '')} id={config.uuid} style={config.style}>
         {config.setting && config.setting.print === 'true' ? <Button className="print-button" icon="printer" loading={printing} onClick={this.print}></Button> : null}
         <Row className="component-wrap">{this.getComponents()}</Row>
       </div>
diff --git a/src/tabviews/custom/components/group/normal-group/index.scss b/src/tabviews/custom/components/group/normal-group/index.scss
index e502301..419bf1b 100644
--- a/src/tabviews/custom/components/group/normal-group/index.scss
+++ b/src/tabviews/custom/components/group/normal-group/index.scss
@@ -14,3 +14,14 @@
   display: block;
   clear: both;
 }
+
+.normal-group-wrap.flex {
+  >.ant-row {
+    display: flex;
+    >.ant-col {
+      flex: 1;
+      max-width: unset;
+      width: 5%;
+    }
+  }
+}
\ No newline at end of file

--
Gitblit v1.8.0