| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Popover, Button } from 'antd' |
| | | import { Popover, Button, Switch, Checkbox } from 'antd' |
| | | import { EditOutlined, CopyOutlined, CloseOutlined, FontColorsOutlined, ProfileOutlined } from '@ant-design/icons' |
| | | |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | |
| | | }) |
| | | |
| | | let hasProfile = false |
| | | if (['pop', 'prompt', 'exec'].includes(card.OpenType)) { |
| | | if (['pop', 'prompt', 'exec', 'form'].includes(card.OpenType)) { |
| | | hasProfile = true |
| | | } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') { |
| | | hasProfile = true |
| | |
| | | |
| | | let btnElement = null |
| | | let _style = resetStyle(card.style) |
| | | if (card.show === 'icon') { |
| | | if (card.OpenType === 'form') { |
| | | if (card.formType === 'switch') { |
| | | btnElement = (<Switch style={_style} size={card.size} checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''}/>) |
| | | } else { |
| | | btnElement = (<Checkbox style={_style}></Checkbox>) |
| | | } |
| | | } else if (card.show === 'icon') { |
| | | btnElement = (<Button style={_style} type="link"><MkIcon type={card.icon}/></Button>) |
| | | } else if (card.show === 'link') { |
| | | btnElement = (<Button style={_style} type="link">{card.label}{card.icon ? <MkIcon type={card.icon}/> : null}</Button>) |
| | |
| | | let options = ['font', 'border', 'padding', 'margin', 'background'] |
| | | |
| | | if (element.eleType === 'button') { |
| | | options.push('width', 'float') |
| | | if (element.OpenType === 'form') { |
| | | options = ['margin', 'float'] |
| | | } else { |
| | | options.push('width', 'float') |
| | | } |
| | | } else if (element.eleType === 'picture') { |
| | | options = ['border', 'margin'] |
| | | } else if (element.eleType === 'slider') { |
| | |
| | | } |
| | | |
| | | delete res.focus |
| | | let style = {} |
| | | |
| | | if (res.class !== cell.class || res.show !== cell.show || !res.style) { |
| | | if (res.OpenType === 'form') { |
| | | if (cell.OpenType !== 'form') { |
| | | res.style = {} |
| | | } |
| | | } else if (res.class !== cell.class || res.show !== cell.show || !res.style) { |
| | | let style = {} |
| | | if (res.show === 'link' || res.show === 'icon') { |
| | | style.color = color[res.class] |
| | | style.backgroundColor = 'transparent' |
| | |
| | | style.color = '#ffffff' |
| | | style.backgroundColor = color[res.class] |
| | | } |
| | | res.style = {...res.style, ...style} |
| | | } |
| | | res.style = {...res.style, ...style} |
| | | |
| | | return res |
| | | } |
| | |
| | | |
| | | .card-button-cell { |
| | | float: left; |
| | | button { |
| | | button:not(.ant-switch) { |
| | | width: 100%; |
| | | background-size: cover; |
| | | background-position: center center; |
| | |
| | | font-weight: inherit; |
| | | } |
| | | } |
| | | .ant-checkbox .ant-checkbox-inner { |
| | | border-radius: 15px; |
| | | } |
| | | } |
| | | .card-cell:hover, .card-button-cell:hover { |
| | | box-shadow: 0px 0px 1px #1890ff; |
| | |
| | | popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'resetPageIndex', 'width', 'display', 'ratio', 'syncComponent', 'clickouter'], |
| | | tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'linkmenu', 'width'], |
| | | innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'swipe', 'icon', 'class', 'color', 'width', 'open'], |
| | | funcbutton: ['label', 'OpenType', 'funcType', 'show', 'swipe', 'icon', 'class', 'color', 'width'] |
| | | funcbutton: ['label', 'OpenType', 'funcType', 'show', 'swipe', 'icon', 'class', 'color', 'width'], |
| | | form: ['label', 'OpenType', 'formType', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'open', 'refreshTab', 'reload', 'title'] |
| | | } |
| | | |
| | | class ActionForm extends Component { |
| | |
| | | requireOptions: [], |
| | | insertUpdateOptions: [{ |
| | | value: 'insert', |
| | | text: this.props.dict['header.form.action.insert'] |
| | | text: '添加' |
| | | }, { |
| | | value: 'update', |
| | | text: this.props.dict['header.form.action.update'] |
| | | text: '修改' |
| | | }, { |
| | | value: 'audit', |
| | | text: this.props.dict['header.form.action.audit'] |
| | | text: '审核' |
| | | }], |
| | | deleteOptions: [{ |
| | | value: 'LogicDelete', |
| | |
| | | text: '物理删除' |
| | | }, { |
| | | value: 'custom', |
| | | text: this.props.dict['header.form.custom'] |
| | | text: '自定义' |
| | | }], |
| | | interTypeOptions: [{ |
| | | value: 'system', |
| | |
| | | } else { |
| | | reOptions.sqlType = this.state.insertUpdateOptions |
| | | } |
| | | } else if (openType === 'form') { |
| | | let intertype = this.record.intertype |
| | | |
| | | if (this.record.formType === 'switch') { |
| | | shows.push('field', 'size', 'openVal', 'closeVal', 'openText', 'closeText') |
| | | } else { |
| | | shows.push('field', 'openVal', 'closeVal') |
| | | } |
| | | |
| | | reOptions.intertype = this.state.interTypeOptions.filter(item => item.value !== 'custom') |
| | | |
| | | if (intertype === 'outer') { |
| | | shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') |
| | | reRequired.innerFunc = false |
| | | |
| | | if (this.record.sysInterface === 'false') { |
| | | reReadonly.interface = false |
| | | reRequired.interface = true |
| | | } else { |
| | | reReadonly.interface = true |
| | | reRequired.interface = false |
| | | } |
| | | } else if (intertype === 'inner') { |
| | | shows.push('innerFunc') |
| | | reRequired.innerFunc = true |
| | | } else { |
| | | shows.push('sql', 'sqlType') |
| | | } |
| | | |
| | | reOptions.Ot = requireOptions |
| | | reOptions.sqlType = [{ |
| | | value: 'update', |
| | | text: '修改' |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | } else if (openType === 'excelIn') { |
| | | reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') |
| | | reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) |
| | |
| | | _fieldval.intertype = 'system' |
| | | _fieldval.sqlType = '' |
| | | |
| | | } else if (value === 'form') { |
| | | _fieldval.Ot = 'requiredSgl' |
| | | |
| | | this.record.Ot = 'requiredSgl' |
| | | } else if (value === 'excelIn') { |
| | | _fieldval.intertype = 'system' |
| | | _fieldval.Ot = 'notRequired' |
| | |
| | | } else if (value === 'update') { |
| | | _fieldval.label = '修改' |
| | | _fieldval.Ot = 'requiredSgl' |
| | | if (hasclass) { |
| | | _fieldval.class = 'purple' |
| | | } else { |
| | | _fieldval.color = 'primary' |
| | | if (this.record.OpenType !== 'form') { |
| | | if (hasclass) { |
| | | _fieldval.class = 'purple' |
| | | } else { |
| | | _fieldval.color = 'primary' |
| | | } |
| | | } |
| | | } else if (value === 'audit') { |
| | | _fieldval.label = '审核' |
| | |
| | | } |
| | | } |
| | | |
| | | this.record.label = _fieldval.label |
| | | this.record.Ot = _fieldval.Ot |
| | | this.record.class = _fieldval.class || '' |
| | | this.record.color = _fieldval.color || '' |
| | | this.record.label = _fieldval.label || this.record.label || '' |
| | | this.record.Ot = _fieldval.Ot || this.record.Ot || '' |
| | | this.record.class = _fieldval.class || this.record.class || '' |
| | | this.record.color = _fieldval.color || this.record.color || '' |
| | | |
| | | if (appType !== 'mob' && _fieldval.Ot === 'notRequired') { |
| | | this.record.control = '' |
| | |
| | | let content = null |
| | | let initVal = item.initVal || '' |
| | | |
| | | if (item.type === 'splitLine') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <p style={{borderBottom: '1px solid #e9e9e9', color: '#1890ff', textAlign: 'center'}}>{item.label}</p> |
| | | </Col> |
| | | ) |
| | | return |
| | | } |
| | | if (item.type === 'text') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.input'] + item.label + '!' } |
| | |
| | | }) |
| | | } |
| | | |
| | | if (type === 'card') { |
| | | opentypes.push({ |
| | | value: 'form', |
| | | text: '表单' |
| | | }) |
| | | } |
| | | |
| | | if (!card.control && card.controlField) { |
| | | card.control = 'disabled' |
| | | } |
| | |
| | | initVal: card.funcType || '', |
| | | required: true, |
| | | options: funTypes |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'formType', |
| | | label: '表单类型', |
| | | initVal: card.formType || 'switch', |
| | | required: true, |
| | | options: [{ |
| | | value: 'switch', |
| | | text: '开关' |
| | | }, { |
| | | value: 'radio', |
| | | text: '勾选框' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | initVal: card.controlVal || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'splitLine', |
| | | key: 'title', |
| | | label: '表单', |
| | | initVal: '' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'field', |
| | | label: Formdict['model.form.field'], |
| | | initVal: card.field || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'size', |
| | | label: '开关尺寸', |
| | | initVal: card.size || 'default', |
| | | options: [{ |
| | | value: 'default', |
| | | text: '大' |
| | | }, { |
| | | value: 'small', |
| | | text: '小' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'openVal', |
| | | label: '开启值', |
| | | initVal: card.openVal || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'closeVal', |
| | | label: '关闭值', |
| | | initVal: card.closeVal || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'openText', |
| | | label: '开启提示', |
| | | initVal: card.openText || '', |
| | | required: false, |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'closeText', |
| | | label: '关闭提示', |
| | | initVal: card.closeText || '', |
| | | required: false, |
| | | }, |
| | | ] |
| | | |
| | | return forms |
| | |
| | | import React, {Component} from 'react' |
| | | import { Button } from 'antd' |
| | | |
| | | /** |
| | | * @description 异步加载模块 |
| | | * @param {*} importComponent |
| | |
| | | // <Button className="loading-skeleton" disabled={true}></Button> // 骨架按钮 |
| | | render() { |
| | | const C = this.state.component |
| | | const btn = this.props.btn || {} |
| | | |
| | | return C ? |
| | | <C {...this.props} /> : |
| | | <Button className={'mk-btn mk-' + btn.class} type={btn.show !== 'button' ? 'link' : ''} icon={btn.icon} disabled={true} >{btn.label}</Button> |
| | | return C ? <C {...this.props} /> : null |
| | | } |
| | | } |
| | | } |
| | |
| | | _data = this.props.syncData |
| | | } |
| | | |
| | | if (['exec', 'prompt', 'pop'].includes(card.OpenType)) { |
| | | if (['exec', 'prompt', 'pop', 'form'].includes(card.OpenType)) { |
| | | return ( |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <NormalButton |
| | |
| | | } |
| | | .mk-cell-btn { |
| | | > div {width: 100%;max-width: 100%;} |
| | | button { |
| | | button:not(.ant-switch) { |
| | | width: 100%; |
| | | max-width: 100%; |
| | | height: auto; |
| | | min-height: 28px; |
| | | } |
| | | .ant-checkbox-inner, .ant-checkbox-checked::after { |
| | | border-radius: 15px; |
| | | } |
| | | } |
| | | .ant-mk-slider { |
| | | box-sizing: border-box; |
| | |
| | | import moment from 'moment' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, message, Drawer } from 'antd' |
| | | import { Button, Modal, notification, message, Drawer, Switch, Checkbox } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { getSysDefaultSql } from '@/utils/utils.js' |
| | |
| | | disabled: false, |
| | | hidden: false, |
| | | checkParam: null, |
| | | autoMatic: false |
| | | autoMatic: false, |
| | | check: false |
| | | } |
| | | |
| | | moduleParams = null |
| | |
| | | } |
| | | if (this.props.disabled || disabled) { |
| | | this.setState({disabled: true}) |
| | | } |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | let data = selectedData && selectedData[0] ? selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({disabled: true}) |
| | | } else { |
| | | this.setState({disabled: false}) |
| | | } |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | let data = nextProps.selectedData && nextProps.selectedData[0] ? nextProps.selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | | } |
| | | |
| | |
| | | }, () => { |
| | | this.improveAction() |
| | | }) |
| | | } else if (btn.OpenType === 'form') { |
| | | this.setState({ |
| | | loading: true, |
| | | check: !this.state.check |
| | | }, () => { |
| | | let item = { |
| | | type: 'text', |
| | | readonly: false, |
| | | readin: true, |
| | | writein: true, |
| | | fieldlen: 50, |
| | | key: btn.field, |
| | | value: this.state.check ? btn.openVal : btn.closeVal |
| | | } |
| | | this.execSubmit(data, () => { this.setState({loading: false})}, [item]) |
| | | }) |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } else if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { // 表单 |
| | | } else if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit' || btn.OpenType === 'form') { // 表单 |
| | | if (btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | primaryId = '' |
| | | |
| | |
| | | param[setting.primaryKey] = primaryId // 设置主键参数 |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { // 表单 |
| | | if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit' || btn.OpenType === 'form') { // 表单 |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | if ((btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') && formdata) { // 表单 |
| | | if ((btn.OpenType === 'pop' || btn.OpenType === 'formSubmit' || btn.OpenType === 'form') && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | |
| | | MKEmitter.emit('popclose') |
| | | } else if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines) |
| | | } else if (btn.OpenType === 'form') { |
| | | let data = this.props.selectedData && this.props.selectedData[0] ? this.props.selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | render() { |
| | | const { btn, show, style } = this.props |
| | | const { loadingNumber, loading, disabled, hidden } = this.state |
| | | const { loadingNumber, loading, disabled, hidden, check } = this.state |
| | | |
| | | if (hidden) return null |
| | | |
| | | if (show === 'actionList') { |
| | | if (btn.OpenType === 'form') { |
| | | if (btn.formType === 'switch') { |
| | | return <Switch loading={loading} checked={check} disabled={disabled || loading} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={style} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> |
| | | } else { |
| | | return <Checkbox disabled={disabled || loading} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={style}></Checkbox> |
| | | } |
| | | } else if (show === 'actionList') { |
| | | return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> |
| | | <Button |
| | | style={style} |
| | |
| | | key: 'openText', |
| | | label: '开启提示', |
| | | initVal: card.openText || '', |
| | | required: false, |
| | | forbid: appType === 'mob' |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'closeText', |
| | | label: '关闭提示', |
| | | initVal: card.closeText || '', |
| | | required: false, |
| | | forbid: appType === 'mob' |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | |
| | | new Promise(resolve => { |
| | | let _fields = [] |
| | | if (config.Template === 'FormTab') { |
| | | if (card.OpenType === 'form') { |
| | | _fields.push({ |
| | | field: card.field, |
| | | label: card.label, |
| | | type: 'text' |
| | | }) |
| | | resolve(_fields) |
| | | } else if (config.Template === 'FormTab') { |
| | | config.groups.forEach(group => { |
| | | _fields.push(...group.sublist) |
| | | }) |