| | |
| | | 'main.return': 'Return', |
| | | 'main.close': 'Close', |
| | | 'main.cancel': 'Cancel', |
| | | 'main.revert.default': 'Restore default Settings', |
| | | 'main.copy.success': 'Copy success', |
| | | 'main.pagination.of': 'of', |
| | | 'main.pagination.items': 'items', |
| | | 'main.page.settingerror': '页面配置错误!', |
| | | 'main.datasource.settingerror': '数据源配置错误!', |
| | | 'main.action.settingerror': 'Button setting error!', |
| | | 'main.action.confirm.tip': 'Do you want to execute?', |
| | | 'main.action.confirm.success': 'Execute successfully!', |
| | | 'main.action.confirm.selectline': 'Please select a line!', |
| | | 'main.action.confirm.selectSingleLine': 'Please select a single row of data!', |
| | | 'main.action.primarykey.required': 'Primary key not set!', |
| | | 'main.action.primarykey.repetition': 'There are multiple primary keys!', |
| | | 'main.action.primarykey.repetitionbid': 'There are multiple BID!', |
| | | 'main.view.unenabled': '抱歉,您访问的页面未启用,请联系管理员。', |
| | | 'main.excel.line': 'line', |
| | | 'main.excel.column': 'column', |
| | | 'main.excel.includekey': ' Contain keywords ', |
| | | 'main.excel.content.emptyerror': '内容不可为空', |
| | | 'main.excel.content.typeerror': '内容应为数值', |
| | | 'main.excel.content.interror': '内容应为整数', |
| | | 'main.excel.content.floaterror': '内容应为浮点数', |
| | | 'main.excel.content.floatIntover': '整数位超出范围', |
| | | 'main.excel.content.floatPointover': '小数位超出范围', |
| | | 'main.excel.content.date.over': '时间为负值或太大', |
| | | 'main.excel.content.date.formatError': '时间格式错误', |
| | | 'main.excel.content.maxlimit': '内容超长', |
| | | 'main.excel.content.limitmin': '小于最小值', |
| | | 'main.excel.content.limitmax': '大于最大值', |
| | | 'main.form.link.error': '联动菜单设置错误!', |
| | | 'main.form.picture.check': '查看图片', |
| | | 'main.role.title': 'The role list', |
| | | 'form.required.input': 'Please enter the ', |
| | | 'form.required.select': 'Please select a ' |
| | |
| | | 'main.return': '返回', |
| | | 'main.close': '关闭', |
| | | 'main.cancel': '取消', |
| | | 'main.revert.default': '恢复默认设置', |
| | | 'main.copy.success': '复制成功', |
| | | 'main.pagination.of': '共', |
| | | 'main.pagination.items': '条', |
| | | 'main.page.settingerror': '页面配置错误!', |
| | | 'main.datasource.settingerror': '数据源配置错误!', |
| | | 'main.action.settingerror': '按钮设置错误!', |
| | | 'main.action.confirm.tip': '确定要执行吗?', |
| | | 'main.action.confirm.success': '执行成功!', |
| | | 'main.action.confirm.selectline': '请选择行!', |
| | | 'main.action.confirm.selectSingleLine': '请选择单行数据!', |
| | | 'main.action.primarykey.required': '未设置主键!', |
| | | 'main.action.primarykey.repetition': '存在多个主键!', |
| | | 'main.action.primarykey.repetitionbid': '存在多个BID!', |
| | | 'main.view.unenabled': '抱歉,您访问的页面未启用,请联系管理员。', |
| | | 'main.excel.line': '行', |
| | | 'main.excel.column': '列', |
| | | 'main.excel.includekey': '含有关键字', |
| | | 'main.excel.content.emptyerror': '内容不可为空', |
| | | 'main.excel.content.typeerror': '内容应为数值', |
| | | 'main.excel.content.interror': '内容应为整数', |
| | | 'main.excel.content.floaterror': '内容应为浮点数', |
| | | 'main.excel.content.floatIntover': '整数位超出范围', |
| | | 'main.excel.content.floatPointover': '小数位超出范围', |
| | | 'main.excel.content.date.over': '时间为负值或太大', |
| | | 'main.excel.content.date.formatError': '时间格式错误', |
| | | 'main.excel.content.maxlimit': '内容超长', |
| | | 'main.excel.content.limitmin': '小于最小值', |
| | | 'main.excel.content.limitmax': '大于最大值', |
| | | 'main.form.link.error': '联动菜单设置错误!', |
| | | 'main.form.picture.check': '查看图片', |
| | | 'main.role.title': '角色列表', |
| | | 'form.required.input': '请输入', |
| | | 'form.required.select': '请选择' |
| | |
| | | import { notification, Spin, Tabs, Switch, Row, Col, Modal } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | ContainerId: Utils.getuuid(), // 菜单外层html Id |
| | | BID: null, // 页面跳转时携带ID |
| | | loadingview: true, // 页面加载中 |
| | |
| | | this.setState({ |
| | | loadingview: false, |
| | | viewlost: true, |
| | | lostmsg: this.state.dict['main.view.unenabled'] |
| | | lostmsg: '抱歉,您访问的页面未启用,请联系管理员。' |
| | | }) |
| | | return |
| | | } |
| | |
| | | setting={setting} |
| | | actions={actions} |
| | | columns={columns} |
| | | dict={this.state.dict} |
| | | MenuID={MenuID} |
| | | selectedData={selectedData} |
| | | /> |
| | |
| | | setting={setting} |
| | | columns={columns} |
| | | pageSize={pageSize} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | total={this.state.total} |
| | | loading={this.state.loading} |
| | |
| | | setting={setting} |
| | | actions={actions} |
| | | columns={columns} |
| | | dict={this.state.dict} |
| | | MenuID={MenuID} |
| | | selectedData={selectedData} |
| | | /> |
| | |
| | | setting={setting} |
| | | columns={columns} |
| | | pageSize={pageSize} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | total={this.state.total} |
| | | loading={this.state.loading} |
| | |
| | | } |
| | | {setting && window.GLOB.breakpoint ? <DebugTable /> : null} |
| | | {!window.GLOB.mkHS && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config} /> : null} |
| | | {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} |
| | | {!window.GLOB.mkHS && setting ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null} |
| | | {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config}/> : null} |
| | | {!window.GLOB.mkHS && setting ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null} |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | | ) |
| | |
| | | pageSizeOptions: pageOptions, |
| | | showSizeChanger: true, |
| | | total: this.props.total || 0, |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} ${this.state.dict['main.pagination.of']} ${total} ${this.state.dict['main.pagination.items']}` |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条` |
| | | } |
| | | } |
| | | |
| | |
| | | actionSettingError = () => { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.settingerror'], |
| | | message: '按钮设置错误!', |
| | | duration: 5 |
| | | }) |
| | | } |
| | |
| | | } else if (item.resourceType === '1' && !item.dataSource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: item.label + ': ' + this.state.dict['main.datasource.settingerror'], |
| | | message: item.label + ': 数据源配置错误!', |
| | | duration: 5 |
| | | }) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | let result = getExcelInSql(btn, data, this.state.dict, (this.props.BID || ''), this.state.primaryId) |
| | | let result = getExcelInSql(btn, data, (this.props.BID || ''), this.state.primaryId) |
| | | |
| | | if (result.errors) { |
| | | notification.warning({ |
| | |
| | | actionSettingError = () => { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.settingerror'], |
| | | message: '按钮设置错误!', |
| | | duration: 5 |
| | | }) |
| | | } |
| | |
| | | tableId: PropTypes.string, // 列表Id |
| | | statFValue: PropTypes.any, // 合计字段数据 |
| | | pageSize: PropTypes.any, // 每页数据 |
| | | dict: PropTypes.object, // 字典项 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | setting: PropTypes.object, // 表格全局设置:tableType(表格是否可选、单选、多选)、columnfixed(列固定)、actionfixed(按钮固定) |
| | | pickup: PropTypes.any, // 数据收起 |
| | |
| | | pageSizeOptions: pageOptions, |
| | | showSizeChanger: true, |
| | | total: this.props.total || 0, |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} ${this.props.dict['main.pagination.of']} ${total} ${this.props.dict['main.pagination.items']}` |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条` |
| | | } |
| | | } |
| | | |
| | |
| | | class PageMessage extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id,用于查询下拉选择项 |
| | | dict: PropTypes.object, // 字典 |
| | | } |
| | | |
| | | state = { |
| | |
| | | |
| | | |
| | | render() { |
| | | const { menu, dict } = this.props |
| | | const { menu } = this.props |
| | | const { debug, visible, data } = this.state |
| | | |
| | | return ( |
| | |
| | | visible={visible} |
| | | onCancel={() => this.setState({visible: false})} |
| | | footer={[ |
| | | <Button key="close" onClick={() => this.setState({visible: false})}>{dict['main.close']}</Button> |
| | | <Button key="close" onClick={() => this.setState({visible: false})}>关闭</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | |
| | | |
| | | class CustomSetting extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典表 |
| | | config: PropTypes.object, // 页面配置信息 |
| | | shortcuts: PropTypes.any, // 自定义设置 |
| | | } |
| | |
| | | visible={visible} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | footer={[ |
| | | <Button key="revert" type="danger" loading={this.state.revertLoading} onClick={this.settingRevert}>{this.props.dict['main.revert.default']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>{this.props.dict['main.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" loading={this.state.confirmLoading} onClick={this.settingSubmit}>{this.props.dict['main.submit']}</Button> |
| | | <Button key="revert" type="danger" loading={this.state.revertLoading} onClick={this.settingRevert}>恢复默认设置</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>取消</Button>, |
| | | <Button key="confirm" type="primary" loading={this.state.confirmLoading} onClick={this.settingSubmit}>提交</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | |
| | | * @description 获取excel导入参数 |
| | | * @return {Object} item 按钮信息 |
| | | * @return {Array} data excel数据 |
| | | * @return {Object} dict 字典项 |
| | | * @return {String} BID 上级Id |
| | | */ |
| | | export function getExcelInSql (item, data, dict, BID, primaryId) { |
| | | export function getExcelInSql (item, data, BID, primaryId) { |
| | | let btn = item.verify |
| | | let keys = ['delete', 'drop', 'insert', 'truncate', 'update'] |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | |
| | | |
| | | let val = item[col.Column] !== undefined ? item[col.Column] : '' |
| | | let _colindex = cols[cindex] || (cindex + 1) |
| | | let _position = (_topline + lindex + 1) + dict['main.excel.line'] + ' ' + _colindex + dict['main.excel.column'] + ' ' |
| | | let _position = (_topline + lindex + 1) + '行 ' + _colindex + '列 ' |
| | | |
| | | if (/^Nvarchar/ig.test(col.type)) { |
| | | if (typeof(val) === 'number') { |
| | |
| | | val = val.replace(/(^\s*$)|\t*|\v*|'*/ig, '') |
| | | |
| | | if (!val && col.required === 'true') { // 必填校验 |
| | | errors.push(_position + dict['main.excel.content.emptyerror']) |
| | | errors.push(_position + '内容不可为空') |
| | | } else if (col.limit && val.length > col.limit) { // 长度校验 |
| | | errors.push(_position + dict['main.excel.content.maxlimit']) |
| | | errors.push(_position + '内容超长') |
| | | } else { // 关键字校验 |
| | | keys.forEach(key => { |
| | | let _patten = new RegExp('(^' + key + '\\s+)|(\\s+' + key + '\\s+)', 'ig') |
| | | if (_patten.test(val)) { |
| | | errors.push(_position + dict['main.excel.includekey'] + key) |
| | | errors.push(_position + '含有关键字' + key) |
| | | } |
| | | }) |
| | | } |
| | | } else if (/^int/ig.test(col.type)) { |
| | | if (!val && val !== 0) { |
| | | errors.push(_position + dict['main.excel.content.emptyerror']) |
| | | errors.push(_position + '内容不可为空') |
| | | } else { |
| | | let _val = val + '' |
| | | |
| | | if (!/^(([^0][0-9]+|0)$)|^(([1-9]+)$)/.test(_val)) { // 检验是否为整数 |
| | | errors.push(_position + dict['main.excel.content.interror']) |
| | | errors.push(_position + '内容应为整数') |
| | | } else if ((col.min || col.min === 0) && val < col.min) { // 最小值检验 |
| | | errors.push(_position + dict['main.excel.content.limitmin']) |
| | | errors.push(_position + '小于最小值') |
| | | } else if ((col.max || col.max === 0) && val > col.max) { // 最大值检验 |
| | | errors.push(_position + dict['main.excel.content.limitmax']) |
| | | errors.push(_position + '大于最大值') |
| | | } |
| | | } |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | if (!val && val !== 0) { |
| | | errors.push(_position + dict['main.excel.content.emptyerror']) |
| | | errors.push(_position + '内容不可为空') |
| | | } else { |
| | | let _val = val + '' |
| | | let _vals = _val.split('.') |
| | | |
| | | if (!/^(([^0][0-9]+|0)\.([0-9]+)$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]+)$)|^(([1-9]+)$)/.test(_val)) { // 检验是否为浮点数 |
| | | errors.push(_position + dict['main.excel.content.floaterror']) |
| | | errors.push(_position + '内容应为浮点数') |
| | | } else if (_vals[0].length > 18) { // 检验整数位 |
| | | errors.push(_position + dict['main.excel.content.floatIntover']) |
| | | errors.push(_position + '整数位超出范围') |
| | | } else if (_vals[1] && _vals[1].length > col.limit) { // 最小值检验 |
| | | errors.push(_position + dict['main.excel.content.floatPointover']) |
| | | errors.push(_position + '小数位超出范围') |
| | | } else if ((col.min || col.min === 0) && val < col.min) { // 最小值检验 |
| | | errors.push(_position + dict['main.excel.content.limitmin']) |
| | | errors.push(_position + '小于最小值') |
| | | } else if ((col.max || col.max === 0) && val > col.max) { // 最大值检验 |
| | | errors.push(_position + dict['main.excel.content.limitmax']) |
| | | errors.push(_position + '大于最大值') |
| | | } |
| | | } |
| | | } else if (col.type === 'date') { |
| | | if (typeof(val) === 'number') { |
| | | if (val > 2958465 || val <= 0) { // 时间过大或小于等于0 |
| | | errors.push(_position + dict['main.excel.content.date.over']) |
| | | errors.push(_position + '时间为负值或太大') |
| | | } else { // 时间格式化 |
| | | if (val < 60) { // 1900-2-29,excel中存在,实际不存在 |
| | | val++ |
| | |
| | | } else if (typeof(val) === 'string') { |
| | | val = val.replace(/(^\s*$)|\t*|\v*/ig, '') |
| | | if (!val && col.required === 'true') { // 时间必填校验 |
| | | errors.push(_position + dict['main.excel.content.emptyerror']) |
| | | errors.push(_position + '内容不可为空') |
| | | } else if (val && !/^[1-9][0-9]{3}/.test(val)) { // 时间正则校验 |
| | | errors.push(_position + dict['main.excel.content.date.formatError']) |
| | | errors.push(_position + '时间格式错误') |
| | | } |
| | | } else { // 时间格式错误 |
| | | errors.push(_position + dict['main.excel.content.date.formatError']) |
| | | errors.push(_position + '时间格式错误') |
| | | } |
| | | } |
| | | |