Browse Source

底层逻辑升级

zhangqiOMG 2 years ago
parent
commit
53491bdd8e

+ 59 - 6
src/components/layout/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <a-layout class="sw-layout">
+  <a-layout class="sw-layout" v-if="isRefresh">
     <!-- <web-socket></web-socket> -->
     <head-temp></head-temp>
     <div class="flex">
@@ -7,7 +7,7 @@
       <menu-temp></menu-temp>
       <a-layout-content class="content-height">
         <history-tabs></history-tabs>
-        <div :style="{ padding: '0px 10px 0 10px', minHeight: 'calc(100vh - 130px)'}">
+        <div :style="{ padding: '10px', minHeight: 'calc(100vh - 130px)'}">
           <router-view v-slot="{ Component }">
             <transition  mode="out-in">
               <keep-alive>
@@ -25,6 +25,12 @@
       Copyright © 2023 嘉兴市云链信息技术有限公司
     </a-layout-footer> -->
   </a-layout>
+  <div class="flex-loading" v-else>
+    <div style="text-align:center">
+      <div class="loading"></div>
+      <p style="margin-top:40px;color:rgb(100, 108, 255)">站点切换中,正在加载站点配置...</p>
+    </div>
+  </div>
 </template>
 <script setup>
 import headTemp from './modules/header.vue';
@@ -32,13 +38,13 @@ import asideTemp from './modules/systemMod.vue'
 import menuTemp from './modules/menu.vue'
 import historyTabs from './modules/historyTabs.vue'
 import webSocket from '../webSocket/index.vue'
+import { storeToRefs } from 'pinia'
+import { useAuthStore } from '@/stores/modules/auth'
 import { useRouter } from "vue-router";
 const router = useRouter()
+const store = useAuthStore()
 
-// watch(() => router.currentRoute.value,(to, from) => {
-//   rotTabs.saveRoute(to)
-//   store.appData(to.name)
-// })
+let { isRefresh } = storeToRefs(store)
 </script>
 <style>
 .site-layout-content {
@@ -81,4 +87,51 @@ const router = useRouter()
   transform: scale(0.9);
 }
 
+.flex-loading{
+  height: 100vh;
+  width: 100vw;
+  display: flex;
+  align-items: center;
+  justify-content: space-around;
+  background-image: url(@/assets/bg.png);
+  background-size: cover;
+}
+.loading {
+  position: relative;
+  width: 205px;
+  perspective: 200px;
+  text-align: center;
+}
+
+.loading:before,
+.loading:after {
+  position: absolute;
+  width: 20px;
+  height: 20px;
+  content: "";
+  animation: jumping 0.5s infinite alternate;
+  background: rgba(0, 0, 0, 0);
+}
+
+.loading:before {
+  left: 55%;
+}
+
+.loading:after {
+  right: 55%;
+  animation-delay: 0.15s;
+}
+
+@keyframes jumping {
+  0% {
+    transform: scale(1) translateY(0px) rotateX(0deg);
+    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
+  }
+
+  100% {
+    transform: scale(1.2) translateY(-25px) rotateX(45deg);
+    background: rgb(100, 108, 255);
+    box-shadow: 0 25px 40px #000;
+  }
+}
 </style>

+ 13 - 7
src/components/layout/modules/header.vue

@@ -54,11 +54,10 @@ let { accountList,nowAccount } = storeToRefs(store)
 const rotTabs = useRouteTabsStore()
 let {historyRoutes} = storeToRefs(rotTabs)
 const accountItemClick = (account,bool)=>{
-  store.defaultAccount(account)
-  /*if (router.currentRoute.value.meta.isDetail) {
-    console.log("执行了")
-    router.go(-1)
-  }*/
+  store.defaultAccount(account,()=>{
+    store.reloadPage()
+    historyRoutes.value = []
+  })
   if (!bool){
     if (router.currentRoute.value.meta.isDetail) {
       router.go(-1)
@@ -66,9 +65,16 @@ const accountItemClick = (account,bool)=>{
   }else {
     router.go(0)
   }
-
-  /* return router.go(0)*/
 }
+// const accountItemClick = (account,bool)=>{
+//   if (router.currentRoute.value.meta.isDetail) {
+//     router.go(-1)
+//   }
+//   store.defaultAccount(account,()=>{
+//     store.reloadPage()
+//     historyRoutes.value = []
+//   })
+// }
 const loginOut = ()=>{
   Modal.confirm({
     title: '注意',

+ 27 - 69
src/components/listTemplate/index.vue

@@ -37,7 +37,7 @@
       </template>
       <a-table class="ant-table-small ant-table-red" :loading="loading" size="small" :dataSource="dataSource" :columns="columns" :pagination="{showSizeChanger:true,defaultPageSize:20,total:total}" :scroll="fullscreen?{x:'max-content',y:'86vh'}:{x:'max-content'}" :row-class-name="(_record, index) => formatter(_record, index)" @change="onChange" bordered>
         <template #headerCell="{ column }">
-          <div style="width:100%;" v-if="column.filter == 1 || column.filter == 2">
+          <div style="width:100%;min-width:70px" v-if="column.filter == 1 || column.filter == 2">
             <a-input v-model:value="column.value" :placeholder="column.title" @change="setSearchParam(column.dataIndex,column.value)" @pressEnter="tableData" :bordered="true">
               <template v-if="column.sortable == 1" #suffix>
                 <sort-ascending-outlined v-if="column.sort == 0" @click="setSort(column,1)"/>
@@ -52,7 +52,7 @@
               <sort-descending-outlined v-else @click="setSort(column,0)"/>
             </span>
           </div>
-
+          
         </template>
         <template #bodyCell="{ column, record }">
           <template v-if="column.dataIndex === 'status'">
@@ -72,24 +72,24 @@
   import field from './field/index.vue'
   import Api  from '@/api/api'
   import utils from '@/utils/utils'
-  /*import settingColumns from '@/components/tableConfiguration/settingColumns.vue'
-  import fullScreen from '@/components/tableConfiguration/fullScreen.vue'*/
-  import {ref,getCurrentInstance,onMounted,defineExpose,watch, computed,onActivated} from 'vue'
+  import settingColumns from '@/components/tableConfiguration/settingColumns.vue'
+  import fullScreen from '@/components/tableConfiguration/fullScreen.vue'
+  import {ref,getCurrentInstance,onMounted,defineExpose,watch, computed,onActivated,onDeactivated} from 'vue'
   import { SortAscendingOutlined,SortDescendingOutlined,DownOutlined,SyncOutlined,SettingOutlined  } from '@ant-design/icons-vue';
   import { storeToRefs } from 'pinia'
-  import { useRouter,onBeforeRouteLeave } from "vue-router";
+  import { useRouter } from "vue-router";
   import { useAuthStore } from '@/stores/modules/auth'
   import { useColumnsStore } from '@/stores/modules/columns'
   import { useBaseStore } from '@/stores/modules/base'
+  import { useRouteTabsStore } from '@/stores/modules/Htabs'
   const store = useAuthStore()
   const colStore = useColumnsStore()
   const base = useBaseStore()
+  const routeTabs = useRouteTabsStore()
   let { app } = storeToRefs(store)
-  let { PageUpParam,nowPageData,keyid,pageTotal,fullscreen } = storeToRefs(base)
+  let { fullscreen } = storeToRefs(base)
   let { selectedColumns } = storeToRefs(colStore)
-
-  let emit = defineEmits(['emitRes'])
-
+  let { historyRoutes } = storeToRefs(routeTabs)
   const router = useRouter()
   const props = defineProps({
     param: Object,
@@ -106,7 +106,7 @@
   const total = ref(0)
 
   const formatter = (_record, index) => {
-    if (props.tableRowStyle)
+    if (props.tableRowStyle) 
       return props.tableRowStyle(_record, index)
     if (index % 2 === 1) {
       return 'table-striped'
@@ -124,37 +124,23 @@
      * 开启列过滤时需要传tableid,因此在获取表格数据的时候把table赋值到请求参数中
      */
     props.param.content.tableid = app.value.meta.tables[props.tableName].tableid
-
-    let param = {
-      tableName:props.tableName,
-      app:app.value,
-      fn:()=>{
-        columns.value = utils.TBLayout(props.tableName)
-      }
-    }
-    colStore.setConfig(param)
+    columns.value = colStore.loadTableConfig(props.tableName)
   }
   const sort = ref([])
   const tableData = async ()=>{
     loading.value = true
     const res = await Api.requested(props.param)
-    emit('emitRes',res)
     dataSource.value = res.data
     total.value = res.total
     sort.value = res.sort
-    loading.value = false
-    // 设置翻页数据
-    if (props.detailPage) {
-      PageUpParam.value = props.param
-      nowPageData.value = dataSource.value
-      keyid.value = props.detailPage.idname
-      pageTotal.value = res.pageTotal
-    }
+    setTimeout(() => {
+      loading.value = false
+    }, 1000);
   }
 
   const toDetailPage = (record)=>{
     // 跳转到详情
-    router.push({name:props.detailPage.name,query:{id:record[props.detailPage.idname]}})
+    router.push({name:props.detailPage.name,query:{id:record[props.detailPage.idname],rowindex:record.rowindex}})
   }
   const search = (val)=>{
     props.param.content.where = Object.assign({},props.param.content.where,val)
@@ -168,33 +154,10 @@
     props.param.content.sort = [nowSort.value]
     tableData()
   }
-  const cache = ref([])
   const setSearchParam = (dataIndex,value)=>{
     props.param.content.pageNumber = 1
     props.param.content.where.tablefilter = props.param.content.where.tablefilter ? props.param.content.where.tablefilter : {}
     props.param.content.where.tablefilter[dataIndex] = value
-
-    //缓存搜索数据
-    let rs = cache.value.some(item=>item.dataIndex == dataIndex)
-    if (rs) {
-      cache.value.forEach(e=>{
-        if (e.dataIndex == dataIndex) {
-          e.value = value
-        }
-      })
-    } else {
-      cache.value.push({
-        dataIndex:dataIndex,
-        value:value
-      })
-    }
-
-    let param = {
-      tableName:props.tableName,
-      app:app.value,
-      cache:cache.value
-    }
-    colStore.cacheInputParam(param)
   }
   const setSort = (column,sort)=>{
     props.param.content.simplesort = {}
@@ -205,27 +168,23 @@
       }
     })
     tableData()
-
+    
   }
+  watch (() => selectedColumns.value,(n, o) => {
+    colStore.loadTableConfig(props.tableName)?columns.value = colStore.loadTableConfig(props.tableName):''
+  })
   defineExpose({
     tableData
   })
-  /**
-   * 开启缓存后需要拉取新数据
-   */
-  onActivated(()=>{
-    getTableLayout()
-  })
   onMounted (()=>{
     getTableLayout()
     props.noAutoQuery ? '' : tableData()
   })
-  watch (() => selectedColumns.value,(n, o) => {
-    columns.value = colStore.getCacheInputParam({
-      tableName:props.tableName,
-      app:app.value,
-      columns:selectedColumns.value
-    })
+  onActivated (()=>{
+    // getTableLayout()
+    props.noAutoQuery ? '' : tableData()
+  })
+  onDeactivated (()=>{
   })
 </script>
 <style scoped>
@@ -234,11 +193,10 @@
 }
 .ant-table-small :deep td{
   font-size: 12px;
-  min-width: 150px;
 }
 .ant-table-small :deep(.table-striped) td {
   background-color: #f8f9fd;
-
+  
 }
 .ant-table-small :deep(.table-striped-red) td {
   color: #d9363e;
@@ -261,4 +219,4 @@
   align-items: center;
   justify-content: space-between;
 }
-</style>
+</style>

+ 62 - 0
src/components/tableConfiguration/fullScreen.vue

@@ -0,0 +1,62 @@
+<template>
+  <div>
+     <fullscreen-outlined v-if="!fullscreen" @click="enterFullscreen"/>
+     <fullscreen-exit-outlined v-else @click="exitFullscreen"/>
+  </div>
+</template>
+
+<script setup>
+  import { FullscreenOutlined,FullscreenExitOutlined  } from '@ant-design/icons-vue';
+  import {ref,defineProps,onMounted,watch} from 'vue'
+  import { storeToRefs } from 'pinia'
+  import { useBaseStore } from '@/stores/modules/base'
+  const base = useBaseStore()
+  let { fullscreen } = storeToRefs(base)
+  const props = defineProps(['domId'])
+  const enterFullscreen = () => {
+     /* 获取(<html>)元素以全屏显示页面 */
+    const full = document.getElementById(props.domId)
+    if (full.RequestFullScreen) {
+        full.RequestFullScreen()
+        //兼容Firefox
+    } else if (full.mozRequestFullScreen) {
+        full.mozRequestFullScreen()
+        //兼容Chrome, Safari and Opera等
+    } else if (full.webkitRequestFullScreen) {
+        full.webkitRequestFullScreen()
+        //兼容IE/Edge
+    } else if (full.msRequestFullscreen) {
+        full.msRequestFullscreen()
+    }
+  }
+  const exitFullscreen = ()=>{
+    if (document.exitFullscreen) {
+        document.exitFullscreen();
+    } else if (document.webkitCancelFullScreen) {
+        document.webkitCancelFullScreen();
+    } else if (document.mozCancelFullScreen) {
+        document.mozCancelFullScreen();
+    } else if (document.msExitFullscreen) {
+        document.msExitFullscreen();
+    }
+  }
+  const handleFullscreenChange = ()=> {
+    if (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) {
+      // 全屏模式激活
+      console.log('全屏模式已激活');
+      fullscreen.value = true
+    } else {
+      // 全屏模式退出
+      fullscreen.value = false
+      console.log('全屏模式已退出');
+    }
+  }
+  onMounted(()=>{
+    document.addEventListener('fullscreenchange', handleFullscreenChange);
+    document.addEventListener('mozfullscreenchange', handleFullscreenChange);
+    document.addEventListener('webkitfullscreenchange', handleFullscreenChange);
+    document.addEventListener('MSFullscreenChange',handleFullscreenChange)
+  })
+</script>
+<style>
+</style>

+ 108 - 0
src/components/tableConfiguration/settingColumns.vue

@@ -0,0 +1,108 @@
+<template>
+  <div>
+    <a-popover trigger="click" placement="left" :getPopupContainer="triggerNode => {return triggerNode.parentNode || document.body;}">
+      <template #title>
+        <div class="title-panel">
+          <span>筛选列</span>
+          <a-button class="fl-r" type="link" @click="reloadConfig">重置</a-button>
+        </div>
+      </template>
+      <template #content>
+        <div style="width:150px">
+          <a-checkbox-group v-model:value="checkedColumns" name="checkboxgroup" @change="onChange">
+            <a-row>
+              <a-col class="mt-10" v-for="(box,index) in columnsData" :key="box.index" :span="24" :draggable="true" @dragstart="dragStart(index)" @dragover="dragOver(index)" @drop="drop(index)" @dragend="dragEnd">
+                <div class="flex">
+                  <a-checkbox :value="box.value">{{box.label}}</a-checkbox>
+                  <drag-outlined />
+                </div>
+              </a-col>
+            </a-row>
+          </a-checkbox-group>
+        </div>
+      </template>
+      <setting-outlined />
+    </a-popover>
+    
+  </div>
+</template>
+
+<script setup>
+  import { SettingOutlined,DragOutlined  } from '@ant-design/icons-vue';
+  import {defineProps,ref,computed,defineEmits,defineExpose,onMounted,onActivated, nextTick} from 'vue'
+  import utils from '@/utils/utils'
+  import { storeToRefs } from 'pinia'
+  import { useColumnsStore } from '@/stores/modules/columns'
+  import { useAuthStore } from '@/stores/modules/auth'
+  const colStore = useColumnsStore()
+  const store = useAuthStore()
+  let { app } = storeToRefs(store)
+  let { checkedColumns,columnsIndex } = storeToRefs(colStore)
+  const props = defineProps(['tableName','columns'])
+  const emit = defineEmits(['change'])
+  const columnsData = ref([]) // checkboxGroup数据
+  const reloadConfig = ()=>{
+    columnsIndex.value = checkedColumns.value = utils.TBLayout(props.tableName).map(e=>e.dataIndex)
+    colStore.userSetting(props.tableName)
+  }
+  /**
+   * 根据选中的数据过滤出表格列数据集
+   * @param {Array} selectedColumns 当前选中的表格列
+   */
+  const onChange = (val)=>{
+    colStore.userSetting(props.tableName)
+  }
+  const draggedIndex = ref(0)
+  const dragStart = (index)=> {
+    draggedIndex.value = index;
+  }
+  const dragOver = (index)=> {
+    event.preventDefault();
+    const movedIndex = draggedIndex.value;
+    if (movedIndex !== index) {
+      const list = [...columnsData.value];
+      const movedItem = list[movedIndex];
+      list.splice(movedIndex, 1);
+      list.splice(index, 0, movedItem);
+      columnsData.value = list;
+      draggedIndex.value = index;
+      columnsIndex.value = columnsData.value.map(e=>e.value)
+    }
+  }
+  const drop = (index)=> {
+    event.preventDefault();
+  }
+  const dragEnd = ()=> {
+    colStore.userSetting(props.tableName)
+    draggedIndex.value = null;
+    
+  }
+  const initData = () => {
+    columnsData.value = colStore.getUserSetting(props.tableName)
+  }
+  onMounted(()=>{
+  //  initData()
+  })
+  onActivated (()=>{
+    initData()
+  })
+  defineExpose({
+  })
+</script>
+<style scoped>
+.flex{
+  padding: 2px 5px;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+.title-panel{
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  overflow: hidden;
+}
+.fl-r{
+  float: right;
+}
+</style>

+ 56 - 12
src/stores/modules/auth.js

@@ -6,12 +6,16 @@ import Api from '@/api/api'
 export const useAuthStore = defineStore('auth', {
   state: () => {
     return {
+      isRefresh:true,
       accountList:[],
       nowAccount:{},
       system: [],
+      actSystem:'',
       mods:[],
       app:{},
       actMod:{},
+      current:[],
+      tableConfigs:{},
       hiddenSensitiveFields:false
     }
   },
@@ -21,7 +25,7 @@ export const useAuthStore = defineStore('auth', {
     strategies: [
       {
         storage: localStorage,
-        paths: ['system', 'mods','app','act_mods','accountList','nowAccount']
+        paths: ['system', 'mods','app','accountList','nowAccount','actSystem','current','tableConfigs']
       }
     ]
   },
@@ -80,26 +84,66 @@ export const useAuthStore = defineStore('auth', {
     },
     // 获取应用数据
     appData (appName) {
-      
-      const findApp = (array, name) => {
-        for (const item of array) {
-          for (const module of item.modules) {
-            const match = module.apps.find(app => app.name === name)
-            if (match) {
-              return match
+      function findAppByName(systems, targetName) {
+        let foundApp = null;
+        function search(systems) {
+          for (let i = 0; i < systems.length; i++) {
+            const system = systems[i];
+            if (system.modules && system.modules.length > 0) {
+              search(system.modules); // 递归调用搜索函数
+            }
+            if (system.apps) {
+              const app = system.apps.find((app) => app.name === targetName);
+              if (app) {
+                foundApp = app;
+                break; // 找到目标 app 后停止搜索
+              }
             }
           }
         }
+        search(systems);
+        return foundApp;
+      }
+      this.app = findAppByName(this.system,appName)
+    },
+
+    async getConfig () {
+      const res = await Api.requested({
+        "classname": "sysmanage.develop.users.users",
+        "method": "queryClientConfig",
+        "content": {
+        }
+      })
+      if (res.data.config) {
+        this.tableConfigs = JSON.parse(res.data.config)
+      } else {
+        this.tableConfigs = {}
       }
-      this.app = findApp(this.system,appName)
     },
-    // 设置默认账号
-    defaultAccount (account) {
+    /**
+     * 设置默认账号
+     */
+    defaultAccount (account,fn) {
+
       this.nowAccount = account
+
       sessionStorage.setItem('token',account.token)
+
+      this.getConfig()
+
       this.systemAuthData()
-    },
 
+      fn()
+    },
+    /**
+     * 切换站点以后刷新数据
+     */
+    reloadPage () {
+      this.isRefresh = false
+      setTimeout(() => {
+        this.isRefresh = true
+      }, 1000);
+    }
   }
     
 })

+ 84 - 96
src/stores/modules/columns.js

@@ -1,5 +1,9 @@
 import { defineStore } from 'pinia'
 import utils from '@/utils/utils'
+import { storeToRefs } from 'pinia'
+import { useAuthStore } from "@/stores/modules/auth";
+const store = useAuthStore()
+let { tableConfigs,app } = storeToRefs(store)
 
 import Api from '@/api/api'
 
@@ -9,10 +13,9 @@ export const useColumnsStore = defineStore('columnStore', {
   state: () => {
     return {
       colIndex:[],
-      tableConfigs:{},
       checkedColumns:[],
       columnsIndex:[],
-      selectedColumns:[],
+      selectedColumns:0,
       cacheData:{},
       time:null
     }
@@ -29,45 +32,91 @@ export const useColumnsStore = defineStore('columnStore', {
   },
   getters:{},
   actions:{
+
     /**
-     * 获取配置数据
-     * @param columnsIndex 列索配置
-     * @param checkedColumns 选择配置
-     * @param tableName 表名称
-     * @param app 应用名称
+     * 用户修改后的配置
      */
-    configToJson ({columnsIndex,checkedColumns,tableName,app}) {
-      this.tableConfigs[`${app.systemappid}${tableName}`] = {
-        index:columnsIndex,
-        selected:checkedColumns
-      }
-      this.setColnums({columnsIndex,checkedColumns,tableName,app})
-      if (this.time !== null) {
-        clearTimeout(this.time)
-      }
-      this.time = setTimeout(() => {
-        this.saveConfig(JSON.stringify(this.tableConfigs))
-      }, 2000);
-
-      sessionStorage.setItem('customConfig',JSON.stringify(this.tableConfigs))
+    userSetting (tableName) {
+      // 设置时间戳,监听列表发生改动
+      this.selectedColumns = new Date()
+      
+      // 配置项
+      tableConfigs.value[`${app.value.systemappid}${tableName}`] = {}
+      tableConfigs.value[`${app.value.systemappid}${tableName}`].columnsIndex = this.columnsIndex
+      tableConfigs.value[`${app.value.systemappid}${tableName}`].checkedColumns = this.checkedColumns
+      this.saveConfig(tableConfigs.value)
     },
     /**
-     * 根据获取到的排序重新排列表格列
-     * @param a 目标数组
-     * @param b 索引数组
+     * 获取应用配置
      */
-    sortTableColnums (ky,columnsData) {
-      let customConfig = sessionStorage.getItem('customConfig')
-      if (customConfig && customConfig[ky]) {
-        customConfig = JSON.parse(customConfig)
-        let a = columnsData
-        let b = []
-        b = customConfig[ky].index
-        const sortedA = b.map((key) => a.find((item) => item.value === key));
-        return sortedA
+    getUserSetting (tableName) {
+      let a = []
+      let b = new Map()
+      let tableColData = utils.TBLayout(tableName)
+      let config = tableConfigs.value[`${app.value.systemappid}${tableName}`]
+      if (config && tableColData.length == config.columnsIndex.length) {
+        let tableColData = utils.TBLayout(tableName).map(e=>{
+          return {
+            value:e.dataIndex,
+            label:e.title
+          }
+        })
+        
+        tableColData.forEach(e=>{
+          b.set(e.value,e.label)
+        })
+
+        //设置选中数据
+        this.checkedColumns = config.checkedColumns
+        config.columnsIndex = this.columnsIndex =  config.columnsIndex.length == 0 ? utils.TBLayout(tableName).map(e=>e.dataIndex) : config.columnsIndex
+        // 设置配置项数据
+        config.columnsIndex.forEach(e=>{
+          a.push({
+            value:e,
+            label:b.get(e)
+          })
+        })
+        return a
       } else {
-        return 'none'
+        //设置选中数据
+        this.checkedColumns = this.columnsIndex = utils.TBLayout(tableName).map(e=>e.dataIndex)
+        a = utils.TBLayout(tableName).map(e=>{
+          return {
+            value:e.dataIndex,
+            label:e.title
+          }
+        })
+        // this.userSetting(tableName)
+        return a
       }
+    },
+    /**表格加载配置项 */
+    loadTableConfig(tableName) {
+      let tableColData = utils.TBLayout(tableName)
+      let config = tableConfigs.value[`${app.value.systemappid}${tableName}`]
+      let a = []
+      let b = new Map()
+      try {
+        if (config && tableColData.length == config.columnsIndex.length) {
+          tableColData.forEach(e=>{
+            b.set(e.dataIndex,e)
+          })
+          config.columnsIndex.forEach(e=>{
+            a.push(b.get(e))
+          })
+          a = a.filter(e=>{
+            if(config.checkedColumns.some(item => item === e.dataIndex)) {
+              return e
+            }
+          })
+          return a
+        } else {
+          return tableColData
+        }
+      } catch (error) {
+      }
+      
+      
     },
      /**
      * 处理系统系统配置项
@@ -77,71 +126,10 @@ export const useColumnsStore = defineStore('columnStore', {
         "classname": "sysmanage.develop.users.users",
         "method": "updateClientConfig",
         "content": {
-          "config": config
+          "config": JSON.stringify(config)
         }
       })
     },
-    /**
-     * 获取系统配置
-     */
-    async setConfig ({tableName,app,fn}) {
-      let parsedData = sessionStorage.getItem('customConfig')
-      if (parsedData) {
-        this.tableConfigs = JSON.parse(parsedData)
-        if (this.tableConfigs[`${app.systemappid}${tableName}`]) {
-          this.columnsIndex =  this.tableConfigs[`${app.systemappid}${tableName}`].index
-          let a = utils.TBLayout(tableName)
-          let b = this.tableConfigs[`${app.systemappid}${tableName}`].selected
-          b = this.columnsIndex.filter(e=>b.includes(e))
-          this.selectedColumns = b.map((key) => a.find((obj) => obj.dataIndex === key));
-        } else {
-          console.log('未查询到设置项')
-          this.columnsIndex = utils.TBLayout(tableName).map(e=>e.dataIndex)
-          fn()
-        }
-      } else {
-        console.log('未查询到设置项')
-        this.columnsIndex = utils.TBLayout(tableName).map(e=>e.dataIndex)
-        fn()
-      }
-      
-    },
-    /**
-     * 设置配置的列数据
-     */
-
-    setColnums (param) {
-      let a = utils.TBLayout(param.tableName)
-      let b = param.checkedColumns ? param.checkedColumns : a.map(e=>e.dataIndex)
-      b = this.columnsIndex.filter(e=>b.includes(e))
-      this.selectedColumns = b.map((key) => a.find((obj) => obj.dataIndex === key));
-    },
-
-    /**
-     * 由于每次缓存都会刷新列配置所以需要手动缓存列搜索信息
-     */
-    cacheInputParam ({tableName,app,cache}) {
-      this.cacheData[`${app.systemappid}${tableName}`] = cache
-    },
-
-    /**
-     * 获取缓存数据
-     */
-    getCacheInputParam ({tableName,app,columns}) {
-      if (this.cacheData[`${app.systemappid}${tableName}`]) {
-        this.cacheData[`${app.systemappid}${tableName}`].forEach(e => {
-          columns.forEach(c => {
-            if (c.dataIndex == e.dataIndex) {
-              c.value = e.value
-            }
-          })
-        })
-        console.log(this.cacheData[`${app.systemappid}${tableName}`])
-        return columns
-      } else {
-        return columns
-      }
-    }
   }
     
 })

+ 3 - 2
src/views/login/login.vue

@@ -150,8 +150,9 @@ export default defineComponent({
           return message.error('当前账号已停用!')
         loading.value = false
         accountList.value = res.account_list
-        store.defaultAccount(res.account_list[0])
-        router.replace({path:'/home'})
+        store.defaultAccount(res.account_list[0],()=>{
+          router.replace({path:'/home'})
+        })
 
       } else {
         loading.value = false