From 0e4c25700fac0e0c7d93327a5eaafc17b8dd3d78 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 08 九月 2021 19:16:09 +0800 Subject: [PATCH] 2021-09-08 --- /dev/null | 11 -- src/views/design/header/versions/index.scss | 0 src/views/design/header/index.jsx | 4 src/components/header/index.jsx | 37 ++++++ src/views/design/header/versions/index.jsx | 199 +++++++++++++++------------------------ 5 files changed, 112 insertions(+), 139 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 9f703f8..f58c12a 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -22,14 +22,12 @@ import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' import avatar from '@/assets/img/avatar.jpg' -import asyncComponent from '@/utils/asyncComponent' import Resetpwd from './resetpwd' import LoginForm from './loginform' import './index.scss' const { confirm } = Modal const { Search } = Input -const VersionsUp = asyncComponent(() => import('./versions')) class Header extends Component { static propTpyes = { @@ -663,6 +661,37 @@ } } + verup = () => { + confirm({ + title: '鐗堟湰鍗囩骇', + content: '閲嶆柊鍔犺浇搴旂敤淇℃伅', + onOk() { + return new Promise(resolve => { + if (!window.GLOB.WebSql && !window.GLOB.IndexDB) { + notification.warning({ + top: 92, + message: '鍗囩骇澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯锛�', + duration: 2 + }) + resolve() + } else { + Api.updateAppVersion() + setTimeout(() => { + notification.success({ + top: 92, + message: '鍗囩骇鎴愬姛锛�', + duration: 2 + }) + resolve() + }, 1000) + } + }) + }, + onCancel() {} + }) + } + + render () { const { mainMenu, collapse } = this.props const { thdMenuList, searchkey, debug, menulist, navBar, menuType } = this.state @@ -680,8 +709,8 @@ ))} </Menu.SubMenu> : null} <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> - <Menu.Item style={{padding: 0}} key="verup"> - <VersionsUp debug={debug} /> + <Menu.Item key="verup" onClick={this.verup}> + 鐗堟湰鍗囩骇 </Menu.Item> <Menu.Item key="logout" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> </Menu> diff --git a/src/components/header/versions/settingform/index.jsx b/src/components/header/versions/settingform/index.jsx deleted file mode 100644 index debd0d8..0000000 --- a/src/components/header/versions/settingform/index.jsx +++ /dev/null @@ -1,118 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, InputNumber, Tooltip, Icon, Radio } from 'antd' - -import './index.scss' - -class SettingForm extends Component { - static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - wrap: PropTypes.object, // 鏁版嵁婧愰厤缃� - inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 - } - - state = {} - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - render() { - const { wrap } = this.props - const { getFieldDecorator } = this.props.form - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <div className="model-menu-setting-form"> - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={12}> - <Form.Item label="瀵艰埅鏍忓悕绉�"> - {getFieldDecorator('name', { - initialValue: wrap.name, - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '瀵艰埅鏍忓悕绉�!' - } - ] - })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鑿滃崟鍙傛暟"> - {getFieldDecorator('MenuNo', { - initialValue: wrap.MenuNo, - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '鑿滃崟鍙傛暟!' - } - ] - })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="閫夋嫨闈欐�佸�硷紝鏃犻渶閰嶇疆鏁版嵁婧愩��"> - <Icon type="question-circle" /> - 鏁版嵁鏉ユ簮 - </Tooltip> - }> - {getFieldDecorator('datatype', { - initialValue: wrap.datatype || 'static' - })( - <Radio.Group> - <Radio value="dynamic">鍔ㄦ��</Radio> - <Radio value="static">闈欐��</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="楂樺害"> - {getFieldDecorator('height', { - initialValue: wrap.height || 50, - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '楂樺害!' - } - ] - })(<InputNumber min={30} max={200} precision={0} onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - </Row> - </Form> - </div> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/components/header/versions/settingform/index.scss b/src/components/header/versions/settingform/index.scss deleted file mode 100644 index 159130b..0000000 --- a/src/components/header/versions/settingform/index.scss +++ /dev/null @@ -1,11 +0,0 @@ -.model-menu-setting-form { - position: relative; - - .anticon-question-circle { - color: #c49f47; - margin-right: 3px; - } - .ant-input-number { - width: 100%; - } -} \ No newline at end of file diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index becaedf..375ad25 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -22,6 +22,7 @@ import './index.scss' const EditMenu = asyncComponent(() => import('@/templates/menuconfig/editfirstmenu')) +const VersionsUp = asyncComponent(() => import('./versions')) const { confirm } = Modal class Header extends Component { @@ -375,6 +376,9 @@ <Switch size="small" style={{marginLeft: '7px'}} disabled={!!editLevel} checked={true} onChange={this.changeEditState} /> </Menu.Item> <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> + {options.sysType !== 'cloud' ? <Menu.Item style={{padding: 0}} key="verup"> + <VersionsUp /> + </Menu.Item> : null} <Menu.Item key="logout" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> </Menu> }> diff --git a/src/components/header/versions/index.jsx b/src/views/design/header/versions/index.jsx similarity index 72% rename from src/components/header/versions/index.jsx rename to src/views/design/header/versions/index.jsx index 0c5e64a..e12d137 100644 --- a/src/components/header/versions/index.jsx +++ b/src/views/design/header/versions/index.jsx @@ -1,23 +1,17 @@ import React, {Component} from 'react' -import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Modal, notification, Timeline, Icon, Button } from 'antd' +import { Modal, notification, Timeline, Icon, Button, Typography } from 'antd' import moment from 'moment' import md5 from 'md5' -// import SettingForm from './settingform' import Api from '@/api' import options from '@/store/options.js' import Utils from '@/utils/utils.js' import './index.scss' -const { confirm } = Modal +const { Paragraph } = Typography class DataSource extends Component { - static propTpyes = { - debug: PropTypes.any - } - state = { visible: false, versions: null, @@ -30,137 +24,94 @@ } verup = () => { - const { debug } = this.props + let _param = { + func: 's_get_sversions_sys', + } - if (!debug || options.sysType === 'cloud') { - confirm({ - title: '鐗堟湰鍗囩骇', - content: '閲嶆柊鍔犺浇搴旂敤淇℃伅', - onOk() { - return new Promise(resolve => { - if (!window.GLOB.WebSql && !window.GLOB.IndexDB) { - notification.warning({ - top: 92, - message: '鍗囩骇澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯锛�', - duration: 2 - }) - resolve() - } else { - Api.updateAppVersion() - setTimeout(() => { - notification.success({ - top: 92, - message: '鍗囩骇鎴愬姛锛�', - duration: 2 - }) - resolve() - }, 1000) - } - }) - }, - onCancel() {} - }) - } else { - Api.updateAppVersion() - - if (!sessionStorage.getItem('CloudUserID') || !sessionStorage.getItem('CloudLoginUID')) { + Api.getSystemConfig(_param).then(result => { + if (!result.status) { notification.warning({ top: 92, - message: '璇风櫥褰曞紑鍙戞満锛�', - duration: 2 + message: result.message, + duration: 5 }) return } - let _param = { - func: 's_get_sversions_sys', + let edition_int = '' + if (options.sysType === 'SSO') { + edition_int = result.edition_int_sso + } else if (options.sysType === 'local' && window.GLOB.systemType !== 'production') { + edition_int = result.edition_int_local + } else { + if (result.edition_int_sso < result.edition_int_local) { + edition_int = result.edition_int_sso + } else { + edition_int = result.edition_int_local + } + } + if (edition_int === '') { + notification.warning({ + top: 92, + message: '鏈煡璇㈠埌鏇存柊鐗堟湰淇℃伅锛�', + duration: 5 + }) + return } - Api.getSystemConfig(_param).then(result => { - if (!result.status) { + let _rduri = window.atob('aHR0cHM6Ly9lcGMubWs5aC5$mkjbi93ZWJhcGkvZG9zdGFycw=='.replace(/\$mk/ig, '')) + let _id = window.atob('YmgwYmFwYWJ0ZDQ1ZXBz$mkZ3JhNzlzZWdiY2g2YzFpYms='.replace(/\$mk/ig, '')) + let sysType = options.sysType.toLowerCase() + + if (window.GLOB.systemType === 'production') { + sysType = '' + } + + let param = { + func: 's_get_sversions_sys_epc', + appkey: window.GLOB.appkey, + userid: _id, + LoginUID: _id, + edition_int: edition_int, + sys_type: sysType, + nonc: Utils.getuuid() + } + + let keys = Object.keys(param).sort() + let values = '' + keys.forEach(key => { + values += key + param[key] + }) + param.sign = md5(values) + param.t = new Date().getTime() + + Api.directRequest(_rduri + '/s_get_sversions_sys_epc', 'post', param, 'true').then(res => { + if (!res.status) { notification.warning({ top: 92, - message: result.message, + message: res.message, duration: 5 + }) + return + } else if (!res.data || res.data.length === 0) { + notification.success({ + top: 92, + message: '宸茬粡鏄渶鏂扮殑鐗堟湰浜嗐��', + duration: 2 }) return } - let edition_int = '' - if (options.sysType === 'SSO') { - edition_int = result.edition_int_sso - } else if (options.sysType === 'local' && window.GLOB.systemType !== 'production') { - edition_int = result.edition_int_local - } else { - if (result.edition_int_sso < result.edition_int_local) { - edition_int = result.edition_int_sso - } else { - edition_int = result.edition_int_local - } - } - if (edition_int === '') { - notification.warning({ - top: 92, - message: '鏈煡璇㈠埌鏇存柊鐗堟湰淇℃伅锛�', - duration: 5 - }) - return - } - - let _rduri = window.atob('aHR0cHM6Ly9lcGMubWs5aC5$mkjbi93ZWJhcGkvZG9zdGFycw=='.replace(/\$mk/ig, '')) - let _id = window.atob('YmgwYmFwYWJ0ZDQ1ZXBz$mkZ3JhNzlzZWdiY2g2YzFpYms='.replace(/\$mk/ig, '')) - let sysType = options.sysType.toLowerCase() - - if (window.GLOB.systemType === 'production') { - sysType = '' - } - - let param = { - func: 's_get_sversions_sys_epc', - appkey: window.GLOB.appkey, - userid: _id, - LoginUID: _id, - edition_int: edition_int, - sys_type: sysType, - nonc: Utils.getuuid() - } - - let keys = Object.keys(param).sort() - let values = '' - keys.forEach(key => { - values += key + param[key] + res.data = res.data.map((item, i) => { + item.status = i === 0 ? 'loading' : 'waiting' + item.index = i + return item }) - param.sign = md5(values) - param.t = new Date().getTime() - - Api.directRequest(_rduri + '/s_get_sversions_sys_epc', 'post', param, 'true').then(res => { - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - return - } else if (!res.data || res.data.length === 0) { - notification.success({ - top: 92, - message: '宸茬粡鏄渶鏂扮殑鐗堟湰浜嗐��', - duration: 2 - }) - return - } - - res.data = res.data.map((item, i) => { - item.status = i === 0 ? 'loading' : 'waiting' - item.index = i - return item - }) - this.setState({versions: res.data, version: res.data[0], visible: true}, () => { - this.queryScript() - }) + this.setState({versions: res.data, version: res.data[0], visible: true}, () => { + this.queryScript() }) }) - } + }) } queryScript = () => { @@ -485,8 +436,8 @@ ]} destroyOnClose > - {versions ? <Timeline> - {versions.map(item => { + <Timeline> + {versions && versions.map(item => { let icon = <Icon type="clock-circle-o" style={{ fontSize: '16px' }} /> if (item.status === 'loading') { icon = <Icon type="sync" spin style={{ fontSize: '16px' }} /> @@ -498,10 +449,10 @@ } } return ( - <Timeline.Item key={item.id} dot={icon}>{item.ProgramName}</Timeline.Item> + <Timeline.Item key={item.id} dot={icon}>{item.ProgramName}锛�<Paragraph style={{display: 'inline-block', marginBottom: '0px'}} copyable>{item.id}</Paragraph>锛�</Timeline.Item> ) })} - </Timeline> : null} + </Timeline> </Modal> </> ) diff --git a/src/components/header/versions/index.scss b/src/views/design/header/versions/index.scss similarity index 100% rename from src/components/header/versions/index.scss rename to src/views/design/header/versions/index.scss -- Gitblit v1.8.0