Merge branch 'positec' into dms
| | |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let id = Utils.getuuid() |
| | | sql = sql.replace(/@time_id@/ig, `'${id}'`) |
| | | sql = sql.replace(/@time_id@/ig, `'${Utils.getuuid()}'`) |
| | | sql = sql.replace(/@ID@/ig, `'${Utils.getuuid()}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${Utils.getuuid()}'`) |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID')}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid')}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID')}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey}'`) |
| | | // sql = sql.replace(/@datam@/ig, `''`) |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | |
| | | }) |
| | | |
| | | let sql = res.dataSource |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | |
| | | tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'linkmenu', 'width', 'hidden', 'openTab'], |
| | | innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'swipe', 'icon', 'class', 'color', 'width', 'hidden'], |
| | | funcbutton: ['label', 'OpenType', 'funcType', 'show', 'swipe', 'icon', 'class', 'color', 'width', 'hidden'], |
| | | form: ['label', 'OpenType', 'formType', 'intertype', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'width', 'refreshTab', 'title', 'hidden'] |
| | | form: ['label', 'OpenType', 'formType', 'intertype', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'width', 'openmenu', 'refreshTab', 'title', 'hidden'] |
| | | } |
| | | |
| | | class ActionForm extends Component { |
| | |
| | | }) |
| | | |
| | | let sql = res.dataSource |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | |
| | | ${_option.sql}` |
| | | |
| | | // LoginUID|SessionUid|UserID|Appkey 已替换 |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && values.database === 'sso') { |
| | |
| | | sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${sql}` |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) |
| | | |
| | | Api.sDebug(sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | |
| | | |
| | | let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _tailScript = _tailScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | let getuuid = () => { |
| | | let uuid = [] |
| | | let timestamp = new Date().getTime() |
| | | let _options = '0123456789abcdefghigklmnopqrstuv' |
| | | for (let i = 0; i < 19; i++) { |
| | | uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1)) |
| | | } |
| | | uuid = timestamp + uuid.join('') |
| | | return uuid |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '') |
| | | let regs = [ |
| | | {reg: /@time_id@/ig, value: `'${getuuid()}'`}, |
| | | {reg: /@BID@/ig, value: `'${getuuid()}'`}, |
| | | {reg: /@upid@/ig, value: `'${getuuid()}'`}, |
| | | {reg: /@typename@/ig, value: `'debug'`}, |
| | | {reg: /@datam@/ig, value: `''`}, |
| | | {reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID')}'`}, |
| | | {reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid')}'`}, |
| | | {reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID')}'`}, |
| | | {reg: /@Appkey@/ig, value: `'${window.GLOB.appkey}'`}, |
| | | {reg: /@\$|\$@/ig, value: ''}, |
| | | {reg: /@select\$|\$select@/ig, value: ''}, |
| | | {reg: /@sum\$|\$sum@/ig, value: ''}, |
| | | ] |
| | | |
| | | if (window.GLOB.process) { |
| | | _dataresource = _dataresource.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) |
| | | _tailScript = _tailScript.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) |
| | | regs.push({reg: /@works_flow_code@/ig, value: `'${getuuid()}'`}) |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | | _customScript = _customScript.replace(/@select\$|\$select@/ig, '') |
| | | _customScript = _customScript.replace(/@sum\$|\$sum@/ig, '') |
| | | _dataresource = _dataresource.replace(/\$sum@/ig, '/*') |
| | | _dataresource = _dataresource.replace(/@sum\$/ig, '*/') |
| | | |
| | | if (type === 'calendar') { |
| | | _dataresource = _dataresource.replace(/@mk_year@/ig, '') |
| | | _customScript = _customScript.replace(/@mk_year@/ig, '') |
| | | regs.push({reg: /@mk_year@/ig, value: '2024'}) |
| | | } |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | regs.push({reg: /@db@/ig, value: window.GLOB.externalDatabase}) |
| | | } |
| | | |
| | | regs.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | _customScript = _customScript.replace(item.reg, item.value) |
| | | _tailScript = _tailScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | if (_customScript) { |
| | | _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) |
| | | select @ErrorCode='',@retmsg ='',@UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='' |
| | | ${_customScript} |
| | | ` |
| | | } |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | if (window.GLOB.urlFields) { |
| | |
| | | { reg: /@datam@/ig, value: `''` }, |
| | | ] |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | regs.push({ |
| | | reg: /@db@/ig, |
| | | value: window.GLOB.externalDatabase |
| | | }) |
| | | } |
| | | if (config.urlFields) { |
| | | config.urlFields.forEach(field => { |
| | | regs.push({ |
| | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | backSql = backSql.replace(/@ID@/ig, `'id'`) |
| | | backSql = backSql.replace(/@BID@/ig, `'bid'`) |
| | | backSql = backSql.replace(/@LoginUID@/ig, `'LoginUID'`) |
| | | backSql = backSql.replace(/@SessionUid@/ig, `'SessionUid'`) |
| | | backSql = backSql.replace(/@UserID@/ig, `'UserID'`) |
| | | backSql = backSql.replace(/@Appkey@/ig, `'appkey'`) |
| | | backSql = backSql.replace(/@typename@/ig, `'typename'`) |
| | | backSql = backSql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) |
| | | } |
| | |
| | | { reg: /@\$/ig, value: '' }, |
| | | { reg: /@datam@/ig, value: `''` }, |
| | | ] |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | regs.push({ |
| | | reg: /@db@/ig, |
| | | value: window.GLOB.externalDatabase |
| | | }) |
| | | } |
| | | |
| | | if (process) { |
| | | regs.push({ reg: /@works_flow_code@/ig, value: `'1949-10-01 15:00:00'` }) |
| | |
| | | } |
| | | |
| | | getSysDefaultSql = (btn, component, process, group, retmsg) => { |
| | | let primaryId = 'id' |
| | | let BID = 'bid' |
| | | let primaryId = Utils.getuuid() |
| | | let BID = Utils.getuuid() |
| | | let verify = btn.verify || {} |
| | | let _actionType = null |
| | | let setting = component.setting |
| | |
| | | |
| | | _sql = _sql.replace(/@ID@/ig, `'${primaryId || ''}'`) |
| | | _sql = _sql.replace(/@BID@/ig, `'${BID}'`) |
| | | _sql = _sql.replace(/@LoginUID@/ig, `'LoginUID'`) |
| | | _sql = _sql.replace(/@SessionUid@/ig, `'SessionUid'`) |
| | | _sql = _sql.replace(/@UserID@/ig, `'UserID'`) |
| | | _sql = _sql.replace(/@Appkey@/ig, `'appkey'`) |
| | | _sql = _sql.replace(/@typename@/ig, `'typename'`) |
| | | _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) |
| | | |
| | |
| | | |
| | | database = database ? (database[0] || '') : '' |
| | | |
| | | let getuuid = () => { |
| | | let uuid = [] |
| | | let timestamp = new Date().getTime() |
| | | let _options = '0123456789abcdefghigklmnopqrstuv' |
| | | for (let i = 0; i < 19; i++) { |
| | | uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1)) |
| | | } |
| | | uuid = timestamp + uuid.join('') |
| | | return uuid |
| | | } |
| | | |
| | | let upId = getuuid() |
| | | let upId = Utils.getuuid() |
| | | |
| | | let vals = [] |
| | | btn.columns.forEach(col => { |
| | |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '(\\s|$)', 'ig'), value: ` #${sheet} `}, |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '\\(', 'ig'), value: ` #${sheet}(`}, |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '\\)', 'ig'), value: ` #${sheet})`}, |
| | | {reg: /@ID@/ig, value: `'id'`}, |
| | | {reg: /@BID@/ig, value: `'bid'`}, |
| | | {reg: /@LoginUID@/ig, value: `'LoginUID'`}, |
| | | {reg: /@SessionUid@/ig, value: `'SessionUid'`}, |
| | | {reg: /@UserID@/ig, value: `'UserID'`}, |
| | | {reg: /@Appkey@/ig, value: `'appkey'`}, |
| | | {reg: /@typename@/ig, value: `'admin'`}, |
| | | {reg: /\$@/ig, value: ''}, |
| | | {reg: /@\$/ig, value: ''}, |
| | | {reg: /@datam@/ig, value: `''`}, |
| | | ] |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | regs.push({reg: /@db@/ig, value: window.GLOB.externalDatabase}) |
| | | } |
| | | |
| | | btn.scripts && btn.scripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '(\\s|$)', 'ig'), value: ` #${sheet} `}, |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '\\(', 'ig'), value: ` #${sheet}(`}, |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '\\)', 'ig'), value: ` #${sheet})`}, |
| | | {reg: /@BID@/ig, value: `'${BID}'`}, |
| | | {reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | | {reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, |
| | | {reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, |
| | | {reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, |
| | | {reg: /@typename@/ig, value: `'admin'`}, |
| | | {reg: /\$@/ig, value: isDM ? '/*' : ''}, |
| | | {reg: /@\$/ig, value: isDM ? '*/' : ''}, |
| | | {reg: /@datam@/ig, value: isDM ? `'Y'` : `''`}, |
| | | ] |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | regs.push({reg: /@db@/ig, value: window.GLOB.externalDatabase}) |
| | | } |
| | | |
| | | btn.scripts && btn.scripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | |
| | | { reg: /@datam@/ig, value: `''` }, |
| | | ] |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | regs.push({ |
| | | reg: /@db@/ig, |
| | | value: window.GLOB.externalDatabase |
| | | }) |
| | | } |
| | | |
| | | let sql = this.formatDataSource(item, regs) |
| | | |
| | | return sql |
| | |
| | | { reg: /@orderBy@/ig, value: item.setting.order || '' }, |
| | | { reg: /@pageSize@/ig, value: 9999 }, |
| | | { reg: /@pageIndex@/ig, value: 1}, |
| | | { reg: /@ID@/ig, value: `''`}, |
| | | { reg: /@BID@/ig, value: `''`}, |
| | | { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | | { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, |
| | | { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, |
| | | { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, |
| | | { reg: /@typename@/ig, value: `'admin'`}, |
| | | ) |
| | | |
| | | if (item.type === 'calendar') { |
| | | regoptions.push({ reg: /@mk_year@/ig, value: '2023' }) |
| | | regoptions.push({ reg: /@mk_year@/ig, value: '2024' }) |
| | | } |
| | | |
| | | regoptions.forEach(cell => { |
| | |
| | | }) |
| | | |
| | | let sql = res.dataSource |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | |
| | | MKEmitter.emit('transferSyncData', tabId) |
| | | |
| | | if (!result.message) return |
| | | |
| | | if (/将截断字符串或二进制数据/ig.test(result.message)) { |
| | | result.message = result.message + '请检查字段集' |
| | | } |
| | | if (result.ErrCode === 'N') { |
| | | Modal.error({ |
| | | title: result.message, |
| | |
| | | MKEmitter.emit('transferSyncData', MenuID) |
| | | |
| | | if (!result.message) return |
| | | |
| | | if (/将截断字符串或二进制数据/ig.test(result.message)) { |
| | | result.message = result.message + '请检查字段集' |
| | | } |
| | | if (result.ErrCode === 'N') { |
| | | Modal.error({ |
| | | title: result.message, |
| | |
| | | MKEmitter.emit('transferSyncData', Tab.uuid) |
| | | |
| | | if (!result.message) return |
| | | |
| | | if (/将截断字符串或二进制数据/ig.test(result.message)) { |
| | | result.message = result.message + '请检查字段集' |
| | | } |
| | | if (result.ErrCode === 'N') { |
| | | Modal.error({ |
| | | title: result.message, |
| | |
| | | import React, { Component } from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { notification } from 'antd' |
| | | import * as XLSX from 'sheetjs-style' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | |
| | | onImportExcel = file => { |
| | | const { btn } = this.props |
| | | |
| | | let btnColumns = btn.verify.columns.filter(option => option.import !== 'init') |
| | | let columns = btnColumns.map(option => option.Column) |
| | | let range = btn.verify.range || 0 |
| | | |
| | | // excel数据处理 |
| | | const { files } = file.target |
| | | const fileReader = new FileReader() |
| | |
| | | // 以二进制流方式读取得到整份excel表格对象 |
| | | const workbook = XLSX.read(result, { type: 'binary' }) |
| | | |
| | | let errors = null |
| | | if (btn.verify.excelHandle === 'true') { |
| | | // eslint-disable-next-line |
| | | let func = new Function('XLSX', 'workbook', 'btn', 'callback', btn.verify.excel_func) |
| | | func(XLSX, workbook, btn.verify, (data, error) => { |
| | | if (!error && (!data || data.length === 0)) { |
| | | error = '未获取到Excel数据!' |
| | | } |
| | | this.props.returndata(data, error) |
| | | }) |
| | | } else { |
| | | let btnColumns = btn.verify.columns.filter(option => option.import !== 'init') |
| | | let columns = btnColumns.map(option => option.Column) |
| | | let range = btn.verify.range || 0 |
| | | |
| | | let error = null |
| | | let sheetName = btn.verify.sheet |
| | | let errDetail = '' |
| | | |
| | | if (sheetName === 'Sheet1' && Object.keys(workbook.Sheets).length === 1) { |
| | | sheetName = Object.keys(workbook.Sheets)[0] |
| | | } |
| | | |
| | | if (!workbook.Sheets.hasOwnProperty(sheetName)) { |
| | | errors = 'notexit' |
| | | error = '工作表《' + sheetName + '》不存在!' |
| | | } else if (range === 1) { |
| | | let header = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], {header: columns})[0] |
| | | |
| | | if (!header) { |
| | | errors = 'empty' |
| | | error = '工作表《' + sheetName + '》为空!' |
| | | } else { |
| | | let iserror = false |
| | | btnColumns.forEach(op => { |
| | | if (iserror) return |
| | | if (error) return |
| | | |
| | | let _name = typeof(header[op.Column]) === 'string' ? header[op.Column].replace(/(^\s*|\s*$)/g, '') : header[op.Column] |
| | | let _text = op.Text ? op.Text.replace(/(^\s*|\s*$)/g, '') : op.Text |
| | | |
| | | if (!_name) { |
| | | iserror = true |
| | | errors = 'headerError' |
| | | errDetail = `Excel中不存在(${_text})列!` |
| | | error = `工作表《${sheetName}》表头错误,Excel中不存在(${_text})列!` |
| | | } else if (_name !== _text) { |
| | | iserror = true |
| | | errors = 'headerError' |
| | | errDetail = `Excel中(${_name})与按钮列信息(${_text})不一致!` |
| | | error = `工作表《${sheetName}》表头错误,Excel中(${_name})与按钮列信息(${_text})不一致!` |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | let data = [] |
| | | |
| | | if (!errors) { |
| | | if (!error) { |
| | | data = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], {header: columns, range: (range)}) |
| | | |
| | | if (!data || data.length === 0) { |
| | | error = '未获取到工作表《' + sheetName + '》数据!' |
| | | } |
| | | } |
| | | |
| | | // 最终获取到并且格式化后的 json 数据 |
| | | this.props.returndata(data, errors, sheetName, errDetail) |
| | | this.props.returndata(data, error) |
| | | } |
| | | |
| | | this.setState({ |
| | | excelId: '', |
| | | }, () => { |
| | |
| | | excelId: Utils.getuuid() |
| | | }) |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '文件解析错误!', |
| | | duration: 5 |
| | | }) |
| | | // 错误传递 |
| | | this.props.returndata([], 'other') |
| | | this.props.returndata([], '文件解析错误!') |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * @description Excel 导入 |
| | | */ |
| | | getexceldata = (data, errors, sheetName, errDetail) => { |
| | | getexceldata = (data, error) => { |
| | | const { btn, BID } = this.props |
| | | |
| | | if (errors) { |
| | | if (errors === 'notexit') { |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '工作表《' + sheetName + '》不存在!', |
| | | message: error, |
| | | duration: 5 |
| | | }) |
| | | } else if (errors === 'empty') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '工作表《' + sheetName + '》为空!', |
| | | duration: 5 |
| | | }) |
| | | } else if (errors === 'headerError') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: `工作表《${sheetName}》表头错误,${errDetail}`, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | this.setState({ loading: false }) |
| | | return |
| | | } |
| | | |
| | | if (!data || data.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到工作表《' + sheetName + '》数据!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({ loading: false }) |
| | | return |
| | | } else if (data.length * btn.verify.columns.length > 30000) { |
| | | if (data.length * btn.verify.columns.length > 30000) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '当前导入数据量过大,如遇错误提示,请分批导入!', |
| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | this.exportExcel(result.data, result.ErrCode, result.message, viewParam.search) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | this.exportExcel(result.data, result.ErrCode, result.message, viewParam.search) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | this.exportExcel(result.data, result.ErrCode, result.message, viewParam.search) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | |
| | | Api.genericInterface(res).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | this.exportExcel(result.data, result.ErrCode, result.message, viewParam.search) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | this.getExcelOutDoubleData(viewParam, pageIndex, pageSize, data) |
| | | } else { |
| | | data = data.concat(result.data) |
| | | this.exportExcel(data, result.ErrCode, result.message) |
| | | this.exportExcel(data, result.ErrCode, result.message, viewParam.search) |
| | | } |
| | | } else { |
| | | this.execError(result) |
| | |
| | | this.getExcelOutData(viewParam, pageIndex, pageSize, data) |
| | | } else { |
| | | data = data.concat(result.data) |
| | | this.exportExcel(data, result.ErrCode, result.message) |
| | | this.exportExcel(data, result.ErrCode, result.message, viewParam.search) |
| | | } |
| | | } else { |
| | | this.execError(result) |
| | |
| | | /** |
| | | * @description Excel 生成 |
| | | */ |
| | | exportExcel = (data, ErrCode, msg) => { |
| | | exportExcel = (data, ErrCode, msg, search) => { |
| | | const { btn } = this.props |
| | | |
| | | let imgCol = false |
| | |
| | | try { |
| | | if (btn.verify.excelHandle === 'true') { |
| | | // eslint-disable-next-line |
| | | let func = new Function('XLSX', 'data', 'columns', 'callback', btn.verify.excel_func) |
| | | func(XLSX, data, columns, (res) => { |
| | | let func = new Function('XLSX', 'data', 'columns', 'searches', 'callback', btn.verify.excel_func) |
| | | func(XLSX, data, columns, search, (res) => { |
| | | res = res || {ErrCode: ErrCode || 'S', message: msg || '导出成功!'} |
| | | this.execSuccess(res) |
| | | }) |
| | |
| | | } |
| | | |
| | | let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@datam@/ig, `''`).replace(/@typename@/ig, `'debug'`) |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | |
| | | const { confirm } = Modal |
| | | const { Search } = Input |
| | | const { Paragraph } = Typography |
| | | |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) |
| | | const FullScripts = asyncComponent(() => import('@/templates/zshare/verifycard/fullScripts')) |
| | | |
| | | class VerifyCard extends Component { |
| | |
| | | _verify.range = 1 |
| | | } |
| | | |
| | | _verify.excelHandle = _verify.excelHandle || 'false' |
| | | _verify.default = _verify.default || 'true' |
| | | _verify.sheet = _verify.sheet || 'Sheet1' |
| | | _verify.range = _verify.range || 0 |
| | | _verify.columns = _columns |
| | | _verify.scripts = _verify.scripts || [] |
| | | _verify.uniques = _verify.uniques || [] |
| | | |
| | | this.setState({ |
| | | searchKey: '', |
| | | verify: { |
| | | ..._verify, |
| | | default: _verify.default || 'true', |
| | | sheet: _verify.sheet || 'Sheet1', |
| | | range: _verify.range || 0, |
| | | columns: _columns, |
| | | scripts: _verify.scripts || [], |
| | | uniques: _verify.uniques || [] |
| | | } |
| | | verify: _verify |
| | | }, () => { |
| | | this.resetUniqueColumns() |
| | | }) |
| | |
| | | if (!err) { |
| | | let _verify = {...verify, ...values} |
| | | |
| | | if (_verify.excelHandle !== 'true') { |
| | | delete _verify.excel_func |
| | | } |
| | | |
| | | let cols = _verify.columns.map(col => col.Column.toLowerCase()) |
| | | cols = Array.from(new Set(cols)) |
| | | |
| | |
| | | resolve(_verify) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请设置Excel表名!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({activeKey: 'basemsg'}) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | onOptionChange = (e, key) => { |
| | | onOptionChange = (e) => { |
| | | const { verify } = this.state |
| | | let value = e.target.value |
| | | |
| | | this.setState({ |
| | | verify: {...verify, default: value} |
| | | }) |
| | | } |
| | | |
| | | onHandleChange = (e) => { |
| | | const { verify } = this.state |
| | | let value = e.target.value |
| | | |
| | | this.setState({ |
| | | verify: {...verify, excelHandle: value} |
| | | }) |
| | | } |
| | | |
| | |
| | | <TabPane tab="基础验证" key="basemsg"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | {card.intertype === 'system' ? <Col span={8}> |
| | | <Form.Item label={'默认sql'}> |
| | | <Radio.Group value={verify.default} onChange={this.onOptionChange}> |
| | | <Radio value="true">执行</Radio> |
| | | <Radio value="false">不执行</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topRight" title="自定义验证Excel格式,可用参数为 XLSX、workbook、btn、callback。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 导入格式 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('excelHandle', { |
| | | initialValue: verify.excelHandle |
| | | })( |
| | | <Radio.Group onChange={this.onHandleChange}> |
| | | <Radio value="false">默认</Radio> |
| | | <Radio value="true">自定义</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> |
| | | {verify.excelHandle === 'true' ? <Col span={24} style={{paddingLeft: '30px'}}> |
| | | <Form.Item wrapperCol={ {xs: { span: 24 }, sm: { span: 24 }} } label=""> |
| | | {getFieldDecorator('excel_func', { |
| | | initialValue: verify.excel_func || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请填写自定义逻辑!' |
| | | } |
| | | ] |
| | | })(<CodeMirror mode="text/javascript" theme="cobalt" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {verify.excelHandle !== 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title="导入时工作表名与excel中必须一致,注:工作表名为Sheet1且excel中仅有一个工作表时不进行表名验证。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | </Col> : null} |
| | | {verify.excelHandle !== 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title="忽略首行时,会校验excel中表头名称与excel列设置是否一致。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | {getFieldDecorator('range', { |
| | | initialValue: verify.range || 0 |
| | | })(<InputNumber min={0} max={100} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | {card.intertype === 'system' ? <Col span={8}> |
| | | <Form.Item label={'默认sql'}> |
| | | <Radio.Group value={verify.default} onChange={this.onOptionChange}> |
| | | <Radio value="true">执行</Radio> |
| | | <Radio value="false">不执行</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Row> |
| | |
| | | </Col> : null} |
| | | {btnType !== 'print' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topRight" title="自定义生成Excel,可用参数为 XLSX、data、columns、callback。"> |
| | | <Tooltip placement="topRight" title="自定义生成Excel,可用参数为 XLSX、data、columns、searches、callback。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 导出格式 |
| | | </Tooltip> |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '') |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | |
| | | let custompage = /@pageSize@|@orderBy@/i.test(_dataresource + _customScript) |
| | | |
| | | // 正则替换 |
| | |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }, { |
| | | reg: /@datam@/ig, |
| | | value: `''` |
| | | }, { |
| | | reg: /@typename@/ig, |
| | | value: `'debug'` |
| | | }, { |
| | | reg: /@\$|\$@/ig, |
| | | value: '' |
| | | }) |
| | | |
| | | regoptions.forEach(item => { |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | _dataresource = _dataresource.replace(/@\$|\$@/ig, '') |
| | | _customScript = _customScript.replace(/@\$|\$@/ig, '') |
| | | _tailScript = _tailScript.replace(/@\$|\$@/ig, '') |
| | | // 正则替换 |
| | | let regoptions = [{ |
| | | reg: /@datam@/ig, |
| | | value: `''` |
| | | }, { |
| | | reg: /@typename@/ig, |
| | | value: `'debug'` |
| | | }, { |
| | | reg: /@\$|\$@/ig, |
| | | value: '' |
| | | }] |
| | | |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) |
| | | } |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | _customScript = _customScript.replace(item.reg, item.value) |
| | | _tailScript = _tailScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | let arr_field = columns.map(col => col.field) |
| | | arr_field = arr_field.join(',') |
| | |
| | | }) |
| | | |
| | | let sql = res.dataSource |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | |
| | | ${_option.sql}` |
| | | |
| | | // LoginUID|SessionUid|UserID|Appkey 已替换 |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && values.database === 'sso') { |
| | |
| | | sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${sql}` |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) |
| | | |
| | | resolve({values, loading: true, promise: () => new Promise((resolve, reject) => { |
| | | Api.sDebug(sql).then(result => { |
| | |
| | | |
| | | // 数据权限 |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') |
| | | sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@typename@/ig, `'debug'`) |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | |
| | | |
| | | // 数据权限 |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | this.setState({loading: true}) |
| | | Api.sDebug(sql).then(res => { |
| | |
| | | class CustomForm extends Component { |
| | | static propTpyes = { |
| | | type: PropTypes.any, |
| | | btn: PropTypes.object, // 按钮信息 |
| | | usefulfields: PropTypes.string, // 可用字段 |
| | | initsql: PropTypes.string, // sql前缀 |
| | | defaultsql: PropTypes.array, // 默认sql |
| | | systemScripts: PropTypes.array, // 系统脚本 |
| | | customScripts: PropTypes.array, // 自定义脚本 |
| | | scriptsChange: PropTypes.func // 表单 |
| | | btn: PropTypes.object, |
| | | usefulfields: PropTypes.string, |
| | | initsql: PropTypes.string, |
| | | defaultsql: PropTypes.string, |
| | | useDefaultSql: PropTypes.any, |
| | | systemScripts: PropTypes.array, |
| | | customScripts: PropTypes.array, |
| | | scriptsChange: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { type, workFlow, flowType } = this.props |
| | | const { type, workFlow, flowType, useDefaultSql, defaultsql } = this.props |
| | | const { editItem, skip } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | |
| | | } |
| | | } |
| | | |
| | | let sql = this.props.initsql + _initCustomScript + _prevCustomScript + _backCustomScript + tail |
| | | let sql = this.props.initsql + _initCustomScript + _prevCustomScript |
| | | |
| | | if (useDefaultSql) { |
| | | sql += `\n/* 默认sql */ |
| | | ${defaultsql} |
| | | ` |
| | | } |
| | | |
| | | sql += _backCustomScript + tail |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | |
| | | |
| | | // 数据权限 |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') |
| | | sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@datam@/ig, `''`) |
| | | sql = sql.replace(/@typename@/ig, `'debug'`) |
| | | |
| | | if (window.GLOB.process && workFlow === 'true') { |
| | | sql = sql.replace(/@works_flow_code@/ig, `'works_flow_code'`) |
| | |
| | | btn={this.props.card} |
| | | initsql={this.state.initsql} |
| | | customScripts={verify.scripts} |
| | | useDefaultSql={verify.default !== 'false'} |
| | | defaultsql={this.state.defaultsql} |
| | | usefulfields={this.state.usefulfields} |
| | | systemScripts={this.state.systemScripts} |
| | |
| | | workFlow={verify.workFlow} |
| | | flowType={verify.flowType} |
| | | customScripts={verify.scripts} |
| | | useDefaultSql={verify.default !== 'false'} |
| | | defaultsql={this.state.defaultsql} |
| | | usefulfields={this.state.usefulfields} |
| | | systemScripts={this.state.systemScripts} |
| | |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(item).then(res => { |
| | | if (!res.status) { |
| | | if (item.func === 'sPC_Get_structured_data' && /将截断字符串或二进制数据/ig.test(res.message)) { |
| | | res.message = res.message + '请检查字段集' |
| | | } |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | |
| | | table { |
| | | border-radius: 0!important; |
| | | .ant-table-column-sorter { |
| | | display: none!important; |
| | | opacity: 0!important; |
| | | } |
| | | } |
| | | .ant-table-thead > tr > th { |
| | |
| | | // import './index.scss' |
| | | |
| | | const Tabview = asyncComponent(() => import('@/components/tabview')) |
| | | const ImgScale = asyncComponent(() => import('@/components/imgScale')) |
| | | |
| | | class MkHS extends Component { |
| | | UNSAFE_componentWillMount() { |
| | |
| | | <Tabview key="tabview"/> |
| | | <Header key="header"/> |
| | | </ConfigProvider> |
| | | <ImgScale /> |
| | | </div> |
| | | ) |
| | | } |