| | |
| | | import React, {Component} from 'react' |
| | | // import { fromJS } from 'immutable' |
| | | import { Spin, notification, Button, Table, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | appsublist: [], |
| | | columns: [ |
| | | { title: '应用名称', dataIndex: 'remark', key: 'remark', align: 'center' }, |
| | | { title: '应用参数', dataIndex: 'kei_no', key: 'kei_no', align: 'center' }, |
| | | { title: '应用编码', dataIndex: 'kei_no', key: 'kei_no', align: 'center' }, |
| | | { |
| | | title: 'Action', |
| | | key: 'action', |
| | |
| | | render: (text, record) => ( |
| | | <div> |
| | | <Button type="link" onClick={() => this.deleteSubApp(record)} style={{color: '#ff4d4f'}}>删除</Button> |
| | | <Button type="link" onClick={() => this.jumpMenu(record)}>编辑应用</Button> |
| | | <Button type="link" onClick={() => this.jumpApp(record)}>编辑应用</Button> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | selectSubApp: null, |
| | | selectedRowKeys: [], |
| | | selectedSubRowKeys: [], |
| | | visible: false, |
| | | subVisible: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | console.log(record) |
| | | } |
| | | |
| | | jumpMenu = (card) => { |
| | | console.log(card) |
| | | // let _type = 'mob' |
| | | // if (card.type === 'pc') { |
| | | // _type = 'pc' |
| | | // } |
| | | // this.props.history.replace(`/mobdesign/${card.uuid}/${_type}/${card.keiNo}/${card.name}`) |
| | | jumpApp = (item) => { |
| | | console.log(item) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | trigerApp = (type) => { |
| | | if ((type === 'appedit' && !this.state.selectApp) || (type === 'subappedit' && !this.state.selectSubApp)) { |
| | | if (type === 'edit' && !this.state.selectApp) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择需要编辑的应用!', |
| | |
| | | }) |
| | | } |
| | | |
| | | trigerSubApp = (type) => { |
| | | if (type === 'edit' && !this.state.selectSubApp) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择需要编辑的子应用!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | subVisible: type |
| | | }) |
| | | } |
| | | |
| | | |
| | | submitCard = () => { |
| | | const { card } = this.state |
| | | const { selectApp, visible } = this.state |
| | | |
| | | this.mobcardRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | confirmloading: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_kei_addupt', |
| | | ID: visible === 'edit' ? selectApp.ID : Utils.getuuid(), |
| | | exec_type: 'y', |
| | | remark: res.remark, |
| | | kei_no: res.kei_no, |
| | | LText: '' |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (visible === 'edit' && selectApp.sublist && selectApp.sublist.length > 0) { |
| | | param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}'`) |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } |
| | | |
| | | Api.getCloudConfig(param).then(result => { |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '操作成功!', |
| | | duration: 5 |
| | | }) |
| | | |
| | | this.setState({ |
| | | confirmloading: false, |
| | | visible: false, |
| | | loading: true |
| | | }) |
| | | this.getAppList() |
| | | } else { |
| | | this.setState({ |
| | | confirmloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | confirmloading: false |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | submitSubCard = () => { |
| | | const { card } = this.state |
| | | |
| | | this.submobcardRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | confirmloading: true |
| | | }) |
| | |
| | | visible: false, |
| | | loading: true |
| | | }) |
| | | this.getMobCards() |
| | | this.getAppList() |
| | | } else { |
| | | this.setState({ |
| | | confirmloading: false |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { loading, visible, columns, applist, appsublist, selectedRowKeys, selectedSubRowKeys, subcolumns, selectApp, selectSubApp } = this.state |
| | | const { loading, visible, subVisible, columns, applist, appsublist, selectedRowKeys, selectedSubRowKeys, subcolumns, selectApp, selectSubApp } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-app-manage"> |
| | |
| | | } |
| | | <div className="app-table"> |
| | | <div className="app-action"> |
| | | <Button className="mk-green" onClick={() => this.trigerApp('appplus')}>添加</Button> |
| | | <Button className="mk-purple" onClick={() => this.trigerApp('appedit')}>修改</Button> |
| | | <Button className="mk-green" onClick={() => this.trigerApp('plus')}>添加</Button> |
| | | <Button className="mk-purple" onClick={() => this.trigerApp('edit')}>修改</Button> |
| | | </div> |
| | | <Table |
| | | rowKey="ID" |
| | |
| | | <div className="app-table"> |
| | | <div className="sub-app-title"><span>子应用</span></div> |
| | | <div className="app-action"> |
| | | <Button className="mk-green" onClick={() => this.trigerApp('subappplus')}>添加</Button> |
| | | <Button className="mk-purple" onClick={() => this.trigerApp('subappedit')}>修改</Button> |
| | | <Button className="mk-green" onClick={() => this.trigerSubApp('plus')}>添加</Button> |
| | | <Button className="mk-purple" onClick={() => this.trigerSubApp('edit')}>修改</Button> |
| | | </div> |
| | | <Table |
| | | rowKey="ID" |
| | |
| | | /> |
| | | </div> |
| | | <Modal |
| | | // className="mob-card-modal" |
| | | title={'编辑应用'} |
| | | width={'600px'} |
| | | maskClosable={false} |
| | | visible={!!visible} |
| | | onCancel={() => this.setState({visible: ''})} |
| | | onCancel={() => this.setState({visible: false})} |
| | | confirmLoading={this.state.confirmloading} |
| | | onOk={this.submitCard} |
| | | cancelText="取消" |
| | | okText="确定" |
| | | destroyOnClose |
| | | > |
| | | <MutilForm card={visible === 'appedit' ? selectApp : (visible === 'subappedit' ? selectSubApp : '')} wrappedComponentRef={(inst) => this.mobcardRef = inst} inputSubmit={this.submitCard} /> |
| | | <MutilForm type={visible} card={visible === 'edit' ? selectApp : ''} wrappedComponentRef={(inst) => this.mobcardRef = inst} inputSubmit={this.submitCard} /> |
| | | </Modal> |
| | | <Modal |
| | | title={'编辑子应用'} |
| | | width={'600px'} |
| | | maskClosable={false} |
| | | visible={!!subVisible} |
| | | onCancel={() => this.setState({subVisible: false})} |
| | | confirmLoading={this.state.confirmloading} |
| | | onOk={this.submitSubCard} |
| | | cancelText="取消" |
| | | okText="确定" |
| | | destroyOnClose |
| | | > |
| | | <MutilForm type={subVisible} card={subVisible === 'edit' ? selectSubApp : ''} wrappedComponentRef={(inst) => this.submobcardRef = inst} inputSubmit={this.submitSubCard} /> |
| | | </Modal> |
| | | </div> |
| | | ) |