| | |
| | | loadmaindata = (params) => { |
| | | const { config } = this.props |
| | | let LText_field = [] |
| | | let diffUser = false |
| | | let LText = params.map((item, index) => { |
| | | let _sql = item.sql |
| | | let _script = item.script |
| | | |
| | | if (index === 0) { |
| | |
| | | ${_script} |
| | | ` |
| | | } |
| | | if (!diffUser && (/@userid@/ig.test(item.sql) || /@userid@/ig.test(_script))) { |
| | | diffUser = true |
| | | } |
| | | |
| | | item.columns.forEach(cell => { |
| | | LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`) |
| | | }) |
| | | return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(_sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort` |
| | | return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(item.sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort` |
| | | }) |
| | | |
| | | let param = { |
| | |
| | | if (config.cacheUseful === 'true') { |
| | | param.time_type = config.timeUnit |
| | | param.time_limit = config.cacheTime |
| | | if (config.diffUser) { |
| | | if (diffUser) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | | } |
| | | param.data_md5 = md5(JSON.stringify(param)) |