king
2021-03-24 abe57d274e6b12c3612788e0be3d1b9201852ebd
2021-03-24
16个文件已修改
277 ■■■■ 已修改文件
src/menu/components/form/dragtitle/index.scss 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/formaction/index.scss 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/normal-form/groupform/index.jsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/normal-form/groupform/index.scss 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/normal-form/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/wrapsetting/settingform/index.jsx 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/wrapsetting/settingform/index.scss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/modulesource/option.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pc/modulesource/option.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/form/normal-form/index.jsx 105 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/form/normal-form/index.scss 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/normalbutton/index.jsx 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/formconfig.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/dragtitle/index.scss
@@ -32,7 +32,6 @@
    top: 18px;
  }
  .page-card.active {
    color: #1890ff;
    .form-sort {
      background: #1890ff;
    }
src/menu/components/form/formaction/index.scss
@@ -7,7 +7,6 @@
    margin-right: 15px;
  }
  .submit {
    min-width: 70px;
    border: none;
  }
  .skip {
src/menu/components/form/normal-form/groupform/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Radio, Select } from 'antd'
import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon } from 'antd'
import { formRule } from '@/utils/option.js'
import './index.scss'
@@ -85,6 +85,24 @@
            </Form.Item>
          </Col>
          <Col span={12}>
            <Form.Item label={
              <Tooltip placement="topLeft" title="用于表单加载时的状态控制。">
                <Icon type="question-circle" />
                状态值
              </Tooltip>
            }>
              {getFieldDecorator('status', {
                initialValue: group.setting.status || '',
                rules: [
                  {
                    max: formRule.input.max,
                    message: formRule.input.message
                  }
                ]
              })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
          <Col span={12}>
            <Form.Item label="焦点">
              {getFieldDecorator('focus', {
                initialValue: group.setting.focus || ''
src/menu/components/form/normal-form/groupform/index.scss
@@ -10,4 +10,9 @@
  .ant-input-number {
    width: 100%;
  }
  .anticon-question-circle {
    color: #c49f47;
    position: relative;
    left: -3px;
  }
}
src/menu/components/form/normal-form/index.jsx
@@ -66,7 +66,7 @@
        name: card.name,
        subtype: card.subtype,
        setting: { },
        wrap: { name: card.name, width: card.width || 24, datatype: 'static' },
        wrap: { name: card.name, width: card.width || 24, datatype: 'static', color: '#1890ff' },
        style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' },
        columns: [],
        scripts: [],
@@ -77,7 +77,7 @@
          style: {},
          fields: [],
          prevButton: {label: '上一步', type: 'prev'},
          subButton: {label: '提交', type: 'submit'},
          subButton: {label: '提交', type: 'submit', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px'}},
          nextButton: {label: '跳过', type: 'next', enable: 'false'}
        }]
      }
@@ -236,7 +236,7 @@
      style: {},
      fields: [],
      prevButton: {label: '上一步', type: 'prev'},
      subButton: {label: '提交', type: 'submit'},
      subButton: {label: '提交', type: 'submit', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px'}},
      nextButton: {label: '跳过', type: 'next', enable: 'false'}
    }
src/menu/components/form/wrapsetting/settingform/index.jsx
@@ -2,7 +2,10 @@
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Radio, Tooltip, Icon, InputNumber, Select } from 'antd'
import asyncComponent from '@/utils/asyncComponent'
import './index.scss'
const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
class SettingForm extends Component {
  static propTpyes = {
@@ -53,7 +56,7 @@
  }
  render() {
    const { wrap } = this.props
    const { wrap, config } = this.props
    const { getFieldDecorator } = this.props.form
    const { roleList } = this.state
@@ -126,6 +129,39 @@
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item label={
                <Tooltip placement="topLeft" title="表单加载时的状态,当字段值与表单组的状态值一致时,启用对应的表单组。">
                  <Icon type="question-circle" />
                  状态控制
                </Tooltip>
              }>
                {getFieldDecorator('statusControl', {
                  initialValue: wrap.statusControl || ''
                })(
                  <Select>
                    <Select.Option key='' value={''}>无</Select.Option>
                    {config.columns.map(option =>
                      <Select.Option key={option.uuid} value={option.field}>{option.label}</Select.Option>
                    )}
                  </Select>
                )}
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item label={
                <Tooltip placement="topLeft" title="完成后的颜色">
                  <Icon type="question-circle" />
                  颜色控制
                </Tooltip>
              }>
                {getFieldDecorator('color', {
                  initialValue: wrap.color || '#1890ff'
                })(
                  <ColorSketch />
                )}
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item label="黑名单">
                {getFieldDecorator('blacklist', {
                  initialValue: wrap.blacklist || []
src/menu/components/form/wrapsetting/settingform/index.scss
@@ -8,4 +8,7 @@
  .ant-input-number {
    width: 100%;
  }
  .color-sketch-block {
    margin-top: 6px;
  }
}
src/menu/modulesource/option.jsx
@@ -24,7 +24,7 @@
  { type: 'menu', url: Mainsearch, component: 'search', subtype: 'mainsearch', title: '搜索条件', width: 24, forbid: ['billPrint'] },
  { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', width: 24 },
  { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', width: 24 },
  { type: 'menu', url: form, component: 'form', subtype: 'form', title: '表单', width: 24 },
  { type: 'menu', url: form, component: 'form', subtype: 'stepform', title: '表单', width: 24 },
  { type: 'menu', url: Carousel, component: 'carousel', subtype: 'datacard', title: '轮播-动态数据', width: 24, forbid: ['billPrint'] },
  { type: 'menu', url: Carousel1, component: 'carousel', subtype: 'propcard', title: '轮播-静态数据', width: 24, forbid: ['billPrint'] },
  { type: 'menu', url: NormalTable, component: 'table', subtype: 'normaltable', title: '常用表', width: 24 },
src/pc/modulesource/option.jsx
@@ -26,7 +26,7 @@
  { type: 'menu', url: Mainsearch, component: 'search', subtype: 'mainsearch', title: '搜索条件', width: 24 },
  { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', width: 24 },
  { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', width: 24 },
  { type: 'menu', url: form, component: 'form', subtype: 'form', title: '表单', width: 24 },
  { type: 'menu', url: form, component: 'form', subtype: 'stepform', title: '表单', width: 24 },
  { type: 'menu', url: Carousel, component: 'carousel', subtype: 'datacard', title: '轮播-动态数据', width: 24 },
  { type: 'menu', url: Carousel1, component: 'carousel', subtype: 'propcard', title: '轮播-静态数据', width: 24 },
  { type: 'menu', url: NormalTable, component: 'table', subtype: 'normaltable', title: '常用表', width: 24 },
src/tabviews/custom/components/form/normal-form/index.jsx
@@ -2,13 +2,13 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { connect } from 'react-redux'
import { Spin, notification } from 'antd'
import { Spin, notification, Button } from 'antd'
// import moment from 'moment'
import Api from '@/api'
// import Utils from '@/utils/utils.js'
import UtilsDM from '@/utils/utils-datamanage.js'
// import asyncComponent from '@/utils/asyncComponent'
import asyncComponent from '@/utils/asyncComponent'
import asyncSpinComponent from '@/utils/asyncSpinComponent'
import MKEmitter from '@/utils/events.js'
import zhCN from '@/locales/zh-CN/main.js'
@@ -17,6 +17,7 @@
import './index.scss'
const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform'))
const NormalButton = asyncComponent(() => import('@/tabviews/zshare/actionList/normalbutton'))
class NormalForm extends Component {
  static propTpyes = {
@@ -34,22 +35,23 @@
    loading: false,            // 数据加载状态
    activeKey: '',             // 选中数据
    sync: false,               // 是否统一请求数据
    data: {},                  // 数据
    group: null
    data: null,                  // 数据
    group: null,
    step: 0
  }
  UNSAFE_componentWillMount () {
    const { data, BID, config } = this.props
    let _data = {}
    let _data = null
    let _sync = false
    
    if (config.setting && config.wrap.datatype !== 'static') {
      _sync = config.setting.sync === 'true'
      if (_sync && data) {
        _data = data[config.dataName] || {}
        if (_data && Array.isArray(_data)) {
      if (_sync && data && data[config.dataName]) {
        _data = data[config.dataName]
        if (Array.isArray(_data)) {
          _data = _data[0] || {}
        }
        _sync = false
@@ -58,10 +60,20 @@
      _data = {}
    }
    config.subcards = config.subcards.map(group => {
      group.subButton.uuid = group.uuid
      group.subButton.Ot = 'requiredSgl'
      group.subButton.btnstyle = group.subButton.style
      group.subButton.OpenType = 'formSubmit'
      return group
    })
    this.setState({
      sync: _sync,
      data: _data,
      group: config.subcards[0],
      step: 0,
      BID: BID || '',
      config: config,
      arr_field: config.columns.map(col => col.field).join(','),
@@ -74,6 +86,7 @@
  componentDidMount () {
    MKEmitter.addListener('reloadData', this.reloadData)
    MKEmitter.addListener('mkFormSubmit', this.mkFormSubmit)
    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
    MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
  }
@@ -87,6 +100,7 @@
      return
    }
    MKEmitter.removeListener('reloadData', this.reloadData)
    MKEmitter.removeListener('mkFormSubmit', this.mkFormSubmit)
    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
    MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
  }
@@ -101,8 +115,8 @@
      let _data = {}
      if (nextProps.data && nextProps.data[config.dataName]) {
        _data = nextProps.data[config.dataName]
        if (_data && Array.isArray(_data)) {
          _data = _data[0]
        if (Array.isArray(_data)) {
          _data = _data[0] || {}
        }
      }
@@ -203,7 +217,7 @@
      this.setState({
        activeKey: '',
        data: _data,
        data: _data || {},
        loading: false
      })
    } else {
@@ -216,20 +230,6 @@
        duration: 10
      })
    }
  }
  changeCard = (index, item) => {
    const { config, data, activeKey } = this.state
    this.openView(item)
    if (!config.wrap.cardType || activeKey === index) return
    this.setState({
      activeKey: index
    })
    MKEmitter.emit('resetSelectLine', config.uuid, (item.setting.primaryId || ''), data)
  }
  openView = (item) => {
@@ -294,9 +294,38 @@
    }
  }
  mkFormSubmit = (btnId) => {
    const { group } = this.state
    if (group.uuid !== btnId) return
    this.formRef.handleConfirm().then(res => {
      MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res})
    })
  }
  prevStep = () => {
    const { config, group } = this.state
    let _group = config.subcards.filter(item => item.sort === (group.sort - 1))[0]
    this.setState({group: null, step: group.sort - 2}, () => {
      this.setState({group: _group})
    })
  }
  nextStep = () => {
    const { config, group } = this.state
    let _group = config.subcards.filter(item => item.sort === (group.sort + 1))[0]
    this.setState({group: null, step: group.sort}, () => {
      this.setState({group: _group})
    })
  }
  render() {
    const { config, loading, BID, data, group } = this.state
    const { config, loading, BID, data, group, dict, step } = this.state
    return (
      <div className="custom-normal-form-box" style={{...config.style}}>
@@ -308,20 +337,34 @@
        }
        {config.subcards.length > 1 ? <div className="mk-normal-form-title">
          {config.subcards.map(card => (
            <div key={card.uuid} className="form-title">
              <span className="form-sort">{card.sort}</span>
            <div key={card.uuid} className={'form-title' + (card.sort <= step ? ' active' : '')}>
              <span className="form-sort" style={{background: config.wrap.color}}>{card.sort}</span>
              <span className="before-line" style={{background: config.wrap.color}}></span>
              <span className="after-line" style={{background: config.wrap.color}}></span>
              {card.setting.title}
            </div>))
          }
        </div> : null}
        <MutilForm
        {group && data ? <MutilForm
          BID={BID}
          dict={dict}
          data={data}
          dict={this.state.dict}
          action={group}
          inputSubmit={this.handleOk}
          wrappedComponentRef={(inst) => this.formRef = inst}
        />
        /> : null}
        {group && data ? <div className="mk-form-action">
          {group.sort !== 1 ? <Button type="link" className="prev" onClick={this.prevStep} style={group.prevButton.style}>{group.prevButton.label}</Button> : null}
          <NormalButton
            BID={BID}
            position="form"
            btn={group.subButton}
            setting={config.setting}
            columns={config.columns}
            selectedData={[data]}
          />
          {group.nextButton.enable === 'true' && group.sort !== config.subcards.length ? <Button type="link" className="skip" onClick={this.nextStep} style={group.nextButton.style}>{group.nextButton.label}</Button> : null}
        </div> : null}
      </div>
    )
  }
src/tabviews/custom/components/form/normal-form/index.scss
@@ -4,6 +4,7 @@
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
  min-height: 200px;
  .mk-normal-form-title {
    display: flex;
@@ -28,16 +29,54 @@
        z-index: 1;
      }
    }
    .form-title:not(:first-child)::before {
    .before-line, .after-line {
      display: none;
    }
    .form-title:not(:first-child) .before-line {
      position: absolute;
      display: inline-block;
      width: 50%;
      height: 2px;
      background: #d8d8d8;
      left: 0%;
      top: 18px;
    }
    .form-title:not(:last-child) .after-line {
      position: absolute;
      content: ' ';
      display: inline-block;
      width: 100%;
      width: 50%;
      height: 2px;
      background: #d8d8d8;
      left: -50%;
      left: 50%;
      top: 18px;
    }
    .form-title:not(.active) {
      .form-sort {
        background: #d8d8d8!important;
      }
      .before-line, .after-line {
        background: #d8d8d8!important;
      }
    }
  }
  .mk-form-action {
    position: relative;
    text-align: center;
    padding-bottom: 10px;
    .prev {
      margin-right: 15px;
    }
    .submit {
      min-width: 70px;
      border: none;
    }
    .skip {
      position: absolute;
      right: 5px;
    }
  }
  
  .loading-mask {
src/tabviews/custom/index.jsx
@@ -672,7 +672,7 @@
        return component
      }
      if (['propcard', 'brafteditor', 'sandbox'].includes(component.subtype) && component.wrap.datatype === 'static') {
      if (['propcard', 'brafteditor', 'sandbox', 'stepform'].includes(component.subtype) && component.wrap.datatype === 'static') {
        component.format = ''
      }
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -54,6 +54,8 @@
    if (position === 'toolbar') {
      MKEmitter.addListener('triggerBtnId', this.actionTrigger)
    } else if (position === 'form') {
      MKEmitter.addListener('triggerFormSubmit', this.actionSubmit)
    }
  }
@@ -62,6 +64,23 @@
      return
    }
    MKEmitter.removeListener('triggerBtnId', this.actionTrigger)
    MKEmitter.removeListener('triggerFormSubmit', this.actionSubmit)
  }
  actionSubmit = (res) => {
    const { btn } = this.props
    if (btn.uuid !== res.menuId) return
    this.setState({
      confirmLoading: true
    })
    this.execSubmit(this.state.tabledata, () => {
      this.setState({
        confirmLoading: false
      })
    }, res.form)
  }
  /**
@@ -117,7 +136,7 @@
        duration: 5
      })
      return
    } else if (!setting.primaryKey) {
    } else if (btn.OpenType !== 'formSubmit' && !setting.primaryKey) {
      // 需要选择行时,校验是否设置主键
      notification.warning({
        top: 92,
@@ -179,7 +198,13 @@
      return
    }
    if (btn.OpenType === 'prompt') {
    if (btn.OpenType === 'formSubmit') {
      this.setState({
        tabledata: data
      })
      MKEmitter.emit('mkFormSubmit', btn.uuid)
      return
    } else if (btn.OpenType === 'prompt') {
      this.updateStatus('start')
      confirm({
        title: this.state.dict['main.action.confirm.tip'],
@@ -275,7 +300,7 @@
        }
        param.LText = Utils.formatOptions(param.LText)
      } else if (btn.OpenType === 'pop') { // 表单
      } else if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { // 表单
        if (btn.sqlType === 'insert') { // 系统函数添加时,生成uuid
          primaryId = ''
@@ -499,7 +524,7 @@
      param[setting.primaryKey] = primaryId // 设置主键参数
      if (btn.OpenType === 'pop') { // 表单
      if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { // 表单
        formdata.forEach(_data => {
          param[_data.key] = _data.value
        })
@@ -610,7 +635,7 @@
          param.BID = this.props.BID
        }
        if (btn.OpenType === 'pop' && formdata) { // 表单
        if ((btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') && formdata) { // 表单
          formdata.forEach(_data => {
            param[_data.key] = _data.value
          })
src/tabviews/zshare/mutilform/index.jsx
@@ -57,7 +57,9 @@
    let supItemVal = {} // 上级菜单初始值
    let deForms = []    // 需要动态获取下拉菜单的表单
    action.fields.forEach(item => {
    let formlist = fromJS(action.fields).toJS()
    formlist.forEach(item => {
      if (item.type === 'text' || item.type === 'number') {              // 用于过滤下拉菜单关联表单
        _inputfields.push(item.field)
      } else if (item.type === 'textarea') {
@@ -71,7 +73,7 @@
      }
    })
    let formlist = action.fields.map(item => {
    formlist = formlist.map(item => {
      if (item.labelwidth) {
        item.labelCol = {style: {width: item.labelwidth + '%'}}
      }
src/templates/modalconfig/index.jsx
@@ -390,7 +390,7 @@
    const { editAction } = this.props
    const { config, menu, openEdition } = this.state
    if ((!config.groups[0] && !config.fields[0]) || (config.fields[0] && config.fields[0].origin)) {
    if (config.fields[0] && config.fields[0].origin) {
      notification.warning({
        top: 92,
        message: '请添加表单',
src/templates/zshare/formconfig.jsx
@@ -667,7 +667,11 @@
  }
  let refresh = []
  if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签
    if (card.focus) {
      card.popClose = 'maingrid'
    }
    refresh.push({
      value: 'maingrid',
      text: Formdict['header.form.refresh.maingrid']