king
2021-11-19 53a5b5bea0fb1efae2b1793e6735754e78982d63
2021-11-19
14个文件已修改
340 ■■■■ 已修改文件
src/mob/components/formdragelement/card.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/modalconfig/source.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/tree/antd-tree/index.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/normalbutton/index.jsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/printbutton/index.jsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/dragelement/card.jsx 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/source.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/sharecomponent/fieldscomponent/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/createinterface/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/formconfig.jsx 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/index.jsx 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/verifycard/index.jsx 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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">
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: ''
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)
    }
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({
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) {
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 : ''
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') {
src/templates/modalconfig/source.jsx
@@ -149,6 +149,11 @@
  },
  {
    type: 'form',
    label: '评分',
    subType: 'rate',
  },
  {
    type: 'form',
    label: CommonDict['model.form.color'],
    subType: 'color',
  },
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',
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}`)
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: '文件压缩必须为图片,图片格式为jpg、png、gif 或 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: '起点(M)',
      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: '正式接口',
      rows: 1,
      initVal: card.proRduri || '',
      tooltip: '正式系统转存接口,图片转存在同一单点服务器下的其他业务系统。',
      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: '文件压缩必须为图片,图片格式为jpg、png、gif 或 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: '起点(M)',
      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: '正式接口',
      rows: 1,
      initVal: card.proRduri || '',
      tooltip: '正式系统转存接口,图片转存在同一单点服务器下的其他业务系统。',
      required: false,
      readonly: false
    },
    {
      type: 'text',
      key: 'suffix',
      label: '后缀名',
      tooltip: '可以上传文件的后缀名,多个类型用逗号分隔,空值时不校验。',
      initVal: card.suffix || '',
      required: false,
      readonly: false
    },
    {
      type: 'select',
      key: 'supField',
      label: '上级表单',
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') {
        if (form.key === 'initval') {
          if (dateOptions.hasOwnProperty(type)) {
          form.options = dateOptions[type]
          form.type = 'select'
        } else if (type === 'switch' && form.key === 'initval') {
          } else if (type === 'switch') {
          form.initVal = !!form.initVal
          form.options = [
            {value: true, text: '开'},
            {value: false, text: '关'}
          ]
          form.type = 'radio'
        } else if (type === 'number' && form.key === 'initval') {
          }
          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>
        )
      }
    })
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}=''`)
        }
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)=\'\''
          }