king
2024-09-09 55a89127d14a20a96720d9050295743f2090f046
src/tabviews/custom/index.jsx
@@ -3,6 +3,7 @@
import { is, fromJS } from 'immutable'
import { notification, Spin, Row, Col, Modal } from 'antd'
import moment from 'moment'
import md5 from 'md5'
import Api from '@/api'
import Utils from '@/utils/utils.js'
@@ -219,6 +220,21 @@
      window.GLOB.CacheData.set(MenuID, urlparam)
      if (window.backend && config.allSqls) {
        let keys = Object.keys(urlparam)
        config.allSqls.forEach(item => {
          item.id = md5(window.GLOB.appkey + item.v_id)
          if (item.type === 'datasource' || item.type === 'excelOut') {
            item.urlkeys = keys
            item.urlparam = urlparam
            if (config.flow_code) {
              item.works_flow_code = config.flow_code
            }
          }
          window.GLOB.CacheData.set('sql_' + item.uuid, item)
        })
      }
      let userName = sessionStorage.getItem('User_Name') || ''
      let fullName = sessionStorage.getItem('Full_Name') || ''
@@ -285,7 +301,7 @@
        }
      })
      config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap)
      config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap, BID)
      if (initInters.length > 0) {
        this.stepInter = {
@@ -680,6 +696,7 @@
        if (item.hasExtend) {
          item.setting.hasExtend = true
          item.setting.sync = 'false'
          item.setting.tableMode = 'compatible'
          item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss')
          item.colsCtrls = null
@@ -698,6 +715,9 @@
          }
        }
      } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
        if (item.wrap.datatype === 'public') {
          balMap.set(item.wrap.publicId + 'public', true)
        }
        item.subcards && item.subcards.forEach(card => {
          if (card.style.boxShadow) {
            delete card.style.hShadow
@@ -908,7 +928,7 @@
          if (item.setting.sync === 'true') {
            // pageable 是否分页,组件属性,不分页的组件才可以统一查询
            if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true') {
            if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true' && !_tailScript) {
            } else {
              item.setting.sync = 'false'
@@ -1126,18 +1146,18 @@
  }
  // 格式化默认设置
  formatSetting = (components, params, inherit, interfaces, balMap, tbMap) => {
  formatSetting = (components, params, inherit, interfaces, balMap, tbMap, BID) => {
    let delay = 20
    return components.map(component => {
      if (component.type === 'tabs') {
        component.subtabs = component.subtabs.map(tab => {
          tab.components = this.formatSetting(tab.components, null, inherit, interfaces, balMap, tbMap)
          tab.components = this.formatSetting(tab.components, null, inherit, interfaces, balMap, tbMap, BID)
          tab = {...tab, ...inherit}
          return tab
        })
        return component
      } else if (component.type === 'group') {
        component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap)
        component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap, BID)
        return component
      }
@@ -1212,6 +1232,8 @@
      if (component.setting.interType !== 'system') return component
      component.setting.uuid = component.uuid
      // dataName 系统生成的数据源名称
      if (component.setting.sync === 'true') {
        component.dataName = 'mk' + component.uuid.slice(-18)
@@ -1233,7 +1255,17 @@
            component.setting.sync = 'false'
            component.setting.onload = 'false'
          } else {
            params.push(getStructDefaultParam(component, searchlist, params.length === 0))
            let backend = false
            if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + component.uuid)) {
              backend = true
            } else if (window.backend && params[0] && params[0].exps) {
              backend = true
            }
            if (backend && !window.GLOB.CacheData.has('sql_' + component.uuid)) {
              component.setting.sync = 'false'
            } else {
              params.push(getStructDefaultParam(component, searchlist, params.length === 0, BID))
            }
          }
        }
      }
@@ -1287,6 +1319,8 @@
      inter.setting.arr_field = inter.columns.map(col => col.field).join(',')
      if (inter.setting.interType !== 'system') return inter
      inter.setting.uuid = inter.uuid
      let _customScript = ''
      let _tailScript = ''
@@ -1349,7 +1383,7 @@
    this.setState({loading: true, loadingview: false})
    if (config.$cache && config.$time) {
      Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => {
      Api.getLCacheConfig(params[0].uuid || params[0].id, config.$time, BID).then(res => {
        if (!res.valid) {
          this.getMainData(param, params, config.MenuID)
        } else {
@@ -1385,11 +1419,11 @@
        }
        params.forEach((item) => {
          let _data = result[item.name] || ''
          let _data = result[item.dataName] || ''
          if (_data && !Array.isArray(_data)) {
            _data = [_data]
          }
          window.GLOB.SyncData.set(item.name, _data)
          window.GLOB.SyncData.set(item.dataName, _data)
        })
        MKEmitter.emit('transferSyncData', MenuID)