| | |
| | | } |
| | | }, |
| | | "caniuse-lite": { |
| | | "version": "1.0.30001399", |
| | | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001399.tgz", |
| | | "integrity": "sha512-4vQ90tMKS+FkvuVWS5/QY1+d805ODxZiKFzsU8o/RsVJz49ZSRR8EjykLJbqhzdPgadbX6wB538wOzle3JniRA==" |
| | | "version": "1.0.30001464", |
| | | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001464.tgz", |
| | | "integrity": "sha512-oww27MtUmusatpRpCGSOneQk2/l5czXANDSFvsc7VuOQ86s3ANhZetpwXNf1zY/zdfP63Xvjz325DAdAoES13g==" |
| | | }, |
| | | "canvg": { |
| | | "version": "3.0.10", |
| | |
| | | { |
| | | "appId": "202108312122504607B107A83F55B40C98CCF", |
| | | "appkey": "20210831212235413F287EC3BF489424496C8", |
| | | "appId": "201912040924165801464FF1788654BC5AC73", |
| | | "appkey": "20191106103859640976D6E924E464D029CF0", |
| | | "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", |
| | | "systemType": "", |
| | | "externalDatabase": "", |
| | | "lineColor": "", |
| | | "filter": "false", |
| | | "defaultApp": "mkindustry", |
| | | "defaultApp": "mk", |
| | | "defaultLang": "zh-CN", |
| | | "WXAppID": "", |
| | | "WXminiAppID": "", |
| | |
| | | "transfer": "false", |
| | | "keepPassword": "true", |
| | | "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], |
| | | "host": "http://demo.mk9h.cn", |
| | | "service": "erp_new/" |
| | | "host": "http://qingqiumarket.cn", |
| | | "service": "MKWMS/" |
| | | } |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Popover, Button, Switch, Checkbox } from 'antd' |
| | | import { EditOutlined, CopyOutlined, CloseOutlined, FontColorsOutlined, ProfileOutlined, WarningOutlined } from '@ant-design/icons' |
| | | import { EditOutlined, CopyOutlined, CloseOutlined, FontColorsOutlined, ProfileOutlined, WarningOutlined, PlusOutlined, MinusOutlined } from '@ant-design/icons' |
| | | |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | |
| | | if (card.OpenType === 'form') { |
| | | if (card.formType === 'switch') { |
| | | btnElement = (<Switch style={_style} className={card.size === 'large' ? 'ant-switch-large' : ''} size={card.size} checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''}/>) |
| | | } else if (card.formType === 'counter') { |
| | | btnElement = (<div style={_style} className={'mk-counter ' + card.size}><span><MinusOutlined /></span><span>1</span><span><PlusOutlined /></span></div>) |
| | | } else if (card.formType === 'radio') { |
| | | btnElement = (<Checkbox style={_style}></Checkbox>) |
| | | } else { |
| | |
| | | height: 26px; |
| | | } |
| | | |
| | | .mk-counter { |
| | | display: inline-block; |
| | | white-space: nowrap; |
| | | border: 1px solid #d9d9d9; |
| | | font-size: 14px; |
| | | border-radius: 2px; |
| | | background: #ffffff; |
| | | span { |
| | | display: inline-block; |
| | | height: 20px; |
| | | line-height: 22px; |
| | | vertical-align: top; |
| | | text-align: center; |
| | | } |
| | | span:first-child { |
| | | width: 22px; |
| | | text-align: center; |
| | | font-size: 12px; |
| | | border-right: 1px solid #d9d9d9; |
| | | } |
| | | span:nth-child(2) { |
| | | width: 42px; |
| | | } |
| | | span:last-child { |
| | | width: 22px; |
| | | text-align: center; |
| | | font-size: 12px; |
| | | border-left: 1px solid #d9d9d9; |
| | | } |
| | | } |
| | | .mk-counter.small { |
| | | font-size: 12px; |
| | | span { |
| | | height: 18px; |
| | | line-height: 19px; |
| | | } |
| | | span:first-child { |
| | | width: 20px; |
| | | font-size: 10px; |
| | | } |
| | | span:nth-child(2) { |
| | | width: 38px; |
| | | } |
| | | span:last-child { |
| | | width: 20px; |
| | | font-size: 10px; |
| | | } |
| | | } |
| | | .mk-counter.large { |
| | | font-size: 16px; |
| | | span { |
| | | height: 24px; |
| | | line-height: 25px; |
| | | } |
| | | span:first-child { |
| | | width: 26px; |
| | | font-size: 13px; |
| | | } |
| | | span:nth-child(2) { |
| | | width: 48px; |
| | | } |
| | | span:last-child { |
| | | width: 26px; |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | |
| | | .card-cell > div { |
| | | background-position: center center; |
| | | background-repeat: no-repeat; |
| | |
| | | |
| | | if (this.record.formType === 'switch') { |
| | | shows.push('field', 'size', 'openVal', 'closeVal', 'openText', 'closeText') |
| | | } else if (this.record.formType === 'counter') { |
| | | shows.push('field', 'size', 'min', 'max', 'decimal') |
| | | } else if (this.record.formType === 'radio') { |
| | | shows.push('field', 'checkType', 'openVal', 'closeVal') |
| | | } else { |
| | |
| | | |
| | | content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> |
| | | } else if (item.type === 'number') { |
| | | initVal = item.initVal || item.initVal === 0 ? item.initVal : '' |
| | | rules = [ |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | |
| | | }, { |
| | | value: 'radio', |
| | | text: '勾选框' |
| | | }, { |
| | | value: 'counter', |
| | | text: '计数器' |
| | | }, |
| | | ...formTypes] |
| | | }, |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'size', |
| | | label: '开关尺寸', |
| | | label: '尺寸', |
| | | initVal: card.size || 'default', |
| | | options: [{ |
| | | value: 'large', |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'min', |
| | | label: '最小值', |
| | | initVal: card.min, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'max', |
| | | label: '最大值', |
| | | initVal: card.max, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | | label: '小数位', |
| | | initVal: card.decimal || 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'closeVal', |
| | | label: '关闭值', |
| | |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | import MkCounter from './mkcounter' |
| | | // import './index.scss' |
| | | |
| | | const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) |
| | |
| | | disabled: false, |
| | | hidden: false, |
| | | autoMatic: false, |
| | | check: false |
| | | check: false, |
| | | count: 0 |
| | | } |
| | | |
| | | moduleParams = null |
| | |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | let data = selectedData && selectedData[0] ? selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | if (btn.formType === 'counter') { |
| | | let count = 0 |
| | | if (data && data[btn.field]) { |
| | | count = +data[btn.field] |
| | | if (isNaN(count)) { |
| | | count = 0 |
| | | } |
| | | } |
| | | this.setState({count: count }) |
| | | } else { |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | | } else if (btn.OpenType === 'formSubmit') { |
| | | this.setState({ |
| | | selines: selectedData || [] |
| | |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | let data = nextProps.selectedData && nextProps.selectedData[0] ? nextProps.selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | if (btn.formType === 'counter') { |
| | | let count = 0 |
| | | if (data && data[btn.field]) { |
| | | count = +data[btn.field] |
| | | if (isNaN(count)) { |
| | | count = 0 |
| | | } |
| | | } |
| | | this.setState({count: count }) |
| | | } else { |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | | } else if (btn.OpenType === 'formSubmit') { |
| | | this.setState({ |
| | | selines: nextProps.selectedData || [] |
| | |
| | | this.improveAction() |
| | | }) |
| | | } else if (btn.OpenType === 'form') { |
| | | this.setState({ |
| | | loading: true, |
| | | check: !this.state.check |
| | | }, () => { |
| | | let type = 'text' |
| | | let fieldlen = 50 |
| | | let value = this.state.check ? btn.openVal : btn.closeVal |
| | | |
| | | if (typeof(value) === 'number') { |
| | | type = 'number' |
| | | fieldlen = 0 |
| | | } |
| | | |
| | | if (btn.formType === 'counter') { |
| | | let item = { |
| | | type: type, |
| | | type: 'number', |
| | | readin: true, |
| | | writein: true, |
| | | fieldlen: fieldlen, |
| | | fieldlen: btn.decimal || 0, |
| | | key: btn.field, |
| | | value: value |
| | | value: this.state.count |
| | | } |
| | | this.execSubmit(data, () => { this.setState({loading: false})}, [item]) |
| | | }) |
| | | this.execSubmit(data, () => {}, [item]) |
| | | } else { |
| | | this.setState({ |
| | | loading: true, |
| | | check: !this.state.check |
| | | }, () => { |
| | | let type = 'text' |
| | | let fieldlen = 50 |
| | | let value = this.state.check ? btn.openVal : btn.closeVal |
| | | |
| | | if (typeof(value) === 'number') { |
| | | type = 'number' |
| | | fieldlen = 0 |
| | | } |
| | | |
| | | let item = { |
| | | type: type, |
| | | readin: true, |
| | | writein: true, |
| | | fieldlen: fieldlen, |
| | | key: btn.field, |
| | | value: value |
| | | } |
| | | this.execSubmit(data, () => { this.setState({loading: false})}, [item]) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | |
| | | } |
| | | |
| | | if ((res.ErrCode === 'S' || !res.ErrCode) || autoMatic) { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.message || '执行成功!', |
| | | duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 |
| | | }) |
| | | if (btn.formType !== 'counter' || res.message) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.message || '执行成功!', |
| | | duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 |
| | | }) |
| | | } |
| | | } else if (res.ErrCode === 'Y') { // 执行成功 |
| | | Modal.success({ |
| | | title: res.message || '执行成功!' |
| | |
| | | MKEmitter.emit('popclose') |
| | | } else if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines) |
| | | } else if (btn.OpenType === 'form') { |
| | | } else if (btn.OpenType === 'form' && btn.formType !== 'counter') { |
| | | let data = this.props.selectedData && this.props.selectedData[0] ? this.props.selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | changeCount = (count) => { |
| | | this.setState({count}, () => { |
| | | this.actionTrigger() |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { loadingNumber, loadingTotal, loading, disabled, hidden, check } = this.state |
| | | const { loadingNumber, loadingTotal, loading, disabled, hidden, check, count } = this.state |
| | | |
| | | if (hidden) return null |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | if (btn.formType === 'switch') { |
| | | return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> |
| | | } else if (btn.formType === 'counter') { |
| | | return <MkCounter count={count} disabled={disabled} btn={btn} onChange={this.changeCount}/> |
| | | } else if (btn.formType === 'radio') { |
| | | return <Checkbox className={btn.checkType || ''} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style}></Checkbox> |
| | | } else { |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { message, InputNumber } from 'antd' |
| | | import { PlusOutlined, MinusOutlined } from '@ant-design/icons' |
| | | |
| | | import './index.scss' |
| | | |
| | | class MkCounter extends Component { |
| | | static propTpyes = { |
| | | count: PropTypes.number, |
| | | btn: PropTypes.object, |
| | | disabled: PropTypes.any, |
| | | onChange: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | count: 0, |
| | | orival: 0 |
| | | } |
| | | |
| | | timer = null |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | this.setState({count: this.props.count, orival: this.props.count}) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | this.setState({count: nextProps.count, orival: nextProps.count}) |
| | | } |
| | | |
| | | minus = () => { |
| | | const { btn } = this.props |
| | | const { count } = this.state |
| | | |
| | | let val = count - 1 |
| | | |
| | | if (btn.min !== '' && val < btn.min) { |
| | | message.warning(`不可小于${btn.min}!`) |
| | | return |
| | | } else if (btn.max !== '' && val > btn.max) { |
| | | message.warning(`不可大于${btn.max}!`) |
| | | return |
| | | } |
| | | |
| | | this.setState({count: val, orival: val}) |
| | | |
| | | clearTimeout(this.timer) |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(val) |
| | | }, 1000) |
| | | } |
| | | |
| | | plus = () => { |
| | | const { btn } = this.props |
| | | const { count } = this.state |
| | | |
| | | let val = count + 1 |
| | | |
| | | if (btn.min !== '' && val < btn.min) { |
| | | message.warning(`不可小于${btn.min}!`) |
| | | return |
| | | } else if (btn.max !== '' && val > btn.max) { |
| | | message.warning(`不可大于${btn.max}!`) |
| | | return |
| | | } |
| | | |
| | | this.setState({count: val, orival: val}) |
| | | |
| | | clearTimeout(this.timer) |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(val) |
| | | }, 1000) |
| | | } |
| | | |
| | | submit = () => { |
| | | const { btn } = this.props |
| | | const { count, orival } = this.state |
| | | |
| | | if (count === '') { |
| | | message.warning(`不可为空!`) |
| | | this.setState({count: 0}) |
| | | return |
| | | } else if (btn.min !== '' && count < btn.min) { |
| | | message.warning(`不可小于${btn.min}!`) |
| | | return |
| | | } else if (btn.max !== '' && count > btn.max) { |
| | | message.warning(`不可大于${btn.max}!`) |
| | | return |
| | | } |
| | | |
| | | if (orival === count) return |
| | | |
| | | clearTimeout(this.timer) |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(count) |
| | | }, 1000) |
| | | } |
| | | |
| | | render() { |
| | | const { btn, disabled } = this.props |
| | | const { count } = this.state |
| | | |
| | | return ( |
| | | <div onClick={(e) => e.stopPropagation()} className={'mk-btn-counter ' + (btn.size || '') + (disabled ? ' mk-disabled' : '')} style={btn.style}> |
| | | <span onClick={this.minus}><MinusOutlined /></span> |
| | | <span><InputNumber value={count} onChange={(val) => this.setState({count: val})} onBlur={this.submit} onPressEnter={this.submit}/></span> |
| | | <span onClick={this.plus}><PlusOutlined /></span> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default MkCounter |
New file |
| | |
| | | .mk-btn-counter { |
| | | position: relative; |
| | | display: inline-block; |
| | | white-space: nowrap; |
| | | border: 1px solid #d9d9d9; |
| | | font-size: 14px; |
| | | border-radius: 2px; |
| | | width: auto!important; |
| | | max-width: auto!important; |
| | | background: #ffffff; |
| | | overflow: hidden; |
| | | |
| | | >span { |
| | | display: inline-block; |
| | | height: 20px; |
| | | line-height: 22px; |
| | | vertical-align: top; |
| | | text-align: center; |
| | | } |
| | | >span:first-child { |
| | | position: relative; |
| | | width: 22px; |
| | | text-align: center; |
| | | font-size: 12px; |
| | | cursor: pointer; |
| | | } |
| | | >span:first-child:after { |
| | | content: ' '; |
| | | display: inline-block; |
| | | width: 1px; |
| | | height: 26px; |
| | | background-color: #d9d9d9; |
| | | position: absolute; |
| | | right: 0px; |
| | | } |
| | | >span:nth-child(2) { |
| | | width: 42px; |
| | | .ant-input-number { |
| | | border: none; |
| | | border-radius: 0; |
| | | height: auto; |
| | | box-shadow: none!important; |
| | | .ant-input-number-handler-wrap { |
| | | display: none; |
| | | } |
| | | .ant-input-number-input { |
| | | padding: 0; |
| | | height: auto; |
| | | text-align: center; |
| | | } |
| | | } |
| | | } |
| | | >span:last-child { |
| | | position: relative; |
| | | width: 22px; |
| | | text-align: center; |
| | | font-size: 12px; |
| | | cursor: pointer; |
| | | } |
| | | >span:last-child::before { |
| | | content: ' '; |
| | | display: inline-block; |
| | | width: 1px; |
| | | height: 26px; |
| | | background-color: #d9d9d9; |
| | | position: absolute; |
| | | left: 0px; |
| | | } |
| | | } |
| | | .mk-btn-counter.mk-disabled .ant-input-number-input { |
| | | color: #bcbcbc !important; |
| | | } |
| | | .mk-btn-counter.mk-disabled::after { |
| | | content: ' '; |
| | | display: block; |
| | | position: absolute; |
| | | left: 0; |
| | | right: 0; |
| | | top: 0; |
| | | bottom: 0; |
| | | } |
| | | .mk-btn-counter.small { |
| | | font-size: 12px; |
| | | >span { |
| | | height: 18px; |
| | | line-height: 19px; |
| | | } |
| | | >span:first-child { |
| | | width: 20px; |
| | | font-size: 10px; |
| | | } |
| | | >span:nth-child(2) { |
| | | width: 38px; |
| | | } |
| | | >span:last-child { |
| | | width: 20px; |
| | | font-size: 10px; |
| | | } |
| | | } |
| | | .mk-btn-counter.large { |
| | | font-size: 16px; |
| | | >span { |
| | | height: 24px; |
| | | line-height: 25px; |
| | | } |
| | | >span:first-child { |
| | | width: 26px; |
| | | font-size: 13px; |
| | | } |
| | | >span:nth-child(2) { |
| | | width: 48px; |
| | | } |
| | | >span:last-child { |
| | | width: 26px; |
| | | font-size: 13px; |
| | | } |
| | | } |