From 763a67d39dcb0e5ae49816abcdb9cb7cbc2bd9e0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 18 五月 2020 10:12:31 +0800
Subject: [PATCH] 2020-05-18

---
 src/assets/img/card2.jpg                                             |    0 
 src/templates/zshare/formconfig.jsx                                  |   86 ++++++
 src/templates/sharecomponent/cardcomponent/carddetailform/index.scss |   16 +
 src/templates/sharecomponent/cardcomponent/index.scss                |   59 ++++
 src/templates/sharecomponent/cardcomponent/dragdetail/index.scss     |   27 +
 src/templates/comtableconfig/index.jsx                               |    9 
 src/templates/sharecomponent/cardcomponent/dragdetail/card.jsx       |   11 
 src/templates/sharecomponent/chartcomponent/index.jsx                |    2 
 /dev/null                                                            |    0 
 src/assets/img/card3.jpg                                             |    0 
 src/templates/comtableconfig/index.scss                              |    1 
 src/tabviews/zshare/actionList/index.jsx                             |   62 +++-
 src/templates/sharecomponent/settingcomponent/settingform/index.jsx  |   44 ++-
 src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx  |  246 ++++++++++++++++++
 src/templates/sharecomponent/cardcomponent/index.jsx                 |  172 ++++++++++--
 src/assets/img/card1.jpg                                             |    0 
 src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx |   18 +
 src/utils/utils.js                                                   |    4 
 src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx      |    2 
 19 files changed, 673 insertions(+), 86 deletions(-)

diff --git a/src/assets/img/A_aFXQS7yyDyUAAAAAAAAAAABkARQnAQ.png b/src/assets/img/A_aFXQS7yyDyUAAAAAAAAAAABkARQnAQ.png
deleted file mode 100644
index 4b06a07..0000000
--- a/src/assets/img/A_aFXQS7yyDyUAAAAAAAAAAABkARQnAQ.png
+++ /dev/null
Binary files differ
diff --git a/src/assets/img/A_qpizTrPVB-IAAAAAAAAAAABkARQnAQ.png b/src/assets/img/A_qpizTrPVB-IAAAAAAAAAAABkARQnAQ.png
deleted file mode 100644
index 15e708a..0000000
--- a/src/assets/img/A_qpizTrPVB-IAAAAAAAAAAABkARQnAQ.png
+++ /dev/null
Binary files differ
diff --git a/src/assets/img/card1.jpg b/src/assets/img/card1.jpg
new file mode 100644
index 0000000..471a8b0
--- /dev/null
+++ b/src/assets/img/card1.jpg
Binary files differ
diff --git a/src/assets/img/card2.jpg b/src/assets/img/card2.jpg
new file mode 100644
index 0000000..665abb5
--- /dev/null
+++ b/src/assets/img/card2.jpg
Binary files differ
diff --git a/src/assets/img/card3.jpg b/src/assets/img/card3.jpg
new file mode 100644
index 0000000..4f4d398
--- /dev/null
+++ b/src/assets/img/card3.jpg
Binary files differ
diff --git "a/src/assets/img/\345\276\256\344\277\241\345\233\276\347\211\207_20200426165043.png" "b/src/assets/img/\345\276\256\344\277\241\345\233\276\347\211\207_20200426165043.png"
deleted file mode 100644
index 92d46cf..0000000
--- "a/src/assets/img/\345\276\256\344\277\241\345\233\276\347\211\207_20200426165043.png"
+++ /dev/null
Binary files differ
diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx
index 2afdbbf..c5774d2 100644
--- a/src/tabviews/zshare/actionList/index.jsx
+++ b/src/tabviews/zshare/actionList/index.jsx
@@ -2341,7 +2341,10 @@
     let param = {
       func: 'sPC_Get_TableData',
       obj_name: 'data',
-      arr_field: arr_field
+      arr_field: arr_field,
+      custom_script: setting.customScript || '',
+      default_sql: setting.default || 'true',
+      dataM: this.props.dataManager ? 'Y' : ''
     }
 
     if (this.props.BID) {
@@ -2354,37 +2357,58 @@
       _dataresource = '(' + _dataresource + ') tb'
     }
 
-    if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲
-      let fieldmap = new Map()
-      let options = search.map(item => {
-        let _field = item.key
+    if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+      _dataresource = _dataresource.replace(/\$@/ig, '/*')
+      _dataresource = _dataresource.replace(/@\$/ig, '*/')
+      param.custom_script = param.custom_script.replace(/\$@/ig, '/*')
+      param.custom_script = param.custom_script.replace(/@\$/ig, '*/')
+    } else {
+      _dataresource = _dataresource.replace(/@\$|\$@/ig, '')
+      param.custom_script = param.custom_script.replace(/@\$|\$@/ig, '')
+    }
 
-        if (fieldmap.has(_field)) {
-          _field = _field + '1'
-        }
+    let regoptions = null
+    if (setting.queryType === 'statistics' || param.custom_script) {
+      let allSearch = Utils.getAllSearchOptions(search)
 
-        fieldmap.set(item.key, true)
-
+      regoptions = allSearch.map(item => {
         return {
-          reg: new RegExp('@' + _field, 'ig'),
-          value: item.value
+          reg: new RegExp('@' + item.key + '@', 'ig'),
+          value: `'${item.value}'`
         }
       })
 
-      options.reverse()
-
-      options.forEach(item => {
-        _dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
+      regoptions.push({
+        reg: new RegExp('@orderBy@', 'ig'),
+        value: orderBy
+      }, {
+        reg: new RegExp('@pageSize@', 'ig'),
+        value: pageSize
+      }, {
+        reg: new RegExp('@pageIndex@', 'ig'),
+        value: pageIndex
       })
+    }
 
+    if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲
+      regoptions.forEach(item => {
+        _dataresource = _dataresource.replace(item.reg, item.value)
+      })
       _search = ''
     }
 
-    let LText = ''
+    let LText = `select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows`
+    
     if (pagination) {
       LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows`
-    } else {
-      LText = `select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows`
+    }
+
+    if (param.custom_script) {
+      regoptions.forEach(item => {
+        param.custom_script = param.custom_script.replace(item.reg, item.value)
+      })
+
+      param.custom_script = Utils.formatOptions(param.custom_script)
     }
 
     param.LText = Utils.formatOptions(LText)
diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index b879a09..489dc0a 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -1099,12 +1099,21 @@
       })
     }
 
+    let charterr = ''
+    config.charts.forEach(chart => {
+      if (!charterr && ['line', 'bar', 'pie'].includes(chart.chartType) && !chart.Xaxis) {
+        charterr = '鍥捐〃' + (chart.title ? '銆�' + chart.title + '銆�' : '') + '鍧愭爣杞存湭璁剧疆锛屼笉鍙惎鐢紒'
+      }
+    })
+
     if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) {
       return '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�'
     } else if (!config.setting.primaryKey) {
       return '鑿滃崟灏氭湭璁剧疆涓婚敭锛屼笉鍙惎鐢紒'
     } else if (!tabinvalid) {
       return '鑿滃崟鏍囩椤佃缃敊璇紙瀛樺湪澶氳鏍囩鏃讹紝琛屾爣绛句笉鍙负绌猴級锛�'
+    } else if (charterr) {
+      return charterr
     } else {
       return true
     }
diff --git a/src/templates/comtableconfig/index.scss b/src/templates/comtableconfig/index.scss
index e9d953f..88c2876 100644
--- a/src/templates/comtableconfig/index.scss
+++ b/src/templates/comtableconfig/index.scss
@@ -174,6 +174,7 @@
         margin-bottom: 70px;
 
         .chart-title {
+          min-height: 40px;
           position: relative;
           color: rgba(0, 0, 0, 0.65);
           font-weight: 400;
diff --git a/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx b/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx
new file mode 100644
index 0000000..dd31a0c
--- /dev/null
+++ b/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx
@@ -0,0 +1,246 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon } from 'antd'
+
+import { formRule } from '@/utils/option.js'
+import './index.scss'
+
+class MainSearch extends Component {
+  static propTpyes = {
+    dict: PropTypes.object,     // 瀛楀吀椤�
+    formlist: PropTypes.any,
+    card: PropTypes.any,
+    inputSubmit: PropTypes.any  // 鍥炶溅鎻愪氦浜嬩欢
+  }
+
+  state = {
+    formlist: null,
+    columns: null
+  }
+
+  UNSAFE_componentWillMount () {
+    const { card } = this.props
+
+    let columns = this.props.formlist.filter(item => item.key === 'field')[0].options
+
+    this.setState({
+      columns: columns,
+      formlist: this.props.formlist.map(item => {
+        if (item.key === 'content' && card.datatype === 'dynamic') {
+          item.hidden = true
+        } else if (item.key === 'field' && card.datatype === 'static') {
+          item.hidden = true
+        }
+
+        return item
+      })
+    })
+  }
+
+  componentDidMount () {
+
+  }
+
+  typeChange = (key, value) => {
+    if (key === 'datatype') {
+      this.setState({
+        formlist: this.props.formlist.map(item => {
+          item.hidden = false
+
+          if (item.key === 'content' && value === 'dynamic') {
+            item.hidden = true
+          } else if (item.key === 'field' && value === 'static') {
+            item.hidden = true
+          }
+
+          return item
+        })
+      })
+      // if (this.props.form.getFieldValue('fieldlength') !== undefined) {
+      //   this.props.form.setFieldsValue({fieldlength: fieldlength})
+      // }
+    }
+  }
+
+  handleSubmit = (e) => {
+    e.preventDefault()
+
+    if (this.props.inputSubmit) {
+      this.props.inputSubmit()
+    }
+  }
+
+  getFields() {
+    const { getFieldDecorator } = this.props.form
+    const fields = []
+    this.state.formlist.forEach((item, index) => {
+      if (item.hidden) return
+
+      if (item.type === 'text') { // 鏂囨湰鎼滅储
+        fields.push(
+          <Col span={12} key={index}>
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
+                <Icon type="question-circle" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal || '',
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.input'] + item.label + '!'
+                  },
+                  {
+                    max: formRule.input.max,
+                    message: formRule.input.message
+                  }
+                ]
+              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)}
+            </Form.Item>
+          </Col>
+        )
+      } else if (item.type === 'number') {
+        fields.push(
+          <Col span={12} key={index}>
+            <Form.Item label={item.tooltip ?
+              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
+                <Icon type="question-circle" />
+                {item.label}
+              </Tooltip> : item.label
+            }>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal,
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.input'] + item.label + '!'
+                  }
+                ]
+              })(item.unlimit ? <InputNumber /> :
+                  <InputNumber min={item.min} max={item.max} precision={item.decimal} />)}
+            </Form.Item>
+          </Col>
+        )
+      } else if (item.type === 'select') { // 涓嬫媺鎼滅储
+        fields.push(
+          <Col span={12} key={index}>
+            <Form.Item label={item.label}>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal || '',
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.select'] + item.label + '!'
+                  }
+                ]
+              })(
+                <Select
+                  showSearch
+                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
+                  onChange={(value) => {this.typeChange(item.key, value)}}
+                  getPopupContainer={() => document.getElementById('card-detail-edit-form')}
+                >
+                  {item.options.map((option, index) =>
+                    <Select.Option id={index} title={option.text} key={index} value={option.value}>
+                      {option.text}
+                    </Select.Option>
+                  )}
+                </Select>
+              )}
+            </Form.Item>
+          </Col>
+        )
+      } else if (item.type === 'radio') {
+        fields.push(
+          <Col span={12} key={index}>
+            <Form.Item label={item.label}>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal,
+                rules: [
+                  {
+                    required: !!item.required,
+                    message: this.props.dict['form.required.select'] + item.label + '!'
+                  }
+                ]
+              })(
+                <Radio.Group onChange={(e) => {this.typeChange(item.key, e.target.value)}}>
+                  {
+                    item.options.map(option => {
+                      return (
+                        <Radio key={option.value} value={option.value}>{option.text}</Radio>
+                      )
+                    })
+                  }
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+        )
+      } else if (item.type === 'multiselect') { // 澶氶��
+        fields.push(
+          <Col span={12} key={index}>
+            <Form.Item label={item.label}>
+              {getFieldDecorator(item.key, {
+                initialValue: item.initVal || []
+              })(
+                <Select
+                  showSearch
+                  mode="multiple"
+                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
+                >
+                  {item.options.map((option, i) =>
+                    <Select.Option id={i} key={i} value={option.value}>{option.text}</Select.Option>
+                  )}
+                </Select>
+              )}
+            </Form.Item>
+          </Col>
+        )
+      }
+    })
+    return fields
+  }
+
+  
+  handleConfirm = () => {
+    const { columns } = this.state
+    // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
+    return new Promise((resolve, reject) => {
+      this.props.form.validateFieldsAndScroll((err, values) => {
+        if (!err) {
+          values.uuid = this.props.card.uuid || ''
+
+          if (values.field && !values.content) {
+            values.content = columns.filter(col => col.value === values.field)[0].text
+          }
+
+          resolve(values)
+        } else {
+          reject(err)
+        }
+      })
+    })
+  }
+
+  render() {
+    const formItemLayout = {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 7 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 17 }
+      }
+    }
+    return (
+      <Form {...formItemLayout} className="card-detail-edit-form" id="card-detail-edit-form">
+        <Row gutter={24}>{this.getFields()}</Row>
+      </Form>
+    )
+  }
+}
+
+export default Form.create()(MainSearch)
\ No newline at end of file
diff --git a/src/templates/sharecomponent/cardcomponent/carddetailform/index.scss b/src/templates/sharecomponent/cardcomponent/carddetailform/index.scss
new file mode 100644
index 0000000..24d7c01
--- /dev/null
+++ b/src/templates/sharecomponent/cardcomponent/carddetailform/index.scss
@@ -0,0 +1,16 @@
+.card-detail-edit-form {
+  min-height: 190px;
+  .ant-form-item {
+    .ant-input-number {
+      width: 100%;
+    }
+  }
+  .anticon-question-circle {
+    color: #c49f47;
+    position: relative;
+    left: -3px;
+  }
+  .ant-radio-group {
+    white-space: nowrap;
+  }
+}
diff --git a/src/templates/sharecomponent/cardcomponent/dragdetail/card.jsx b/src/templates/sharecomponent/cardcomponent/dragdetail/card.jsx
index 77ae2a2..0f344dd 100644
--- a/src/templates/sharecomponent/cardcomponent/dragdetail/card.jsx
+++ b/src/templates/sharecomponent/cardcomponent/dragdetail/card.jsx
@@ -28,15 +28,22 @@
   })
 
   let _class = ''
-  if (card.type === 'title') {
+  if (card.bold === 'true') {
     _class = 'ant-card-meta-title'
   } else {
     _class = 'ant-card-meta-description'
   }
 
+  if (card.width) {
+    _class += ' ' + card.width
+  }
+  if (card.align) {
+    _class += ' ' + card.align
+  }
+
   return (
     <div ref={node => drag(drop(node))} className={_class} style={{ opacity: opacity}}>
-      <div className="content">{card.content}</div>
+      <div className="content" title={card.content}>{card.content}</div>
       <Icon className="edit" title="缂栬緫" type="edit" onClick={() => editCard(card)} />
       <Icon className="edit close" title="鍒犻櫎" type="close" onClick={() => delCard(card)} />
     </div>
diff --git a/src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx b/src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx
index dcdd9fe..e6bc7fc 100644
--- a/src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx
+++ b/src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx
@@ -31,7 +31,7 @@
   })
 
   return (
-    <div ref={drop} className="ant-card-meta-detail">
+    <div ref={drop} className="ant-card-meta-detail" style={{marginLeft: 48}}>
       {cards.map(card => (
         <Card
           key={card.uuid}
diff --git a/src/templates/sharecomponent/cardcomponent/dragdetail/index.scss b/src/templates/sharecomponent/cardcomponent/dragdetail/index.scss
index a4906fa..9e71592 100644
--- a/src/templates/sharecomponent/cardcomponent/dragdetail/index.scss
+++ b/src/templates/sharecomponent/cardcomponent/dragdetail/index.scss
@@ -1,29 +1,48 @@
-.ant-card-meta-detail {
+.line-card-edit-box .ant-card-meta-detail {
   overflow: visible;
   .ant-card-meta-title, .ant-card-meta-description {
     position: relative;
     overflow: visible;
-  }
-  .ant-card-meta-description {
     display: inline-block;
     width: 100%;
     vertical-align: top;
+    font-size: 14px;
 
     .content {
+      max-width: 100%;
+      display: inline-block;
       overflow: hidden;
       word-break: break-word;
       white-space: nowrap;
       text-overflow: ellipsis;
     }
   }
+
+  .helf {
+    width: 50%;
+  }
+  .third {
+    width: 33.3%;
+  }
+  .align-center {
+    text-align: center;
+  }
+  .align-right {
+    text-align: right;
+  }
+  .ant-card-meta-title:not(:last-child), .ant-card-meta-description:not(:last-child) {
+    margin-bottom: 0px;
+  }
+
   .edit {
     position: absolute;
     left: 0;
     top: -10px;
-    font-size: 14px;
+    font-size: 13px;
     color: #1890ff;
     cursor: pointer;
     display: none;
+    padding: 0 5px;
   }
   .edit.close {
     left: 20px;
diff --git a/src/templates/sharecomponent/cardcomponent/index.jsx b/src/templates/sharecomponent/cardcomponent/index.jsx
index a3066b4..eddefc1 100644
--- a/src/templates/sharecomponent/cardcomponent/index.jsx
+++ b/src/templates/sharecomponent/cardcomponent/index.jsx
@@ -1,17 +1,18 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Card, Icon } from 'antd'
+import { Icon, Modal } from 'antd'
 
 import Utils from '@/utils/utils.js'
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
-// import ChartCompileForm from './chartcompile'
+import { getCardDetailForm } from '@/templates/zshare/formconfig'
 
 import DragDetail from './dragdetail'
+import CardDetailForm from './carddetailform'
 import './index.scss'
 
-// const { Meta } = Card
+const { confirm } = Modal
 
 class LineChart extends Component {
   static propTpyes = {
@@ -22,7 +23,8 @@
 
   state = {
     dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS,
-    visible: true,
+    visible: false,
+    formlist: null,
     cardcell: null   // 鍗$墖鍏冪礌
   }
 
@@ -57,59 +59,157 @@
   }
 
   editdetail = (_cell) => {
+    const { config } = this.props
     if (!_cell) {
-      _cell = {uuid: Utils.getuuid()}
+      _cell = {
+        datatype: 'dynamic'
+      }
+    }
+
+    let _columns = config.columns.filter(col => ['text', 'number'].includes(col.type))
+    _columns = _columns.map(col => {
+      return {
+        uuid: col.uuid,
+        value: col.field,
+        text: col.label
+      }
+    })
+
+    if (_columns.filter(col => col.value === _cell.field).length === 0) {
+      _cell.field = ''
     }
 
     this.setState({
-      cardcell: _cell
+      cardcell: _cell,
+      visible: true,
+      formlist: getCardDetailForm(_cell, _columns)
     })
-
   }
 
-  deletedetail = () => {
+  handleSubmit = () => {
+    const { card } = this.props
+    let _details = fromJS(card.details).toJS()
 
+    this.detailFormRef.handleConfirm().then(res => {
+      if (!res.uuid) {
+        res.uuid = Utils.getuuid()
+        _details.push(res)
+      } else {
+        _details = _details.map(item => {
+          if (item.uuid === res.uuid) return res
+          return item
+        })
+      }
+
+      this.setState({
+        cardcell: null,
+        visible: false,
+        formlist: null
+      })
+      this.plotChange({details: _details})
+    })
+  }
+
+  editModalCancel = () => {
+    this.setState({
+      cardcell: null,
+      visible: false,
+      formlist: null
+    })
+  }
+
+  deletedetail = (cell) => {
+    const { card } = this.props
+    const { dict } = this.state
+    let _this = this
+
+    confirm({
+      content: dict['model.confirm'] + dict['model.delete'] + ` - ${cell.content} 锛焋,
+      okText: dict['model.confirm'],
+      cancelText: dict['header.cancel'],
+      onOk() {
+        let _details = fromJS(card.details).toJS()
+
+        _details = _details.filter(item => item.uuid !== cell.uuid)
+
+        _this.plotChange({details: _details})
+      },
+      onCancel() {}
+    })
+    
   }
 
   render() {
     const { card } = this.props
+    const { dict, visible, cardcell } = this.state
 
     return (
       <div className="line-card-edit-box">
         {card.title ? <p className="chart-title">{card.title}</p> : null}
-        {card.cardType === 'card1' ? <Card
-          className={card.widthType === 'ratio' ? 'ant-col ant-col-' + card.cardWidth : ''}
+        <div
+          className={'ant-card ant-card-bordered chart-card' + (card.widthType === 'ratio' ? ' ant-col ant-col-' + card.cardWidth : '')}
           style={card.widthType === 'absolute' ? { width: card.cardWidth } : null}
         >
-          <div className="ant-card-meta">
-            <Icon type="plus" onClick={this.editdetail} />
-            <DragDetail
-              list={card.details}
-              handleList={this.handleList}
-              handleMenu={this.editdetail}
-              deleteMenu={this.deletedetail}
-            />
+          <div className="ant-card-head">
+            <div className="ant-card-head-wrapper">
+              <div className="ant-card-head-title">Card Title</div>
+              <div className="ant-card-extra">
+                <span>Action</span>
+              </div>
+            </div>
           </div>
-        </Card> : null}
-        {/* <Card
-          className={card.widthType === 'ratio' ? 'ant-col ant-col-' + card.cardWidth : ''}
-          style={card.widthType === 'absolute' ? { width: card.cardWidth } : null}
+          <div className="ant-card-body">
+            <div className="ant-card-meta">
+              <Icon type="plus" onClick={() => this.editdetail()} />
+              {card.cardType === 'card2' ? <div className="ant-card-meta-avatar">
+                <span className="ant-avatar ant-avatar-circle ant-avatar-image" style={{width: 32, height: 32}}>
+                  <img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt=""/>
+                </span>
+              </div> : null }
+              <DragDetail
+                list={card.details}
+                handleList={this.handleList}
+                handleMenu={this.editdetail}
+                deleteMenu={this.deletedetail}
+              />
+            </div>
+          </div>
+          {card.cardType === 'card2' ? <ul className="ant-card-actions">
+            <li style={{width: '33.3333%'}}>
+              <span>
+                <Icon type="setting"/>
+              </span>
+            </li>
+            <li style={{width: '33.3333%'}}>
+              <span>
+                <Icon type="edit"/>
+              </span>
+            </li>
+            <li style={{width: '33.3333%'}}>
+              <span>
+                <Icon type="edit"/>
+              </span>
+            </li>
+          </ul> : null}
+        </div>
+        {/* 鏄剧ず鍒楃紪杈� */}
+        <Modal
+          title="缂栬緫"
+          visible={visible}
+          width={650}
+          maskClosable={false}
+          onOk={this.handleSubmit}
+          onCancel={this.editModalCancel}
+          destroyOnClose
         >
-          <Meta
-            avatar={
-              <Avatar size={64} src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
-            }
-            title="Card title"
-            description="This is the description"
+          <CardDetailForm
+            dict={dict}
+            card={cardcell}
+            inputSubmit={this.handleSubmit}
+            formlist={this.state.formlist}
+            wrappedComponentRef={(inst) => this.detailFormRef = inst}
           />
-        </Card> */}
-        {/* <ChartCompileForm
-          plot={plot}
-          type={plot.chartType}
-          config={this.props.config}
-          dict={this.state.dict}
-          plotchange={this.plotChange}
-        /> */}
+        </Modal>
       </div>
     )
   }
diff --git a/src/templates/sharecomponent/cardcomponent/index.scss b/src/templates/sharecomponent/cardcomponent/index.scss
index cf87b79..dfa0e28 100644
--- a/src/templates/sharecomponent/cardcomponent/index.scss
+++ b/src/templates/sharecomponent/cardcomponent/index.scss
@@ -1,18 +1,69 @@
 .line-card-edit-box {
   margin-bottom: 30px;
   padding: 30px 20px;
-  
-  .ant-card {
+
+  .ant-card.chart-card {
     min-height: 100px;
+
+    .ant-card-head {
+      min-height: 40px;
+      line-height: 2;
+      .ant-card-head-title {
+        color: #000000;
+        font-weight: 500;
+      }
+      .ant-card-extra {
+        cursor: pointer;
+        color: #1890ff;
+      }
+    }
   }
 
   .ant-card.ant-card-bordered .ant-card-body {
     padding: 20px;
     zoom: 1;
 
-    // .ant-card-meta-avatar {
+    .ant-card-meta {
+      position: relative;
+      >.anticon-plus {
+        color: #26C281;
+        position: absolute;
+        right: -15px;
+        top: -5px;
+        padding: 5px;
+      }
 
-    // }
+      .ant-card-meta-avatar {
+        position: absolute;
+        top: 0px;
+        left: 0px;
+      }
+      // .ant-card-meta-avatar + .ant-card-meta-detail {
+      //   float: left;
+      // }
+      .ant-avatar-image {
+        box-sizing: border-box;
+        margin: 0;
+        padding: 0;
+        font-variant: tabular-nums;
+        line-height: 1.5;
+        list-style: none;
+        font-feature-settings: 'tnum';
+        position: relative;
+        display: inline-block;
+        overflow: hidden;
+        color: #fff;
+        white-space: nowrap;
+        text-align: center;
+        vertical-align: middle;
+        border-radius: 50%;
+
+        img {
+          width: 100%;
+          height: 100%;
+        }
+      }
+    }
   }
 
   .chart-title {
diff --git a/src/templates/sharecomponent/chartcomponent/index.jsx b/src/templates/sharecomponent/chartcomponent/index.jsx
index e928d24..cc58df2 100644
--- a/src/templates/sharecomponent/chartcomponent/index.jsx
+++ b/src/templates/sharecomponent/chartcomponent/index.jsx
@@ -442,7 +442,7 @@
 
     return (
       <div className="line-chart-edit-box" style={{minHeight: plot.height ? plot.height + 50 : 450}}>
-        {plot.title ? <p className="chart-title">{plot.title}</p> : null}
+        <p className="chart-title">{plot.title}</p>
         <div className="canvas" id={plot.uuid}></div>
         <ChartCompileForm
           plot={plot}
diff --git a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx
index 5c9e405..1b0edb1 100644
--- a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx
+++ b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx
@@ -13,6 +13,9 @@
 import bar4 from '@/assets/img/bar4.png'
 import pie1 from '@/assets/img/pie1.png'
 import pie2 from '@/assets/img/pie2.png'
+import card1 from '@/assets/img/card1.jpg'
+import card2 from '@/assets/img/card2.jpg'
+import card3 from '@/assets/img/card3.jpg'
 import './index.scss'
 
 const syslegends = {
@@ -107,13 +110,18 @@
   card: [
     {
       uuid: 'card1',
-      url: pie1,
+      url: card1,
       type: 'card1'
     },
     {
       uuid: 'card2',
-      url: pie2,
+      url: card2,
       type: 'card2'
+    },
+    {
+      uuid: 'card3',
+      url: card3,
+      type: 'card3'
     }
   ]
 }
@@ -413,9 +421,11 @@
 
             if (!result.details) {
               result.details = [
-                {type: 'title', uuid: 'cardtitle', content: 'Card title', datatype: 'static', align: 'left'},
-                {type: 'description', uuid: 'carddescription', content: 'This is the description', datatype: 'static', align: 'left'}
+                {bold: 'true', uuid: 'cardtitle', content: 'Card title', datatype: 'static', align: 'left'},
+                {bold: 'false', uuid: 'carddescription', content: 'Card content', datatype: 'static', align: 'left'}
               ]
+              result.actions = []
+              result.title = ''
             }
           }
 
diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx
index 76f9893..2f565dc 100644
--- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx
+++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx
@@ -316,15 +316,46 @@
       let _dataresource = _setting.dataresource
       let _customScript = _setting.customScript
 
+      // 鎼滅储鏉′欢
       let allSearch = Utils.initMainSearch(config.search)
       allSearch = Utils.getAllSearchOptions(allSearch)
 
+      // 鏄剧ず鍒楀瓧娈碉紝鐢ㄤ簬鏌ヨ
+      let arr_field = []
+      config.columns.forEach(col => {
+        if (col.field) {
+          arr_field.push(col.field)
+        }
+      })
+      arr_field = arr_field.join(',')
+
+      // 姝e垯鏇挎崲
       let regoptions = allSearch.map(item => {
         return {
           reg: new RegExp('@' + item.key + '@', 'ig'),
           value: `'${item.value}'`
         }
       })
+      regoptions.push({
+        reg: new RegExp('@orderBy@', 'ig'),
+        value: _setting.order
+      })
+      if (_setting.laypage !== 'false') {
+        regoptions.push({
+          reg: new RegExp('@pageSize@', 'ig'),
+          value: 10
+        }, {
+          reg: new RegExp('@pageIndex@', 'ig'),
+          value: 1
+        })
+      }
+
+      // 鏁版嵁婧愬鐞�
+      if (/\s/.test(_dataresource)) {
+        _dataresource = '(' + _dataresource + ') tb'
+      }
+
+      _dataresource = `select ${_setting.laypage !== 'false' ?  'top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_setting.order}) as rows from ${_dataresource}) tmptable ${_setting.laypage !== 'false' ?  'where rows > 0' : ''} order by tmptable.rows`
 
       if (_setting.queryType === 'statistics') {
         regoptions.forEach(item => {
@@ -333,19 +364,6 @@
       }
 
       if (_customScript) {
-        regoptions.push({
-          reg: new RegExp('@orderBy@', 'ig'),
-          value: _setting.order
-        })
-        if (_setting.laypage !== 'false') {
-          regoptions.push({
-            reg: new RegExp('@pageSize@', 'ig'),
-            value: 10
-          }, {
-            reg: new RegExp('@pageIndex@', 'ig'),
-            value: 1
-          })
-        }
         regoptions.forEach(item => {
           _customScript = _customScript.replace(item.reg, item.value)
         })
diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index f07c50a..af90474 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -2078,4 +2078,90 @@
       }]
     }
   ]
+}
+
+/**
+ * @description 鑾峰彇鍗$墖璇︽儏琛ㄥ崟閰嶇疆淇℃伅
+ * @param {object} card  // 鏍囩閰嶇疆淇℃伅
+ */
+export function getCardDetailForm (card, _columns) {
+  return [
+    {
+      type: 'radio',
+      key: 'datatype',
+      label: '鏁版嵁绫诲瀷',
+      initVal: card.datatype || 'dynamic',
+      required: true,
+      options: [{
+        value: 'dynamic',
+        text: '鍔ㄦ��'
+      }, {
+        value: 'static',
+        text: '闈欐��'
+      }]
+    },
+    {
+      type: 'text',
+      key: 'content',
+      label: '鍐呭',
+      initVal: card.content || '',
+      required: true
+    },
+    {
+      type: 'select',
+      key: 'field',
+      label: '瀛楁',
+      initVal: card.field || '',
+      required: true,
+      options: _columns
+    },
+    {
+      type: 'radio',
+      key: 'bold',
+      label: '鍔犵矖',
+      initVal: card.bold || 'false',
+      required: true,
+      options: [{
+        value: 'true',
+        text: '鏄�'
+      }, {
+        value: 'false',
+        text: '鍚�'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'width',
+      label: '瀹藉害',
+      initVal: card.width || '',
+      required: false,
+      options: [{
+        value: '',
+        text: '100%'
+      }, {
+        value: 'helf',
+        text: '50%'
+      }, {
+        value: 'third',
+        text: '33.3%'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'align',
+      label: '瀵归綈',
+      initVal: card.align || '',
+      required: false,
+      options: [{
+        value: '',
+        text: '宸�'
+      }, {
+        value: 'align-center',
+        text: '灞呬腑'
+      }, {
+        value: 'align-right',
+        text: '鍙�'
+      }]
+    }
+  ]
 }
\ No newline at end of file
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 5dc693e..3a918f8 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1141,11 +1141,11 @@
         /* 鍚岀被鏁版嵁楠岃瘉 */
         Set @tbid=''
 
-        Select top 1 @tbid='X' from (select ${item.field}${_primaryKey},1 an n from ${datasource} ) tb  inner join (select ID from  dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID group by ${item.field} having sum(n)>1
+        Select top 1 @tbid='X' from (select ${item.field}${_primaryKey},1 as n from ${datasource} ) tb  inner join (select ID from  dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID group by ${item.field} having sum(n)>1
         
         If @tbid!=''
         Begin
-          Set @errorcode='E' ,Set @remsg='${item.fieldlabel} 鍊间笉鍞竴'
+          Set @ErrorCode='E' Set @retmsg='${item.fieldlabel} 鍊间笉鍞竴'
           goto aaa
         end
         `

--
Gitblit v1.8.0