From 34e7681fd12b1c4e4994d3bea1a553870e10bc50 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 11 三月 2023 17:58:54 +0800 Subject: [PATCH] 2023-03-11 --- src/tabviews/custom/components/module/account/index.jsx | 79 ++++++++++++++++++++++++++++++++------- 1 files changed, 64 insertions(+), 15 deletions(-) diff --git a/src/tabviews/custom/components/module/account/index.jsx b/src/tabviews/custom/components/module/account/index.jsx index 1a9a7b6..4996d2c 100644 --- a/src/tabviews/custom/components/module/account/index.jsx +++ b/src/tabviews/custom/components/module/account/index.jsx @@ -1,14 +1,17 @@ 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 Api from '@/api' +import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import './index.scss' const { Option } = Select +const { confirm } = Modal class AccountModule extends Component { static propTpyes = { @@ -39,7 +42,9 @@ loadData = () => { let param = { - func: 's_get_fcc_book_data' + func: 's_get_fcc_book_data', + dataM: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', + mk_organization: sessionStorage.getItem('organization') || '' } Api.genericInterface(param).then(res => { @@ -69,10 +74,6 @@ return true }) - if (!activeItem && books.length > 0) { - activeItem = books[0] - } - this.setState({books, activeItem}) if (activeItem) { @@ -82,15 +83,63 @@ } 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) { - MKEmitter.emit('resetSelectLine', this.props.config.uuid, activeItem.id, activeItem) + if (!activeItem && Item) { + this.setBook(Item) + } else if (Item) { + const that = this + confirm({ + title: '纭畾鍒囨崲璐﹀鍚楋紵', + content: '鍒囨崲璐﹀鏃剁郴缁熼渶瑕佸埛鏂般��', + onOk() { + return new Promise(resolve => { + that.setBook(Item, resolve) + }) + }, + onCancel() {} + }) } + } + + 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') || '' + let param = { + func: 'sPC_TableData_InUpDe', + LText: `delete tmp_session_show_key where createuserid='${userid}' and key_type='fcc_years' + insert into tmp_session_show_key ( key_id,key_type,createuserid,CreateUser,CreateStaff) + select '${item.id}','fcc_years','${userid}','${sid}','${sessionStorage.getItem('Full_Name') || ''}'`, + exec_type: 'y' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) + + 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 = () => { @@ -132,11 +181,11 @@ </div> )}> {books.map(item => ( - <Option key={item.id}>{item.account_name}</Option> + <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 key={item.id}>{item.account_name}</Option> + <Option disabled={!item.months} key={item.id}>{item.account_name}</Option> ))} </Select>} {activeItem ? <span className="date">{activeItem.date}</span> : null} -- Gitblit v1.8.0