| | |
| | | "mainSystemApi": "http://cloud.mk9h.cn/webapi/dostars", |
| | | "systemType": "", |
| | | "lineColor": "", |
| | | "webStorage": "websql", |
| | | "filter": "false" |
| | | } |
| | |
| | | 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 |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * @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}) |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | _param = JSON.stringify(_param) |
| | | _param = md5(_param) |
| | | |
| | | if (mkDB) { |
| | | if (mkDataBase && storUsable) { |
| | | param.nonc = Utils.getuuid() |
| | | |
| | | let keys = Object.keys(param).sort() |
| | |
| | | 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) { |
| | |
| | | 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) |
| | | }) |
| | |
| | | } |
| | | resolve(res) |
| | | }) |
| | | mkDB = null |
| | | mkDataBase = null |
| | | storUsable = false |
| | | console.warn(results) |
| | | }) |
| | | }) |
| | |
| | | * @description 将数据写入websql |
| | | */ |
| | | 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) |
| | | }) |
| | | } |
| | | |
| | |
| | | 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 { |
| | |
| | | avatar: avatar, |
| | | systems: [], |
| | | searchkey: '', |
| | | thdMenuList: [] |
| | | thdMenuList: [], |
| | | oriVersion: '', |
| | | newVersion: '' |
| | | } |
| | | |
| | | handleCollapse = () => { |
| | |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // 获取系统的版本信息 |
| | | 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 = () => { |
| | |
| | | } |
| | | |
| | | 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> |
| | | ) |
| | | |
| | |
| | | {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} |
| | | {/* 头像、用户名 */} |
| | |
| | | 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) |
| | | }) |
| | | |
| | |
| | | '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!', |
| | |
| | | 'main.logout': '退出', |
| | | 'main.doc': '文档中心', |
| | | 'main.logout.hint': '您确定要退出吗?', |
| | | 'main.verup': '版本升级', |
| | | 'main.password': '修改密码', |
| | | 'main.password.origin': '原密码', |
| | | 'main.password.origin.required': '请输入原密码!', |
| | |
| | | } |
| | | ] |
| | | } |
| | | }, |
| | | {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:[ |
| | |
| | | */ |
| | | 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生成失败!'}) |
| | | } |
| | | } |
| | | |
| | |
| | | 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' |
| | | |
| | |
| | | } |
| | | |
| | | 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: { |
| | |
| | | } |
| | | |
| | | _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' |
| | |
| | | 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 = { |