From 8d05744179a026a243b86e3a99296e30375ccfb0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 05 二月 2021 18:48:31 +0800 Subject: [PATCH] 2021-02-05 --- src/views/mobmanage/index.jsx | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 163 insertions(+), 5 deletions(-) diff --git a/src/views/mobmanage/index.jsx b/src/views/mobmanage/index.jsx index 11f5baf..b5249f3 100644 --- a/src/views/mobmanage/index.jsx +++ b/src/views/mobmanage/index.jsx @@ -1,11 +1,67 @@ import React, {Component} from 'react' +// import { fromJS } from 'immutable' +import { Spin, notification, Button, Table } from 'antd' + +import Api from '@/api' +// import Utils from '@/utils/utils.js' import asyncComponent from '@/utils/asyncComponent' import './index.scss' const Header = asyncComponent(() => import('@/mob/header')) -const MobCard = asyncComponent(() => import('@/mob/mobcard')) +// const MobCard = asyncComponent(() => import('@/mob/mobcard')) -class MobileManage extends Component { +class AppManage extends Component { + state = { + loading: false, + applist: [], + columns: [ + { title: '搴旂敤鍚嶇О', dataIndex: 'remark', key: 'remark', align: 'center' }, + { title: '搴旂敤鍙傛暟', dataIndex: 'kei_no', key: 'kei_no', align: 'center' }, + { + title: 'Action', + key: 'action', + align: 'center', + render: (text, record) => (<Button type="link" style={{color: '#ff4d4f'}}>鍒犻櫎</Button>), + }, + ], + subcolumns: [ + { + title: '搴旂敤绫诲瀷', dataIndex: 'typename', key: 'typename', align: 'center' + }, + { + title: '璇█', dataIndex: 'lang', key: 'lang', align: 'center', + render: (text, record) => text === 'en-US' ? '鑻辨枃' : '涓枃' + }, + { + title: '鐧诲綍', dataIndex: 'login_types', key: 'login_types', align: 'center', + render: (text, record) => text === 'false' ? '涓嶉渶瑕�' : '闇�瑕�' + }, + { + title: '鏉冮檺绠$悊', dataIndex: 'role_type', key: 'role_type', align: 'center', + render: (text, record) => text === 'false' ? '涓嶉渶瑕�' : '闇�瑕�' + }, + { + title: '鐭繛鎺�', dataIndex: 'link_type', key: 'link_type', align: 'center', + render: (text, record) => text === 'false' ? '涓嶅惎鐢�' : '鍚敤' + }, + { + title: 'Action', + key: 'action', + align: 'center', + render: (text, record) => (<Button type="link" style={{color: '#ff4d4f'}}>鍒犻櫎</Button>), + }, + ], + selectApp: null, + selectSubApp: null, + selectedRowKeys: [], + selectedSubRowKeys: [], + } + + UNSAFE_componentWillMount() { + document.body.className = '' + this.getAppList() + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -13,6 +69,39 @@ this.setState = () => { return } + } + + getAppList = () => { + let param = { + func: 's_get_kei' + } + + Api.getCloudConfig(param).then(result => { + if (result.status) { + this.setState({ + loading: false, + applist: result.data.map(item => { + item.sublist = item.data_detail || [] + item.sublist = item.sublist.map(cell => { + cell.ID = cell.d_id + return cell + }) + + return item + }) + }) + + } else { + this.setState({ + loading: false + }) + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) } jumpMenu = (card) => { @@ -23,14 +112,83 @@ this.props.history.replace(`/mobdesign/${card.uuid}/${_type}/${card.keiNo}/${card.name}`) } + /** + * + */ + onSelectChange = selectedRowKeys => { + const { applist } = this.state + let selectApp = applist.filter(item => item.ID === selectedRowKeys[0])[0] + + this.setState({ selectedRowKeys, selectApp }) + } + + /** + * + */ + onSubChange = selectedSubRowKeys => { + + this.setState({ selectedSubRowKeys }) + } + + /** + * @description 鐐瑰嚮鏁磋锛岃Е鍙戝垏鎹紝 鍒ゆ柇鏄惁鍙�夛紝鍗曢�夋垨澶氶�夛紝杩涜瀵瑰簲鎿嶄綔 + */ + changeRow = (record) => { + this.setState({ selectedRowKeys: [record.ID], selectApp: record }) + } + + /** + * @description 鐐瑰嚮鏁磋锛岃Е鍙戝垏鎹紝 鍒ゆ柇鏄惁鍙�夛紝鍗曢�夋垨澶氶�夛紝杩涜瀵瑰簲鎿嶄綔 + */ + changeSubRow = (record) => { + this.setState({ selectedSubRowKeys: [record.ID], selectSubApp: record }) + } + render () { + const { loading, columns, applist, selectedRowKeys, selectedSubRowKeys, selectApp, subcolumns } = this.state + return ( - <div className="mobile-manage"> + <div className="mk-app-manage"> <Header view="manage" /> - <MobCard jumpMenu={this.jumpMenu}/> + {loading ? + <div className="loading-mask"> + <div className="ant-spin-blur"></div> + <Spin /> + </div> : null + } + <div className="app-table"> + <div className="app-action"> + <Button className="mk-green">娣诲姞</Button> + <Button className="mk-purple">淇敼</Button> + </div> + <Table + rowKey="ID" + columns={columns} + dataSource={applist} + pagination={false} + rowSelection={{ type: 'radio', selectedRowKeys, onChange: this.onSelectChange }} + onRow={(record) => ({ onClick: () => {this.changeRow(record)} })} + /> + </div> + <div className="app-table"> + <div className="sub-app-title"><span>瀛愬簲鐢�</span></div> + <div className="app-action"> + <Button className="mk-green">娣诲姞</Button> + <Button className="mk-purple">淇敼</Button> + </div> + <Table + rowKey="ID" + columns={subcolumns} + dataSource={selectApp ? selectApp.sublist : []} + pagination={false} + rowSelection={{ type: 'radio', selectedSubRowKeys, onChange: this.onSubChange }} + onRow={(record) => ({ onClick: () => {this.changeSubRow(record)} })} + /> + </div> + {/* <MobCard jumpMenu={this.jumpMenu}/> */} </div> ) } } -export default MobileManage \ No newline at end of file +export default AppManage \ No newline at end of file -- Gitblit v1.8.0