From 04b5222fcf0c8f24b3a577cf3a05fb57462982a5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 11 八月 2020 09:18:27 +0800 Subject: [PATCH] 2020-08-11 --- public/options.json | 1 src/index.js | 16 - src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 70 +++---- src/api/index.js | 226 ++++++++++++++++--------- src/locales/zh-CN/main.js | 1 src/components/header/index.jsx | 69 ++++++- src/locales/en-US/main.js | 1 src/tabviews/verupmanage/config.jsx | 4 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 67 +++++- src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 20 + src/views/login/index.jsx | 12 + 11 files changed, 320 insertions(+), 167 deletions(-) diff --git a/public/options.json b/public/options.json index 9547a18..a918828 100644 --- a/public/options.json +++ b/public/options.json @@ -4,6 +4,5 @@ "mainSystemApi": "http://cloud.mk9h.cn/webapi/dostars", "systemType": "", "lineColor": "", - "webStorage": "websql", "filter": "false" } \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index bae643c..130f012 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -6,29 +6,34 @@ import Utils from '@/utils/utils.js' import options from '@/store/options.js' -let mkDB = null +let mkDataBase = null +let storUsable = false -if (window.GLOB.webSqlUsable) { +if (window.openDatabase) { let service = window.GLOB.service ? '-' + window.GLOB.service.replace('/', '') : '' try { - mkDB = openDatabase(`mkdb${service}`, '1', 'mk-pc-database', 50 * 1024 * 1024) - mkDB.transaction(tx => { - tx.executeSql('CREATE TABLE IF NOT EXISTS VERSIONS (id unique, version varchar(50), CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50))', [], () => { + mkDataBase = openDatabase(`mkdb${service}`, '1', 'mk-pc-database', 50 * 1024 * 1024) + mkDataBase.transaction(tx => { + tx.executeSql('CREATE TABLE IF NOT EXISTS VERSIONS (version varchar(50), createDate varchar(50), CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50))', [], () => { }, () => { // eslint-disable-next-line throw 'CREATE TABLE ERROR' }) - tx.executeSql('CREATE TABLE IF NOT EXISTS CONFIGS (id unique, menuid varchar(50), userid varchar(50), openEdition varchar(50), webEdition varchar(50), LongParam text, LongParamUser text, CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50), CDefine4 varchar(50), CDefine5 varchar(50))', [], () => { + tx.executeSql('CREATE TABLE IF NOT EXISTS CONFIGS (menuid varchar(50), userid varchar(50), openEdition varchar(50), webEdition varchar(50), LongParam text, LongParamUser text, CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50), CDefine4 varchar(50), CDefine5 varchar(50))', [], () => { }, () => { // eslint-disable-next-line throw 'CREATE TABLE ERROR' }) }) + // mkDataBase.transaction(tx => { + // tx.executeSql('DROP TABLE VERSIONS') + // tx.executeSql('DROP TABLE CONFIGS') + // }) } catch (e) { console.warn(e) - mkDB = null + mkDataBase = null } } @@ -225,79 +230,137 @@ } /** - * @description 鑾峰彇绯荤粺鍩烘湰璁剧疆锛屽惎鐢ㄦ垨鏇存柊websql + * @description 鑾峰彇绯荤粺鐗堟湰淇℃伅锛屽惎鐢ㄦ垨鏇存柊websql */ - getSystemStyle () { - // 鑾峰彇绯荤粺淇℃伅 - let param = { - func: 's_Get_style', - TypeCharOne: 'PC', - LText: `select '${window.GLOB.appkey}'`, - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - param.userid = sessionStorage.getItem('UserID') || '' - param.lang = localStorage.getItem('lang') || '' - param.SessionUid = localStorage.getItem('SessionUid') || '' - param.LoginUID = sessionStorage.getItem('LoginUID') || '' - param.appkey = window.GLOB.appkey || '' - - if (window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } - - param.nonc = Utils.getuuid() + getAppVersion (_resolve, _reject) { + let appVersion = {} - let keys = Object.keys(param).sort() - let values = '' - keys.forEach(key => { - if (key === 'rduri' || key === 't') return - if (typeof(param[key]) === 'object') { - values += key + JSON.stringify(param[key]) + new Promise((resolve, reject) => { + if (!mkDataBase) { + reject() } else { - values += key + param[key] - } - }) - param.sign = md5(values) - param.t = new Date().getTime() - - return new Promise(resolve => { - axios({ - url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, - data: param - }).then(res => { - if (mkDB) { - let version = res.app_version ? `${res.app_version}` : '1' - // mkDB.transaction(tx => { - // tx.executeSql('DROP TABLE CONFIGS') - // }) - - mkDB.transaction(tx => { - tx.executeSql('SELECT * FROM VERSIONS', [], (tx, results) => { - if (results.rows.length === 0) { - tx.executeSql('INSERT INTO VERSIONS (id, version) VALUES (?, ?)', ['pc', version]) - tx.executeSql('DELETE FROM CONFIGS') - } else if (results.rows.length === 1) { - let _ver = results.rows[0] - if (version !== _ver.version) { - tx.executeSql(`UPDATE VERSIONS SET version=${version}`) - tx.executeSql('DELETE FROM CONFIGS') - } - } else if (results.rows.length > 1) { - tx.executeSql('DELETE FROM VERSIONS') - tx.executeSql('INSERT INTO VERSIONS (id, version) VALUES (?, ?)', ['pc', version]) - tx.executeSql('DELETE FROM CONFIGS') - } - }, (tx, results) => { - console.warn(results) - }) + mkDataBase.transaction(tx => { + if (!mkDataBase) { + reject() + return + } + tx.executeSql('SELECT * FROM VERSIONS', [], (tx, results) => { + if (results.rows.length === 0) { + tx.executeSql('DELETE FROM CONFIGS') + resolve({version: '', createDate: ''}) + } else if (results.rows.length === 1) { + resolve(results.rows[0]) + } else if (results.rows.length > 1) { + tx.executeSql('DELETE FROM VERSIONS') + tx.executeSql('DELETE FROM CONFIGS') + resolve({version: '', createDate: ''}) + } + }, (tx, results) => { + reject() + console.warn(results) }) + }) + } + }).then(msg => { + if (msg.version) { + appVersion.oldVersion = msg.version + } + let curTime = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + + let param = { + func: 's_get_app_version', + modifydate: msg.createDate || curTime, + } + + param.userid = sessionStorage.getItem('UserID') || '' + param.lang = localStorage.getItem('lang') || '' + param.SessionUid = localStorage.getItem('SessionUid') || '' + param.LoginUID = sessionStorage.getItem('LoginUID') || '' + param.appkey = window.GLOB.appkey || '' + + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + + param.nonc = Utils.getuuid() + + let keys = Object.keys(param).sort() + let values = '' + keys.forEach(key => { + if (key === 'rduri' || key === 't') return + if (typeof(param[key]) === 'object') { + values += key + JSON.stringify(param[key]) + } else { + values += key + param[key] } - resolve(res) }) - }) + param.sign = md5(values) + param.t = new Date().getTime() + + return new Promise((resolve, reject) => { + axios({ + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, + data: param + }).then(res => { + let version = res.app_version || '1.00' + appVersion.newVersion = version + appVersion.oldVersion = appVersion.oldVersion || version + + mkDataBase.transaction(tx => { + if (res.menu_data && res.menu_data.length > 0) { + let keys = res.menu_data.map(mid => `'${mid.menuid}'`) + tx.executeSql(`DELETE FROM CONFIGS where menuid in (${keys.join(',')})`, [], () => {}, () => { + reject() + }) + } + if (msg.version) { + tx.executeSql(`UPDATE VERSIONS SET createDate='${curTime}'`, [], () => { + resolve() + }, () => { + reject() + }) + } else { + tx.executeSql('INSERT INTO VERSIONS (version, createDate) VALUES (?, ?)', [version, curTime], () => { + resolve() + }, () => { + reject() + }) + } + }) + }) + }) + }, () => { + _reject() + mkDataBase = null + return Promise.reject() + }).then(() => { + storUsable = true + _resolve(appVersion) + }) + } + + /** + * @description 鏇存柊绯荤粺鐗堟湰淇℃伅锛屾竻绌洪厤缃俊鎭� + */ + updateAppVersion (newVersion) { + return new Promise(resolve => { + if (!mkDataBase) { + resolve({status: false}) + return + } + let curTime = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + + mkDataBase.transaction(tx => { + tx.executeSql(`DELETE FROM CONFIGS`, [], () => {}, () => { + resolve({status: false}) + }) + tx.executeSql(`UPDATE VERSIONS SET version='${newVersion}', createDate='${curTime}'`, [], () => { + resolve({status: true}) + }, () => { + resolve({status: false}) + }) + }) + }) } /** @@ -440,7 +503,7 @@ _param = JSON.stringify(_param) _param = md5(_param) - if (mkDB) { + if (mkDataBase && storUsable) { param.nonc = Utils.getuuid() let keys = Object.keys(param).sort() @@ -457,7 +520,7 @@ param.t = new Date().getTime() return new Promise(resolve => { - mkDB.transaction(tx => { + mkDataBase.transaction(tx => { tx.executeSql(`SELECT * FROM CONFIGS WHERE menuid='${param.MenuID}' and userid='${param.userid}'`, [], (tx, results) => { let paramItem = results.rows[0] if (paramItem) { @@ -477,7 +540,7 @@ data: param }).then(res => { if (res.status) { - this.writeInWebSql([param.MenuID, param.MenuID, param.userid, res.open_edition, res.web_edition, res.LongParam, res.LongParamUser]) + this.writeInWebSql([param.MenuID, param.userid, res.open_edition, res.web_edition, res.LongParam, res.LongParamUser]) } resolve(res) }) @@ -492,7 +555,8 @@ } resolve(res) }) - mkDB = null + mkDataBase = null + storUsable = false console.warn(results) }) }) @@ -533,9 +597,9 @@ * @description 灏嗘暟鎹啓鍏ebsql */ writeInWebSql (data) { - if (!mkDB) return - mkDB.transaction(tx => { - tx.executeSql('INSERT INTO CONFIGS (id, menuid, userid, openEdition, webEdition, LongParam, LongParamUser) VALUES (?, ?, ?, ?, ?, ?, ?)', data) + if (!mkDataBase) return + mkDataBase.transaction(tx => { + tx.executeSql('INSERT INTO CONFIGS (menuid, userid, openEdition, webEdition, LongParam, LongParamUser) VALUES (?, ?, ?, ?, ?, ?)', data) }) } diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 40bbeb0..eb80ffe 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -4,7 +4,7 @@ import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import moment from 'moment' -import {Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button, Input } from 'antd' +import { Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button, Input, Badge } from 'antd' import asyncComponent from '@/utils/asyncComponent' import { @@ -55,7 +55,9 @@ avatar: avatar, systems: [], searchkey: '', - thdMenuList: [] + thdMenuList: [], + oriVersion: '', + newVersion: '' } handleCollapse = () => { @@ -633,10 +635,54 @@ }) } }) + + // 鑾峰彇绯荤粺鐨勭増鏈俊鎭� + new Promise((resolve, reject) => { + Api.getAppVersion(resolve, reject) + }).then(res => { + this.setState({ + oriVersion: res.oldVersion, + newVersion: res.newVersion + }) + }) } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + verup = () => { + const { oriVersion, newVersion } = this.state + const _this = this + + confirm({ + title: this.state.dict['main.verup'], + content: `鏈�鏂扮増鏈�${newVersion}锛屽綋鍓嶇増鏈�${oriVersion}`, + okText: this.state.dict['main.confirm'], + cancelText: this.state.dict['main.cancel'], + onOk() { + return new Promise(resolve => { + Api.updateAppVersion(newVersion).then(res => { + if (res.status) { + notification.success({ + top: 92, + message: '鍗囩骇鎴愬姛锛�', + duration: 2 + }) + _this.setState({oriVersion: newVersion}) + } else { + notification.warning({ + top: 92, + message: '鍗囩骇澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯锛�', + duration: 2 + }) + } + resolve() + }) + }) + }, + onCancel() {} + }) } gotoDoc = () => { @@ -650,22 +696,25 @@ } render () { - const { thdMenuList, searchkey } = this.state + const { thdMenuList, searchkey, oriVersion, newVersion } = this.state const menu = ( - <Menu overlayclassname="header-dropdown"> - {this.props.debug && <Menu.Item key="0"> + <Menu className="header-dropdown"> + {this.props.debug && <Menu.Item key="switch"> {this.state.dict['main.edit']} <Switch size="small" className="edit-switch" disabled={!!this.props.editLevel} checked={this.props.editState} onChange={this.changeEditState} /> </Menu.Item>} - {!this.props.editState ? <Menu.Item key="1" onClick={this.changePassword}>{this.state.dict['main.password']}</Menu.Item> : null} + {!this.props.editState ? <Menu.Item key="password" onClick={this.changePassword}>{this.state.dict['main.password']}</Menu.Item> : null} {/* {this.state.systems.length > 0 ? <Menu.SubMenu title="鍒囨崲绯荤粺"> {this.state.systems.map((system, index) => ( <Menu.Item className="header-subSystem" key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item> ))} </Menu.SubMenu> : null} */} - <Menu.Item key="2" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> - <Menu.Item key="3" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> + <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> + {oriVersion ? <Menu.Item key="verup" onClick={this.verup}> + <Badge dot={oriVersion !== newVersion}>{this.state.dict['main.verup']}</Badge> + </Menu.Item> : null} + <Menu.Item key="logout" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> </Menu> ) @@ -695,9 +744,9 @@ {this.props.editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} {/* 杩涘叆缂栬緫鎸夐挳 */} {this.props.editState && !this.props.editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} - {this.props.editState && !this.props.editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ? + {/* {this.props.editState && !this.props.editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ? <a href="#/mobmanage" target="_blank" className="mobile" type="edit"> 搴旂敤绠$悊 <Icon type="arrow-right" /></a> : null - } + } */} {/* 缂栬緫鑿滃崟 */} {this.props.editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null} {/* 澶村儚銆佺敤鎴峰悕 */} diff --git a/src/index.js b/src/index.js index f9dd9e5..88e31d7 100644 --- a/src/index.js +++ b/src/index.js @@ -168,22 +168,6 @@ document.getElementById('root').className = option[window.GLOB.style] } - let mkDBUseable = false - if (process.env.NODE_ENV === 'production') { // 鏄惁浣跨敤web瀛樺偍 - mkDBUseable = options.sysType !== 'local' || window.GLOB.systemType === 'production' - } else { - mkDBUseable = true - } - - if (config.webStorage && mkDBUseable) { - let stor = config.webStorage.toLowerCase() - if (stor.indexOf('websql') > -1) { - window.GLOB.webSqlUsable = true - } else if (stor.indexOf('indexeddb') > -1) { - window.GLOB.IndexedDBUsable = true - } - } - render(Route) }) diff --git a/src/locales/en-US/main.js b/src/locales/en-US/main.js index e05da11..d91a40c 100644 --- a/src/locales/en-US/main.js +++ b/src/locales/en-US/main.js @@ -11,6 +11,7 @@ 'main.logout': 'Logout', 'main.doc': '鏂囨。涓績', 'main.logout.hint': 'Are you sure you want to log out?', + 'main.verup': 'Version upgrade', 'main.password': 'Change the password', 'main.password.origin': 'Original Password', 'main.password.origin.required': 'Please input your original password!', diff --git a/src/locales/zh-CN/main.js b/src/locales/zh-CN/main.js index 89a728c..a2f0315 100644 --- a/src/locales/zh-CN/main.js +++ b/src/locales/zh-CN/main.js @@ -11,6 +11,7 @@ 'main.logout': '閫�鍑�', 'main.doc': '鏂囨。涓績', 'main.logout.hint': '鎮ㄧ‘瀹氳閫�鍑哄悧?', + 'main.verup': '鐗堟湰鍗囩骇', 'main.password': '淇敼瀵嗙爜', 'main.password.origin': '鍘熷瘑鐮�', 'main.password.origin.required': '璇疯緭鍏ュ師瀵嗙爜锛�', diff --git a/src/tabviews/verupmanage/config.jsx b/src/tabviews/verupmanage/config.jsx index 768fdea..89c1876 100644 --- a/src/tabviews/verupmanage/config.jsx +++ b/src/tabviews/verupmanage/config.jsx @@ -34,6 +34,10 @@ } ] } + }, + {OpenType:'prompt',Ot:'notRequired',sqlType:'custom',position:'toolbar',sql:'sVersion',execSuccess:'grid',label:'鏇存柊鐗堟湰',intertype:'inner',execError:'never',class:'primary', + verify:{default:'false',uniques:[],scripts:[{position:'back',sql:'update sapp set app_version=app_version+0.01,modifyuserid=@userid@,modifydate=getdate() where id=@appkey@',uuid:'1592636597030trc047em39bdrpo9tgu'}],customverifys:[],voucher:{enabled:false},contrasts:[],invalid:'false',accountdate:'false',billcodes:[]}, + icon:'',innerFunc:'',uuid:'15926364942911efnal5pv6r92if2vr2' } ], columns:[ diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index f49bcf5..1f4d6b4 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -378,54 +378,50 @@ */ exportExcel = (data) => { const { btn } = this.props - if (data && data.length > 0) { - try { - let _header = [] - let _topRow = {} - let colwidth = [] + + try { + let _header = [] + let _topRow = {} + let colwidth = [] - btn.verify.columns.forEach(col => { - if (!data[0].hasOwnProperty(col.Column)) return - if (_topRow[col.Column]) return + btn.verify.columns.forEach(col => { + if (_topRow[col.Column]) return - _header.push(col.Column) - _topRow[col.Column] = col.Text + _header.push(col.Column) + _topRow[col.Column] = col.Text - colwidth.push({width: col.Width}) + colwidth.push({width: col.Width || 20}) + }) + + let table = [] + + table.push(_topRow) + + data && data.forEach(item => { + let _row = {} + _header.forEach(field => { + _row[field] = item[field] }) - let table = [] + table.push(_row) + }) - table.push(_topRow) + const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) - data.forEach(item => { - let _row = {} - _header.forEach(field => { - _row[field] = item[field] - }) + ws['!cols'] = colwidth - table.push(_row) - }) + const wb = XLSX.utils.book_new() + XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') - const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) + XLSX.writeFile(wb, this.state.excelName) - ws['!cols'] = colwidth - - const wb = XLSX.utils.book_new() - XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') - - XLSX.writeFile(wb, this.state.excelName) - - if (btn.verify && btn.verify.enable === 'true' && btn.verify.script) { - this.execCustomScript() - } else { - this.execSuccess({ErrCode: 'S', ErrMesg: '瀵煎嚭鎴愬姛锛�'}) - } - } catch { - this.execError({ErrCode: 'N', message: 'Excel鐢熸垚澶辫触锛�'}) + if (btn.verify && btn.verify.enable === 'true' && btn.verify.script) { + this.execCustomScript() + } else { + this.execSuccess({ErrCode: 'S', ErrMesg: '瀵煎嚭鎴愬姛锛�'}) } - } else { - this.execError({ErrCode: 'N', message: '鏈煡璇㈠埌瀵煎嚭鏁版嵁锛�'}) + } catch { + this.execError({ErrCode: 'N', message: 'Excel鐢熸垚澶辫触锛�'}) } } diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index a8626b0..c13f4a2 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import { fromJS } from 'immutable' import { Form, Tabs, Row, Col, Input, Button, Table, Popconfirm, Icon, Tooltip, notification, Modal, message, InputNumber, Radio, Typography } from 'antd' import moment from 'moment' @@ -218,24 +219,58 @@ } UNSAFE_componentWillMount() { - let _verify = this.props.card.verify || {} - _verify = JSON.parse(JSON.stringify(_verify)) - + const { columns, card } = this.props + let _verify = fromJS(card.verify || {}).toJS() let _columns = _verify.columns || [] - _columns = _columns.map(col => { - col.required = col.required || 'true' - col.type = col.type || 'Nvarchar(50)' - - if (/^Nvarchar/ig.test(col.type)) { - col.limit = col.type.match(/\d+/)[0] - } else if (/^Decimal/ig.test(col.type)) { - col.limit = col.type.match(/\d+/ig)[1] - } else { - col.limit = '' - } - return col - }) + // 鍚屾鏄剧ず鍒� + if (_columns.length === 0) { + columns.forEach(col => { + if (!col.field) return + let _type = 'Nvarchar(50)' + let _limit = '50' + if (col.type === 'number' && !col.decimal) { + _type = 'Int' + _limit = '' + } else if (col.type === 'number') { + _type = 'Decimal(18,' + col.decimal + ')' + _limit = col.decimal + } + + let _cell = { + uuid: col.uuid, + Column: col.field, + Text: col.label, + type: _type, + limit: _limit, + import: 'true', + required: 'true' + } + + if (_type !== 'Nvarchar(50)') { + _cell.min = 0 + _cell.max = 999999 + } + + _columns.push(_cell) + }) + } else { + // 鏃ф暟鎹吋瀹� + _columns = _columns.map(col => { + col.required = col.required || 'true' + col.type = col.type || 'Nvarchar(50)' + + if (/^Nvarchar/ig.test(col.type)) { + col.limit = col.type.match(/\d+/)[0] + } else if (/^Decimal/ig.test(col.type)) { + col.limit = col.type.match(/\d+/ig)[1] + } else { + col.limit = '' + } + + return col + }) + } this.setState({ verify: { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index e50a5e6..e20c028 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -73,11 +73,21 @@ } _verify.enable = _verify.enable || 'false' - _verify.columns = _verify.columns || [] - _verify.columns = _verify.columns.map(col => { - col.Width = col.Width || 20 - return col - }) + + // 鍚屾鏄剧ず鍒� + if (!_verify.columns || _verify.columns.length === 0) { + _verify.columns = [] + config.columns.forEach(item => { + if (!item.field) return + + _verify.columns.push({ + Column: item.field, + Text: item.label, + Width: 20, + uuid: Utils.getuuid() + }) + }) + } if (card.intertype !== 'inner' || card.innerFunc) { _verify.enable = 'false' diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index d72c7b0..8b029a1 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -222,7 +222,17 @@ this.setState({touristLogin: true}) } - Api.getSystemStyle().then(res => { + // 鑾峰彇绯荤粺淇℃伅 + let _param = { + func: 's_Get_style', + TypeCharOne: 'PC', + LText: `select '${window.GLOB.appkey}'`, + } + + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) + + Api.getSystemConfig(_param).then(res => { if (res.status) { let _url = window.location.href.split('#')[0] + 'system' let systemMsg = { -- Gitblit v1.8.0