From 53a5b5bea0fb1efae2b1793e6735754e78982d63 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 19 十一月 2021 13:31:27 +0800
Subject: [PATCH] 2021-11-19

---
 src/templates/zshare/modalform/index.jsx                |   66 +++++++--
 src/tabviews/custom/components/tree/antd-tree/index.jsx |    5 
 src/templates/zshare/formconfig.jsx                     |  194 ++++++++++++++++-----------
 src/templates/zshare/verifycard/index.jsx               |    3 
 src/mob/modalconfig/source.jsx                          |    6 
 src/tabviews/zshare/actionList/printbutton/index.jsx    |   18 ++
 src/mob/components/formdragelement/card.jsx             |    6 
 src/tabviews/zshare/mutilform/index.jsx                 |   24 +++
 src/templates/sharecomponent/fieldscomponent/index.jsx  |    3 
 src/templates/modalconfig/source.jsx                    |    5 
 src/templates/zshare/createinterface/index.jsx          |    4 
 src/tabviews/zshare/actionList/normalbutton/index.jsx   |   18 ++
 src/templates/modalconfig/dragelement/card.jsx          |    4 
 src/utils/utils.js                                      |    6 
 14 files changed, 259 insertions(+), 103 deletions(-)

diff --git a/src/mob/components/formdragelement/card.jsx b/src/mob/components/formdragelement/card.jsx
index 3682448..dddd925 100644
--- a/src/mob/components/formdragelement/card.jsx
+++ b/src/mob/components/formdragelement/card.jsx
@@ -1,6 +1,6 @@
 import React from 'react'
 import { useDrag, useDrop } from 'react-dnd'
-import { Icon, Button, Popover, Switch, Checkbox, Form } from 'antd'
+import { Icon, Button, Popover, Switch, Checkbox, Form, Rate } from 'antd'
 import moment from 'moment'
 
 import asyncComponent from '@/utils/asyncComponent'
@@ -84,6 +84,10 @@
         </div>
       </div>
     </div>)
+  } else if (card.type === 'rate') {
+    formItem = (<div className={'am-list-item ' + (card.place || '')}><div className="am-list-line"><div className="am-input-label">{card.label}</div><div style={{textAlign: 'left'}} className={'am-input-control ' + (card.place === 'up_down' ? 'left' : '')}>
+      <Rate value={card.initval || 0} count={card.rateCount || 5} character={card.character ? <Icon type={card.character}/> : <Icon type="star" theme="filled"/>} allowHalf={card.allowHalf === 'true'} />
+    </div></div></div>)
   } else if (card.type === 'fileupload') {
     formItem = (
       <div className="am-list-item checkbox">
diff --git a/src/mob/modalconfig/source.jsx b/src/mob/modalconfig/source.jsx
index 8d2248d..190030d 100644
--- a/src/mob/modalconfig/source.jsx
+++ b/src/mob/modalconfig/source.jsx
@@ -84,6 +84,12 @@
   },
   {
     type: 'form',
+    label: '璇勫垎',
+    subType: 'rate',
+    url: ''
+  },
+  {
+    type: 'form',
     label: CommonDict['header.form.funcvar'],
     subType: 'funcvar',
     url: ''
diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx
index 0bd6242..fc666d5 100644
--- a/src/tabviews/custom/components/tree/antd-tree/index.jsx
+++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx
@@ -252,14 +252,14 @@
       logMap.set(val, true)
       if (pval === config.wrap.mark) {
         parentNodes.push({
-          // ...item,
+          ...item,
           $title: item[config.wrap.labelField] || '',
           $key: val,
           $parentId: ''
         })
       } else if (pval) {
         _options.push({
-          // ...item,
+          ...item,
           $title: item[config.wrap.labelField] || '',
           $key: val,
           $parentId: pval
@@ -416,6 +416,7 @@
     }
 
     if (selected) {
+      delete _data.children
       MKEmitter.emit('resetSelectLine', config.uuid, (_data ? _data.$key : ''), _data)
     }
 
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 2c3b427..57f3d60 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1814,6 +1814,24 @@
 
       if (['date', 'datemonth', 'datetime'].includes(_type) && item.declareType === 'nvarchar(50)') {
         _type = 'text'
+      } else if (item.type === 'rate') {
+        item.rateCount = item.rateCount || 5
+        let allowHalf = item.allowHalf === 'true'
+
+        if (allowHalf) {
+          _initval = parseFloat(_initval)
+          if (_initval % 0.5 !== 0) {
+            _initval = parseInt(_initval)
+          }
+        } else {
+          _initval = parseInt(_initval)
+        }
+
+        if (isNaN(_initval) || _initval < 0) {
+          _initval = 0
+        } else if (_initval > item.rateCount) {
+          _initval = item.rateCount
+        }
       }
 
       result.push({
diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index ebedaf7..e16fd39 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -1466,6 +1466,24 @@
         _fieldlen = item.fieldlength || 512
       } else if (item.type === 'number') {
         _fieldlen = item.decimal ? item.decimal : 0
+      } else if (item.type === 'rate') {
+        item.rateCount = item.rateCount || 5
+        let allowHalf = item.allowHalf === 'true'
+
+        if (allowHalf) {
+          _initval = parseFloat(_initval)
+          if (_initval % 0.5 !== 0) {
+            _initval = parseInt(_initval)
+          }
+        } else {
+          _initval = parseInt(_initval)
+        }
+
+        if (isNaN(_initval) || _initval < 0) {
+          _initval = 0
+        } else if (_initval > item.rateCount) {
+          _initval = item.rateCount
+        }
       }
 
       if (_initval === undefined) {
diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index f5f056e..5e054e8 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, notification, Tooltip } from 'antd'
+import { Form, Row, Col, notification, Tooltip, Icon, Rate } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
@@ -74,7 +74,7 @@
 
       if (item.type === 'split' || item.type === 'hint') return true
 
-      if (!item.field || !['text', 'number', 'switch', 'select', 'link', 'linkMain', 'funcvar', 'date', 'datemonth', 'datetime', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color'].includes(item.type)) return false
+      if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'linkMain', 'funcvar', 'date', 'datemonth', 'datetime', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color'].includes(item.type)) return false
 
       // 鏁版嵁鑷姩濉厖
       let readin = item.readin !== 'false'
@@ -161,6 +161,24 @@
 
       if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect'].includes(item.type) && item.resourceType === '1') {
         deForms.push(item)
+      } else if (item.type === 'rate') {
+        item.rateCount = item.rateCount || 5
+        item.allowHalf = item.allowHalf === 'true'
+
+        if (item.allowHalf) {
+          item.initval = parseFloat(item.initval)
+          if (item.initval % 0.5 !== 0) {
+            item.initval = parseInt(item.initval)
+          }
+        } else {
+          item.initval = parseInt(item.initval)
+        }
+
+        if (isNaN(item.initval) || item.initval < 0) {
+          item.initval = 0
+        } else if (item.initval > item.rateCount) {
+          item.initval = item.rateCount
+        }
       }
 
       if (item.type === 'text') {
@@ -711,6 +729,8 @@
           content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />)
         } else if (item.type === 'textarea') {
           content = (<MKTextArea config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})}/>)
+        } else if (item.type === 'rate') {
+          content = (<Rate count={item.rateCount} disabled={item.readonly} onChange={(val) => this.recordChange({[item.field]: val})} character={item.character ? <Icon type={item.character}/> : <Icon type="star" theme="filled"/>} allowHalf={item.allowHalf}/>)
         } else if (item.type === 'brafteditor') {
           content = (<MKEditor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
           label = item.hidelabel !== 'true' ? label : ''
diff --git a/src/templates/modalconfig/dragelement/card.jsx b/src/templates/modalconfig/dragelement/card.jsx
index 0b25add..a2245e2 100644
--- a/src/templates/modalconfig/dragelement/card.jsx
+++ b/src/templates/modalconfig/dragelement/card.jsx
@@ -1,6 +1,6 @@
 import React from 'react'
 import { useDrag, useDrop } from 'react-dnd'
-import { Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox, Form } from 'antd'
+import { Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox, Form, Rate, Icon } from 'antd'
 import { QuestionCircleOutlined, UploadOutlined, EditOutlined, CopyOutlined, CloseOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
@@ -90,6 +90,8 @@
     formItem = (<Input style={{marginTop: '4px'}} value={card.linkfield} />)
   } else if (card.type === 'linkMain') {
     formItem = (<Input style={{marginTop: '4px'}} />)
+  } else if (card.type === 'rate') {
+    formItem = (<Rate value={card.initval || 0} count={card.rateCount || 5} character={card.character ? <Icon type={card.character}/> : <Icon type="star" theme="filled"/>} allowHalf={card.allowHalf === 'true'} />)
   } else if (card.type === 'switch') {
     formItem = (<Switch checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''} style={{marginTop: '8px'}} checked={card.initval}/>)
   } else if (card.type === 'radio') {
diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx
index 4c57d66..8a514cd 100644
--- a/src/templates/modalconfig/source.jsx
+++ b/src/templates/modalconfig/source.jsx
@@ -149,6 +149,11 @@
   },
   {
     type: 'form',
+    label: '璇勫垎',
+    subType: 'rate',
+  },
+  {
+    type: 'form',
     label: CommonDict['model.form.color'],
     subType: 'color',
   },
diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx
index e0c0088..c7630d7 100644
--- a/src/templates/sharecomponent/fieldscomponent/index.jsx
+++ b/src/templates/sharecomponent/fieldscomponent/index.jsx
@@ -181,13 +181,12 @@
       if (lastItem && lastItem.span) {
         span = lastItem.span
       }
-
       selectCards.forEach(item => { // 寰幆娣诲姞鏂板瀛楁
         let newcard = {
           uuid: Utils.getuuid(),
           label: item.label,
           field: item.field,
-          initval: '',
+          initval: item.type === 'number' ? 0 : '',
           type: item.type,
           resourceType: '0',
           setAll: 'false',
diff --git a/src/templates/zshare/createinterface/index.jsx b/src/templates/zshare/createinterface/index.jsx
index 9db5ce3..d3ee481 100644
--- a/src/templates/zshare/createinterface/index.jsx
+++ b/src/templates/zshare/createinterface/index.jsx
@@ -457,6 +457,8 @@
                   _fieldtype = 'datetime'
                 } else if (_field.type === 'number') {
                   _fieldtype = `decimal(18,${_fieldlen})`
+                } else if (_field.type === 'rate') {
+                  _fieldtype = `decimal(18,2)`
                 }
 
                 _field.fieldtype = _fieldtype
@@ -663,6 +665,8 @@
           _type = 'datetime'
         } else if (form.type === 'number') {
           _type = `decimal(18,${form.fieldlen})`
+        } else if (form.type === 'rate') {
+          _type = `decimal(18,2)`
         }
 
         _declarefields.push(`@${_key} ${_type}`)
diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index ab0abab..0687e8d 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -2249,6 +2249,9 @@
     value: 'textarea',
     text: Formdict['model.form.textarea']
   }, {
+    value: 'rate',
+    text: '璇勫垎'
+  }, {
     value: 'color',
     text: Formdict['model.form.color']
   }, {
@@ -2310,6 +2313,9 @@
     }, {
       value: 'textarea',
       text: Formdict['model.form.textarea']
+    }, {
+      value: 'rate',
+      text: '璇勫垎'
     }, {
       value: 'funcvar',
       text: Formdict['header.form.funcvar']
@@ -2744,6 +2750,19 @@
     },
     {
       type: 'radio',
+      key: 'allowHalf',
+      label: '鍗婇��',
+      initVal: card.allowHalf || 'false',
+      options: [{
+        value: 'true',
+        text: '鏀寔'
+      }, {
+        value: 'false',
+        text: '涓嶆敮鎸�'
+      }]
+    },
+    {
+      type: 'radio',
       key: 'readonly',
       label: Formdict['header.form.readonly'],
       initVal: card.readonly || 'false',
@@ -2857,6 +2876,24 @@
       }]
     },
     {
+      type: 'number',
+      min: 1,
+      max: 100,
+      precision: 0,
+      key: 'rateCount',
+      label: '鎬绘暟',
+      initVal: card.rateCount || 5,
+      tooltip: '榛樿鍊间负5銆�',
+      required: false
+    },
+    {
+      type: 'icon',
+      key: 'character',
+      label: '鑷畾涔夊浘鏍�',
+      initVal: card.character || '',
+      required: false
+    },
+    {
       type: 'radio',
       key: 'dropdown',
       label: '涓嬫媺妗�',
@@ -2941,84 +2978,6 @@
     //   forbid: appType !== 'mob'
     // },
     {
-      type: 'number',
-      key: 'span',
-      min: 1,
-      max: 24,
-      precision: 0,
-      label: '琛ㄥ崟瀹藉害',
-      initVal: card.span || (['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type) ? 24 : 12),
-      tooltip: '鏍呮牸甯冨眬鏁磋24绛夊垎銆�',
-      required: true,
-      forbid: appType === 'mob'
-    },
-    {
-      type: 'number',
-      key: 'labelwidth',
-      min: 1,
-      max: 100,
-      precision: 1,
-      label: '鍚嶇О瀹藉害',
-      initVal: card.labelwidth || 33.3,
-      tooltip: '鍚嶇О鍗犳嵁琛ㄥ崟瀹藉害鐨勭櫨鍒嗘瘮銆傛敞锛氬瓨鍦ㄥ鍒楄〃鍗曟椂锛屽綋鍓嶈〃鍗曞鏋滄兂瑕佸崰鎹暣琛屽彲鍙傜収浠ヤ笅姣斾緥锛屼袱鍒楋紙16.2锛夈�佷笁鍒楋紙10.5锛夈�佸洓鍒楋紙7.7锛�',
-      required: true,
-      forbid: appType === 'mob'
-    },
-    {
-      type: 'radio',
-      key: 'compress',
-      label: '鍘嬬缉',
-      initVal: card.compress || 'false',
-      tooltip: '鏂囦欢鍘嬬缉蹇呴』涓哄浘鐗囷紝鍥剧墖鏍煎紡涓簀pg銆乸ng銆乬if 鎴� jpeg',
-      options: [{
-        value: 'true',
-        text: Formdict['model.true']
-      }, {
-        value: 'false',
-        text: Formdict['model.false']
-      }]
-    },
-    {
-      type: 'number',
-      key: 'limit',
-      min: 0.01,
-      max: 1000,
-      precision: 2,
-      label: '璧风偣锛圡锛�',
-      initVal: card.limit || 2,
-      tooltip: '鍘嬬缉璧风偣锛屽皬浜庤捣鐐瑰�肩殑鏂囦欢涓嶈繘琛屽帇缂┿��',
-      required: true
-    },
-    {
-      type: 'textarea',
-      key: 'rduri',
-      label: '杞瓨鎺ュ彛',
-      rows: 1,
-      initVal: card.rduri || '',
-      tooltip: '鍥剧墖杞瓨鍦ㄥ悓涓�鍗曠偣鏈嶅姟鍣ㄤ笅鐨勫叾浠栦笟鍔$郴缁熴��',
-      required: false,
-      readonly: false
-    },
-    {
-      type: 'textarea',
-      key: 'proRduri',
-      label: '姝e紡鎺ュ彛',
-      rows: 1,
-      initVal: card.proRduri || '',
-      tooltip: '姝e紡绯荤粺杞瓨鎺ュ彛锛屽浘鐗囪浆瀛樺湪鍚屼竴鍗曠偣鏈嶅姟鍣ㄤ笅鐨勫叾浠栦笟鍔$郴缁熴��',
-      required: false,
-      readonly: false
-    },
-    {
-      type: 'text',
-      key: 'suffix',
-      label: '鍚庣紑鍚�',
-      tooltip: '鍙互涓婁紶鏂囦欢鐨勫悗缂�鍚嶏紝澶氫釜绫诲瀷鐢ㄩ�楀彿鍒嗛殧锛岀┖鍊兼椂涓嶆牎楠屻��',
-      initVal: card.suffix || '',
-      required: false,
-      readonly: false
-    },
-    {
       type: 'radio',
       key: 'encryption',
       label: '鍔犲瘑浼犺緭',
@@ -3090,6 +3049,85 @@
       forbid: appType !== 'mob'
     },
     {
+      type: 'radio',
+      key: 'compress',
+      label: '鍘嬬缉',
+      initVal: card.compress || 'false',
+      tooltip: '鏂囦欢鍘嬬缉蹇呴』涓哄浘鐗囷紝鍥剧墖鏍煎紡涓簀pg銆乸ng銆乬if 鎴� jpeg',
+      options: [{
+        value: 'true',
+        text: Formdict['model.true']
+      }, {
+        value: 'false',
+        text: Formdict['model.false']
+      }]
+    },
+    {
+      type: 'number',
+      key: 'limit',
+      min: 0.01,
+      max: 1000,
+      precision: 2,
+      label: '璧风偣锛圡锛�',
+      initVal: card.limit || 2,
+      tooltip: '鍘嬬缉璧风偣锛屽皬浜庤捣鐐瑰�肩殑鏂囦欢涓嶈繘琛屽帇缂┿��',
+      required: true
+    },
+    {
+      type: 'number',
+      key: 'span',
+      min: 1,
+      max: 24,
+      precision: 0,
+      label: '琛ㄥ崟瀹藉害',
+      initVal: card.span || (['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type) ? 24 : 12),
+      tooltip: '鏍呮牸甯冨眬鏁磋24绛夊垎銆�',
+      required: true,
+      forbid: appType === 'mob'
+    },
+    {
+      type: 'number',
+      key: 'labelwidth',
+      min: 1,
+      max: 100,
+      precision: 1,
+      label: '鍚嶇О瀹藉害',
+      initVal: card.labelwidth || 33.3,
+      tooltip: '鍚嶇О鍗犳嵁琛ㄥ崟瀹藉害鐨勭櫨鍒嗘瘮銆傛敞锛氬瓨鍦ㄥ鍒楄〃鍗曟椂锛屽綋鍓嶈〃鍗曞鏋滄兂瑕佸崰鎹暣琛屽彲鍙傜収浠ヤ笅姣斾緥锛屼袱鍒楋紙16.2锛夈�佷笁鍒楋紙10.5锛夈�佸洓鍒楋紙7.7锛�',
+      required: true,
+      forbid: appType === 'mob'
+    },
+    {
+      type: 'textarea',
+      key: 'rduri',
+      label: '杞瓨鎺ュ彛',
+      rows: 1,
+      initVal: card.rduri || '',
+      tooltip: '鍥剧墖杞瓨鍦ㄥ悓涓�鍗曠偣鏈嶅姟鍣ㄤ笅鐨勫叾浠栦笟鍔$郴缁熴��',
+      required: false,
+      readonly: false
+    },
+    {
+      type: 'textarea',
+      key: 'proRduri',
+      label: '姝e紡鎺ュ彛',
+      rows: 1,
+      initVal: card.proRduri || '',
+      tooltip: '姝e紡绯荤粺杞瓨鎺ュ彛锛屽浘鐗囪浆瀛樺湪鍚屼竴鍗曠偣鏈嶅姟鍣ㄤ笅鐨勫叾浠栦笟鍔$郴缁熴��',
+      required: false,
+      readonly: false
+    },
+    {
+      type: 'text',
+      key: 'suffix',
+      label: '鍚庣紑鍚�',
+      tooltip: '鍙互涓婁紶鏂囦欢鐨勫悗缂�鍚嶏紝澶氫釜绫诲瀷鐢ㄩ�楀彿鍒嗛殧锛岀┖鍊兼椂涓嶆牎楠屻��',
+      initVal: card.suffix || '',
+      required: false,
+      readonly: false
+    },
+    
+    {
       type: 'select',
       key: 'supField',
       label: '涓婄骇琛ㄥ崟',
diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index a210a4b..4860148 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber, Tooltip } from 'antd'
+import { Form, Row, Col, Input, Select, Radio, notification, InputNumber, Tooltip } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { formRule } from '@/utils/option.js'
@@ -16,6 +16,7 @@
 const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
 const FieldsTable = asyncComponent(() => import('./fieldtable'))
 const DataTable = asyncComponent(() => import('./datatable'))
+const MkIcon = asyncComponent(() => import('@/components/mkIcon'))
 
 const modalTypeOptions = {
   text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom'],
@@ -33,6 +34,7 @@
   datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
   textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'count', 'placeholder', 'marginTop', 'marginBottom'],
   color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'],
+  rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'rateCount', 'character', 'place'],
   hint: ['label', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'],
   split: ['label', 'type', 'marginTop', 'marginBottom'],
   brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'span', 'labelwidth', 'tooltip', 'extra', 'encryption', 'marginTop', 'marginBottom'],
@@ -112,20 +114,27 @@
       resourceType: resourceType,
       linkSubFields: linkSubFields,
       formlist: formlist.map(form => {
-        if (dateOptions.hasOwnProperty(type) && form.key === 'initval') {
-          form.options = dateOptions[type]
-          form.type = 'select'
-        } else if (type === 'switch' && form.key === 'initval') {
-          form.initVal = !!form.initVal
-          form.options = [
-            {value: true, text: '寮�'},
-            {value: false, text: '鍏�'}
-          ]
-          form.type = 'radio'
-        } else if (type === 'number' && form.key === 'initval') {
-          form.type = 'number'
-          form.initVal = form.initVal || 0
-          form.required = true
+        if (form.key === 'initval') {
+          if (dateOptions.hasOwnProperty(type)) {
+            form.options = dateOptions[type]
+            form.type = 'select'
+          } else if (type === 'switch') {
+            form.initVal = !!form.initVal
+            form.options = [
+              {value: true, text: '寮�'},
+              {value: false, text: '鍏�'}
+            ]
+            form.type = 'radio'
+          }
+          if (type === 'number') {
+            form.type = 'number'
+            form.initVal = form.initVal || 0
+            form.required = true
+          } else if (type === 'rate') {
+            form.type = 'number'
+            form.initVal = form.initVal || 0
+            form.required = false
+          }
         } else if (form.key === 'label') {
           form.required = true
           if (type === 'hint') {
@@ -243,6 +252,10 @@
             } else if (value === 'number') {
               form.type = 'number'
               form.required = true
+              form.initVal = 0
+            } else if (value === 'rate') {
+              form.type = 'number'
+              form.required = false
               form.initVal = 0
             } else {
               form.type = 'text'
@@ -565,7 +578,7 @@
                 >
                   {item.options.map((option, i) =>
                     <Select.Option key={`${i}`} value={option.value || option.field || ''}>
-                      {item.key === 'icon' && <Icon type={option.text} />} {option.text || option.label}
+                      {option.text || option.label}
                     </Select.Option>
                   )}
                 </Select>
@@ -707,6 +720,27 @@
             </Form.Item>
           </Col>
         )
+      } else if (item.type === 'icon') {
+        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: this.props.dict['form.required.select'] + item.label + '!'
+                }]
+              })(
+                <MkIcon allowClear />
+              )}
+            </Form.Item>
+          </Col>
+        )
       }
     })
 
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 5bc26a1..b96e7a0 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -659,6 +659,9 @@
         } else if (_f.type === 'number') {
           _type = `decimal(18,${_fieldlen})`
           _select.push(`@${_f.field}=0`)
+        } else if (_f.type === 'rate') {
+          _type = `decimal(18,2)`
+          _select.push(`@${_f.field}=0`)
         } else {
           _select.push(`@${_f.field}=''`)
         }
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 80283fb..e96a81f 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1383,7 +1383,7 @@
     if (!_initvars.includes(_key)) {
       _initvars.push(_key)
 
-      if (form.type === 'number') {
+      if (form.type === 'number' || form.type === 'rate') {
         let val = form.value
         if (typeof(val) !== 'number') {
           val = parseFloat(val)
@@ -1410,6 +1410,8 @@
         _type = 'datetime'
       } else if (form.type === 'number') {
         _type = `decimal(18,${form.fieldlen})`
+      } else if (form.type === 'rate') {
+        _type = `decimal(18,2)`
       }
 
       _declarefields.push(`@${_key} ${_type}`)
@@ -2255,6 +2257,8 @@
             type = 'datetime=null'
           } else if (item.type === 'number') {
             type = `decimal(18,${item.decimal})=0`
+          } else if (item.type === 'rate') {
+            type = `decimal(18,2)=0`
           } else {
             type = 'nvarchar(50)=\'\''
           }

--
Gitblit v1.8.0