king
2020-11-04 79e1455e4ba4f4a7d04a483dda1a354e53921a69
src/tabviews/custom/index.jsx
@@ -10,19 +10,19 @@
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import Utils from '@/utils/utils.js'
import asyncSpinComponent from '@/utils/asyncSpinComponent'
import asyncComponent from '@/utils/asyncComponent'
import { refreshTabView } from '@/store/action'
import NotFount from '@/components/404'
import './index.scss'
// 通用组件
const AntvBarAndLine = asyncSpinComponent(() => import('./components/chart/antv-bar-line'))
const AntvPie = asyncSpinComponent(() => import('./components/chart/antv-pie'))
const AntvTabs = asyncSpinComponent(() => import('./components/tabs/antv-tabs'))
const DataCard = asyncSpinComponent(() => import('./components/card/data-card'))
const PropCard = asyncSpinComponent(() => import('./components/card/prop-card'))
const MainSearch = asyncSpinComponent(() => import('./components/search/main-search'))
const AntvBarAndLine = asyncComponent(() => import('./components/chart/antv-bar-line'))
const AntvPie = asyncComponent(() => import('./components/chart/antv-pie'))
const AntvTabs = asyncComponent(() => import('./components/tabs/antv-tabs'))
const DataCard = asyncComponent(() => import('./components/card/data-card'))
const PropCard = asyncComponent(() => import('./components/card/prop-card'))
const MainSearch = asyncComponent(() => import('./components/search/main-search'))
class CustomPage extends Component {
  static propTpyes = {
@@ -66,6 +66,12 @@
      let config = ''
      let userConfig = null
      setTimeout(() => { // 延时加载状态
        this.setState({
          loadingview: false
        })
      }, 1500)
      try { // 配置信息解析
        config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
      } catch (e) {
@@ -86,7 +92,6 @@
      // 页面配置解析错误时提示
      if (!config) {
        this.setState({
          loadingview: false,
          viewlost: true
        })
        return
@@ -95,7 +100,6 @@
      // 页面未启用时,显示未启用页面
      if (!config.enabled) {
        this.setState({
          loadingview: false,
          viewlost: true,
          lostmsg: this.state.dict['main.view.unenabled']
        })
@@ -140,7 +144,6 @@
      this.setState({
        BID: param && param.BID ? param.BID : '',
        loadingview: false,
        userConfig: userConfig,
        setting: config.setting,
        config,
@@ -222,7 +225,7 @@
      if (component.floor === 1 && component.dataName && !component.pageable && component.setting.interType === 'system' && component.setting.onload === 'true' && component.setting.sync === 'true') {
        let param = this.getDefaultParam(component, mainSearch)
        params.push(param)
      } else {
      } else if (component.floor === 1) {
        component.setting.sync = 'false'
      }
@@ -307,22 +310,11 @@
      let _sql = item.sql
      let _script = item.script
      // if (index === 0) {
      //   _script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000) select @ErrorCode='',@retmsg =''
      //     ${_script}
      //   `
      // }
      // if (params.length === index + 1) {
      //   _sql = `${_sql}
      //     aaa:
      //       if @ErrorCode!=''
      //       begin
      //         insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
      //         goto bbb
      //       end
      //   `
      // }
      if (index === 0) {
        _script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000) select @ErrorCode='',@retmsg =''
          ${_script}
        `
      }
      item.columns.forEach(cell => {
        LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`)
@@ -335,7 +327,7 @@
      LText: LText.join(' union all '),
      LText_field: LText_field.join(' union all ')
    }
    param.LText = Utils.formatOptions(param.LText)
    param.LText_field = Utils.formatOptions(param.LText_field)
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')