From cd49c7caada72872817b36712db7bd9e338a081f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 18 二月 2021 18:33:47 +0800 Subject: [PATCH] 2021-02-18 --- src/views/mobmanage/index.jsx | 124 ++++++++++++++++++++++++++++++++++------ 1 files changed, 104 insertions(+), 20 deletions(-) diff --git a/src/views/mobmanage/index.jsx b/src/views/mobmanage/index.jsx index 261e72c..f4c551e 100644 --- a/src/views/mobmanage/index.jsx +++ b/src/views/mobmanage/index.jsx @@ -1,6 +1,7 @@ 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' @@ -17,7 +18,7 @@ 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', @@ -52,7 +53,7 @@ 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> ) }, @@ -61,6 +62,8 @@ selectSubApp: null, selectedRowKeys: [], selectedSubRowKeys: [], + visible: false, + subVisible: false } UNSAFE_componentWillMount() { @@ -118,13 +121,8 @@ 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) } /** @@ -159,7 +157,7 @@ } trigerApp = (type) => { - if ((type === 'appedit' && !this.state.selectApp) || (type === 'subappedit' && !this.state.selectSubApp)) { + if (type === 'edit' && !this.state.selectApp) { notification.warning({ top: 92, message: '璇烽�夋嫨闇�瑕佺紪杈戠殑搴旂敤锛�', @@ -173,11 +171,84 @@ }) } + 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 }) @@ -203,7 +274,7 @@ visible: false, loading: true }) - this.getMobCards() + this.getAppList() } else { this.setState({ confirmloading: false @@ -223,7 +294,7 @@ } 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"> @@ -236,8 +307,8 @@ } <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" @@ -251,8 +322,8 @@ <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" @@ -264,19 +335,32 @@ /> </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> ) -- Gitblit v1.8.0