| | |
| | | flex: auto; |
| | | min-height: 100%; |
| | | } |
| | | |
| | | .component-wrap >.ant-col { |
| | | min-height: 0; |
| | | } |
| | |
| | | getMenulist = (result) => { |
| | | let thdMenuList = [] |
| | | let menulist = [] |
| | | let names = new Map() |
| | | let doublenames = new Map() |
| | | result.fst_menu && result.fst_menu.forEach(fst => { |
| | | let fstItem = { |
| | | MenuID: fst.MenuID, |
| | |
| | | ParentId: snd.MenuID, |
| | | MenuID: trd.MenuID, |
| | | MenuName: trd.MenuName, |
| | | menu_name: trd.MenuName, |
| | | ParentNames: [fst.MenuName, snd.MenuName], |
| | | MenuNo: trd.MenuNo, |
| | | EasyCode: trd.EasyCode, |
| | |
| | | |
| | | trdItem.OpenType = trdItem.OpenType.toLowerCase() // NewPage为打开外部页面地址 |
| | | |
| | | if (names.has(trdItem.menu_name)) { |
| | | doublenames.set(trdItem.menu_name, true) |
| | | } else { |
| | | names.set(trdItem.menu_name, true) |
| | | } |
| | | |
| | | thdMenuList.push(trdItem) |
| | | |
| | | return trdItem |
| | |
| | | } |
| | | |
| | | menulist.push(fstItem) |
| | | }) |
| | | |
| | | thdMenuList = thdMenuList.map(item => { |
| | | if (doublenames.has(item.menu_name)) { |
| | | item.menu_name += '(' + item.ParentNames.join('-') + ')' |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | return { menulist, thdMenuList } |
| | |
| | | option.MenuNo.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 || |
| | | option.EasyCode.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 |
| | | ) { |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.MenuName}</Menu.Item> |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.menu_name}</Menu.Item> |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.MenuName}</Menu.Item> |
| | | return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.menu_name}</Menu.Item> |
| | | })} |
| | | </Menu> |
| | | </div> |
| | |
| | | }) |
| | | |
| | | window.GLOB.CacheMap = new Map() // 缓存配置信息 |
| | | window.GLOB.CacheVoucher = new Map() // 缓存凭证信息 |
| | | window.GLOB.UserCacheMap = new Map() // 缓存用户自定义设置 |
| | | window.GLOB.CacheData = new Map() // 存储选中数据 |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Button } from 'antd' |
| | | import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, PrinterOutlined } from '@ant-design/icons' |
| | | import { Popover, Button, Modal } from 'antd' |
| | | import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, PrinterOutlined, UngroupOutlined } from '@ant-design/icons' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | import getSettingForm from './options' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | |
| | | static propTpyes = { |
| | | group: PropTypes.object, |
| | | deletecomponent: PropTypes.func, |
| | | unGroup: PropTypes.func, |
| | | updateConfig: PropTypes.func, |
| | | } |
| | | |
| | |
| | | this.updateComponent(group) |
| | | } |
| | | |
| | | unGroup = () => { |
| | | const { group } = this.state |
| | | |
| | | if (group.components.length === 0) return |
| | | |
| | | const _this = this |
| | | confirm({ |
| | | title: '确定释放分组元素吗?', |
| | | content: '', |
| | | onOk() { |
| | | _this.props.unGroup(group.uuid) |
| | | |
| | | setTimeout(() => { |
| | | _this.updataGroup() |
| | | }, 10) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | updataGroup = () => { |
| | | const { group } = this.props |
| | | |
| | | if (group.components.length === 0) { |
| | | this.setState({ |
| | | group: fromJS(group).toJS() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { group } = this.state |
| | | let _style = resetStyle(group.style) |
| | |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="tabs" card={group}/> |
| | | <UngroupOutlined title="释放" style={group.components.length > 0 ? {color: '#32c5d2'} : {color: '#eeeeee', cursor: 'not-allowed'}} onClick={this.unGroup}/> |
| | | <PasteComponent insert={this.insert} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(group.uuid)} /> |
| | |
| | | } |
| | | } |
| | | .voucher-body { |
| | | padding: 0 15px; |
| | | padding: 0 30px; |
| | | .voucher-code { |
| | | display: inline-block; |
| | | width: 160px; |
| | |
| | | const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) |
| | | const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'menu', id, originalIndex }, |
| | |
| | | } else if (card.type === 'table' && card.subtype === 'editable') { |
| | | return (<EditTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'group' && card.subtype === 'normalgroup') { |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} unGroup={unGroup} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'editor') { |
| | | return (<BraftEditor card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'code') { |
| | |
| | | handleList({...config, components: cards.map(item => item.uuid === element.uuid ? element : item)}) |
| | | } |
| | | |
| | | const unGroup = (id) => { |
| | | let { card, index } = findCard(`${id}`) |
| | | let components = [...card.components].map(item => { |
| | | if (item.wrap) { |
| | | item.wrap.width = card.width |
| | | item.width = card.width |
| | | } else if (item.plot) { |
| | | item.plot.width = card.width |
| | | item.width = card.width |
| | | } |
| | | return item |
| | | }) |
| | | card.components = [] |
| | | |
| | | const _cards = update(cards, { $splice: [[index, 1, card, ...components]] }) |
| | | |
| | | handleList({...config, components: _cards}) |
| | | } |
| | | |
| | | const deleteCard = (id) => { |
| | | const { card } = findCard(id) |
| | | |
| | |
| | | card={card} |
| | | moveCard={moveCard} |
| | | delCard={deleteCard} |
| | | unGroup={unGroup} |
| | | findCard={findCard} |
| | | updateConfig={updateConfig} |
| | | /> |
| | |
| | | const Iframe = asyncComponent(() => import('@/menu/components/iframe')) |
| | | const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'menu', id, originalIndex }, |
| | |
| | | } else if (card.type === 'table' && card.subtype === 'editable') { |
| | | return (<EditTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'group' && card.subtype === 'normalgroup') { |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} unGroup={unGroup} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'editor') { |
| | | return (<BraftEditor card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'code') { |
| | |
| | | setCards(_cards) |
| | | } |
| | | |
| | | const unGroup = (id) => { |
| | | let { card, index } = findCard(`${id}`) |
| | | let components = [...card.components].map(item => { |
| | | if (item.wrap) { |
| | | item.wrap.width = card.width |
| | | item.width = card.width |
| | | } else if (item.plot) { |
| | | item.plot.width = card.width |
| | | item.width = card.width |
| | | } |
| | | return item |
| | | }) |
| | | card.components = [] |
| | | |
| | | const _cards = update(cards, { $splice: [[index, 1, card, ...components]] }) |
| | | |
| | | handleList({...menu, components: _cards}) |
| | | } |
| | | |
| | | const deleteCard = (id) => { |
| | | const { card } = findCard(id) |
| | | |
| | |
| | | card={card} |
| | | moveCard={moveCard} |
| | | delCard={deleteCard} |
| | | unGroup={unGroup} |
| | | findCard={findCard} |
| | | updateConfig={updateConfig} |
| | | /> |
| | |
| | | const CodeSandbox = asyncComponent(() => import('@/menu/components/code/sandbox')) |
| | | const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'menu', id, originalIndex }, |
| | |
| | | } else if (card.type === 'table' && card.subtype === 'normaltable') { |
| | | return (<NormalTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'group' && card.subtype === 'normalgroup') { |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} unGroup={unGroup} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'editor') { |
| | | return (<BraftEditor card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'menubar') { |
| | |
| | | handleList({...config, components: cards.map(item => item.uuid === element.uuid ? element : item)}) |
| | | } |
| | | |
| | | const unGroup = (id) => { |
| | | let { card, index } = findCard(`${id}`) |
| | | let components = [...card.components].map(item => { |
| | | if (item.wrap) { |
| | | item.wrap.width = card.width |
| | | item.width = card.width |
| | | } else if (item.plot) { |
| | | item.plot.width = card.width |
| | | item.width = card.width |
| | | } |
| | | return item |
| | | }) |
| | | card.components = [] |
| | | |
| | | const _cards = update(cards, { $splice: [[index, 1, card, ...components]] }) |
| | | |
| | | handleList({...config, components: _cards}) |
| | | } |
| | | |
| | | const deleteCard = (id) => { |
| | | const { card } = findCard(id) |
| | | |
| | |
| | | card={card} |
| | | moveCard={moveCard} |
| | | delCard={deleteCard} |
| | | unGroup={unGroup} |
| | | findCard={findCard} |
| | | updateConfig={updateConfig} |
| | | /> |
| | |
| | | const ShareCode = asyncComponent(() => import('@/mob/components/sharecode')) |
| | | const Iframe = asyncComponent(() => import('@/menu/components/iframe')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'menu', id, originalIndex }, |
| | |
| | | } else if (card.type === 'table' && card.subtype === 'normaltable') { |
| | | return (<NormalTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'group' && card.subtype === 'normalgroup') { |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} unGroup={unGroup} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'code') { |
| | | return (<CodeSandbox card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'editor') { |
| | |
| | | setCards(_cards) |
| | | } |
| | | |
| | | const unGroup = (id) => { |
| | | let { card, index } = findCard(`${id}`) |
| | | let components = [...card.components].map(item => { |
| | | if (item.wrap) { |
| | | item.wrap.width = card.width |
| | | item.width = card.width |
| | | } else if (item.plot) { |
| | | item.plot.width = card.width |
| | | item.width = card.width |
| | | } |
| | | return item |
| | | }) |
| | | card.components = [] |
| | | |
| | | const _cards = update(cards, { $splice: [[index, 1, card, ...components]] }) |
| | | |
| | | handleList({...menu, components: _cards}) |
| | | } |
| | | |
| | | const deleteCard = (id) => { |
| | | const { card } = findCard(id) |
| | | |
| | |
| | | card={card} |
| | | moveCard={moveCard} |
| | | delCard={deleteCard} |
| | | unGroup={unGroup} |
| | | findCard={findCard} |
| | | updateConfig={updateConfig} |
| | | /> |
| | |
| | | const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) |
| | | const Iframe = asyncComponent(() => import('@/menu/components/iframe')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'menu', id, originalIndex }, |
| | |
| | | } else if (card.type === 'table' && card.subtype === 'editable') { |
| | | return (<EditTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'group' && card.subtype === 'normalgroup') { |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | return (<NormalGroup group={card} updateConfig={updateConfig} unGroup={unGroup} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'editor') { |
| | | return (<BraftEditor card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'code') { |
| | |
| | | setCards(_cards) |
| | | } |
| | | |
| | | const unGroup = (id) => { |
| | | let { card, index } = findCard(`${id}`) |
| | | let components = [...card.components].map(item => { |
| | | if (item.wrap) { |
| | | item.wrap.width = card.width |
| | | item.width = card.width |
| | | } else if (item.plot) { |
| | | item.plot.width = card.width |
| | | item.width = card.width |
| | | } |
| | | return item |
| | | }) |
| | | card.components = [] |
| | | |
| | | const _cards = update(cards, { $splice: [[index, 1, card, ...components]] }) |
| | | |
| | | handleList({...menu, components: _cards}) |
| | | } |
| | | |
| | | const deleteCard = (id) => { |
| | | const { card } = findCard(id) |
| | | |
| | |
| | | card={card} |
| | | moveCard={moveCard} |
| | | delCard={deleteCard} |
| | | unGroup={unGroup} |
| | | findCard={findCard} |
| | | updateConfig={updateConfig} |
| | | /> |
| | |
| | | padding-right: 16px; |
| | | background-size: 100%; |
| | | |
| | | .component-wrap >.ant-col { |
| | | min-height: 0; |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | |
| | | disableAdd: false, |
| | | disableSave: false, |
| | | typeOptions: [], |
| | | subjects: [], |
| | | charType: '', |
| | | charInt: '', |
| | | vouDate: null, |
| | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | window.GLOB.CacheVoucher.delete(config.uuid) |
| | | |
| | | this.setState({ |
| | | config: fromJS(config).toJS(), |
| | |
| | | } |
| | | |
| | | loadData = () => { |
| | | const { book } = this.state |
| | | const { book, config } = this.state |
| | | |
| | | if (!book) return |
| | | |
| | |
| | | typeOptions: typeOptions, |
| | | charType: typeOptions[0] ? typeOptions[0].voucher_class : '', |
| | | charInt: typeOptions[0] ? typeOptions[0].voucher_char_int : '', |
| | | subjects: res.subjects || [], |
| | | }) |
| | | |
| | | let names = {} |
| | | let supplier = [] |
| | | let customer = [] |
| | | let department = [] |
| | | let project = [] |
| | | let inventory = [] |
| | | let employee = [] |
| | | let cash_flow = [] |
| | | |
| | | res.sup && res.sup.forEach(item => { |
| | | names[item.sup_type_code] = item.sup_type_name |
| | | }) |
| | | |
| | | res.supplier && res.supplier.forEach(item => { |
| | | supplier.push({value: item.suppliercode, label: item.suppliername}) |
| | | }) |
| | | |
| | | res.customer && res.customer.forEach(item => { |
| | | customer.push({value: item.customercode, label: item.customername}) |
| | | }) |
| | | |
| | | res.co_pro && res.co_pro.forEach(item => { |
| | | department.push({value: item.co_pro_code, label: item.co_pro_name}) |
| | | }) |
| | | |
| | | res.pm && res.pm.forEach(item => { |
| | | project.push({value: item.projectcode, label: item.projectname}) |
| | | }) |
| | | |
| | | res.materiel && res.materiel.forEach(item => { |
| | | inventory.push({value: item.productcode, label: item.productname}) |
| | | }) |
| | | |
| | | res.workers && res.workers.forEach(item => { |
| | | employee.push({value: item.workercode, label: item.workername}) |
| | | }) |
| | | |
| | | res.cash_flow && res.cash_flow.forEach(item => { |
| | | cash_flow.push({value: item.cash_flow_code, label: item.cash_flow_name}) |
| | | }) |
| | | |
| | | let message = { |
| | | subjects: res.subjects || [], |
| | | names: names, |
| | | supplier: supplier, |
| | | customer: customer, |
| | | department: department, |
| | | project: project, |
| | | inventory: inventory, |
| | | employee: employee, |
| | | cash_flow: cash_flow, |
| | | } |
| | | |
| | | window.GLOB.CacheVoucher.set(config.uuid, message) |
| | | |
| | | setTimeout(() => { |
| | | this.getVoucher() |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate, subjects } = this.state |
| | | const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate } = this.state |
| | | |
| | | return ( |
| | | <div className="menu-voucher-wrap" style={config.style}> |
| | |
| | | <Button type="link" className="" onClick={this.triggerprint}>备注</Button> |
| | | </div> |
| | | </div> |
| | | <VoucherTable config={config} subjects={subjects} data={data}/> |
| | | <VoucherTable config={config} data={data}/> |
| | | </div> : null} |
| | | {config.wrap.type === 'check' ? <div className="voucher-body"> |
| | | <div className="pre-wrap"> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Modal, Input, InputNumber, notification, message, AutoComplete, Select } from 'antd' |
| | | import { Table, Modal, Form, Input, InputNumber, notification, message, AutoComplete, Select, Popover, Button } from 'antd' |
| | | import { PlusOutlined, CloseOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | |
| | | } |
| | | } |
| | | |
| | | class Accounting extends React.Component { |
| | | state = { |
| | | subAccounts: [], |
| | | record: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { data, tableId } = this.props |
| | | let subAccounts = data.sup_accounting.split(',') |
| | | let msg = window.GLOB.CacheVoucher.get(tableId) || {} |
| | | let names = msg.names || {} |
| | | |
| | | subAccounts = subAccounts.map(n => { |
| | | let item = { |
| | | field: n, |
| | | label: names[n] || n, |
| | | initval: data[n] || '', |
| | | options: [] |
| | | } |
| | | |
| | | if (msg[n]) { |
| | | item.options = msg[n] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({subAccounts: subAccounts, record: fromJS(data).toJS()}) |
| | | } |
| | | |
| | | selectChange = (val, item) => { |
| | | this.setState({record: {...this.state.record, [item.field]: val || ''}}) |
| | | } |
| | | |
| | | getFields() { |
| | | const { subAccounts } = this.state |
| | | |
| | | const fields = [] |
| | | |
| | | subAccounts.forEach((item) => { |
| | | fields.push( |
| | | <Form.Item label={item.label} key={item.field}> |
| | | <Select |
| | | showSearch |
| | | allowClear |
| | | defaultValue={item.initval} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(val) => this.selectChange(val, item)} |
| | | > |
| | | {item.options.map((option, i) => |
| | | <Select.Option key={i} value={option.value}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | | ) |
| | | }) |
| | | |
| | | return fields |
| | | } |
| | | |
| | | confirm = () => { |
| | | const { subAccounts, record } = this.state |
| | | |
| | | let empty = '' |
| | | subAccounts.forEach(item => { |
| | | if (!empty && !record[item.field]) { |
| | | empty = item.label |
| | | } |
| | | }) |
| | | |
| | | if (empty) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择' + empty, |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | this.props.confirm(record) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | return <div> |
| | | {this.getFields()} |
| | | <div className="footer"> |
| | | <Button onClick={this.props.cancel}>取消</Button> |
| | | <Button onClick={this.confirm}>确定</Button> |
| | | </div> |
| | | </div> |
| | | } |
| | | } |
| | | |
| | | class BodyCell extends React.Component { |
| | | state = { |
| | | editing: false, |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props.record), fromJS(nextProps.record)) || |
| | | nextState.editing !== this.state.editing |
| | | visible: false, |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | |
| | | this.setState({editing: false}) |
| | | |
| | | if (col.field === 'subjectscode') return |
| | | |
| | | if (value !== record[col.field]) { |
| | | let line = {...record, [col.field]: value} |
| | | |
| | |
| | | MKEmitter.emit('delRecord', col.tableId, record) |
| | | } |
| | | |
| | | onSelectBlur = () => { |
| | | const { visible } = this.state |
| | | |
| | | if (visible) return |
| | | |
| | | this.setState({editing: false}) |
| | | } |
| | | |
| | | onSelectChange = (val, option) => { |
| | | const { col, record } = this.props |
| | | |
| | | this.setState({editing: false}) |
| | | |
| | | let line = {...record, ...option.props.extra} |
| | | |
| | | if (record.sup_accounting && !line.sup_accounting) { |
| | | record.sup_accounting.split(',').forEach(item => { |
| | | line[item] = '' |
| | | }) |
| | | } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | |
| | | if (line.sup_accounting) { |
| | | setTimeout(() => { |
| | | this.setState({visible: true}) |
| | | }, 100) |
| | | } else { |
| | | this.setState({editing: false}) |
| | | setTimeout(() => { |
| | | MKEmitter.emit('tdFocus', 'debtor' + record.uuid) |
| | | }, 50) |
| | | } |
| | | } |
| | | |
| | | confirm = (res) => { |
| | | const { col } = this.props |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, fromJS(res).toJS()) |
| | | |
| | | this.setState({editing: false, visible: false}) |
| | | setTimeout(() => { |
| | | MKEmitter.emit('tdFocus', 'debtor' + res.uuid) |
| | | }, 50) |
| | | } |
| | | |
| | | cancel = () => { |
| | | const { col } = this.props |
| | | let record = fromJS(this.props.record).toJS() |
| | | record.balance_direction = '' |
| | | record.count_type = '' |
| | | record.foreign_currency_type = '' |
| | | record.mnemonic_code = '' |
| | | record.subjectscode = '' |
| | | record.subjectsname = '' |
| | | record.sup_accounting.split(',').forEach(item => { |
| | | record[item] = '' |
| | | }) |
| | | |
| | | record.sup_accounting = '' |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, record) |
| | | |
| | | this.setState({editing: false, visible: false}) |
| | | } |
| | | |
| | | render() { |
| | | let { col, record, subjects, className } = this.props |
| | | const { editing } = this.state |
| | | let { col, record, className } = this.props |
| | | const { editing, visible } = this.state |
| | | |
| | | let children = null |
| | | let colSpan = 1 |
| | |
| | | colSpan = 0 |
| | | } else { |
| | | if (editing) { |
| | | children = <Select |
| | | let msg = window.GLOB.CacheVoucher.get(col.tableId) |
| | | let subjects = msg ? msg.subjects : [] |
| | | |
| | | children = <> |
| | | <Select |
| | | showSearch |
| | | defaultValue={record.subjectscode || ''} |
| | | dropdownClassName="edit-table-dropdown" |
| | | id={col.uuid + record.uuid} |
| | | onBlur={this.onBlur} |
| | | onBlur={this.onSelectBlur} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onSelect={this.onSelectChange} |
| | | > |
| | | {subjects.map((item, i) => (<Select.Option key={i} extra={item} value={item.subjectscode}>{item.subjectscode + ' ' + item.subjectsname}</Select.Option>))} |
| | | </Select> |
| | | <Popover overlayClassName="subject-pop-wrap" placement="bottom" title="辅助核算" visible={visible} content={<Accounting confirm={this.confirm} cancel={this.cancel} tableId={col.tableId} data={record}/>}> |
| | | <span className="pop-anchor"></span> |
| | | </Popover> |
| | | </> |
| | | } else { |
| | | let val = '' |
| | | if (record.subjectscode) { |
| | | val = (record.subjectscode || '') + ' ' + (record.subjectsname || '') |
| | | |
| | | record.sup_accounting && record.sup_accounting.split(',').forEach(item => { |
| | | if (record[item]) { |
| | | val += '_' + record[item] |
| | | } |
| | | }) |
| | | } |
| | | children = <div className="content-wrap" onClick={this.focus}>{val}</div> |
| | | } |
| | |
| | | class VoucherTable extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, // 菜单Id |
| | | subjects: PropTypes.array, // 会计科目 |
| | | BID: PropTypes.any, // 主表ID |
| | | data: PropTypes.any, // 表格数据 |
| | | total: PropTypes.any, // 总数 |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, subjects, data } = this.props |
| | | const { config, data } = this.props |
| | | |
| | | let columns = [ |
| | | { |
| | |
| | | width: '34%', |
| | | onCell: record => ({ |
| | | record, |
| | | subjects, |
| | | col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid}, |
| | | }) |
| | | }, |
| | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | this.resetData(fromJS(nextProps.data).toJS()) |
| | | } else if (!is(fromJS(this.props.subjects), fromJS(nextProps.subjects))) { |
| | | this.resetSubjects(nextProps.subjects) |
| | | } |
| | | } |
| | | |
| | | resetSubjects = (subjects) => { |
| | | const { config } = this.props |
| | | let columns = fromJS(this.state.columns).toJS() |
| | | |
| | | this.setState({ |
| | | columns: columns.map(col => { |
| | | if (col.key === 'subjectscode') { |
| | | return { |
| | | title: '会计科目', |
| | | dataIndex: 'subjectscode', |
| | | key: 'subjectscode', |
| | | width: '34%', |
| | | onCell: record => ({ |
| | | record, |
| | | subjects, |
| | | col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid}, |
| | | }) |
| | | } |
| | | } |
| | | return col |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | resetData = (data) => { |
| | |
| | | display: inline-block; |
| | | } |
| | | } |
| | | .pop-anchor { |
| | | position: absolute; |
| | | bottom: 0; |
| | | left: 50%; |
| | | } |
| | | } |
| | | .subject-pop-wrap { |
| | | padding-top: 0px; |
| | | .ant-popover-arrow { |
| | | display: none; |
| | | } |
| | | .ant-popover-content { |
| | | position: relative; |
| | | z-index: 1; |
| | | } |
| | | |
| | | .ant-form-item { |
| | | display: flex; |
| | | margin-bottom: 15px; |
| | | width: 200px; |
| | | |
| | | .ant-form-item-label { |
| | | width: 60px; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | flex: 1; |
| | | .ant-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | } |
| | | .ant-popover-inner-content { |
| | | padding-right: 30px; |
| | | } |
| | | .footer { |
| | | text-align: right; |
| | | .ant-btn { |
| | | border: none; |
| | | box-shadow: none; |
| | | margin-right: 15px; |
| | | } |
| | | .ant-btn:last-child { |
| | | color: var(--mk-sys-color); |
| | | } |
| | | } |
| | | } |
| | | .subject-pop-wrap::before { |
| | | content: ''; |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | } |
| | | .edit-table-dropdown { |
| | | .ant-select-dropdown-menu-item { |
| | | white-space: unset; |
| | |
| | | padding-right: 16px; |
| | | background-size: 100%; |
| | | |
| | | .component-wrap >.ant-col { |
| | | min-height: 0; |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | |
| | | padding-right: 16px; |
| | | background-size: 100%; |
| | | |
| | | .component-wrap >.ant-col { |
| | | min-height: 0; |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | |
| | | |
| | | this.props.updatefield(items) |
| | | } else if (type === 'form') { |
| | | let lastItem = config.fields[config.fields.length - 1] |
| | | let firstItem = config.fields[0] |
| | | let span = this.state.appType === 'mob' ? 24 : 12 |
| | | if (lastItem && lastItem.span) { |
| | | span = lastItem.span |
| | | let labelwidth = 33.3 |
| | | if (firstItem && firstItem.span) { |
| | | span = firstItem.span |
| | | labelwidth = firstItem.labelwidth || 33.3 |
| | | } |
| | | selectCards.forEach(item => { // 循环添加新增字段 |
| | | let newcard = { |
| | |
| | | type: item.type, |
| | | resourceType: '0', |
| | | span: span, |
| | | labelwidth: 33.3, |
| | | labelwidth: labelwidth, |
| | | options: [], |
| | | dataSource: '', |
| | | decimal: item.decimal, |
| | |
| | | if (item.type === 'text' && item.length >= 256) { |
| | | newcard.type = 'textarea' |
| | | newcard.fieldlength = item.length |
| | | if (lastItem && lastItem.type === newcard.type) { |
| | | newcard.span = lastItem.span |
| | | newcard.labelwidth = lastItem.labelwidth |
| | | } else if (lastItem) { |
| | | if (firstItem) { |
| | | if (firstItem.type === newcard.type) { |
| | | newcard.span = firstItem.span |
| | | newcard.labelwidth = firstItem.labelwidth |
| | | } else { |
| | | newcard.span = 24 |
| | | if (lastItem.span === 12) { |
| | | if (firstItem.span === 12) { |
| | | newcard.labelwidth = 16.2 |
| | | } else if (lastItem.span === 8) { |
| | | } else if (firstItem.span === 8) { |
| | | newcard.labelwidth = 10.5 |
| | | } else if (lastItem.span === 8) { |
| | | } else if (firstItem.span === 6) { |
| | | newcard.labelwidth = 7.7 |
| | | } |
| | | } |
| | | } else { |
| | | newcard.span = 24 |
| | | newcard.labelwidth = 16.2 |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Input, Popconfirm, Form, Radio, message } from 'antd' |
| | | import { Table, Input, Popconfirm, Form, message } from 'antd' |
| | | import { ArrowUpOutlined, ArrowDownOutlined, DeleteOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons' |
| | | |
| | | import { formRule } from '@/utils/option.js' |
| | |
| | | }) |
| | | } |
| | | |
| | | getColumnSearchProps = column => ({ |
| | | filterDropdown: () => ( |
| | | <div style={{ padding: 8 }}> |
| | | <Radio.Group onChange={(e) => this.changeDatatype(column, e)} value={column.datatype}> |
| | | <Radio style={{display: 'block', height: '30px', lineHeight: '30px'}} value="string"> |
| | | 字符串 |
| | | </Radio> |
| | | <Radio style={{display: 'block', height: '30px', lineHeight: '30px'}} value="number"> |
| | | 数字 |
| | | </Radio> |
| | | </Radio.Group> |
| | | </div> |
| | | ), |
| | | filterIcon: () => ( |
| | | <SwapOutlined style={{ color: column.datatype === 'number' ? '#1890ff' : ''}} /> |
| | | ) |
| | | }) |
| | | |
| | | changeDatatype = (column, e) => { |
| | | changeDatatype = (column) => { |
| | | const { columns, dataSource } = this.state |
| | | let value = e.target.value |
| | | let value = column.datatype !== 'number' ? 'number' : 'string' |
| | | let _data = dataSource.map(item => { |
| | | let val = item[column.dataIndex] |
| | | if (value === 'number') { |
| | |
| | | } |
| | | |
| | | if (col.dataIndex !== 'operation') { |
| | | col = {...col, ...this.getColumnSearchProps(col)} |
| | | col.title = <div> |
| | | Value |
| | | <Popconfirm |
| | | title={`确定切换为${col.datatype === 'number' ? '文本' : '数值'}吗?`} |
| | | overlayClassName="popover-confirm" |
| | | onConfirm={() => this.changeDatatype(col) |
| | | }> |
| | | <SwapOutlined style={{ color: col.datatype === 'number' ? '#1890ff' : ''}} /> |
| | | </Popconfirm> |
| | | </div> |
| | | } |
| | | |
| | | return col |
| | |
| | | return { |
| | | columns: columns.map(col => { |
| | | if (col.dataIndex !== 'operation') { |
| | | col = {...col, ...this.getColumnSearchProps(col)} |
| | | col.title = <div> |
| | | Value |
| | | <Popconfirm |
| | | title={`确定切换为${col.datatype === 'number' ? '文本' : '数值'}吗?`} |
| | | overlayClassName="popover-confirm" |
| | | onConfirm={() => this.changeDatatype(col) |
| | | }> |
| | | <SwapOutlined style={{ color: col.datatype === 'number' ? '#1890ff' : ''}} /> |
| | | </Popconfirm> |
| | | </div> |
| | | } |
| | | return col |
| | | }), |
| | |
| | | } |
| | | .ant-table-thead > tr > th { |
| | | padding: 10px 16px; |
| | | position: relative; |
| | | |
| | | .anticon-swap { |
| | | position: absolute; |
| | | right: 16px; |
| | | font-size: 14px; |
| | | top: 12px; |
| | | color: #b8b8b8; |
| | | } |
| | | } |
| | | .ant-table-tbody > tr > td { |
| | | padding: 5px 10px; |
| | |
| | | <div className="bill-print-wrap" > |
| | | {loadingview && <Spin size="large" />} |
| | | {pages ? <div id="bill-print"> |
| | | {pages.map((components, index) => (<div className={'print-page' + (auto ? ' auto' : '')} key={index} style={{...config.style, overflow: 'hidden', boxSizing: 'border-box'}}><Row>{this.getComponents(components)}</Row></div>))} |
| | | {pages.map((components, index) => (<div className={'print-page' + (auto ? ' auto' : '')} key={index} style={{...config.style, overflow: 'hidden', boxSizing: 'border-box'}}><Row className="component-wrap">{this.getComponents(components)}</Row></div>))} |
| | | </div> : null} |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | {config && window.GLOB.breakpoint ? <DebugTable /> : null} |