king
2021-06-24 95afd40fc2741ac0ce59c2091f6cfce1f98877d4
src/views/pcdesign/index.jsx
@@ -8,7 +8,7 @@
import { ConfigProvider, notification, Modal, Collapse, Switch, Button, Icon, message, Spin } from 'antd'
import Api from '@/api'
import Utils from '@/utils/utils.js'
import Utils, { setGLOBFuncs } from '@/utils/utils.js'
import zhCN from '@/locales/zh-CN/mob.js'
import enUS from '@/locales/en-US/mob.js'
import antdEnUS from 'antd/es/locale/en_US'
@@ -25,6 +25,7 @@
const MenuForm = asyncComponent(() => import('./menuform'))
const MenuShell = asyncComponent(() => import('@/pc/menushell'))
const SourceWrap = asyncComponent(() => import('@/pc/modulesource'))
const CreateView = asyncComponent(() => import('@/pc/createview'))
const BgController = asyncComponent(() => import('@/pc/bgcontroller'))
const Quotecomponent = asyncComponent(() => import('@/pc/quotecomponent'))
const PasteController = asyncComponent(() => import('@/menu/pastecontroller'))
@@ -40,6 +41,7 @@
sessionStorage.setItem('isEditState', 'true')
sessionStorage.setItem('editMenuType', 'menu') // 编辑菜单类型
sessionStorage.setItem('appType', 'pc')        // 应用类型
sessionStorage.setItem('typename', 'pc')
document.body.className = ''
window.GLOB.UserComponentMap = new Map() // 缓存用户自定义组件
window.GLOB.CacheIndependent = new Map()
@@ -77,7 +79,6 @@
        sessionStorage.setItem('appId', param.ID || '')
        sessionStorage.setItem('lang', param.lang || 'zh-CN')
        sessionStorage.setItem('kei_no', param.kei_no || '')
        sessionStorage.setItem('link_type', param.link_type || 'true')
        sessionStorage.setItem('role_type', param.role_type || 'true')
        sessionStorage.setItem('login_types', param.login_types || 'true')
@@ -128,6 +129,7 @@
      this.updateCustomComponent()
      this.getAppPictures()
      this.getSmStemp()
      setGLOBFuncs()
    }, 1000)
  }
@@ -165,11 +167,8 @@
      type: 'view'
    }
    if (menu.fixed && menu.MenuNo && menu.MenuName) {
      param.fixed = true
      param.MenuNo = menu.MenuNo
      param.MenuName = menu.MenuName
    }
    param.MenuNo = menu.MenuNo || ''
    param.MenuName = menu.MenuName || ''
    param = window.btoa(window.encodeURIComponent(JSON.stringify(param)))
@@ -251,7 +250,9 @@
  }
  getSmStemp = () => {
    let _sql = `select ID,TemplateCode,SignName from bd_msn_sms_temp where deleted=0 and appkey='${window.GLOB.appkey}'`
    let _sql = `select ID,TemplateCode,SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a
      inner join (select openid from sapp where id='${window.GLOB.appkey}') b
      on a.openid=b.openid`
    _sql = Utils.formatOptions(_sql)
@@ -324,6 +325,7 @@
  updateCustomComponent = () => {
    Api.getSystemConfig({
      func: 's_get_custom_components',
      typename: 'pc',
      typecharone: ''
    }).then(res => {
      let coms = []
@@ -484,8 +486,8 @@
            MenuID: MenuId,
            Template: 'webPage',
            enabled: false,
            MenuName: '',
            MenuNo: '',
            MenuName: urlParam.MenuName || '',
            MenuNo: urlParam.MenuNo || '',
            tables: [],
            components: [],
            viewType: 'menu',
@@ -499,12 +501,6 @@
        config.MenuID = MenuId
        config.open_edition = result.open_edition || ''
        window.GLOB.urlFields = config.urlFields || []
        if (urlParam.fixed) {
          config.fixed = true
          config.MenuName = urlParam.MenuName
          config.MenuNo = urlParam.MenuNo
        }
        let indeComs = []
        config.components.forEach(item => {
@@ -620,6 +616,8 @@
      config.uuid = MenuId
      config.MenuID = MenuId
      config.open_edition = ''
      config.MenuName = urlParam.MenuName || ''
      config.MenuNo = urlParam.MenuNo || ''
      let indeComs = []
      config.components.forEach(item => {
@@ -919,7 +917,7 @@
                SndID: parMenuId,
                ParentID: parMenuId,
                MenuID: item.uuid,
                MenuNo: item.wrap.MenuNo || '',
                MenuNo: item.wrap.MenuNo || Utils.getuuid(),
                EasyCode: '',
                Template: item.type,
                TypeCharOne: sessionStorage.getItem('kei_no'),
@@ -1045,21 +1043,21 @@
            })
            if (appViewList.length > _length) {
              let param = {
              let kparam = {
                func: 's_kei_link_keyids_addupt',
                BID: sessionStorage.getItem('appId'),
                exec_type: 'y',
                LText: ''
              }
    
              param.LText = appViewList.map(item => `select '${item.keys_id}','${item.keys_type}','${item.kei_no}','${item.appkey}','${item.bid}','${sessionStorage.getItem('CloudUserID')}','${item.remark}'`)
              param.LText = param.LText.join(' union all ')
              param.LText = Utils.formatOptions(param.LText)
              kparam.LText = appViewList.map(item => `select '${item.keys_id}','${item.keys_type}','${item.kei_no}','${item.appkey}','${item.bid}','${sessionStorage.getItem('CloudUserID')}','${item.remark}'`)
              kparam.LText = kparam.LText.join(' union all ')
              kparam.LText = Utils.formatOptions(kparam.LText)
        
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
              param.secretkey = Utils.encrypt('', param.timestamp)
              kparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
              kparam.secretkey = Utils.encrypt('', kparam.timestamp)
    
              Api.getSystemConfig(param).then(result => {
              Api.getSystemConfig(kparam).then(result => {
                if (!result.status) {
                  notification.warning({
                    top: 92,
@@ -1330,14 +1328,14 @@
          check(item.components)
          return
        }
        if (['propcard', 'brafteditor', 'sandbox'].includes(item.subtype) && item.wrap.datatype === 'static') return
        if (['propcard', 'brafteditor', 'sandbox', 'stepform'].includes(item.subtype) && item.wrap.datatype === 'static') return
  
        if (item.setting) {
          if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) {
            error = `组件《${item.name}》未设置数据源!`
          } else if (item.setting.interType === 'system' && item.setting.execute === 'false' && item.scripts.length === 0) {
            error = `组件《${item.name}》未设置数据源!`
          } else if (item.setting.interType && !item.setting.primaryKey) {
          } else if (!item.setting.primaryKey) {
            error = `组件《${item.name}》未设置主键!`
          }
        }
@@ -1345,6 +1343,12 @@
          if (!item.plot.Xaxis) {
            error = `组件《${item.name}》图表字段尚未设置!`
          }
        } else if (item.type === 'dashboard' && !item.plot.valueField) {
          error = `组件《${item.name}》显示值尚未设置!`
        } else if (item.type === 'scatter' && (!item.plot.Xaxis || !item.plot.Yaxis || !item.plot.gender)) {
          error = `组件《${item.name}》坐标轴尚未设置!`
        } else if (item.type === 'tree' && (!item.wrap.valueField || !item.wrap.labelField || !item.wrap.parentField)) {
          error = `组件《${item.name}》基本信息尚未设置!`
        }
      })
    }
@@ -1391,11 +1395,6 @@
      })
      return
    }
    // Api.getSystemConfig({
    //   func: 'sPC_MainMenu_Del',
    //   MenuID: '1614740497468ku800sbg853vupf65v4'
    // })
    sessionStorage.removeItem('sysRoles')
    sessionStorage.removeItem('permFuncField')
@@ -1513,6 +1512,7 @@
              </div>
              <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
              <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} />
              <CreateView resetmenu={this.getAppMenus} />
              <PasteController type="menu" Tab={null} insert={this.insert} />
              <StyleCombControlButton menu={config} />
              <SysInterface config={config} updateConfig={this.updateConfig}/>
@@ -1520,7 +1520,7 @@
              <Quotecomponent config={config} updateConfig={this.updateConfig}/>
              <Button className="mk-border-green" icon="home" onClick={this.setHomeView}>设为首页</Button>
              <Button className="mk-border-danger" icon="redo" onClick={this.refreshView}>强制刷新</Button>
              <Button type="default" onClick={this.closeView}>{dict['mob.return']}</Button>
              <Button type="default" onClick={this.closeView}>关闭</Button>
            </div>
            <div className={'menu-body ' + (menuloading ? 'saving' : '')}>
              {config && config.components ? <MenuShell menu={config} handleList={this.updateConfig} /> : null}