| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | .ant-tabs-nav .ant-tabs-tab-active { |
| | | color: $color6; |
| | | } |
| | | .ant-tabs-nav .ant-tabs-ink-bar { |
| | | background-color: $color6; |
| | | } |
| | | .ant-tabs-nav .ant-tabs-tab:active { |
| | | color: $color7; |
| | | } |
| | | .ant-tabs-nav .ant-tabs-tab:hover { |
| | | color: $color5; |
| | | } |
| | | } |
| | | >.mk-breadview-wrap { |
| | | >.ant-breadcrumb { |
| | |
| | | } |
| | | } |
| | | |
| | | .ant-tabs-nav .ant-tabs-tab-active { |
| | | color: $color6; |
| | | } |
| | | .ant-tabs-nav .ant-tabs-ink-bar { |
| | | background-color: $color6; |
| | | } |
| | | .ant-tabs-nav .ant-tabs-tab:active { |
| | | color: $color7; |
| | | } |
| | | .ant-tabs-nav .ant-tabs-tab:hover { |
| | | color: $color5; |
| | | } |
| | | |
| | | // 系统样式修改 |
| | | .ant-select-dropdown-menu-item:hover:not(.ant-select-dropdown-menu-item-disabled) { |
| | | background-color: $color1; |
| | |
| | | background-color: $color6; |
| | | } |
| | | } |
| | | .ant-tree li .ant-tree-node-content-wrapper:hover { |
| | | background-color: $color1; |
| | | } |
| | | .ant-tree li .ant-tree-node-content-wrapper.ant-tree-node-selected { |
| | | background-color: $color2; |
| | | } |
| | | } |
| | | |
| | | body.hidden-split-line #root { // 去除登录页分割线 |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | options = ['margin', 'float'] |
| | | } else { |
| | | options.push('width', 'minHeight', 'float') |
| | | _style.minHeight = _style.minHeight || '28px' |
| | | } |
| | | if (element.wrapStyle) { |
| | | _style.float = element.wrapStyle.textAlign || 'left' |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['background', 'height', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['background', 'height', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | name: card.name, |
| | | subtype: card.subtype, |
| | | setting: { interType: 'system' }, |
| | | wrap: { name: card.name, datatype: 'dynamic', width: card.width || 24, encryption: 'true', minHeight: 100 }, |
| | | wrap: { name: card.name, datatype: 'dynamic', width: card.width || 24, encryption: 'true' }, |
| | | style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, |
| | | headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' }, |
| | | columns: [], |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | const { card } = this.state |
| | | |
| | | let style = {...card.style} |
| | | if (card.wrap.minHeight) { |
| | | style.minHeight = card.wrap.minHeight |
| | | } |
| | | |
| | | return ( |
| | | <div className="menu-normal-editor-box" style={style} onClick={this.clickComponent} id={card.uuid}> |
| | |
| | | ] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'minHeight', |
| | | label: '最小高度', |
| | | initval: wrap.minHeight || '', |
| | | min: 0, |
| | | max: 3000, |
| | | precision: 0, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | changeStyle = () => { |
| | | const { group } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], group.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], group.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | name: '凭证', |
| | | subtype: card.subtype, |
| | | // setting: { interType: 'system' }, |
| | | wrap: { name: '凭证', title: '', width: card.width || 12, type: 'edit' }, |
| | | wrap: { name: '凭证', title: '', width: card.width || 12, type: 'createVoucher' }, |
| | | style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px', paddingBottom: '20px' }, |
| | | headerStyle: {}, |
| | | columns: [], |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | |
| | | updateWrap = (res) => { |
| | | let _card = {...this.state.card, wrap: res} |
| | | _card.switchable = res.type !== 'edit' |
| | | |
| | | this.updateComponent(_card) |
| | | } |
| | |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <div className="voucher-box"> |
| | | <div className="voucher-header"> |
| | | <Button className="add-background header-btn">新增</Button> |
| | | {card.wrap.type === 'createVoucher' ? <div className="voucher-header"> |
| | | <Button className="add-background header-btn">保存并新增</Button> |
| | | <Button className="add-background header-btn">保存</Button> |
| | | <Button className="print-background header-btn">打印</Button> |
| | | <Button className="system-background header-btn">导入</Button> |
| | | <Button className="out-background header-btn">导出</Button> |
| | | </div> |
| | | <Button className="out-background header-btn">更多</Button> |
| | | </div> : null} |
| | | {card.wrap.type === 'checkVoucher' ? <div className="voucher-header"> |
| | | <Button className="add-background header-btn">保存</Button> |
| | | <Button className="print-background header-btn">打印</Button> |
| | | <Button className="out-background header-btn">关闭</Button> |
| | | </div> : null} |
| | | <div className="voucher-body"> |
| | | <div className="pre-wrap"> |
| | | <div className="voucher-code"> |
| | | <div>记<DownOutlined/></div> |
| | | <div>1</div> |
| | | 号 |
| | | </div> |
| | | <div className="voucher-date"> |
| | | 日期:<div>请选择日期 <CalendarOutlined /></div> |
| | | </div> |
| | | <div className="voucher-affix"> |
| | | 附单据 <div>2</div> 张 |
| | | <Button type="link" className="">附件</Button> |
| | | <Button type="link" className="">备注</Button> |
| | | </div> |
| | | {card.wrap.type === 'createVoucher' || card.wrap.type === 'checkVoucher' ? <div className="pre-wrap"> |
| | | <div className="voucher-code"> |
| | | <div>记<DownOutlined/></div> |
| | | <div>1</div> |
| | | 号 |
| | | </div> |
| | | <div className="voucher-date"> |
| | | 日期:<div>请选择日期 <CalendarOutlined /></div> |
| | | </div> |
| | | <div className="voucher-affix"> |
| | | 附单据 <div>2</div> 张 |
| | | <Button type="link" className="">附件</Button> |
| | | <Button type="link" className="">备注</Button> |
| | | </div> |
| | | </div> : null} |
| | | {card.wrap.type === 'createTemp' || card.wrap.type === 'checkTemp' ? <div className="pre-wrap"> |
| | | <div className="temp-code"> |
| | | 模板名称: |
| | | <div> </div> |
| | | </div> |
| | | <div className="temp-code"> |
| | | 模板类型: |
| | | <div>日常支出<DownOutlined/></div> |
| | | </div> |
| | | <Button className="out-background header-btn">关闭</Button> |
| | | <Button className="add-background header-btn">保存</Button> |
| | | </div> : null} |
| | | <VoucherTable config={card}/> |
| | | {card.wrap.type === 'createVoucher' || card.wrap.type === 'checkVoucher' ? <div className="user">制单人:</div> : null} |
| | | </div> |
| | | <VoucherTable config={card}/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | ) |
| | |
| | | } |
| | | } |
| | | } |
| | | .temp-code { |
| | | display: inline-block; |
| | | width: 180px; |
| | | margin-right: 15px; |
| | | |
| | | div { |
| | | display: inline-block; |
| | | min-width: 100px; |
| | | margin-right: 10px; |
| | | margin-left: 10px; |
| | | border: 1px solid #d9d9d9; |
| | | padding: 4px 10px; |
| | | border-radius: 4px; |
| | | |
| | | .anticon-down { |
| | | position: relative; |
| | | left: 3px; |
| | | color: #c8c8c8; |
| | | font-size: 12px; |
| | | margin-left: 5px; |
| | | } |
| | | } |
| | | } |
| | | .header-btn { |
| | | float: right; |
| | | margin-left: 10px; |
| | | } |
| | | .pre-wrap { |
| | | padding: 10px 0px; |
| | | } |
| | |
| | | border-radius: 4px; |
| | | } |
| | | } |
| | | .user { |
| | | padding-top: 15px; |
| | | } |
| | | } |
| | | |
| | | .add-background { |
| | |
| | | // required: false |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | field: 'type', |
| | | label: '类型', |
| | | initval: wrap.type || 'edit', |
| | | initval: wrap.type || 'createVoucher', |
| | | required: true, |
| | | options: [ |
| | | {value: 'edit', label: '编辑'}, |
| | | {value: 'check', label: '查看'}, |
| | | {value: 'createVoucher', label: '新增凭证'}, |
| | | {value: 'checkVoucher', label: '查看凭证'}, |
| | | {value: 'createTemp', label: '新增模板'}, |
| | | {value: 'checkTemp', label: '编辑模板'}, |
| | | ] |
| | | }, |
| | | { |
| | |
| | | style.fontSize = card.wrap.fontSize || 14 |
| | | style.fontWeight = card.wrap.fontWeight || 'normal' |
| | | |
| | | MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | style.fontSize = card.wrap.fontSize || 14 |
| | | style.fontWeight = card.wrap.fontWeight || 'normal' |
| | | |
| | | MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | label={<ColumnHeightOutlined title="最小高度"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.minHeight || '28px'} options={['px']} onChange={(val) => this.changeNormalStyle(val, 'minHeight')}/> |
| | | <StyleInput defaultValue={card.minHeight || ''} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'minHeight')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | } |
| | | |
| | | let col = 'ant-col-' + (card.width || 24) |
| | | if (card.type === 'login') { |
| | | let height = '' |
| | | if (card.wrap && card.wrap.height) { |
| | | // scaleview |
| | | height = card.wrap.height.replace(/\d+vw/ig, (word) => { |
| | | return parseFloat(word) * (window.GLOB.winWidth || 420) / 100 + 'px' |
| | | // return parseFloat(word) * 350 / 100 + 'px' |
| | | }).replace(/\d+vh/ig, (word) => { |
| | | return parseFloat(word) * (window.GLOB.winHeight || 738) / 100 + 'px' |
| | | // return parseFloat(word) * 615 / 100 + 'px' |
| | | }) |
| | | } |
| | | // if (card.type === 'login') { |
| | | // let height = '' |
| | | // if (card.wrap && card.wrap.height) { |
| | | // // scaleview |
| | | // height = card.wrap.height.replace(/\d+vw/ig, (word) => { |
| | | // return parseFloat(word) * (window.GLOB.winWidth || 420) / 100 + 'px' |
| | | // // return parseFloat(word) * 350 / 100 + 'px' |
| | | // }).replace(/\d+vh/ig, (word) => { |
| | | // return parseFloat(word) * (window.GLOB.winHeight || 738) / 100 + 'px' |
| | | // // return parseFloat(word) * 615 / 100 + 'px' |
| | | // }) |
| | | // } |
| | | |
| | | style.minHeight = height |
| | | } |
| | | // style.minHeight = height |
| | | // } |
| | | |
| | | const getCardComponent = () => { |
| | | if (card.type === 'bar' || card.type === 'line') { |
| | |
| | | if (_card.wrap.classify === 'signin') { |
| | | active = 'signin' |
| | | } |
| | | if (!_card.style.minHeight && _card.wrap.height) { |
| | | _card.style.minHeight = _card.wrap.height |
| | | delete _card.wrap.height |
| | | } |
| | | |
| | | this.setState({ |
| | | active, |
| | | card: _card |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['width', 'background', 'border', 'padding', 'margin', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['width', 'background', 'border', 'padding', 'margin', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | // precision: 0, |
| | | // required: false |
| | | // }, |
| | | { |
| | | type: 'styleInput', |
| | | field: 'height', |
| | | label: '最小高度', |
| | | initval: wrap.height || '', |
| | | tooltip: '组件占用的最小高度,用于页面布局。', |
| | | required: false, |
| | | options: ['px', 'vh', 'vw', '%'] |
| | | }, |
| | | // { |
| | | // type: 'styleInput', |
| | | // field: 'height', |
| | | // label: '最小高度', |
| | | // initval: wrap.height || '', |
| | | // tooltip: '组件占用的最小高度,用于页面布局。', |
| | | // required: false, |
| | | // options: ['px', 'vh', 'vw', '%'] |
| | | // }, |
| | | // { |
| | | // type: 'styleInput', |
| | | // field: 'maxWidth', |
| | |
| | | } |
| | | |
| | | let col = ' ant-col ant-col-' + (card.width || 24) |
| | | if (card.type === 'login') { |
| | | let height = '' |
| | | if (card.wrap && card.wrap.height) { |
| | | // scaleview |
| | | height = card.wrap.height.replace(/\d+vw/ig, (word) => { |
| | | return parseFloat(word) * (window.GLOB.winWidth || 420) / 100 + 'px' |
| | | // return parseFloat(word) * 350 / 100 + 'px' |
| | | }).replace(/\d+vh/ig, (word) => { |
| | | return parseFloat(word) * (window.GLOB.winHeight || 738) / 100 + 'px' |
| | | // return parseFloat(word) * 615 / 100 + 'px' |
| | | }) |
| | | } |
| | | |
| | | style.minHeight = height |
| | | } |
| | | |
| | | const getCardComponent = () => { |
| | | if (card.type === 'bar' || card.type === 'line') { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Select, Input, DatePicker, notification } from 'antd' |
| | | import { Button, Select, Input, Modal, DatePicker, notification } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const VoucherTable = asyncComponent(() => import('./voucherTable')) |
| | | |
| | | class VoucherModule extends Component { |
| | |
| | | |
| | | state = { |
| | | BID: '', |
| | | type: 'createVoucher', |
| | | config: null, |
| | | loading: false, |
| | | data: [], |
| | | disableAdd: false, |
| | | disableSave: false, |
| | | tbdata: [], |
| | | typeOptions: [], |
| | | charType: '', |
| | | charInt: '', |
| | | vouDate: null, |
| | | book: null, |
| | | username: sessionStorage.getItem('User_Name'), |
| | | change: false |
| | | status: '' // 新建时,empty、change、saved |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | } |
| | | |
| | | window.GLOB.CacheVoucher.delete(config.uuid) |
| | | let type = config.wrap.type || 'createVoucher' |
| | | |
| | | this.setState({ |
| | | config: fromJS(config).toJS(), |
| | | type: type, |
| | | BID: BID || '', |
| | | status: 'empty', |
| | | book: window.GLOB.CacheData.get(config.wrap.supBook) || null |
| | | }, () => { |
| | | this.loadData() |
| | | this.getVoucher() |
| | | }) |
| | | } |
| | | |
| | |
| | | if (!config.wrap.supModule || config.wrap.supModule !== MenuID) return |
| | | if (id !== this.state.BID || id !== '') { |
| | | this.setState({ BID: id, BData: data }, () => { |
| | | this.loadData() |
| | | this.getVoucher() |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | window.GLOB.CacheVoucher.set(config.uuid, message) |
| | | |
| | | setTimeout(() => { |
| | | this.getVoucher() |
| | | }, 200) |
| | | }) |
| | | } |
| | | |
| | | |
| | | getVoucher = () => { |
| | | const { BID, type } = this.state |
| | | |
| | | if (!BID || type === 'createVoucher' || type === 'createTemp') return |
| | | |
| | | let param = { |
| | | func: 's_get_fcc_voucher', |
| | | BID: BID |
| | | } |
| | | |
| | | let data = [ |
| | | {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 124, creditor: ''}, |
| | | {remark: '购入固定资产', subjectscode: '1001', subjectsname: '库存现金', debtor: '', creditor: 124}, |
| | |
| | | {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 34, creditor: '', i: Math.random()}, |
| | | ] |
| | | |
| | | this.setState({ |
| | | data: data |
| | | Api.genericInterface(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | tbdata: fromJS(data).toJS() |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | triggeradd = () => { |
| | | |
| | | triggersave = (t) => { |
| | | const { tbdata } = this.state |
| | | |
| | | let err = '' |
| | | let tip = '' |
| | | let list = [] |
| | | |
| | | tbdata.forEach((line, index) => { |
| | | if (err) return |
| | | if (line.type === 'total') { |
| | | if (line.debtor !== line.creditor) { |
| | | err = '借贷不平衡!' |
| | | } |
| | | return |
| | | } |
| | | |
| | | let _index = index + 1 |
| | | |
| | | if (!line.remark && !line.subjectscode && !line.debtor && line.debtor !== 0 && !line.creditor && line.creditor !== 0) { |
| | | if (_index === 1) { |
| | | err = '第1行不可为空。' |
| | | } |
| | | return |
| | | } |
| | | |
| | | if (!line.remark) { |
| | | err = `第${_index}行,摘要不可为空。` |
| | | } else if (!line.subjectscode) { |
| | | err = `第${_index}行,科目不可为空。` |
| | | } else if (!line.debtor && line.debtor !== 0 && !line.creditor && line.creditor !== 0) { |
| | | err = `第${_index}行,请输入金额。` |
| | | } else if (line.debtor === 0 || line.creditor === 0) { |
| | | err = `第${_index}行,金额不能为0。` |
| | | } else if (line.sup_accounting) { |
| | | line.sup_accounting.split(',').forEach(item => { |
| | | if (!line[item]) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (line.count_type === 'Y' && !err) { |
| | | if (!line.count) { |
| | | tip += `第${_index}行,数量为空或为0!;` |
| | | } else if (line.price) { |
| | | if (line.debtor && line.debtor !== line.count * line.price) { |
| | | tip += `第${_index}行,数量和金额不匹配!;` |
| | | } else if (line.creditor && line.creditor !== line.count * line.price) { |
| | | tip += `第${_index}行,数量和金额不匹配!;` |
| | | } |
| | | } |
| | | } |
| | | |
| | | list.push(line) |
| | | }) |
| | | |
| | | if (!err && list.length === 0) { |
| | | err = '第1行不可为空。' |
| | | } |
| | | |
| | | if (err) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: err, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (tip) { |
| | | const _this = this |
| | | confirm({ |
| | | content: tip + '确认要保存吗?', |
| | | onOk() { |
| | | _this.voucherSave(list, t) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.voucherSave(list, t) |
| | | } |
| | | } |
| | | |
| | | triggersave = () => { |
| | | voucherSave = (list, t) => { |
| | | const { BID, config, charInt, charType, book } = this.state |
| | | |
| | | if (!book) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择账套!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_fcc_voucher_addupt', |
| | | BID: BID, |
| | | voucher_code: '', |
| | | voucher_text: '', |
| | | remark: '', |
| | | account_year_code: '', |
| | | voucher_type: '', |
| | | voucher_type_text: '', |
| | | orgcode: '', |
| | | orgname: '', |
| | | voucher_class: '', |
| | | years: book.years, |
| | | business_type: '', |
| | | voucher_sign: '', |
| | | voucher_char: charType, |
| | | voucher_char_int: charInt, |
| | | account_code: book.account_code || '', |
| | | fibvoucherdate: '', |
| | | UserName: sessionStorage.getItem('User_Name') || '', |
| | | FullName: sessionStorage.getItem('Full_Name') || '', |
| | | sup_data: '', |
| | | subject_data: '' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (t === 'add') { |
| | | this.setState({ |
| | | status: 'empty', |
| | | tbdata: [], |
| | | charInt: charInt + 1 |
| | | }) |
| | | MKEmitter.emit('cleartable', config.uuid) |
| | | } else { |
| | | this.setState({ |
| | | status: 'saved' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | triggerprint = () => { |
| | | |
| | | } |
| | | |
| | | dataChange = (data) => { |
| | | this.setState({ |
| | | status: 'change', |
| | | tbdata: data |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate, username } = this.state |
| | | const { type, status, loading, config, typeOptions, charType, charInt, data, vouDate, username } = this.state |
| | | |
| | | return ( |
| | | <div className="menu-voucher-wrap" style={config.style}> |
| | | <div className="voucher-header"> |
| | | <Button className="add-background header-btn" disabled={disableAdd} onClick={this.triggeradd}>新增</Button> |
| | | <Button className="add-background header-btn" disabled={disableSave} onClick={this.triggersave}>保存</Button> |
| | | <Button className="print-background header-btn" disabled={disableSave} onClick={this.triggerprint}>打印</Button> |
| | | <Button className="system-background header-btn" disabled={disableSave} onClick={this.triggerprint}>导入</Button> |
| | | <Button className="out-background header-btn" disabled={disableSave} onClick={this.triggerprint}>导出</Button> |
| | | </div> |
| | | {config.wrap.type === 'edit' ? <div className="voucher-body"> |
| | | <div className="pre-wrap"> |
| | | {type === 'createVoucher' ? <div className="voucher-header"> |
| | | <Button className="add-background header-btn" disabled={status === 'empty'} onClick={() => this.triggersave('add')}>保存并新增</Button> |
| | | <Button className="add-background header-btn" disabled={status === 'empty' || status === 'saved'} onClick={() => this.triggersave()}>保存</Button> |
| | | <Button className="print-background header-btn" disabled={status !== 'saved'} onClick={this.triggerprint}>打印</Button> |
| | | <Button className="out-background header-btn" onClick={this.triggerprint}>更多</Button> |
| | | </div> : null} |
| | | <div className="voucher-body"> |
| | | {type === 'createVoucher' ? <div className="pre-wrap"> |
| | | <div className="voucher-code"> |
| | | <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charint})}> |
| | | {typeOptions.map(option => |
| | |
| | | <Button type="link" className="" onClick={this.triggerprint}>附件</Button> |
| | | <Button type="link" className="" onClick={this.triggerprint}>备注</Button> |
| | | </div> |
| | | </div> |
| | | <VoucherTable config={config} data={data}/> |
| | | </div> : null} |
| | | {config.wrap.type === 'check' ? <div className="voucher-body"> |
| | | <div className="pre-wrap"> |
| | | <div className="voucher-code"> |
| | | 记 1 号 |
| | | </div> |
| | | <div className="voucher-date"> |
| | | 日期:2022-02-24 |
| | | </div> |
| | | <div className="voucher-affix"> |
| | | 附单据 2 张 |
| | | <Button type="link" className="" onClick={this.triggerprint}>附件</Button> |
| | | <Button type="link" className="" onClick={this.triggerprint}>备注</Button> |
| | | </div> |
| | | </div> |
| | | <VoucherTable config={config} data={data}/> |
| | | </div> : null} |
| | | </div> : null} |
| | | <VoucherTable config={config} loading={loading} data={data} onChange={this.dataChange}/> |
| | | </div> |
| | | <div className="user">制单人:{username}</div> |
| | | </div> |
| | | ) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Modal, Form, Input, InputNumber, notification, message, AutoComplete, Select, Popover, Button } from 'antd' |
| | | import { Table, Form, Input, InputNumber, notification, AutoComplete, Select, Popover, Button } from 'antd' |
| | | import { PlusOutlined, CloseOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import './index.scss' |
| | | |
| | | class BodyRow extends React.Component { |
| | |
| | | this.setState({editing: false}) |
| | | |
| | | let line = {...record} |
| | | line[col.field] = value |
| | | |
| | | if (value !== record[col.field]) { |
| | | line[col.field] = value |
| | | |
| | | if (col.field === 'debtor') { |
| | | line.creditor = '' |
| | | if (isNaN(line.debtor)) { |
| | | line.debtor = '' |
| | | } |
| | | } else { |
| | | if (col.field === 'debtor') { |
| | | line.creditor = '' |
| | | if (isNaN(line.debtor)) { |
| | | line.debtor = '' |
| | | if (isNaN(line.creditor)) { |
| | | line.creditor = '' |
| | | } |
| | | } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | } else { |
| | | line.debtor = '' |
| | | if (isNaN(line.creditor)) { |
| | | line.creditor = '' |
| | | } |
| | | } |
| | | |
| | | if (line.count_type === 'Y' && line.count) { |
| | | if (line.debtor) { |
| | | line.price = Math.round(line.debtor / line.count * 10000) / 10000 |
| | | } else if (line.creditor) { |
| | | line.price = Math.round(line.creditor / line.count * 10000) / 10000 |
| | | } |
| | | } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | |
| | | setTimeout(() => { |
| | | if (col.field === 'debtor' && (line.debtor || line.debtor === 0)) { |
| | |
| | | line.debtor = '' |
| | | if (isNaN(line.creditor)) { |
| | | line.creditor = '' |
| | | } |
| | | } |
| | | |
| | | if (line.count_type === 'Y' && line.count) { |
| | | if (line.debtor) { |
| | | line.price = Math.round(line.debtor / line.count * 10000) / 10000 |
| | | } else if (line.creditor) { |
| | | line.price = Math.round(line.creditor / line.count * 10000) / 10000 |
| | | } |
| | | } |
| | | |
| | |
| | | line.count = 0 |
| | | } |
| | | |
| | | if (line.count && line.price) { |
| | | line.debtor = Math.round(line.count * line.price * 100) / 100 |
| | | } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | |
| | | this.setState({counting: false, priceing: true, value: line.price || 0}, () => { |
| | |
| | | if (isNaN(line.count)) { |
| | | line.count = 0 |
| | | } |
| | | |
| | | if (line.count && line.price) { |
| | | line.debtor = Math.round(line.count * line.price * 100) / 100 |
| | | } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | } |
| | |
| | | |
| | | if (isNaN(line.price)) { |
| | | line.price = 0 |
| | | } |
| | | |
| | | if (line.count && line.price) { |
| | | line.debtor = Math.round(line.count * line.price * 100) / 100 |
| | | } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | |
| | | |
| | | if (isNaN(line.price)) { |
| | | line.price = 0 |
| | | } |
| | | |
| | | if (line.count && line.price) { |
| | | line.debtor = Math.round(line.count * line.price * 100) / 100 |
| | | } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | |
| | | } |
| | | } else if (col.field === 'debtor') { |
| | | if (editing) { |
| | | children = <InputNumber id={col.uuid + record.uuid} defaultValue={record.debtor} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | children = <InputNumber id={col.uuid + record.uuid} precision={2} defaultValue={record.debtor} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | } else { |
| | | let val = record.debtor |
| | | let down = false |
| | |
| | | extra = <CloseOutlined onClick={this.delRecord}/> |
| | | |
| | | if (editing) { |
| | | children = <InputNumber id={col.uuid + record.uuid} defaultValue={record.creditor} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | children = <InputNumber id={col.uuid + record.uuid} precision={2} defaultValue={record.creditor} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | } else { |
| | | let val = record.creditor |
| | | let down = false |
| | |
| | | class VoucherTable extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, // 菜单Id |
| | | BID: PropTypes.any, // 主表ID |
| | | data: PropTypes.any, // 表格数据 |
| | | total: PropTypes.any, // 总数 |
| | | loading: PropTypes.bool, // 表格加载中 |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | onChange: PropTypes.func, // 表格变动 |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | data: [], |
| | | edData: [], |
| | | edColumns: [], |
| | | tableId: '', // 表格ID |
| | | pageSize: 10, // 每页数据条数 |
| | | columns: null, // 显示列 |
| | | loading: false, |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | MKEmitter.addListener('nextLine', this.nextLine) |
| | | MKEmitter.addListener('plusLine', this.plusLine) |
| | | MKEmitter.addListener('delRecord', this.delRecord) |
| | | MKEmitter.addListener('cleartable', this.cleartable) |
| | | MKEmitter.addListener('changeRecord', this.changeRecord) |
| | | } |
| | | |
| | |
| | | MKEmitter.removeListener('nextLine', this.nextLine) |
| | | MKEmitter.removeListener('plusLine', this.plusLine) |
| | | MKEmitter.removeListener('delRecord', this.delRecord) |
| | | MKEmitter.removeListener('cleartable', this.cleartable) |
| | | MKEmitter.removeListener('changeRecord', this.changeRecord) |
| | | } |
| | | |
| | |
| | | if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | this.resetData(fromJS(nextProps.data).toJS()) |
| | | } |
| | | } |
| | | |
| | | cleartable = (tbid) => { |
| | | const { tableId } = this.state |
| | | |
| | | if (tbid !== tableId) return |
| | | |
| | | this.resetData([]) |
| | | } |
| | | |
| | | resetData = (data) => { |
| | |
| | | this.setState({edData: _data}, () => { |
| | | MKEmitter.emit('tdFocus', 'remark' + line.uuid) |
| | | }) |
| | | this.props.onChange(_data) |
| | | } |
| | | } |
| | | |
| | |
| | | let line = {uuid: Utils.getuuid(), index: 0, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''} |
| | | |
| | | _data.splice(record.index, 0, line) |
| | | |
| | | this.setState({edData: _data.map((item, index) => { |
| | | _data = _data.map((item, index) => { |
| | | item.index = index |
| | | return item |
| | | })}) |
| | | }) |
| | | |
| | | this.setState({edData: _data}) |
| | | this.props.onChange(_data) |
| | | } |
| | | |
| | | delRecord = (id, record) => { |
| | |
| | | _data.push(this.getTotalLine(_data)) |
| | | |
| | | this.setState({edData: _data}) |
| | | this.props.onChange(_data) |
| | | } |
| | | |
| | | changeRecord = (tableId, record) => { |
| | |
| | | _data.push(this.getTotalLine(_data)) |
| | | |
| | | this.setState({edData: _data}) |
| | | } |
| | | |
| | | checkData = () => { |
| | | const { edData } = this.state |
| | | |
| | | let err = '' |
| | | let data = fromJS(edData).toJS().map(item => { |
| | | // let line = [] |
| | | // fields.forEach(col => { |
| | | // if (col.editable !== 'true' || item.$deleted) { |
| | | // if (col.type === 'number') { |
| | | // item[col.field] = +item[col.field] |
| | | // if (isNaN(item[col.field])) { |
| | | // item[col.field] = 0 |
| | | // } |
| | | // } else { |
| | | // item[col.field] = item[col.field] !== undefined ? (item[col.field] + '') : '' |
| | | // } |
| | | // return |
| | | // } |
| | | // if (col.type === 'text') { |
| | | // let val = item[col.field] !== undefined ? (item[col.field] + '') : '' |
| | | // if (col.required === 'true' && !val) { |
| | | // line.push(`${col.label}不可为空`) |
| | | // } |
| | | // item[col.field] = val |
| | | // } else if (col.type === 'number') { |
| | | // let val = item[col.field] |
| | | // if (!val && val !== 0) { |
| | | // line.push(`${col.label}不可为空`) |
| | | // return |
| | | // } |
| | | // val = +val |
| | | // if (isNaN(val)) { |
| | | // line.push(`${col.label}数据格式错误`) |
| | | // return |
| | | // } |
| | | |
| | | // val = +val.toFixed(col.decimal || 0) |
| | | |
| | | // if (typeof(col.max) === 'number' && val > col.max) { |
| | | // line.push(`${col.label}不可大于${col.max}`) |
| | | // } else if (typeof(col.min) === 'number' && val < col.min) { |
| | | // line.push(`${col.label}不可小于${col.min}`) |
| | | // } |
| | | |
| | | // item[col.field] = val |
| | | // } |
| | | // }) |
| | | |
| | | return item |
| | | }) |
| | | |
| | | if (err) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: err, |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | this.submit(data) |
| | | } |
| | | } |
| | | |
| | | submit = (data) => { |
| | | const { BID } = this.props |
| | | |
| | | let param = { |
| | | // excel_in: result.lines, |
| | | BID: BID || '' |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | param.func = 'submit.innerFunc' |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | this.execError({}) |
| | | }) |
| | | } |
| | | |
| | | execSuccess = (res) => { |
| | | const { submit } = this.props |
| | | |
| | | if (res && res.ErrCode === 'S') { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.ErrMesg || this.state.dict['main.action.confirm.success'], |
| | | duration: submit.stime ? submit.stime : 2 |
| | | }) |
| | | } else if (res && res.ErrCode === 'Y') { // 执行成功 |
| | | Modal.success({ |
| | | title: res.ErrMesg || this.state.dict['main.action.confirm.success'] |
| | | }) |
| | | } else if (res && res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | |
| | | if (submit.closetab === 'true') { |
| | | MKEmitter.emit('popclose') |
| | | } |
| | | if (submit.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit) |
| | | } |
| | | } |
| | | |
| | | execError = (res) => { |
| | | const { submit } = this.props |
| | | |
| | | if (res.ErrCode === 'E') { |
| | | Modal.error({ |
| | | title: res.message || res.ErrMesg, |
| | | }) |
| | | } else if (res.ErrCode === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: submit.ntime ? submit.ntime : 10 |
| | | }) |
| | | } else if (res.ErrCode === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: submit.ftime ? submit.ftime : 10 |
| | | }) |
| | | } else if (res.ErrCode === 'NM') { |
| | | message.error(res.message || res.ErrMesg) |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | |
| | | if (submit.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit) |
| | | } |
| | | this.props.onChange(_data) |
| | | } |
| | | |
| | | render() { |
| | |
| | | columns={columns} |
| | | dataSource={edData} |
| | | bordered={true} |
| | | // loading={this.props.loading} |
| | | loading={this.props.loading} |
| | | onRow={(record, index) => { |
| | | return { |
| | | data: record |