From 59002c8182d10c21a1becdff4e566ee11cd1cd91 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 23 四月 2024 18:13:08 +0800 Subject: [PATCH] 2024-04-23 --- src/menu/components/module/invoice/index.jsx | 72 ++++++++++++++++++++++++++++++++---- 1 files changed, 64 insertions(+), 8 deletions(-) diff --git a/src/menu/components/module/invoice/index.jsx b/src/menu/components/module/invoice/index.jsx index 344641e..6902bb1 100644 --- a/src/menu/components/module/invoice/index.jsx +++ b/src/menu/components/module/invoice/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Popover, Button } from 'antd' +import { Popover, Button, Modal } from 'antd' import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons' import moment from 'moment' @@ -9,6 +9,7 @@ import asyncIconComponent from '@/utils/asyncIconComponent' import { getTables, checkComponent } from '@/utils/utils-custom.js' import MKEmitter from '@/utils/events.js' +import VerifyCard from './verifycard' import getWrapForm from './options' import './index.scss' @@ -25,7 +26,8 @@ state = { card: null, - date: moment().format('YYYY骞碝M鏈�') + date: moment().format('YYYY骞碝M鏈�'), + btn: null } UNSAFE_componentWillMount () { @@ -69,7 +71,9 @@ {field: 'productname', label: '鍟嗗搧鍚嶇О', initval: '', type: 'text', match: 'like', uuid: Utils.getuuid()}, {field: 'productcode', label: '鍟嗗搧缂栫爜', initval: '', type: 'text', match: 'like', uuid: Utils.getuuid()}, ], - } + }, + billSaveBtn: {type: 'billsave', intertype: 'system', label: '淇濆瓨鍗曟嵁'}, + billOutBtn: {type: 'billout', intertype: 'custom', label: '鎻愪氦寮�绁�', procMode: 'system'}, } let buys = [ @@ -149,8 +153,8 @@ } else { let _card = fromJS(card).toJS() - // _card.buyer.format = 'array' - // _card.detail.format = 'array' + // _card.billSaveBtn = _card.billSaveBtn || {type: 'billsave', intertype: 'system', label: '淇濆瓨鍗曟嵁'} + // _card.billOutBtn = _card.billOutBtn || {type: 'billout', intertype: 'custom', label: '鎻愪氦寮�绁�', procMode: 'system'} this.setState({ card: _card @@ -205,6 +209,14 @@ } } + if (!card.billSaveBtn.scripts || card.billSaveBtn.scripts.length === 0) { + card.errors.push({ level: 0, detail: '鏈坊鍔犲崟鎹繚瀛樿剼鏈紒'}) + // } else if (!card.billOutBtn.scripts || card.billOutBtn.scripts.length === 0) { + // card.errors.push({ level: 0, detail: '鏈坊鍔犳彁浜ゅ紑绁ㄥ墠缃剼鏈紒'}) + // } else if (card.billSaveBtn.cbScripts.length === 0) { + // card.errors.push({ level: 0, detail: '鏈坊鍔犳彁浜ゅ紑绁ㄥ洖璋冭剼鏈紒'}) + } + if (card.errors.length === 0) { card.$tables = getTables(card) card.$tables = [...card.$tables, ...getTables(card.buyer)] @@ -240,8 +252,20 @@ this.updateComponent({...this.state.card, wrap: res}) } + verifySubmit = () => { + this.verifyRef.handleConfirm().then(res => { + if (res.type === 'billout') { + this.updateComponent({...this.state.card, billOutBtn: res}) + } else { + this.updateComponent({...this.state.card, billSaveBtn: res}) + } + + this.setState({ btn: null }) + }) + } + render() { - const { card, date } = this.state + const { card, date, btn } = this.state let style = {...card.style} if (card.wrap.invColor) { @@ -263,8 +287,20 @@ <ToolOutlined /> </Popover> <div className="inv-action"> - <Button className="mk-bill">淇濆瓨鍗曟嵁</Button> - <Button className="mk-submit">鎻愪氦寮�绁�</Button> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <EditOutlined style={{color: '#1890ff'}} onClick={() => this.setState({btn: card.billSaveBtn})} title="缂栬緫"/> + </div> + } trigger="hover"> + <Button className="mk-bill">淇濆瓨鍗曟嵁</Button> + </Popover> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <EditOutlined style={{color: '#1890ff'}} onClick={() => this.setState({btn: card.billOutBtn})} title="缂栬緫"/> + </div> + } trigger="hover"> + <Button className="mk-submit">鎻愪氦寮�绁�</Button> + </Popover> </div> <div className="inv-header"> <div className="mk-select">璇烽�夋嫨鍙戠エ绉嶇被</div> @@ -413,6 +449,26 @@ <span className="content">寮�绁ㄤ汉</span> </div> </div> + <Modal + wrapClassName="mk-pop-modal" + visible={btn !== null} + width={'90vw'} + maskClosable={false} + okText="鎻愪氦" + onOk={this.verifySubmit} + onCancel={() => { + if (this.verifyRef.handleCancel) { + this.verifyRef.handleCancel().then(() => { + this.setState({ btn: null }) + }) + } else { + this.setState({ btn: null }) + } + }} + destroyOnClose + > + <VerifyCard card={btn} wrappedComponentRef={(inst) => this.verifyRef = inst}/> + </Modal> </div> ) } -- Gitblit v1.8.0