| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Select, Divider } from 'antd' |
| | | import { notification, Select, Divider, Modal } from 'antd' |
| | | import { PlusOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | |
| | | import './index.scss' |
| | | |
| | | const { Option } = Select |
| | | const { confirm } = Modal |
| | | |
| | | class AccountModule extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | changeBook = (value) => { |
| | | const { books } = this.state |
| | | const { books, activeItem } = this.state |
| | | |
| | | let activeItem = books.filter(item => item.id === value)[0] |
| | | let Item = books.filter(item => item.id === value)[0] |
| | | |
| | | this.setState({activeItem}) |
| | | if (!activeItem && Item) { |
| | | this.setBook(Item) |
| | | } else if (Item) { |
| | | const _this = this |
| | | confirm({ |
| | | title: '确定切换账套吗?', |
| | | content: '切换账套时系统需要刷新。', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.setBook(Item, resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (activeItem) { |
| | | MKEmitter.emit('resetSelectLine', this.props.config.uuid, activeItem.id, activeItem) |
| | | setBook = (item, resolve) => { |
| | | if (!resolve) { |
| | | this.setState({activeItem: item}) |
| | | |
| | | MKEmitter.emit('resetSelectLine', this.props.config.uuid, item.id, item) |
| | | } |
| | | |
| | | let userid = sessionStorage.getItem('UserID') || '' |
| | | let sid = localStorage.getItem('SessionUid') || '' |
| | |
| | | func: 'sPC_TableData_InUpDe', |
| | | LText: `delete tmp_session_show_key where createuserid='${userid}' and createuser='${sid}' and key_type='fcc_years' |
| | | insert into tmp_session_show_key ( key_id,key_type,createuserid,CreateUser,CreateStaff) |
| | | select '${activeItem.id}','fcc_years','${userid}','${sid}','${sessionStorage.getItem('Full_Name') || ''}'`, |
| | | select '${item.id}','fcc_years','${userid}','${sid}','${sessionStorage.getItem('Full_Name') || ''}'`, |
| | | exec_type: 'y' |
| | | } |
| | | |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | |
| | | Api.genericInterface(param) |
| | | Api.genericInterface(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | resolve && resolve() |
| | | return |
| | | } |
| | | |
| | | if (resolve) { |
| | | window.location.reload() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | addBook = () => { |
| | |
| | | {books.map(item => ( |
| | | <Option disabled={!item.months} key={item.id}>{item.account_name}</Option> |
| | | ))} |
| | | </Select> : <Select value={activeItem ? activeItem.id : ''} placeholder="请选择账套" onChange={this.changeBook}> |
| | | </Select> : <Select value={activeItem ? activeItem.id : ''} disabled={config.wrap.readonly === 'true'} placeholder="请选择账套" onChange={this.changeBook}> |
| | | {books.map(item => ( |
| | | <Option disabled={!item.months} key={item.id}>{item.account_name}</Option> |
| | | ))} |