Browse Source

currentUserInfo 使用store

noToken
安虹睿 1 year ago
parent
commit
1d51db071d
  1. 147
      PC/InterFace.Dash/src/api/wms-interface.js
  2. 2
      PC/InterFace.Dash/src/components/rowDrop/index.vue
  3. 6
      PC/InterFace.Dash/src/layout/components/Navbar.vue
  4. 2
      PC/InterFace.Dash/src/mixins/TableHeaderMixins.js
  5. 4
      PC/InterFace.Dash/src/mixins/mixins.js
  6. 77
      PC/InterFace.Dash/src/permission.js
  7. 3
      PC/InterFace.Dash/src/store/getters.js
  8. 48
      PC/InterFace.Dash/src/store/modules/user.js
  9. 2
      PC/InterFace.Dash/src/utils/defaultButtons.js
  10. 217
      PC/InterFace.Dash/src/views/basicConfig/ExportCustomUserSetting.vue
  11. 24
      PC/InterFace.Dash/src/views/login/index.vue
  12. 2
      PC/InterFace.Dash/src/views/menuList/ExportCustomUserSetting.vue

147
PC/InterFace.Dash/src/api/wms-interface.js

@ -2,14 +2,6 @@
import request from '@/utils/request' import request from '@/utils/request'
let base_api = localStorage.getItem('base') let base_api = localStorage.getItem('base')
let colum_url = localStorage.getItem('columnsApiNames') let colum_url = localStorage.getItem('columnsApiNames')
// 转义传参
const initParams = (data) => {
return {
skipCount:data.SkipCount,
maxResultCount:data.MaxResultCount,
sorting:data.Sorting
}
}
// 获取表头数据 // 获取表头数据
export function getInterfaceBoard() { export function getInterfaceBoard() {
@ -29,142 +21,3 @@ export function getDefinitionMenu(IncludeTypes) {
params:{IncludeLocalizationResources:true} params:{IncludeLocalizationResources:true}
}) })
} }
// 获取导出配置信息接口
// export function getExportConfigList(name) {
// return request({
// url: base_api + '/get-by-user-and-table-name',
// method: 'post',
// params:{
// userId:JSON.parse(localStorage.getItem("currentUserInfo")).id,
// exportTableName:name
// },
// })
// }
//外部数据转换
// export function dataExchangeFromOut(data) {
// return axios({
// method:'get',
// url: interfaceBoard_api + 'outgoing-to-external',
// params:initParams(data)
// })
// }
// //归档外部数据转换
// export function dataExchangeFromOut_file(data) {
// return axios({
// method:'get',
// url: interfaceBoard_api + 'archived-outgoing-to-external',
// params:initParams(data)
// })
// }
// //wms数据接收
// export function comingToWms(data) {
// return axios({
// method:'get',
// url: interfaceBoard_api + 'incoming-to-wms',
// params:initParams(data)
// })
// }
// //归档wms数据接收
// export function comingToWms_file(data) {
// return axios({
// method:'get',
// url: interfaceBoard_api + 'archived-incoming-to-wms',
// params:initParams(data)
// })
// }
// //wms数据转换
// export function dataExchangeFromWms(data) {
// return axios({
// method:'get',
// url: interfaceBoard_api + 'data-exchange_Outgoing-from-wms',
// params:initParams(data)
// })
// }
// // 归档wms数据转换
// export function dataExchangeFromWms_file(data) {
// return axios({
// method:'get',
// url: interfaceBoard_api + 'data-exchange_Archived-outgoing-from-wms',
// params:initParams(data)
// })
// }
// //外部数据接收
// export function comingFromOut(data) {
// return axios({
// method:'get',
// url: interfaceBoard_api + 'data-exchange_Incoming-from-external',
// params:initParams(data)
// })
// }
// //归档外部数据接收
// export function comingFromOut_file(data) {
// return axios({
// method:'get',
// url: interfaceBoard_api + 'data-exchange_Archived-incoming-from-external',
// params:initParams(data)
// })
// }
// 测试数据-列表
// export function TestSchool(data, includeDetails) {
// return request({
// method:'post',
// url: base_api + '/api/TestSchool/base/get-list-page-by-filter?includeDetails='+Boolean(includeDetails),
// data
// })
// }
// // 测试数据-列表-根据id获取详情
// export function TestSchoolItemById(id) {
// return request({
// method:'get',
// url: base_api + '/api/app/test-school/'+id,
// })
// }
// // 测试数据-列表-新增、编辑
// export function TestSchool_save(data,isAdd) {
// let _type = isAdd ? 'create' : 'update-by-id'
// return request({
// method:'post',
// url: base_api + '/api/TestSchool/base/'+_type,
// data:data,
// params:{id:data.id}
// })
// }
// // 测试数据-列表-删除
// export function TestSchool_delete(id) {
// return request({
// method:'DELETE',
// url: base_api + '/api/TestSchool/base/delete-by-id',
// params:{id:id}
// })
// }
// // 测试数据-明细-列表
// export function TestSchoolDetailList(data,includeDetails) {
// return request({
// method:'post',
// url: base_api + '/api/TestStudentDetail/base/get-list-page-by-filter?includeDetails='+Boolean(includeDetails),
// data
// })
// }
// // 测试数据-明细-删除
// export function TestSchoolDetailList_delete(id) {
// return request({
// method:'DELETE',
// url: base_api + '/api/TestStudentDetail/base/delete-by-id',
// params:{id:id}
// })
// }

2
PC/InterFace.Dash/src/components/rowDrop/index.vue

@ -61,7 +61,7 @@ export default {
dataList: [], dataList: [],
// allSelect hasSelect NoSelect // allSelect hasSelect NoSelect
allSeletType:'NoSelect', allSeletType:'NoSelect',
userName:JSON.parse(localStorage.getItem('currentUserInfo')).userName userName:this.$store.getters.currentUserInfo.userName
} }
}, },
props: { props: {

6
PC/InterFace.Dash/src/layout/components/Navbar.vue

@ -78,11 +78,11 @@ export default {
this.$store.dispatch("app/toggleSideBar"); this.$store.dispatch("app/toggleSideBar");
}, },
async logout() { async logout() {
// await this.$store.dispatch("user/logout"); await this.$store.dispatch("user/logout")
// this.$router.push(`/login?redirect=${this.$route.fullPath}`); // this.$router.push(`/login?redirect=${this.$route.fullPath}`);
localStorage.removeItem("interfaceBoardColumnsNames") localStorage.removeItem("interfaceBoardColumnsNames")
localStorage.removeItem("currentUserInfo") // this.$router.push(`/login?redirect=${this.$route.fullPath}&isAutoLogin=false`)
this.$router.push(`/login?redirect=${this.$route.fullPath}&isAutoLogin=false`) this.$router.push(`/login?isAutoLogin=false`)
}, },
handleClick() { handleClick() {

2
PC/InterFace.Dash/src/mixins/TableHeaderMixins.js

@ -40,7 +40,7 @@ export const TableHeaderMixins = {
let _params = { let _params = {
isRedundance:Boolean(form.isRedundance), isRedundance:Boolean(form.isRedundance),
isDetailExport:Boolean(form.isDetail), isDetailExport:Boolean(form.isDetail),
userId:JSON.parse(localStorage.getItem("currentUserInfo")).id userId:this.$store.getters.currentUserInfo.id
} }
let _exportUrl = this.URLOption_export ? this.URLOption_export : this.URLOption_base; let _exportUrl = this.URLOption_export ? this.URLOption_export : this.URLOption_base;
let _special = this.URLOption_export ? true : false let _special = this.URLOption_export ? true : false

4
PC/InterFace.Dash/src/mixins/mixins.js

@ -58,8 +58,8 @@ export const mixins = {
let _list_defalut = columnsData ? columnsData : this.$isTableColumns[this.$route.name] let _list_defalut = columnsData ? columnsData : this.$isTableColumns[this.$route.name]
let _type = type ? type : 'list_api' let _type = type ? type : 'list_api'
if(!_list_defalut)return if(!_list_defalut)return
let _local = localStorage.getItem('file_Columns_' + _type + '_' + JSON.parse(localStorage.getItem('currentUserInfo')).userName + '_' + this.$route.name) let _local = localStorage.getItem('file_Columns_' + _type + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name)
let _list_local = JSON.parse(localStorage.getItem('file_Columns_' + _type + '_' + JSON.parse(localStorage.getItem('currentUserInfo')).userName + '_' + this.$route.name)) let _list_local = JSON.parse(localStorage.getItem('file_Columns_' + _type + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name))
let _new_list = [] //格式化后的数据 let _new_list = [] //格式化后的数据
// 如果没有缓存则直接为默认值 // 如果没有缓存则直接为默认值
if(!_local){ if(!_local){

77
PC/InterFace.Dash/src/permission.js

@ -27,41 +27,48 @@ router.beforeEach(async (to, from, next) => {
if( _url_isAutoLogin== 'false' || _url_isAutoLogin == 'true'){ if( _url_isAutoLogin== 'false' || _url_isAutoLogin == 'true'){
isAutoLogin = JSON.parse(_url_isAutoLogin) isAutoLogin = JSON.parse(_url_isAutoLogin)
} }
let userInfo = localStorage.getItem('currentUserInfo')
// 是否有用户信息: // 是否有用户信息:
const userInfo = store.getters.currentUserInfo
// 1、如果没有判断是否为自动登录(是自动登录则自动执行登录,账号密码为配置信息中的值,不是自动登录则跳到登录页) // 1、如果没有判断是否为自动登录(是自动登录则自动执行登录,账号密码为配置信息中的值,不是自动登录则跳到登录页)
// 2、有/没有:则检查是否有api接口的表头数据,没有的话重新获取 // 2、有/没有:则检查是否有api接口的表头数据,没有的话重新获取
if(userInfo){ if(userInfo){
console.log('有store.getters.currentUserInfo',store.getters.currentUserInfo)
if(store.getters.permission_routes && store.getters.permission_routes.length > 0){ if(store.getters.permission_routes && store.getters.permission_routes.length > 0){
console.log('有store.getters.permission_routes',store.getters.permission_routes)
next() next()
}else{ }
else{
console.log('没有store.getters.permission_routes',store.getters.permission_routes)
const accessRoutes = await store.dispatch('permission/getApiColumnsNames') const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
router.addRoutes(accessRoutes) router.addRoutes(accessRoutes)
console.log(52)
next({ next({
...to, ...to,
query:{ query:{
loginName:from.query.loginName, loginName:to.query.loginName,
isAutoLogin:from.query.isAutoLogin, isAutoLogin:to.query.isAutoLogin,
isSinglePage:to.query.isSinglePage
}, },
replace: true replace: true
}) })
} }
}else{ }else{
console.log('没有store.getters.currentUserInfo',store.getters.currentUserInfo)
if(!interfaceBoardColumnsNames){ if(!interfaceBoardColumnsNames){
console.log('没有interfaceBoardColumnsNames',interfaceBoardColumnsNames)
const accessRoutes = await store.dispatch('permission/getApiColumnsNames') const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
router.addRoutes(accessRoutes) router.addRoutes(accessRoutes)
console.log(123,to)
next({ next({
...to, ...to,
query:{ query:{
loginName:to.query.loginName, loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin, isAutoLogin:to.query.isAutoLogin,
isSinglePage:to.query.isSinglePage
}, },
replace: true replace: true
}) })
} }
if(isAutoLogin || to.query.loginName){ if(isAutoLogin || to.query.loginName){
console.log('有自动登录',isAutoLogin,to.query.loginName)
// let loginForm= { // let loginForm= {
// userNameOrEmailAddress:localStorage.getItem("userNameOrEmailAddress"), // userNameOrEmailAddress:localStorage.getItem("userNameOrEmailAddress"),
// password:localStorage.getItem("client_secret"), // password:localStorage.getItem("client_secret"),
@ -71,32 +78,42 @@ router.beforeEach(async (to, from, next) => {
// } // }
// // store.dispatch('user/login', loginForm).then(() => { // // store.dispatch('user/login', loginForm).then(() => {
// login(loginForm).then(()=>{ // login(loginForm).then(()=>{
let _username = to.query.loginName ? to.query.loginName : localStorage.getItem("userNameOrEmailAddress") let _username = to.query.loginName || localStorage.getItem("isLoginName") || localStorage.getItem("userNameOrEmailAddress")
if(to.path != '/login'){ if(to.path != '/login'){
getUsersByUserName(_username).then(res=>{ await store.dispatch('user/getUserInfo',_username).then(()=>{
// todo:currentUserInfo全程需要优化
if(res && JSON.stringify(res).length > 0){
localStorage.setItem("currentUserInfo", JSON.stringify(res));
// next('/')
next({ next({
...to, ...to,
query:{ query:{
loginName:to.query.loginName, loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin, isAutoLogin:to.query.isAutoLogin,
isSinglePage:to.query.isSinglePage
}, },
replace: true replace: true
}) })
}else{ }).catch(()=>{
next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`) next({
// next(`/login`) path:'/login',
Message.error('获取用户信息失败,请重试') query:{
} isAutoLogin:to.query.isAutoLogin,
isSinglePage:to.query.isSinglePage
},
replace: true
}) })
.catch(err => { // next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
console.log('获取用户信息失败,请重试') // next(`/login`)
Message.error('获取用户信息失败,请重试!')
}) })
}else{ }else{
next() next()
// next({
// ...to,
// query:{
// loginName:to.query.loginName,
// isAutoLogin:to.query.isAutoLogin,
// isSinglePage:to.query.isSinglePage
// },
// replace: true
// })
} }
// }) // })
// .catch((error) => { // .catch((error) => {
@ -104,11 +121,29 @@ router.beforeEach(async (to, from, next) => {
// }) // })
} }
else{ else{
console.log('不自动登录',isAutoLogin,to.query.loginName)
if (to.path != '/login') { if (to.path != '/login') {
Message.error('获取用户信息失败,请重新登录') Message.error('获取用户信息失败,请重新登录')
next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`) next({
next(`/login`) path:'/login',
query:{
isAutoLogin:to.query.isAutoLogin,
loginName:to.query.loginName,
isSinglePage:to.query.isSinglePage
},
replace: true
})
// next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
// next(`/login`)
}else{ }else{
// next({
// ...to,
// query:{
// isAutoLogin:to.query.isAutoLogin,
// loginName:to.query.loginName,
// },
// replace: true
// })
next() next()
} }
} }

3
PC/InterFace.Dash/src/store/getters.js

@ -12,6 +12,7 @@ const getters = {
roles: state => state.user.roles, roles: state => state.user.roles,
permission_routes: state => state.permission.routes, permission_routes: state => state.permission.routes,
errorLogs: state => state.errorLog.logs, errorLogs: state => state.errorLog.logs,
dictionaries: state => state.dictionaries.dict dictionaries: state => state.dictionaries.dict,
currentUserInfo: state => state.user.userInfo,
} }
export default getters export default getters

48
PC/InterFace.Dash/src/store/modules/user.js

@ -1,7 +1,8 @@
import { import {
token, token,
logout, logout,
getInfo getInfo,
getUsersByUserName
} from '@/api/wms-auth' } from '@/api/wms-auth'
import { import {
getToken, getToken,
@ -20,8 +21,10 @@ const state = {
name: '', name: '',
avatar: '', avatar: '',
introduction: '', introduction: '',
roles: [] roles: [],
userInfo:null
} }
import { Message } from 'element-ui'
const mutations = { const mutations = {
SET_TOKEN: (state, token) => { SET_TOKEN: (state, token) => {
@ -38,6 +41,9 @@ const mutations = {
}, },
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles state.roles = roles
},
SET_USERINFO: (state, data) => {
state.userInfo = data
} }
} }
@ -141,13 +147,14 @@ const actions = {
dispatch dispatch
}) { }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout().then(() => { // logout().then(() => {
commit('SET_TOKEN', '') commit('SET_TOKEN', '')
commit('SET_ROLES', []) commit('SET_ROLES', [])
removeToken() // commit('SET_USERINFO', null)
resetRouter() // removeToken()
removeCompany() // resetRouter()
removeWarehouseCode() // removeCompany()
// removeWarehouseCode()
// reset visited views and cached views // reset visited views and cached views
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485 // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
dispatch('tagsView/delAllViews', null, { dispatch('tagsView/delAllViews', null, {
@ -155,10 +162,10 @@ const actions = {
}) })
resolve() resolve()
// 防止路由叠加 // 防止路由叠加
location.reload() // location.reload()
}).catch(error => { // }).catch(error => {
reject(error) // reject(error)
}) // })
}) })
}, },
@ -202,7 +209,26 @@ const actions = {
dispatch('tagsView/delAllViews', null, { dispatch('tagsView/delAllViews', null, {
root: true root: true
}) })
},
getUserInfo({
commit
},username) {
return new Promise((resolve, reject) => {
getUsersByUserName(username).then(res=>{
if(res && JSON.stringify(res).length > 0){
localStorage.setItem('isLoginName',username)
commit('SET_USERINFO', res)
resolve(res)
}else{
reject('获取用户信息失败,请重试111')
} }
})
.catch(err => {
reject(error)
console.log('获取用户信息失败,请重试')
})
})
},
} }
export default { export default {

2
PC/InterFace.Dash/src/utils/defaultButtons.js

@ -43,7 +43,7 @@ export function defaultExportBtn(option) {
export function defaultFieldSettingBtn(option,source) { export function defaultFieldSettingBtn(option,source) {
let _source = source ? source : 'list_api' let _source = source ? source : 'list_api'
// todo:监听已经配置过的字段按钮更改状态特殊显示 // todo:监听已经配置过的字段按钮更改状态特殊显示
let _local = localStorage.getItem('file_Columns_' + _source + '_' + JSON.parse(localStorage.getItem('currentUserInfo')).userName + '_' + this.$route.name) let _local = localStorage.getItem('file_Columns_' + _source + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name)
let _type = '' let _type = ''
let _num = 0 let _num = 0
if(_local){ if(_local){

217
PC/InterFace.Dash/src/views/basicConfig/ExportCustomUserSetting.vue

@ -1,217 +0,0 @@
<template>
<div class="page-box" v-loading="Loading.appMainLoading">
<tablePagination
v-if="apiColumns_Table"
:currenButtonData="currenButtonData"
:tableData="tableData"
:tableLoading="Loading.tableLoading"
:tableColumns="apiColumns_Table"
@rowDrop="rowDrop"
:totalCount="totalCount"
:multipleSelection="multipleSelection"
:MaxResultCount="PageListParams.MaxResultCount"
@topbutton="topbutton"
@inlineDialog="inlineDialog"
@sortChange="sortChange"
@alertoldSkipCount="alertoldSkipCount"
@alterResultCount="alterResultCount"
@handleSelectionChange="handleSelectionChange"
@buttonOperationClick_left="buttonOperationClick_left"
:currentPageProps="oldSkipCount"
:quicklySearchOption="quicklySearchOption"
@quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear"
:primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData"
:buttonOperationList_left="operationButtonsTable"
>
<!-- <div slot="tableTopSlot">
上方按钮插槽位置预留
</div>
<div slot="searchPrimarySlot">
普通初级搜索插槽位置预留
</div> -->
<!-- <template>表格内容插槽位置预留</template> -->
</tablePagination>
<!-- 新增与编辑 -->
<newAndEdiDialog
:loading="Loading.newAndEdiLoading"
:active="active"
:pageStatus="pageStatus"
:formReveal="formReveal"
:formTitle="formTitle"
:displayDialog="editDialog"
:FormData="formReveal ? CreateFormData : editFormData"
:Form="formReveal ? CreateForm : editForm"
:Options="editOptions"
:Handle="editHandle"
:Rules="formReveal ? editRules.cerateRule : editRules.editRule"
@FormSubmit="FormSubmit"
@close="FormClose"
@goBack="goBack"
></newAndEdiDialog>
<!-- 搜索按钮窗体组件 -->
<searchPage
ref="searchTable"
:tableLoading="Loading.autoTableLoading"
:advancedFilter="advancedFilter()"
:filterPageListParams="filterPageListParams"
:formTitle="searchTitle"
:displayDialog="displayDialog.AddNewDialog"
:searchTableData="searchData"
:searchTableColumns="searchColumns"
:searchTotalCount="searchTotalCount"
:supplierItemPage="searchPageListParams"
@handleSelectionChange="prepareFormData"
@SizeChange="searchAlterResultCount($event, searchPageListParams)"
@CurrentChange="searchAlertoldSkipCount($event, searchPageListParams)"
@tableButtonClick="searchSubmit(arguments)"
></searchPage>
<!-- 新导入 disabledMethod 导入方式禁用 disabledIsAllowPartImport 是否局部导入禁用-->
<!-- methodValue 导入方式默认选项 是否局部导入 默认选项 -->
<importFile
:loading="Loading.importLoading"
:show="displayDialog.importDialog"
:disabledMethod = {method1:false,method2:false,method3:false}
:disabledIsAllowPartImport = {isAllowPartImport1:false,isAllowPartImport2:false}
isAllowPartImportValue="1"
@importClick="postImportMergeClick(arguments)"
@postImportDown="importDown"
></importFile>
<!--抽屉-->
<curren-Drawer
ref="currenDrawer_Ref"
:title="apiColumns_DesTions"
@rowDrop="rowDrop"
:tableColumns="apiColumns_DetailsTable"
:tabsDesTions="apiColumns_DesTions"
:DrawerLoading="Loading.DrawerLoading"
:drawer="displayDialog.detailsDialog"
:propsData="propsData"
:dropdownData="dropdownData"
@drawerShut="(val) => (displayDialog.detailsDialog = val)"
@drawerbutton="drawerbutton"
@handleCommand="drawerHandle"
@close-value="closeValue"
:firstTabs="firstTabs"
:totalCount="totalCountDetails"
:currentPage="oldSkipCountDetails"
:MaxResultCount="MaxResultCountDetails"
@alterResultCountDetails="alterResultCountDetails"
@alertoldSkipCountDetails="alertoldSkipCountDetails"
:buttonOperationList_left="operationButtonsDetail"
></curren-Drawer>
<!-- <curren-Drawer
:title="apiColumns_DesTions"
:tableColumns="apiColumns_DetailsTable"
:tabsDesTions="apiColumns_DesTions"
:DrawerLoading="Loading.DrawerLoading"
:drawer="displayDialog.detailsDialog"
:dropdownData="dropdownData"
:propsData="propsData"
:tableLoading="tableLoading"
@drawerShut="(val) => (displayDialog.detailsDialog = val)"
@drawerbutton="drawerbutton"
@handleCommand="drawerHandle"
@close-value="closeValue"
:firstTabs="firstTabs"
></curren-Drawer> -->
</div>
</template>
<script>
import { tableMixins } from "@/mixins/TableMixins"
import { LoadingMixins } from "@/mixins/LoadingMixins"
import { drawerMixins } from "@/mixins/drawerMixins"
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"
import { newAndEdiDialogMixins } from "@/mixins/newAndEdiDialogMixins"
import { mixins } from "@/mixins/mixins"
import { filterSelectMixins } from '@/mixins/filter-Select'
import * as tableColumns_api from "@/utils/tableColumns_api/index" //
import * as tabsDesTions_api from "@/utils/tabsDesTions_api/index" //
import * as detailsTableColumns_api from "@/utils/detailsTableColumns_api/index" //
import { initFromApiColumnsLable } from '@/utils/index'
import * as detailsPageColumns_api from "@/utils/detailsPageColumns_api/index" //
// import { getExportConfigList } from '@/api/wms-interface'
export default {
name: "ExportCustomUserSetting",
mixins: [
tableMixins,
LoadingMixins,
drawerMixins,
TableHeaderMixins,
mixins,
filterSelectMixins,
newAndEdiDialogMixins
],
computed: {
editDialog: {
get: function () {
return this.displayDialog.newDialog || this.displayDialog.editDialog;
},
},
},
data () {
const userInfo=JSON.parse(localStorage.getItem("currentUserInfo"))
return {
tableLoading:false,
//
currenButtonData: [
this.defaultAddBtn(),//
this.defaultFieldSettingBtn(),//
this.defaultFreshBtn(),//
this.defaultFilterBtn(),//
],
//
CreateFormData: {
customUserSetting: null,
exportUserName: userInfo.name,
exportUserId: userInfo.id,
exportColumnName: null,
exportTableName: null,
},
//
editFormData: {
customUserSetting: null,
exportUserName: userInfo.name,
exportUserId: userInfo.id,
exportColumnName: null,
exportTableName: null,
},
editOptions: {},
CreateForm: [
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 },
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 },
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 },
],
editForm: [
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 },
{ type: "input", label:initFromApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 },
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 },
],
editRules: {
cerateRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnName: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName: [{ required: true, trigger: "blur", message: "不可为空" }],
},
editRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnName: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName: [{ required: true, trigger: "blur", message: "不可为空" }],
}
},
};
},
mounted () {
this.initApiColumns(tableColumns_api,tabsDesTions_api,detailsTableColumns_api,detailsPageColumns_api)
this.paging();
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/basicData.scss";
</style>

24
PC/InterFace.Dash/src/views/login/index.vue

@ -166,10 +166,18 @@ export default {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
// todo-new:localStorage.getItem("userNameOrEmailAddress") // todo-new:localStorage.getItem("userNameOrEmailAddress")
getUsersByUserName(this.loginForm.username).then(res=>{ this.$store.dispatch('user/getUserInfo',this.loginForm.username).then(()=>{
// store.dispatch('user/setName',res) this.$router.push({
localStorage.setItem("currentUserInfo", JSON.stringify(res)); path:'/',
this.$router.push({ path: '/'}) query:{
loginName:this.loginForm.username,
isAutoLogin:this.$route.query.isAutoLogin,
isSinglePage:this.$route.query.isSinglePage
},
replace: true
})
}).catch(()=>{
this.$message.error('获取用户信息失败,请重试!')
}) })
return return
this.loading = true this.loading = true
@ -179,10 +187,10 @@ export default {
login(this.loginForm).then(()=>{ login(this.loginForm).then(()=>{
// this.$store.dispatch('user/login', this.loginForm).then(() => { // this.$store.dispatch('user/login', this.loginForm).then(() => {
// //
getUsersByUserName(localStorage.getItem("userNameOrEmailAddress")).then(res=>{ // getUsersByUserName(localStorage.getItem("userNameOrEmailAddress")).then(res=>{
// store.dispatch('user/setName',res) // // store.dispatch('user/setName',res)
localStorage.setItem("currentUserInfo", JSON.stringify(res)); // localStorage.setItem("currentUserInfo", JSON.stringify(res));
}) // })
getInterfaceBoard().then(result => { getInterfaceBoard().then(result => {
localStorage.setItem("interfaceBoardColumnsNames", JSON.stringify(result.resources[_zh].texts)); localStorage.setItem("interfaceBoardColumnsNames", JSON.stringify(result.resources[_zh].texts));
this.$router.push({ path: '/'}) this.$router.push({ path: '/'})

2
PC/InterFace.Dash/src/views/menuList/ExportCustomUserSetting.vue

@ -155,7 +155,7 @@
}, },
}, },
data () { data () {
const userInfo=JSON.parse(localStorage.getItem("currentUserInfo")) const userInfo=this.$store.getters.currentUserInfo
return { return {
tableLoading:false, tableLoading:false,
// //

Loading…
Cancel
Save