Browse Source

【Job】同步最新版本更新开发

faster_AG_grid
安虹睿 1 year ago
parent
commit
06b2d48771
  1. 64
      PC/UI.WinIn.FasterZ.Job/package-lock.json
  2. 1
      PC/UI.WinIn.FasterZ.Job/package.json
  3. 33
      PC/UI.WinIn.FasterZ.Job/public/config.js
  4. 22
      PC/UI.WinIn.FasterZ.Job/src/App.vue
  5. 166
      PC/UI.WinIn.FasterZ.Job/src/api/wms-auth.js
  6. 1
      PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue
  7. 5
      PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue
  8. 3
      PC/UI.WinIn.FasterZ.Job/src/components/umyTable/index.vue
  9. 31
      PC/UI.WinIn.FasterZ.Job/src/layout/components/Navbar.vue
  10. 8
      PC/UI.WinIn.FasterZ.Job/src/mixins/TableHeaderMixins.js
  11. 10
      PC/UI.WinIn.FasterZ.Job/src/mixins/TableMixins.js
  12. 21
      PC/UI.WinIn.FasterZ.Job/src/oidc/oidc-client.js
  13. 243
      PC/UI.WinIn.FasterZ.Job/src/permission.js
  14. 68
      PC/UI.WinIn.FasterZ.Job/src/router/index.js
  15. 6
      PC/UI.WinIn.FasterZ.Job/src/store/getters.js
  16. 9
      PC/UI.WinIn.FasterZ.Job/src/store/modules/definition.js
  17. 228
      PC/UI.WinIn.FasterZ.Job/src/store/modules/permission.js
  18. 179
      PC/UI.WinIn.FasterZ.Job/src/store/modules/user.js
  19. 7
      PC/UI.WinIn.FasterZ.Job/src/utils/auth.js
  20. 3
      PC/UI.WinIn.FasterZ.Job/src/utils/defaultButtons.js
  21. 15
      PC/UI.WinIn.FasterZ.Job/src/utils/request.js
  22. 25
      PC/UI.WinIn.FasterZ.Job/src/views/callback/index.vue
  23. 31
      PC/UI.WinIn.FasterZ.Job/src/views/dashboard/index.vue
  24. 4
      PC/UI.WinIn.FasterZ.Job/src/views/error-page/401.vue
  25. 23
      PC/UI.WinIn.FasterZ.Job/src/views/error-page/404.vue
  26. 47
      PC/UI.WinIn.FasterZ.Job/src/views/login/index.vue
  27. 33
      PC/UI.WinIn.FasterZ.Job/src/views/menuAll/index.vue
  28. 548
      PC/UI.WinIn.FasterZ.Job/src/views/menuList/AbpIdentityMarkRoles.vue
  29. 638
      PC/UI.WinIn.FasterZ.Job/src/views/menuList/AbpIdentityMarkUsers.vue
  30. 612
      PC/UI.WinIn.FasterZ.Job/src/views/menuList/ExportCustomUserSetting.vue
  31. 32
      PC/UI.WinIn.FasterZ.Job/src/views/profileuser/index.vue
  32. 106
      PC/UI.WinIn.FasterZ.Job/src/views/profileuser/index_dy.vue
  33. 100
      PC/UI.WinIn.FasterZ.Job/src/views/profileuser/resetPwd.vue
  34. 52
      PC/UI.WinIn.FasterZ.Job/src/views/profileuser/userInfo.vue
  35. 2
      PC/UI.WinIn.FasterZ.Job/vue.config.js

64
PC/UI.WinIn.FasterZ.Job/package-lock.json

@ -27,6 +27,7 @@
"moment": "^2.29.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"oidc-client": "^1.11.5",
"path-to-regexp": "2.4.0",
"qs": "^6.10.3",
"screenfull": "4.2.0",
@ -7416,6 +7417,11 @@
"node": "*"
}
},
"node_modules/crypto-js": {
"version": "4.1.1",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz",
"integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
},
"node_modules/css": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz",
@ -16024,6 +16030,35 @@
"integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==",
"dev": true
},
"node_modules/oidc-client": {
"version": "1.11.5",
"resolved": "https://registry.npmmirror.com/oidc-client/-/oidc-client-1.11.5.tgz",
"integrity": "sha512-LcKrKC8Av0m/KD/4EFmo9Sg8fSQ+WFJWBrmtWd+tZkNn3WT/sQG3REmPANE9tzzhbjW6VkTNy4xhAXCfPApAOg==",
"dependencies": {
"acorn": "^7.4.1",
"base64-js": "^1.5.1",
"core-js": "^3.8.3",
"crypto-js": "^4.0.0",
"serialize-javascript": "^4.0.0"
}
},
"node_modules/oidc-client/node_modules/acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/oidc-client/node_modules/core-js": {
"version": "3.32.2",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.32.2.tgz",
"integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ==",
"hasInstallScript": true
},
"node_modules/omelette": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/omelette/-/omelette-0.4.5.tgz",
@ -29520,6 +29555,11 @@
"randomfill": "^1.0.3"
}
},
"crypto-js": {
"version": "4.1.1",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz",
"integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
},
"css": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz",
@ -36331,6 +36371,30 @@
"integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==",
"dev": true
},
"oidc-client": {
"version": "1.11.5",
"resolved": "https://registry.npmmirror.com/oidc-client/-/oidc-client-1.11.5.tgz",
"integrity": "sha512-LcKrKC8Av0m/KD/4EFmo9Sg8fSQ+WFJWBrmtWd+tZkNn3WT/sQG3REmPANE9tzzhbjW6VkTNy4xhAXCfPApAOg==",
"requires": {
"acorn": "^7.4.1",
"base64-js": "^1.5.1",
"core-js": "^3.8.3",
"crypto-js": "^4.0.0",
"serialize-javascript": "^4.0.0"
},
"dependencies": {
"acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A=="
},
"core-js": {
"version": "3.32.2",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.32.2.tgz",
"integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ=="
}
}
},
"omelette": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/omelette/-/omelette-0.4.5.tgz",

1
PC/UI.WinIn.FasterZ.Job/package.json

@ -33,6 +33,7 @@
"moment": "^2.29.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"oidc-client": "^1.11.5",
"path-to-regexp": "2.4.0",
"qs": "^6.10.3",
"screenfull": "4.2.0",

33
PC/UI.WinIn.FasterZ.Job/public/config.js

@ -1,17 +1,28 @@
// dev_win
// window.SITE_CONFIG['baseApi'] = 'http://192.168.0.190:30002'
// window.SITE_CONFIG['authApi'] = 'http://192.168.0.190:30002'
// window.SITE_CONFIG['userApi'] = 'http://192.168.0.190:30000'
window.SITE_CONFIG['baseApi'] = 'http://dev.ccwin-in.com:60067'
window.SITE_CONFIG['authApi'] = 'http://dev.ccwin-in.com:60067'
window.SITE_CONFIG['userApi'] = 'http://dev.ccwin-in.com:60064'
window.SITE_CONFIG['baseApi'] = 'http://dev.ccwin-in.com:60023'
window.SITE_CONFIG['authApi'] = 'http://dev.ccwin-in.com:60020'
// window.SITE_CONFIG['baseApi'] = 'http://192.168.0.190:60078'//http://dev.ccwin-in.com:60022
// window.SITE_CONFIG['authApi'] = 'http://192.168.0.190:60065'//http://dev.ccwin-in.com:60020
window.SITE_CONFIG['businessApi'] = 'http://dev.ccwin-in.com:10097'
window.SITE_CONFIG['columnsApiNamesZh'] = 'Job'
window.SITE_CONFIG['isAutoLogin'] = true
//是否登录配置信息【loginName】
window.SITE_CONFIG['isConfigLogin'] = false
//如果【isConfigLogin】为true则使用【loginName】登录
window.SITE_CONFIG['configLoginName'] = 'admin'
// 默认登录密码(isConfigLogin为true或者链接参数存在loginName使用)
window.SITE_CONFIG['configLoginPass'] = '1q2w3E*'
// 是否单页面(不显示菜单头部等部分)
window.SITE_CONFIG['isSinglePage'] = false
window.SITE_CONFIG['userNameOrEmailAddress'] = 'admin'
window.SITE_CONFIG['client_secret'] = '1q2w3E*'
window.SITE_CONFIG['browserTitle'] = 'JOB-QAD&WMS'
// 项目配置
window.SITE_CONFIG['appClientId'] = 'Z_App'
// 项目配置内部名称
window.SITE_CONFIG['appClientScope'] = 'Job'
// 浏览器名称
window.SITE_CONFIG['browserTitle'] = 'Job-QAD&WMS'
// 单点登录使用数据
window.SITE_CONFIG['oidcLogin_url'] = 'http://dev.ccwin-in.com:60065',
window.SITE_CONFIG['oidcLogin_clientId'] = 'InterfaceDash_App'
window.SITE_CONFIG['oidcLogin_scopes'] = 'offline_access Z profile'
// 隐藏的页面
window.SITE_CONFIG['menuHiddenConfig'] = [
'CheckJobDetail','CountJobDetail','DeliverJobDetail',
'InspectJobDetail','IssueJobDetail','JisDeliverJobDetail',

22
PC/UI.WinIn.FasterZ.Job/src/App.vue

@ -10,15 +10,25 @@ export default {
}
localStorage.setItem('baseApi',window.SITE_CONFIG['baseApi'])
localStorage.setItem('authApi',window.SITE_CONFIG['authApi'])
localStorage.setItem('userApi',window.SITE_CONFIG['userApi'])
// localStorage.setItem('userApi',window.SITE_CONFIG['userApi'])
localStorage.setItem('businessApi',window.SITE_CONFIG['businessApi'])
localStorage.setItem('columnsApiNamesZh',window.SITE_CONFIG['columnsApiNamesZh'])
localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin'])
localStorage.setItem('isConfigLogin',window.SITE_CONFIG['isConfigLogin'])
localStorage.setItem('configLoginName',window.SITE_CONFIG['configLoginName'])
localStorage.setItem('configLoginPass',window.SITE_CONFIG['configLoginPass'])
localStorage.setItem('isSinglePage',window.SITE_CONFIG['isSinglePage'])
localStorage.setItem('userNameOrEmailAddress',window.SITE_CONFIG['userNameOrEmailAddress'])
localStorage.setItem('client_secret',window.SITE_CONFIG['client_secret'])
localStorage.setItem('menuHiddenConfig',window.SITE_CONFIG['menuHiddenConfig'])
localStorage.setItem('appClientId',window.SITE_CONFIG['appClientId'])
localStorage.setItem('appClientScope',window.SITE_CONFIG['appClientScope'])
localStorage.setItem('browserTitle',window.SITE_CONFIG['browserTitle'])
// 使
localStorage.setItem('oidcLogin_url',window.SITE_CONFIG['oidcLogin_url'])
localStorage.setItem('oidcLogin_clientId',window.SITE_CONFIG['oidcLogin_clientId'])
localStorage.setItem('oidcLogin_scopes',window.SITE_CONFIG['oidcLogin_scopes'])
//
localStorage.setItem('menuHiddenConfig',window.SITE_CONFIG['menuHiddenConfig'])
// localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin'])
// localStorage.setItem('userNameOrEmailAddress',window.SITE_CONFIG['userNameOrEmailAddress'])
// localStorage.setItem('client_secret',window.SITE_CONFIG['client_secret'])
//
const language_brow = (navigator.language || navigator.browserLanguage)

166
PC/UI.WinIn.FasterZ.Job/src/api/wms-auth.js

@ -1,47 +1,60 @@
import request from '@/utils/request'
let authApi = localStorage.getItem('authApi') + '/api'
let userApi = localStorage.getItem('userApi')
let baseApi = localStorage.getItem('baseApi') + '/api'
let authUrl = localStorage.getItem('authApi')
let authApi = authUrl + '/api'
export function logout() {
return request({
url: authApi + '/account/logout',
method: 'get'
})
}
// faster-new
// 登录
export function login(data) {
return request({
url: authApi + '/account/login',
url: authUrl + '/CustAccount/login',
method: 'post',
data
})
}
// 获取token
export function token(data) {
return request({
url: authApi + '/connect/token',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data
})
}
export function logout() {
// 通过token获取用户信息(单点登录)
export function getUsersByToken(token) {
return request({
url: authApi + '/account/logout',
method: 'get'
url: authUrl + '/connect/userinfo',
method: 'get',
Token:token
})
}
// faster-new
// 通过用户名获取用户信息
export function getUsersByUserName(name) {
let _api = userApi == 'undefined' ? authApi : userApi + '/api'
return request({
url: _api + '/identity/users/by-username/'+name,
url: authApi + '/identity/users/by-username/'+name,
method: 'get',
})
}
// 获取表头zh转义数据
export function getInterfaceBoard() {
return request({
method:'get',
url: authApi + '/abp/application-localization',
url: baseApi + '/abp/application-localization',
params:{
CultureName:localStorage.getItem('browserLanguage'),
OnlyDynamics:false
@ -54,7 +67,7 @@ export function getInterfaceBoard() {
export function getDefinitionMenu(IncludeTypes) {
return request({
method:'get',
url: authApi + '/abp/application-configuration',
url: baseApi + '/abp/application-configuration',
params:{IncludeLocalizationResources:true}
})
}
@ -63,7 +76,132 @@ export function getDefinitionMenu(IncludeTypes) {
export async function getApiDefinition() {
return request({
method:'get',
url: authApi + '/abp/api-definition',
url: baseApi + '/abp/api-definition',
params:{IncludeTypes:true}
})
}
// *************权限Roles页面维护*************
//获取列表
export function getPageListRoles(data) {
return request({
url: authApi + '/identity/roles',
// url: 'http://192.168.0.190:44330/Identity/Roles',
method: 'get',
params: data
})
}
//获取权限模板
export function getPermissionsRoles(data) {
return request({
url: authApi +'/permission-management/permissions',
method: 'get',
params: data
})
}
// 创建角色
export function postCreateRoles(data) {
return request({
url: authApi + '/identity/roles',
method: 'post',
data
})
}
//编辑角色
export function postUpdateRoles(data, id) {
return request({
url: authApi+'/identity/roles/' + id,
method: 'put',
data
})
}
//删除角色
export function postDeleteRoles(id) {
return request({
url: authApi + '/identity/roles/' + id,
method: 'delete',
})
}
//保存权限模板
export function savePermissionsRoles(URL, data) {
return request({
url: authApi + URL,
method: 'put',
data
})
}
// 更新权限
export function updatePermissionsGranted(pname,pkey) {
return request({
url: authApi + `/permissions/get-isGranted?name=demox&providerName=${pname}&providerKey=${pkey}`,
method: 'post',
})
}
// *************用户Users页面维护*************
//获取全部用户信息
export function getPageListUsers(data) {
return request({
url: authApi + '/identity/users',
method: 'get',
params: data
})
}
//新建用户
export function postCreateUser(data) {
return request({
url: authApi + '/identity/users',
method: 'post',
data
})
}
//编辑用户
export function postUpdateUser(data, id) {
return request({
url: authApi + '/identity/users/' + id,
method: 'put',
data
})
}
//删除用户
export function postDeleteUser(id) {
return request({
url: authApi + '/identity/users/' + id,
method: 'delete',
})
}
// 获取当前用户的角色
export function usersroles() {
return request({
url: authApi + '/identity/users/assignable-roles',
method: 'get'
})
}
//获取当前角色
export function getusersID(data) {
return request({
url: authApi + '/identity/users/' + data + '/roles',
method: 'get'
})
}
//修改登录用户的密码-强密码规则
export function postLoginUserInfo(data, id) {
return request({
url: authApi + '/identity/users/change-password/' + id,
method: 'post',
data
})
}

1
PC/UI.WinIn.FasterZ.Job/src/components/currenButton/innerButton.vue

@ -16,6 +16,7 @@
}"
:class="item.class"
@click="tableButtonClick(item.name,item)"
v-permission="item.permission"
>{{ item.label }}</el-button>
<!-- v-permission="item.permission" -->
</div>

5
PC/UI.WinIn.FasterZ.Job/src/components/tablePagination/index.vue

@ -97,7 +97,7 @@ export default {
noUsePermissionBtn:{
type: Array,
default: () => {
return ['refresh','field']
return ['refresh','field','export','filter']//
}
},
rowMaxHeight:{
@ -307,7 +307,8 @@ export default {
_list.push(item)
}else{
if(this.noUsePermissionBtn.indexOf(item.name) < 0){
item.permission = [this.$route.name+'.'+item.name]
let _scope = item.clientScope || localStorage.getItem('appClientScope')
item.permission = [_scope + '.' +this.$route.name+'.'+item.name]
}else{
item.permission = []
}

3
PC/UI.WinIn.FasterZ.Job/src/components/umyTable/index.vue

@ -167,6 +167,7 @@
:key="indexButton"
type="text"
size="mini"
v-permission="itemButton.permission"
:style="{color:itemButton.color || '#409EFF'}"
@click="buttonOperationClick_right(scope.row, itemButton, indexButton)"
>{{itemButton.label}}</el-button>
@ -212,8 +213,10 @@ import { formatTimeStrToStr } from "@/utils/formatTime";
import _ from "lodash";
import { getMatchRegConformValue } from "@/utils/index"
import showCopyJsonPop from "@/components/showCopyJsonPop"
import permission from "@/directive/permission/index"
export default {
name: "currenTable",
directives: { permission },
components:{ showCopyJsonPop },
filters: {
formatDate(time) {

31
PC/UI.WinIn.FasterZ.Job/src/layout/components/Navbar.vue

@ -1,5 +1,5 @@
<template>
<div class="navbar">
<div class="navbar" v-loading.fullscreen.lock="fullscreenLoading">
<hamburger
id="hamburger-container"
:is-active="sidebar.opened"
@ -16,7 +16,7 @@
<!-- <screenfull id="screenfull" class="right-menu-item hover-effect" /> -->
<!-- <el-tooltip content="Global Size" effect="dark" placement="bottom">
<!-- <el-tooltip content="Global Size" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> -->
</template>
@ -36,9 +36,9 @@
<router-link to="/">
<el-dropdown-item>系统首页</el-dropdown-item>
</router-link>
<!-- <el-dropdown-item divided @click.native="handleClick">
<el-dropdown-item @click.native="showProfileuser">
<span style="display: block">个人中心</span>
</el-dropdown-item> -->
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span style="display: block">退出登录</span>
</el-dropdown-item>
@ -57,6 +57,10 @@ import Screenfull from "@/components/Screenfull";
import SizeSelect from "@/components/SizeSelect";
import Search from "@/components/HeaderSearch";
import getPageTitle from '@/utils/get-page-title'
import { mgr } from "@/oidc/oidc-client";
import {
logout,
} from '@/api/wms-auth'
export default {
components: {
@ -69,6 +73,7 @@ export default {
},
data(){
return{
fullscreenLoading:false,
pageTitle:getPageTitle()
}
},
@ -80,13 +85,21 @@ export default {
this.$store.dispatch("app/toggleSideBar");
},
async logout() {
await this.$store.dispatch("user/logout")
// this.$router.push(`/login?redirect=${this.$route.fullPath}`);
// this.$router.push(`/login?redirect=${this.$route.fullPath}&isAutoLogin=false`)
this.$router.push(`/login?isAutoLogin=false`)
this.fullscreenLoading = true
this.$store.dispatch("user/logout")
// 使
// mgr.signoutRedirect()
// mgr.signoutRedirectCallback()
// .then(() => {
// this.$store.dispatch("user/logout")
// })
// .catch(function(error){
// this.$message.error("退")
// this.fullscreenLoading = false
// })
},
handleClick() {
showProfileuser() {
this.$router.push({ name: 'Profileuser'});
},
},

8
PC/UI.WinIn.FasterZ.Job/src/mixins/TableHeaderMixins.js

@ -67,11 +67,11 @@ export const TableHeaderMixins = {
this.paging()
// this.$store.dispatch("app/appMainLoading", true)
}
// 新增(原始前端写死配置方式)
else if (val == 'newly') {
// 新增(原始前端写死配置)
else if (val == 'Create') {
this.formTitle = "新增" + this.$route.meta.title;
this.formReveal = true
this.theEvent = "newly"
this.theEvent = "Create"
this.displayDialog.newDialog = true;
}
// Api新增(参数配置从api获取)
@ -290,7 +290,7 @@ export const TableHeaderMixins = {
* list_api: 表头来自api的列表 detail_api: 表头来自api列表的明细 detailPage_api表头来自api的明细页面列表
* list: 表头固定的列表 detail: 表头固定列表的明细
*/
rowDrop(data,type) {
rowDrop(data,type) {
if(!type || type == 'list_api'){ this.apiColumns_Table = data }
if(type && type == 'detail_api'){ this.apiColumns_DetailsTable = data }
// if(type && type == 'detailPage_api'){ this.apiColumns_DetailsPage = data }

10
PC/UI.WinIn.FasterZ.Job/src/mixins/TableMixins.js

@ -51,15 +51,19 @@ export const tableMixins = {
},
methods: {
// 主表-右侧操作列基础按钮
buttonOperationList_rightBase(){
buttonOperationList_rightBase(op_e,op_d){
return [{
label:'编辑',
name:'edit',
color:'#ff9000'
color:'#ff9000',
hide:op_e && op_e.hide ? op_e.hide : false,
permission:op_e && op_e.permission ? op_e.permission : []
},{
label:'删除',
name:'delete',
color:'red'
color:'red',
hide:op_d && op_d.hide ? op_d.hide : false,
permission:op_d && op_d.permission ? op_d.permission : []
}]
},
// 主表-右侧操作列基础按钮

21
PC/UI.WinIn.FasterZ.Job/src/oidc/oidc-client.js

@ -0,0 +1,21 @@
import Oidc from "oidc-client";
export const identityServerBase = localStorage.getItem('oidcLogin_url');//目标服务器登录地址
export const vueBase = window.location.origin
// 参考文档 https://github.com/IdentityModel/oidc-client-js/wiki
export const mgr = new Oidc.UserManager({
authority: `${identityServerBase}`, // 认证服务器
client_id: localStorage.getItem('oidcLogin_clientId'), // 表示客户端的ID,必选项
redirect_uri: `${vueBase}/callback`,// 表示重定向URI,认证服务器回调的客户端页面。可选项
response_type: `code`,
scope: localStorage.getItem('oidcLogin_scopes'), // 表示申请的权限范围,可选项
post_logout_redirect_uri: `${vueBase}/home?action=logout`,
automaticSilentRenew: false,
// accessTokenExpiringNotificationTime: 10,
// filterProtocolClaims: false,
// loadUserInfo: true,
// monitorSession: false,
// includeIdTokenInSilentRenew : false,
});

243
PC/UI.WinIn.FasterZ.Job/src/permission.js

@ -3,124 +3,181 @@ import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie
import { getToken,removeToken } from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
import { asyncRoutes } from '@/router'
import { mgr } from "@/oidc/oidc-client";
NProgress.configure({
showSpinner: false
}) // NProgress Configuration
router.beforeEach(async (to, from, next) => {
// start progress bar
NProgress.start()
// set page title
document.title = getPageTitle()
const whiteList = ['/login','/callback'] // no redirect whitelist
const loginErr = '登录失败,请重新登录 !'
const getErrMsg = '数据获取失败 !'
// 退出登录处理
const logoutHandle = (msg) => {
if(msg){
Message.error(msg)
}
setTimeout(()=>{
store.dispatch("user/logout")
},0)
}
// 跳转登录页
const pageToLogin = (to, from, next) => {
if (whiteList.indexOf(to.path) >= 0 ) {
// in the free login whitelist, go directly
next()
NProgress.done()
} else {
// other pages that do not have permission to access are redirected to the login page.
// removeToken()
store.dispatch('user/resetToken')
next(`/login?redirect=${to.path}`)
NProgress.done()
}
}
// 首次进入页面加载数据处理
const toPageInit = async (to, from, next) => {
// const hasToken = getToken()
// // 获取用户信息
// // let _userName = localStorage.getItem("isLoginTokenName")//使用用户名获取
// // if(_userName && _userName != null && (!store.getters.currentUserInfo || store.getters.currentUserInfo.length <= 0)){
// // await store.dispatch('user/getUserInfo',_userName)//使用用户名获取
// let _user_access = hasToken.substring(hasToken.indexOf(" ") + 1,hasToken.length)
// if(hasToken && hasToken != null && (!store.getters.currentUserInfo || store.getters.currentUserInfo.length <= 0)){
// await store.dispatch('user/getUserInfoByToken',_user_access)
// .then(()=>{
// toNextHandle(to, from, next)
// })
// .catch(()=>{
// // toNextHandle(to, from, next)
// Message.error(loginErr)
// pageToLogin(to, from, next)
// })
// return
// }
if(getToken()){
toNextHandle(to, from, next)
}else{
logoutHandle('暂无token,请重新登录')
}
}
// 获取数据失败处理
const getErrHandle = (to, from, next) => {
let isAutoLogin = JSON.parse(localStorage.getItem('isConfigLogin')) || to.query.loginName
Message.error(getErrMsg)
if(!isAutoLogin){
logoutHandle()
}
NProgress.done()
}
// 跳转处理
const toNextHandle = async (to, from, next) => {
let isFresh = false
// 获取表头转义
if(!store.getters.columZHList || store.getters.columZHList.length <= 0){
await store.dispatch('definition/getColumZHList',()=>{
NProgress.done()
if(!store.getters.columZHList){
await store.dispatch('definition/getColumZHList').catch(()=>{
getErrHandle(to, from, next)
})
}
// 获取菜单数据
if(!store.getters.permission_routes || store.getters.permission_routes.length <= 0){
const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
router.addRoutes(accessRoutes)
// 获取菜单数据 permission_routes
if(!store.getters.hasApiToken){
isFresh = true
await store.dispatch('permission/getAppConfig')
.then((res)=>{
// 没有权限(token失效处理)
if(!res || !res.auth || !res.auth.grantedPolicies || JSON.stringify(res.auth.grantedPolicies) == '{}'){
logoutHandle('用户无权限或者token失效,请配置权限或重新登录')
}
})
.catch(()=>{
getErrHandle(to, from, next)
})
}
// 获取枚举数据
if(!store.getters.enumList || store.getters.enumList.length <= 0){
await store.dispatch('definition/getDefinitionConfig')
await store.dispatch('definition/getDefinitionConfig').catch(()=>{
getErrHandle(to, from, next)
})
}
// 是否已尝试过自动登录
const alreadyTryLogin = localStorage.getItem('alreadyTryLogin')
// 是否有用户信息:
const userInfo = store.getters.currentUserInfo
// 判断是否自动登录
let isAutoLogin = JSON.parse(localStorage.getItem('isAutoLogin'))
// 如果路径中有isAutoLogin参数则优先,否则读取配置文件中的isAutoLogin参数
let _url_isAutoLogin = to.query.isAutoLogin
if( _url_isAutoLogin== 'false' || _url_isAutoLogin == 'true'){
isAutoLogin = JSON.parse(_url_isAutoLogin)
}
if(to.path == '/login'){
console.log('-------当前路由为登录页-------')
next()
if(isFresh){
next({...to,replace:true})
}else{
console.log('-------当前路由不是登录页-------')
if((userInfo && userInfo.id) || alreadyTryLogin == 'true'){
if(userInfo && userInfo.id){
console.log('-------当前有用户信息-------',userInfo)
next()
}
NProgress.done()
}
router.beforeEach(async (to, from, next) => {
// start progress bar
NProgress.start()
// set page title
document.title = getPageTitle()
const hasToken = getToken()
// 判断是否自动登录
let isAutoLogin = JSON.parse(localStorage.getItem('isConfigLogin')) || to.query.loginName
if(hasToken || to.path == '/callback'){
if (to.path === '/login') {
console.log('有token,是登录页,将跳转至/')
// if is logged in, redirect to the home page
next({
path: '/'
})
NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
} else {
if(to.path == '/callback'){
console.log('有token,是callback页,next')
next()
}else{
console.log('-------当前没有用户信息,但是已尝试过登录-------')
console.log('有token,不是登录页,不是callback页,toPageInit')
await toPageInit(to, from, next)
}
next()
}else{
console.log('-------当前没有用户信息-------')
if(isAutoLogin || to.query.loginName){
let _username = to.query.loginName || localStorage.getItem("isLoginName") || localStorage.getItem("userNameOrEmailAddress")
console.log('-------要求自动登录-------',isAutoLogin,to.query.loginName,_username)
// let loginForm= {
// userNameOrEmailAddress:localStorage.getItem("userNameOrEmailAddress"),
// password:localStorage.getItem("client_secret"),
// // rememberMe:true,
// // grant_type: 'password',
// // client_id: 'Auth_App',
// }
// // store.dispatch('user/login', loginForm).then(() => {
// login(loginForm).then(()=>{
await store.dispatch('user/getUserInfo',_username).then(()=>{
console.log("-------用户信息获取成功-------")
localStorage.setItem('alreadyTryLogin',true)
next(to)
// next({
// ...to,
// query:{
// loginName:to.query.loginName,
// isAutoLogin:to.query.isAutoLogin,
// isSinglePage:to.query.isSinglePage
// },
// replace: true
// })
}).catch(()=>{
localStorage.setItem('alreadyTryLogin',true)
next()
// next({
// path:'/login',
// query:{
// isAutoLogin:to.query.isAutoLogin,
// isSinglePage:to.query.isSinglePage
// },
// replace: true
// })
// next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
// next(`/login`)
localStorage.setItem("isLoginName",_username)
// Message.error('获取用户信息失败,请重试!')
}
}else{
if (to.path === '/login') {
console.log('没有token,是登录页,pageToLogin')
pageToLogin(to, from, next)
} else {
// 如果有单点登录方式使用下方配置
// mgr.signinRedirect(); //执行重定向
if(isAutoLogin){
let _username = localStorage.getItem("isConfigLogin") && localStorage.getItem("isConfigLogin") != 'false' ? localStorage.getItem("configLoginName") : to.query.loginName
await store.dispatch('user/login', {
username:_username,
password:localStorage.getItem("configLoginPass")
})
// })
// .catch((error) => {
// console.log('登录失败')
// })
.then(()=>{
toPageInit(to, from, next)
})
.catch(()=>{
// toNextHandle(to, from, next)
Message.error(loginErr)
pageToLogin(to, from, next)
})
}else{
console.log('-------不需要自动登录-------',isAutoLogin,to.query.loginName)
next({
path:'/login',
query:{
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
isSinglePage:to.query.isSinglePage
},
replace: true
})
console.log('没有token,不是登录页,不是自动登录,pageToLogin')
pageToLogin(to, from, next)
}
}
}
localStorage.setItem('alreadyTryLogin',false)
})
router.afterEach(() => {

68
PC/UI.WinIn.FasterZ.Job/src/router/index.js

@ -60,25 +60,29 @@ export let constantRoutes = [
component: () => import('@/views/error-page/401'),
hidden: true
},
{
path: '/callback',
component: () => import('@/views/callback/index'),
hidden: true
},
{
path: '/',
component: Layout,
redirect: '/dashboard',
redirect: '/home',
// hidden: true,
children: [{
path: 'dashboard',
path: 'home',
component: () => import('@/views/dashboard/index'),
name: 'Dashboard',
name: 'Home',
meta: {
keepAlive : true,
// title: localStorage.getItem('browserLanguage') == 'zh-Hans' ? '系统首页' : 'Dashboard',
title: i18n.t('common.home'),
icon: 'svg_dashboard',
outerFirst:true
// affix: true
}
}]
},
},
{
path: '/',
component: Layout,
@ -96,7 +100,41 @@ export let constantRoutes = [
// affix: true
}
}]
},
},
{
path: '/',
component: Layout,
redirect: '/profileuser',
hidden: true,
children: [{
path: 'profileuser',
component: () => import('@/views/profileuser/index'),
name: 'Profileuser',
meta: {
title: '个人中心',
icon: 'user',
noCache: true
}
}]
},
// {
// path: '/',
// component: Layout,
// redirect: '/RoleManage',
// hidden: true,
// children: [{
// path: 'RoleManage',
// component: () => import('@/views/systemManage/RoleManage'),
// name: 'RoleManage',
// meta: {
// keepAlive : true,
// title: 'RoleManage',
// icon: 'svg_dashboard',
// outerFirst:true
// // affix: true
// }
// }]
// },
]
/**
@ -107,22 +145,20 @@ export let constantRoutes = [
export let asyncRoutes = [
/** when your routing map is too long, you can split it into small modules **/
// 404 page must be placed at the end !!!
// {
// path: '*',
// redirect: '/404',
// hidden: true
// }
{
path: '*',
redirect: '/404',
hidden: true
}
]
const createRouter = () => new Router({
// mode: 'history', // require service support
mode: 'hash', // 单点登录需要使用history,但是history会使线上nginx刷新404(需要确认及处理)
scrollBehavior: () => ({
y: 0
}),
// todo-new:有token后使用去掉下一行代码
routes: constantRoutes.concat(asyncRoutes)
// todo-new:有token后使打开下方代码,并检查是否有效
// routes: constantRoutes
// routes: constantRoutes.concat(asyncRoutes)
routes: constantRoutes
})
const router = createRouter()

6
PC/UI.WinIn.FasterZ.Job/src/store/getters.js

@ -5,11 +5,11 @@ const getters = {
loading: state => state.app.loading,
visitedViews: state => state.tagsView.visitedViews,
cachedViews: state => state.tagsView.cachedViews,
token: state => state.user.token,
introduction: state => state.user.introduction,
roles: state => state.user.roles,
roles: state => state.permission.roles,//当前用户权限
currentUserInfo: state => state.user.userInfo,//当前用户信息
permission_routes: state => state.permission.routes,//接口获取的菜单
permission_routes: state => state.permission.routes,//全部菜单
hasApiToken:state => state.permission.configApiToken,//配置config接口是否有权限
tablesName:state => state.permission.tablesName,//接口获取所有的表名
errorLogs: state => state.errorLog.logs,
enumList: state => state.definition.enumList,//接口获取的枚举

9
PC/UI.WinIn.FasterZ.Job/src/store/modules/definition.js

@ -161,7 +161,7 @@ const actions = {
return new Promise((resolve,reject) => {
getInterfaceBoard()
.then(res=>{
let _zh = res.resources[localStorage.getItem('columnsApiNamesZh')].texts;
let _zh = res.resources[localStorage.getItem('appClientScope')].texts;
commit('SET_COLUMZH_LIST', _zh)
resolve(res)
})
@ -170,6 +170,13 @@ const actions = {
reject(err)
})
})
},
// 重置配置信息
resetDefinition({ commit }) {
commit('SET_ENUM_LIST', [])
commit('SET_COLUMZH_LIST', null)
commit('SET_DTOCOLUMN_TYPES', [])
commit('SET_API_ACTIONS', [])
}
}

228
PC/UI.WinIn.FasterZ.Job/src/store/modules/permission.js

@ -5,74 +5,34 @@ import {
import Layout from '@/layout'
import { getDefinitionMenu } from '@/api/wms-auth'
import store from '@/store'
import router from '@/router'
/**
* Use meta.role to determine if the current user has permission
* @param roles
* @param route
*/
function hasPermission(roles, route) {
if (route.meta && route.meta.roles) {
if (route.meta.roles == "skip") {
return true
} else {
return roles.some(role => route.meta.roles.includes(role))
}
} else {
return false
}
}
const filterAccessedRoutes = (items,indexVal,childrenIndex) => {
const route = JSON.parse(JSON.stringify(items))
route.forEach((val, index) => {
// debugger;
if(val.meta && val.meta.roles == "skip"){
if (val.children && val.children.length != 0) {
filterAccessedRoutes(items[index-indexVal].children,childrenIndex)
}
if(items[index-indexVal].children && items[index-indexVal].children.length == 0){
items.splice(index-indexVal, 1)
indexVal++
}
}
})
indexVal = 0
}
/**
* Filter asynchronous routing tables by recursion
* @param routes asyncRoutes
* @param roles
*/
export function filterAsyncRoutes(routes, roles) {
const res = []
routes.forEach(route => {
const tmp = {
...route
}
if (hasPermission(roles, tmp)) {
if (tmp.children) {
tmp.children = filterAsyncRoutes(tmp.children, roles)
}
res.push(tmp)
}
})
return res
}
// 身份权限的页面标识(角色等)
const AbpIdentity_mark = 'AbpIdentityMark'
const state = {
routes: [],//菜单
addRoutes: [],
roles: [],//当前用户权限
configApiToken:false,//配置config接口是否有权限
tablesName:null,//所有的表名
}
const mutations = {
SET_ROUTES: (state, routes) => {
state.addRoutes = routes
state.routes = constantRoutes.concat(routes)
router.addRoutes(routes)
},
// 配置config接口是否为空(即没有权限)
SET_CONFIG_TOKEN: (state, data) => {
state.configApiToken = data
},
// 设置权限(v-permission)
SET_ROLES: (state, roles) => {
state.roles = roles
},
SET_TABLESNAME: (state, data) => {
state.tablesName = data
}
},
}
/**
* 静态路由懒加载
@ -92,28 +52,27 @@ export function generaMenu(routes, data, first) {
let _noShowMenus = localStorage.getItem('menuHiddenConfig').split(',')
data.forEach(item => {
let _item = {
path: '/'+item.name,
path: item.path,
component: loadView(item.name),
hidden: _noShowMenus.indexOf(item.name) >= 0, // 状态为0的隐藏
name: item.name,
// meta: item.meta
meta: {
title: item.title,
icon: item.icon || 'svg_default',
roles: item.permission,
outerFirst:first
},
meta: item.meta
}
let menu = _item
if(first && item.component == '@/layout'){
// if(first && item.component == '@/layout'){
if(first){
menu = {
path: '/',
component: Layout,
redirect: '/' + item.name,
children: [],
// redirect: 'noRedirect',
}
if(item.children && item.children.length > 0){
menu.meta=item.meta
}else{
menu.children = []
menu.children.push(_item)
}
menu.children = []
menu.children.push(_item)
}
// 一级菜单 二级菜单 特定属性
// if (item.component == '@/layout' || item.component == 'index') {
@ -134,6 +93,7 @@ export function generaMenu(routes, data, first) {
// menu.hasOpen = false // 是否打开过,默认false
// }
if (item.children && item.children.length > 0) {
if(!menu.children)menu.children = []
generaMenu(menu.children, item.children)
}
// if (item.permission == 'skip' && item.children.length == 0) {
@ -147,9 +107,25 @@ export function generaMenu(routes, data, first) {
export function initTreeMenusHandle(tree, list,first) {
let _res = []
tree.forEach(item=>{
if(list.indexOf(item.name) >= 0){
item.title = store.getters.columZHList[item.name] || item.name
if(first)item.component = '@/layout'
if(list.indexOf(item.name) >= 0 || item.name.indexOf(AbpIdentity_mark) >= 0){
if(item.name.indexOf(AbpIdentity_mark) >= 0){
if(item.name == AbpIdentity_mark){
item.title = '系统设置管理'
}else{
let _name = item.name.substring(AbpIdentity_mark.length,item.name.length)
item.title = store.getters.columZHList[_name] || _name
}
}else{
item.title = store.getters.columZHList[item.name] || item.name
}
item.path = '/'+item.name
item.meta={
title: item.title,
icon: item.icon || 'svg_default',
// roles: item.permission,
outerFirst:first
}
// if(first)item.component = '@/layout'
if (item.children && item.children.length > 0) {
item.children = initTreeMenusHandle(item.children,list)
}
@ -159,55 +135,75 @@ export function initTreeMenusHandle(tree, list,first) {
return _res
}
const actions = {
getApiColumnsNames({
// 设置权限
resetUserRoles({commit}){
commit('SET_ROUTES',[])
commit('SET_ROLES', [])
commit('SET_TABLESNAME', null)
},
// 获取菜单数据
getAppConfig({
commit
}, userId) {
return new Promise(resolve => {
let accessedRoutes = asyncRoutes
// accessedRoutes = filterAsyncRoutes(asyncRoutes, roles)
// let indexVal = 0
// let childrenIndex = 0
// filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
// commit('SET_ROUTES', accessedRoutes)
// resolve(accessedRoutes)
getDefinitionMenu(true).then(res => {
// 存储当前用户信息
store.dispatch('user/setUserInfo',res.currentUser)
let roles_arr = []
if(!res.auth.grantedPolicies || JSON.stringify(res.auth.grantedPolicies) == '{}'){
commit('SET_CONFIG_TOKEN',false)
}else{
commit('SET_CONFIG_TOKEN',true)
}
for(let r in res.auth.grantedPolicies){
if(res.auth.grantedPolicies[r])roles_arr.push(r)
}
commit('SET_ROLES', roles_arr)
let _allConfig = res.auth.grantedPolicies;//所有配置
let _menuList = []//接口获取所有的菜单
let _AbpIdentity = []//接口获取所有的身份配置信息数据
for(let item in _allConfig){
let point_number = item.split('.').length - 1
// 只选择配置项中的数据
if(point_number == 1 && item.substring(0,item.indexOf('.')) == localStorage.getItem('columnsApiNamesZh')){
if(point_number == 1 && item.substring(0,item.indexOf('.')) == localStorage.getItem('appClientScope')){
_menuList.push(item.substring(item.indexOf('.') + 1,item.length))
}
}
// 身份配置信息数据(用户、角色)
if(point_number == 1 && item.substring(0,item.indexOf('.')) == 'AbpIdentity'){
_AbpIdentity.push(AbpIdentity_mark + item.substring(item.indexOf('.') + 1,item.length))
}
}
// 存储所有的表名
commit('SET_TABLESNAME', _menuList)
// 数据模拟,todo-new:接口获取
// 数据模拟,todo-faster:接口获取
let _treeMenusAll = null//树形菜单
// _treeMenusAll = [
// {name:"aaaaaaa"},
// {name:"ExportCustomUserSetting"
// // ,children:[
// // {name:'OutgoingDataHistory',children:[
// // {name:'IncomingData',children:[
// // {name:'OutgoingDataHistory'},
// // {name:'IncomingData'},
// // {name:'333333'},
// // ]},
// // {name:'eee1111-bbb',children:[
// // {name:'ExportCustomUserSetting'},
// // {name:'MessageReceive'},
// // ]},
// // ]},
// // {name:'eee222'},
// // {name:'eee333'},
// // {name:'eee444'},
// // {name:'eee555'},
// // ]
// {
// name:"ExportCustomUserSetting1",
// children:[
// {name:'ExportCustomUserSetting'},
// {name:'OutgoingDataHistory'
// ,children:[
// {name:"OutgoingDataHistory"},
// {name:'IncomingData',children:[
// {name:'IncomingDataHistory'},
// {name:'IncomingData'},
// {name:'333333'},
// ]},
// {name:'eee1111-bbb',children:[
// {name:'IncomingDataHistory'},
// {name:'MessageReceive'},
// ]},
// ]},
// {name:'eee222'},
// {name:'eee333'},
// {name:'eee444'},
// {name:'eee555'},
// ]
// },
// {name:"OutgoingDataHistory"},
// {name:"IncomingData"},
// {name:"IncomingDataHistory"},
// {name:"MesProductL7PartsNote"},
// {name:"MessageReceive"},
// {name:"OutgoingData"},
@ -231,30 +227,38 @@ const actions = {
// {name:"VendPart"},
// {name:"Vend"},
// ]
let _initTreeMenus = []
let _menuAndAbpList = [..._menuList,..._AbpIdentity]// 包含配置项中的业务菜单+身份权限菜单(角色用户等)
let _initTreeMenus = []//转义为树状结构
if(_treeMenusAll && _treeMenusAll.length > 0){
_initTreeMenus = initTreeMenusHandle(_treeMenusAll,_menuList,true)
_initTreeMenus = initTreeMenusHandle(_treeMenusAll,_menuAndAbpList,true)
}else{
let _data = []
for(let i in _menuList){
_data.push({name:_menuList[i]})
// 自定义系统设置管理分级
if(_AbpIdentity && _AbpIdentity.length > 0){
_data.push({name:AbpIdentity_mark,children:[]})
}
_initTreeMenus = initTreeMenusHandle(_data,_menuList,true)
for(let i in _menuAndAbpList){
if(_menuAndAbpList[i].indexOf(AbpIdentity_mark) >= 0){
_data[0].children.push({ name:_menuAndAbpList[i] })
}
else{
_data.push({name:_menuAndAbpList[i]})
}
}
_initTreeMenus = initTreeMenusHandle(_data,_menuAndAbpList,true)
}
// 最后查重+层级查重后的菜单
let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true)
let accessedRoutes = _initEndMenus
// let indexVal = 0
// let childrenIndex = 0
// filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
commit('SET_ROUTES', accessedRoutes)
resolve(accessedRoutes)
resolve(res)
}).catch(err => {
console.log(err)
})
})
},
}
export default {

179
PC/UI.WinIn.FasterZ.Job/src/store/modules/user.js

@ -1,6 +1,8 @@
import {
token,
login,
logout,
getUsersByToken,
getUsersByUserName
} from '@/api/wms-auth'
import {
@ -11,85 +13,124 @@ import {
import router, {
resetRouter
} from '@/router'
import qs from 'qs'
import store from '@/store'
import { mgr } from "@/oidc/oidc-client";
const state = {
token: getToken(),
introduction: '',
roles: [],
userInfo:null
}
const mutations = {
SET_TOKEN: (state, token) => {
state.token = token
},
SET_INTRODUCTION: (state, introduction) => {
state.introduction = introduction
},
// 设置权限(v-permission)
SET_ROLES: (state, roles) => {
let _roles = [
'IncomingDataHistory.filter',
'IncomingData.export',
'MesProductL7PartsNote.filter',
'MesProductL7PartsNote.export'
]
state.roles = _roles
},
SET_USERINFO: (state, data) => {
state.userInfo = data
}
}
// 登录(token)成功后处理
const loginSuccess = (type,token,username,resolve,reject) => {
let _type = type ? type : 'Bearer'
setToken(_type + ' ' + token)
localStorage.setItem('isLoginTokenName',username)
resolve()
// store.dispatch('user/getUserInfoByToken',token).then(()=>{
// resolve()
// }).catch(()=>{
// reject()
// })
// store.dispatch('user/getUserInfo',username).then(()=>{
// resolve()
// }).catch(()=>{
// reject()
// })
}
// 单点登录(token)成功后处理
const loginSuccessBySignin = (res,resolve, reject,commit) => {
let _token = res.token_type + ' ' + res.access_token
setToken(_token)
store.dispatch('user/getUserInfoByToken',res.access_token).then(()=>{
resolve()
}).catch(()=>{
reject()
})
}
const actions = {
// user login
// 设置当前用户
setUserInfo({commit},data){
commit('SET_USERINFO',data)
},
// 登录,需要密码
login({
commit
commit,
}, userInfo) {
const {
password,
username,
company,
warehouseCode
} = userInfo
let loginData = {
userNameOrEmailAddress: username,
password: password,
rememberMe: true
}
let parseData = JSON.parse(JSON.stringify(userInfo))
delete parseData.warehouseCode
delete parseData.company
parseData.client_secret = window.SITE_CONFIG['client_secret']
let tokenData = qs.stringify(parseData)
return new Promise((resolve, reject) => {
// login(loginData).then(response => {
let params = {
password: password,
userNameOrEmailAddress: username
// let params = qs.stringify({
// password: password,
// username: username,
// client_id:localStorage.getItem('appClientId'),
// scopes:localStorage.getItem('appClientScope'),
// grant_type:'password'
// });
let params= {
name:username,
password: password
}
token(params).then(response => {
const {
accessToken,
tokenType
} = response
if (accessToken == null) {
reject()
login(params).then(response => {
if (response && response.token) {
loginSuccess(null,response.token,username,resolve,reject,commit)
} else {
commit('SET_TOKEN', accessToken)
setToken(tokenType + ' ' + accessToken)
resolve()
reject()
}
}).catch(error => {
reject(error)
})
// token(params).then(response => {
// if (response.access_token == null) {
// reject()
// } else {
// loginSuccess(response,username,resolve,reject,commit)
// }
// }).catch(error => {
// reject(error)
// })
})
},
// 单点登录
loginBySignin({
commit,
}) {
return new Promise((resolve, reject) => {
mgr.signinRedirectCallback()
.then(() => {
mgr.getUser()
.then((res_token) => {
if(res_token){
loginSuccessBySignin(res_token,resolve, reject,commit)
}else{
mgr.signinRedirect(); //执行重定向
}
})
})
.catch(function(e) {
// console.log('catch')
mgr.signinRedirect(); //执行重定向
console.error("CallBack 错误信息" + e);
});
})
},
// user logout
logout({
commit,
@ -97,18 +138,17 @@ const actions = {
}) {
return new Promise((resolve, reject) => {
// logout().then(() => {
commit('SET_TOKEN', '')
// commit('SET_USERINFO', null)
// removeToken()
// resetRouter()
dispatch('permission/resetUserRoles',null,{root:true})
dispatch('definition/resetDefinition',null,{root:true})
dispatch('tagsView/delAllViews', null, {root: true}).then(()=>{
removeToken()
resetRouter()
resolve()
})
// reset visited views and cached views
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
dispatch('tagsView/delAllViews', null, {
root: true
})
resolve()
// 防止路由叠加
// location.reload()
// 防止路由叠加(打开后单点登录的退出无效),如果有单点登录方式关闭下方location.reload()
location.reload()
// }).catch(error => {
// reject(error)
// })
@ -120,8 +160,8 @@ const actions = {
commit
}) {
return new Promise(resolve => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
// commit('SET_ROLES', [])
localStorage.setItem('isLoginTokenName',null)
removeToken()
resolve()
})
@ -134,8 +174,6 @@ const actions = {
return new Promise((resolve, reject) => {
getUsersByUserName(username).then(res=>{
if(res && JSON.stringify(res).length > 0){
localStorage.setItem('isLoginName',username)
// commit('SET_ROLES', res)
commit('SET_USERINFO', res)
resolve(res)
}else{
@ -148,6 +186,29 @@ const actions = {
})
})
},
// get userInfo
getUserInfoByToken({
commit
},access_token) {
return new Promise((resolve, reject) => {
getUsersByToken(access_token)
.then(info=>{
if(info){
let _info = info
_info.name = info.preferred_username
_info.id = info.sub
commit('SET_USERINFO', _info)
resolve(_info)
}else{
reject('用户信息获取失败')
}
})
.catch(err=>{
reject(err)
})
})
},
}
export default {
@ -155,4 +216,4 @@ export default {
state,
mutations,
actions
}
}

7
PC/UI.WinIn.FasterZ.Job/src/utils/auth.js

@ -2,8 +2,6 @@ import Cookies from 'js-cookie'
import store from '@/store'
const TokenKey = 'Admin-Token'
const CompanyKey = 'Admin-Company'
const WarehouseCodeKey = 'Admin-WarehouseCode'
export function getToken() {
return Cookies.get(TokenKey)
@ -19,5 +17,6 @@ export function removeToken() {
// fast-new
export function getLoginName() {
return (store.getters.currentUserInfo && store.getters.currentUserInfo.name) ? store.getters.currentUserInfo.name : localStorage.getItem('isLoginName')
}
let _name = (store.getters.currentUserInfo && store.getters.currentUserInfo.name) ? store.getters.currentUserInfo.name : localStorage.getItem('isLoginTokenName')
return (!_name || _name == 'null') ? null : _name
}

3
PC/UI.WinIn.FasterZ.Job/src/utils/defaultButtons.js

@ -13,7 +13,7 @@ export function defaultAddBtn(option) {
type: "primary",
icon: "el-icon-plus",
label: i18n.t('btns.add'),
name: "newly",
name: "Create",
size: "mini",
background:"#31bb99"
})
@ -123,5 +123,6 @@ function __defaultBtnOption(option,specific){
isDetailExport:option && option.isDetailExport ? option.isDetailExport : false,
isRedundance:option && option.isRedundance ? option.isRedundance : false,
permission:option && option.permission ? option.permission : null,
clientScope:option && option.clientScope ? option.clientScope : null,
}
}

15
PC/UI.WinIn.FasterZ.Job/src/utils/request.js

@ -20,7 +20,8 @@ service.interceptors.request.use(
config => {
// do something before request is sent
if (store.getters.token) {
// if (store.getters.token) {
if (getToken() && getToken() != null) {
// let each request carry token
// ['X-Token'] is a custom headers key
// please modify it according to the actual situation
@ -92,12 +93,12 @@ service.interceptors.response.use(
},
error => {
// if(!error.response || !error.response.data){
// // Message({
// // message: '访问出错,请重试',
// // type: 'error',
// // duration: 5 * 1000,
// // showClose:true
// // })
// Message({
// message: '访问出错,请重试',
// type: 'error',
// duration: 5 * 1000,
// showClose:true
// })
// return Promise.reject(error)
// }
let err = error.response.data.error // for debug

25
PC/UI.WinIn.FasterZ.Job/src/views/callback/index.vue

@ -0,0 +1,25 @@
<template>
<!-- callback.vue单点登录成功的回调页面 -->
<div
style="height: 100vh;"
v-loading="loading"
element-loading-text="正在加载中"
element-loading-spinner="el-icon-loading"
></div>
</template>
<script>
export default {
name:'callback',
data() {
return {
loading:true
};
},
created() {
this.$store.dispatch("user/loginBySignin").then(()=>{
this.$router.push("/");
})
}
};
</script>

31
PC/UI.WinIn.FasterZ.Job/src/views/dashboard/index.vue

@ -27,24 +27,31 @@ export default {
])
},
mounted(){
this.initData(this.permission_routes)
let _menus = JSON.parse(JSON.stringify(this.permission_routes))
let _showList = _menus.filter(item=>{
return !item.hidden
})
this.navList = this.initData(_showList,true)
},
methods:{
initData(data){
initData(data,first){
let _list = []
data.forEach(item => {
if(!item.hidden && item.path !== '/' && item.meta) {
let _item = {
title:item.meta.title,
name:item.name,
path:item.path,
children:item.children
}
this.navList.push(_item)
//
if(item.meta){
item.title = item.meta.title
_list.push(item)
}
if(!item.hidden && item.children){
this.initData(item.children)
//
else{
if(item.children && item.children.length > 0)_list.push(item.children[0])
}
if(item.children && item.children.length > 0)item.children = this.initData(item.children)
});
_list = _list.filter(item=>{
return !item.hidden
})
return _list
},
goPage(item){
this.$router.push({name: item.name})

4
PC/UI.WinIn.FasterZ.Job/src/views/error-page/401.vue

@ -14,7 +14,7 @@
<ul class="list-unstyled">
<li>或者你可以去:</li>
<li class="link-type">
<router-link to="/dashboard">
<router-link to="/home">
回首页
</router-link>
</li>
@ -49,7 +49,7 @@ export default {
methods: {
back() {
if (this.$route.query.noGoBack) {
this.$router.push({ path: '/dashboard' })
this.$router.push({ path: '/home' })
} else {
this.$router.go(-1)
}

23
PC/UI.WinIn.FasterZ.Job/src/views/error-page/404.vue

@ -8,13 +8,10 @@
<img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404">
</div>
<div class="bullshit">
<div class="bullshit__oops">OOPS!</div>
<div class="bullshit__info">All rights reserved
<a style="color:#20a0ff" href="https://wallstreetcn.com" target="_blank">wallstreetcn</a>
</div>
<div class="bullshit__headline">{{ message }}</div>
<div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to return to the homepage.</div>
<a href="" class="bullshit__return-home">Back to home</a>
<div class="bullshit__oops">访问发生错误!</div>
<div class="bullshit__headline">暂无该页面或者您没有访问权限</div>
<div class="bullshit__info">请检查您输入的地址是否正确<br/>以及是否有该权限<br/>或者单击下面的按钮返回主页</div>
<a href="/home" class="bullshit__return-home">返回主页</a>
</div>
</div>
</div>
@ -24,11 +21,6 @@
export default {
name: 'Page404',
computed: {
message() {
return 'The webmaster said that you can not enter this page...'
}
}
}
</script>
@ -167,10 +159,11 @@ export default {
line-height: 40px;
color: #1482f0;
opacity: 0;
margin-bottom: 20px;
margin-bottom: 30px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-fill-mode: forwards;
padding-top: 20px;
}
&__headline {
font-size: 20px;
@ -185,11 +178,11 @@ export default {
animation-fill-mode: forwards;
}
&__info {
font-size: 13px;
font-size: 16px;
line-height: 21px;
color: grey;
opacity: 0;
margin-bottom: 30px;
margin-bottom: 40px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.2s;

47
PC/UI.WinIn.FasterZ.Job/src/views/login/index.vue

@ -35,13 +35,12 @@
>
<el-form-item prop="password">
<span class="svg-container">
<svg-icon icon-class="password" />
<svg-icon icon-class="svg_password" />
</span>
<el-input
:key="passwordType"
ref="password"
v-model="loginForm.password"
:type="passwordType"
:type="passwordType == 'svg_password' ? 'password' : 'text'"
placeholder="密码"
name="password"
tabindex="2"
@ -52,7 +51,7 @@
/>
<span class="show-pwd" @click="showPwd">
<svg-icon
:icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
:icon-class="passwordType === 'svg_password' ? 'svg_eye' : 'svg_eyeOpen'"
/>
</span>
</el-form-item>
@ -95,8 +94,6 @@ export default {
rememberMe:true,
grant_type: 'password',
client_id: 'Auth_App',
// warehouseCode: localStorage.getItem("warehouseCode"),
// company: localStorage.getItem("company"),
// username: '',
// password: ''
},
@ -104,7 +101,7 @@ export default {
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
},
passwordType: 'password',
passwordType: 'svg_password',
capsTooltip: false,
loading: false,
redirect: undefined,
@ -152,10 +149,10 @@ export default {
this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z')
},
showPwd () {
if (this.passwordType === 'password') {
if (this.passwordType === 'svg_password') {
this.passwordType = ''
} else {
this.passwordType = 'password'
this.passwordType = 'svg_password'
}
this.$nextTick(() => {
this.$refs.password.focus()
@ -164,36 +161,16 @@ export default {
handleLogin () {
this.$refs.loginForm.validate(valid => {
if (valid) {
// todo-new:
this.$store.dispatch('user/getUserInfo',this.loginForm.username).then(()=>{
localStorage.setItem('isLoginName',this.loginForm.username)
this.$router.push({
path:'/',
query:{
isSinglePage:this.$route.query.isSinglePage
},
replace: true
})
}).catch(()=>{
this.$message.error('获取用户信息失败,请重试!')
})
return
this.loading = true
this.loginForm.userNameOrEmailAddress = this.loginForm.username
let _zh = localStorage.getItem('columnsApiNamesZh')
login(this.loginForm).then(()=>{
// this.$store.dispatch('user/login', this.loginForm).then(() => {
//
// getUsersByUserName(localStorage.getItem("userNameOrEmailAddress")).then(res=>{
// // store.dispatch('user/setName',res)
// localStorage.setItem("currentUserInfo", JSON.stringify(res));
// })
// this.$router.push({ path: '/'})
// this.loading = false
this.$store.dispatch('user/login', this.loginForm)
.then(() => {
this.$router.push({ path: '/'})
})
.catch((error) => {
this.$message.error('用户名或密码错误!')
this.loading = false
if(!error){
this.$message.error('用户名或密码错误!')
}
})
} else {
console.log('error submit!!')

33
PC/UI.WinIn.FasterZ.Job/src/views/menuAll/index.vue

@ -27,24 +27,31 @@ export default {
])
},
mounted(){
this.initData(this.permission_routes)
let _menus = JSON.parse(JSON.stringify(this.permission_routes))
// let _showList = _menus.filter(item=>{
// return !item.hidden
// })
this.navList = this.initData(_menus,true)
},
methods:{
initData(data){
initData(data,first){
let _list = []
data.forEach(item => {
if(item.path !== '/' && item.meta) {
let _item = {
title:item.meta.title,
name:item.name,
path:item.path,
children:item.children
}
this.navList.push(_item)
//
if(item.meta){
item.title = item.meta.title
_list.push(item)
}
if(item.children){
this.initData(item.children)
//
else{
if(item.children && item.children.length > 0)_list.push(item.children[0])
}
})
if(item.children && item.children.length > 0)item.children = this.initData(item.children)
});
// _list = _list.filter(item=>{
// return !item.hidden
// })
return _list
},
goPage(item){
this.$router.push({name: item.name})

548
PC/UI.WinIn.FasterZ.Job/src/views/menuList/AbpIdentityMarkRoles.vue

@ -0,0 +1,548 @@
<template>
<div class="appMainPage">
<el-row :gutter="24">
<el-col :md="16" style="margin-bottom: 10px">
<div class="main">
<div class="table-active">
<div class="bttton-box">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleCreate"
size="mini"
v-permission="['AbpIdentity.Roles.Create']"
>创建角色</el-button
>
<el-button
type="success"
icon="el-icon-refresh"
@click.native.prevent="Createview"
size="mini"
>刷新</el-button
>
</div>
<div class="query-box">
<!-- 搜索 -->
<searchNormal
ref="normalSearch_roleManage"
@searchNormalClick="filtrate"
@searchNormalClear="filtrate"
></searchNormal>
</div>
</div>
<el-table
v-loading="tableLoading"
:border="true"
ref="multipleTable"
:data="tableData"
height="calc(100vh - 265px)"
style="width: 100%"
@sort-change="sortChange"
@row-click="handleRowClick"
@selection-change="handleSelectionChange"
>
<el-table-column
prop="name"
label="角色名"
sortable="custom"
:align="'left'"
/>
<el-table-column label="操作" :align="'center'" width="150">
<template slot-scope="scope">
<el-button
type="text"
@click="Update(scope.row)"
v-permission="['AbpIdentity.Roles.Update']"
v-if="scope.row.name == 'admin' ? false : true"
>编辑</el-button
>
<el-button
type="text"
@click="Delete(scope.row)"
v-permission="['AbpIdentity.Roles.Delete']"
v-if="scope.row.name == 'admin' ? false : true"
style="color:red"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="Footer">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.currentPage"
:page-sizes="[10, 15, 20]"
:page-size="queryInfo.pagesize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
<el-button
type="primary"
size="mini"
style="margin-left: 10px; background-color: #409eff"
>确定</el-button
>
</div>
</el-col>
<el-col
v-loading="treeLoading"
:md="8"
v-permission="['AbpIdentity.Roles.Update']"
>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix" style="height: 20px">
<el-tooltip
class="item"
effect="dark"
content="选择指定角色的模块权限"
placement="top"
>
<span class="role-span">{{name}}角色模块权限</span>
</el-tooltip>
<el-button
:loading="treeLoading"
:disabled="multipleSelection.length != 1"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="savePer"
v-permission="['AbpIdentity.Roles.ManagePermissions']"
v-if="name != 'admin'"
>保存</el-button>
</div>
<el-tree
ref="tree"
:check-strictly="false"
:data="permissionsData"
:props="defaultProps"
show-checkbox
node-key="name"
class="permission-tree"
/>
</el-card>
</el-col>
</el-row>
<el-dialog
:title="formTitle"
:visible.sync="dialogVisible"
width="800px"
:close-on-click-modal="false"
>
<el-form
ref="form"
:model="form"
label-width="70px"
:rules="rules"
>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" style="width: 380px" maxlength="23" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="resetform"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getPageListRoles,
getPermissionsRoles,
savePermissionsRoles,
updatePermissionsGranted,
postCreateRoles,
postUpdateRoles,
postDeleteRoles,
} from "@/api/wms-auth";
import permission from "@/utils/permission/index";
import searchNormal from "@/components/searchNormal/index.vue"
export default {
directives: { permission },
components:{
searchNormal
},
name:"AbpIdentityMarkRoles",
data() {
//
return {
URL: 'identity/roles',
//
name: '',
//
dialogVisible: false,
//
isEdit: false,
//title
formTitle: "",
//
total: 0,
//
queryInfo: {
//
currentPage: 1,
//
pagesize: 20,
Sorting: "",
},
//ID
usersId: "",
//
concurrencyStamp: "",
//
form: {
name: "",
isDefault: true,
isPublic: true,
},
// table
tableLoading:false,
//
treeLoading: false,
//
checkedPermission: [],
//
permissionsData: [],
defaultProps: {
children: "children",
label: "displayName",
},
//
params: {
providerName: "R",
providerKey: "",
},
//
multipleSelection: [],
//table
tableData: [],
rules: {
name: [
{ required: true, trigger: "blur", message: "请输入姓名" },
{
min: 1,
max: 23,
message: "长度在 1 到 23 个字符",
trigger: "blur",
},
],
},
};
},
mounted() {
this.pageList();
},
methods: {
//table
pageList(val) {
const data = {
Filter: val || '',
Sorting: this.queryInfo.Sorting,
SkipCount: (this.queryInfo.currentPage - 1) * this.queryInfo.pagesize,
MaxResultCount: this.queryInfo.pagesize,
};
this.tableLoading = true
getPageListRoles(data).then((res) => {
this.total = res.totalCount;
this.tableData = res.items;
this.tableLoading = false
}).catch(err=>{
console.log(err)
this.tableLoading = false
})
},
//
sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
this.queryInfo.Sorting = "";
this.handleFilter();
return;
}
this.queryInfo.Sorting = prop + " " + order;
this.handleFilter();
},
//
handleFilter() {
this.queryInfo.currentPage = 1;
this.pageList();
},
//
filtrate(val) {
this.queryInfo.currentPage = 1;
this.pageList(val);
},
//
handleSizeChange(val) {
this.queryInfo.pagesize = val;
this.pageList();
},
//
handleCurrentChange(val) {
this.queryInfo.currentPage = val;
this.pageList();
},
//
resetform() {
this.$refs.form.resetFields();
this.dialogVisible = false;
this.form.name = "";
this.$refs.multipleTable.clearSelection();
},
//
handleCreate() {
this.formTitle = "创建角色";
this.dialogVisible = true;
this.isEdit = false;
},
//
Createview() {
this.queryInfo.currentPage = 1;
this.queryInfo.Sorting = "";
this.$refs.normalSearch_roleManage.searchNormalClear()//
this.$refs.multipleTable.clearSort();
},
//
Update(row) {
if (row) {
this.formTitle = "编辑角色";
this.dialogVisible = true;
this.isEdit = true;
this.usersId = row.id;
this.form.name = row.name;
this.concurrencyStamp = row.concurrencyStamp;
}
},
//
Delete(row) {
this.$confirm("此操作将永久删除该角色, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
if (this.tableData.length == 1) {
this.queryInfo.currentPage = this.queryInfo.currentPage - 1;
}
postDeleteRoles(row.id).then((res) => {
this.$successMsg("删除成功!");
this.pageList();
this.permissionsData = []
});
})
.catch(() => {});
},
//
submitForm() {
this.$refs.form.validate((valid) => {
//
if (valid && !this.isEdit) {
postCreateRoles(this.form)
.then((res) => {
this.resetform();
this.$successMsg("创建成功!");
this.queryInfo.currentPage = 1;
this.pageList();
})
.catch((err) => {
this.resetform();
});
} else if (valid && this.isEdit) {
//
const data = JSON.parse(JSON.stringify(this.form));
data.concurrencyStamp = this.concurrencyStamp;
postUpdateRoles(data, this.usersId)
.then((res) => {
this.$successMsg("编辑成功!");
this.pageList();
this.resetform();
})
.catch((err) => {
this.resetform();
});
} else {
this.$errorMsg("请按照提示继续输入!");
return false;
}
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
savePer(){
let _allList = []
let checkedKeys = this.$refs.tree.getCheckedKeys();
this.permissionsData.forEach(item=>{
//
item.children.forEach(item_menu=>{
let _Granted1 = checkedKeys.indexOf(item_menu.name) >= 0 ? true : false
_allList.push({isGranted:_Granted1,name:item_menu.name})
//
if(item_menu.children){
item_menu.children.forEach(item_handle=>{
let _Granted2 = checkedKeys.indexOf(item_handle.name) >= 0 ? true : false
_allList.push({isGranted:_Granted2,name:item_handle.name})
// true
if(_Granted2){
_allList.forEach((allItem)=>{
if(allItem.name == item_handle.parentName){
allItem.isGranted = true
}
})
}
})
}
})
})
this.treeLoading = true;
savePermissionsRoles(
`/permission-management/permissions?providerName=${this.params.providerName}&providerKey=${this.multipleSelection[0].name}`,
{permissions:_allList}
).then((response) => {
updatePermissionsGranted(this.params.providerName,this.multipleSelection[0].name).then(()=>{
this.$notify({
title: "成功",
message: "更新成功",
type: "success",
duration: 2000,
});
this.treeLoading = false;
//
if(this.multipleSelection[0].name == this.$store.getters.currentUserInfo.name){
location.reload()
}
}).catch(()=>{
this.treeLoading = false;
})
}).catch(err=>{
this.treeLoading = false;
});
},
//table
handleRowClick(row, column, event) {
let that = this
this.name = row.name
this.treeLoading = true;
// if (row.name == "admin") {
// this.$notify({
// title: "",
// message: "",
// type: "warning",
// duration: 2000,
// });
// this.$refs.multipleTable.clearSelection();
// this.permissionsData = [];
// this.checkedPermission = [];
// } else {
this.$refs.multipleTable.clearSelection();
this.$refs.multipleTable.toggleRowSelection(row);
// }
this.params.providerKey = row.name;
getPermissionsRoles(this.params).then((res) => {
this.permissionsData = [];
this.checkedPermission = [];
//
res.groups.forEach((itemRes,indexRes) => {
itemRes.children = []
this.permissionsData.push(itemRes)
// todo:使
itemRes.permissions.forEach(item => {
if(!item.parentName){
//
if(item.isGranted)this.checkedPermission.push(item.name)
this.permissionsData[indexRes].children.push(item)
}else{
//
if(item.isGranted)this.checkedPermission.push(item.name)
this.permissionsData[indexRes].children.forEach((pItem,pindex)=>{
if(pItem.name == item.parentName){
if(!this.permissionsData[indexRes].children[pindex].children)this.permissionsData[indexRes].children[pindex].children = []
this.permissionsData[indexRes].children[pindex].children.push(item)
// childrenflase
if(item.isGranted == false){
if(this.checkedPermission.indexOf(item.parentName) >= 0){
this.checkedPermission.splice(this.checkedPermission.indexOf(item.parentName),1)
}
}
}
})
}
})
})
that.$nextTick(() => {
that.$refs.tree.setCheckedKeys(this.checkedPermission)
})
console.log('拥有权限',this.checkedPermission)
console.log('菜单树',this.permissionsData)
that.treeLoading = false;
})
.catch((err)=>{
this.$errorMsg('暂无更改权限')
that.treeLoading = false;
})
},
},
};
</script>
<style lang="scss" scoped>
.appMainPage {
padding: 20px;
.main {
.table-active {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
padding: 5px 0 15px 0;
.bttton-box {
display: flex;
}
}
}
.el-table__body-wrapper {
tbody {
span {
cursor: pointer;
&:hover {
color: #409eff;
}
}
}
}
.Footer {
padding: 25px 0;
display: flex;
justify-content: flex-end;
}
::v-deep .el-dialog {
.el-dialog__header {
button {
display: none;
}
}
}
.permission-tree{
padding: 20px;
height: 690px;
overflow-y: auto;
}
}
</style>

638
PC/UI.WinIn.FasterZ.Job/src/views/menuList/AbpIdentityMarkUsers.vue

@ -0,0 +1,638 @@
<template>
<div class="appMainPage" v-loading="loading">
<div class="main">
<div class="table-active">
<div class="bttton-box">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleCreate"
size="mini"
v-permission="['AbpIdentity.Users.Create']"
>创建用户</el-button
>
<el-button
type="success"
icon="el-icon-refresh"
@click.native.prevent="Createview"
size="mini"
>刷新</el-button
>
</div>
<div class="query-box">
<!-- 搜索 -->
<searchNormal
ref="normalSearch_UserManage"
@searchNormalClick="filtrate"
@searchNormalClear="filtrate"
></searchNormal>
</div>
</div>
<el-table
ref="multipleTable"
:data="tableData"
height="calc(100vh - 260px)"
style="width: 100%"
@sort-change="sortChange"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
:border="true"
>
<el-table-column :align="'center'" type="selection" width="55" />
<el-table-column
prop="userName"
label="用户名"
width="180"
:align="'left'"
sortable="custom"
/>
<el-table-column
prop="name"
label="姓名"
width="180"
:align="'left'"
sortable="custom"
/>
<el-table-column
prop="isActive"
label="是否启用"
sortable="custom"
:align="'center'"
width="180"
>
<template slot-scope="scope">
<span>{{ scope.row['isActive'] | trigger('whetherOrNot', "label") }}</span>
</template>
</el-table-column>
<el-table-column label="操作" :align="'center'" width="230">
<template slot-scope="scope">
<el-button
type="text"
@click="Update(scope.row)"
v-permission="['AbpIdentity.Users.Update']"
v-if="scope.row.name == 'admin' ? false : true"
>编辑</el-button>
<el-button
type="text"
@click="deleteUser(scope.row)"
v-if="scope.row.name == 'admin' ? false : true"
v-permission="['AbpIdentity.Users.Delete']"
style="color:red"
>删除用户</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="Footer">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.currentPage"
:page-sizes="[10, 15, 20]"
:page-size="queryInfo.pagesize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
<el-button
type="primary"
size="mini"
style="margin-left: 10px; background-color: #409eff"
>确定</el-button
>
</div>
<el-dialog
:title="formTitle"
:visible.sync="dialogVisible"
width="800px"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
>
<el-form
ref="form"
:model="form"
label-width="70px"
:rules="rules"
>
<el-form-item label="用户名" prop="userName">
<el-input
v-model="form.userName"
maxlength="20"
/>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" maxlength="20" />
</el-form-item>
<el-form-item label="角色" prop="roleNames">
<el-select
:disabled="!checkPermission(['AbpIdentity.Users.ManagePermissions']) && isEdit"
v-model="form.roleNames"
multiple
style="width: 100%"
placeholder="请选择"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="是否启用" prop="isActive">
<el-select
v-model="form.isActive"
style="width: 100%"
placeholder="请选择"
>
<el-option
v-for="item in userOptions('whetherOrNot')"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="密码" prop="password" v-if="!isEdit">
<el-input
ref="password"
v-model="form.password"
maxlength="16"
minlength="6"
:type="passwordType"
/>
<span class="show-pwd" @click="showPwd">
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
</span>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="resetform"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { isvalidPhone } from "@/utils/validate";
import checkPermission from '@/utils/permission'
import {
getPageListUsers,
usersroles,
postCreateUser,
postUpdateUser,
postDeleteUser,
getusersID,
} from "@/api/wms-auth";
import permission from "@/utils/permission/index";
import searchNormal from "@/components/searchNormal/index.vue"
export default {
directives: { permission },
components:{
searchNormal
},
name:"AbpIdentityMarkUsers",
data() {
//
const validPhone = (rule, value, callback) => {
if (!value) {
callback(new Error("请输入电话号码"));
} else if (!isvalidPhone(value)) {
callback(new Error("请输入正确的11位手机号码"));
} else {
callback();
}
};
const validName = (rule, value, callback) => {
if (!value) {
callback(new Error("请输入登录名称"));
} else if (/[\u4E00-\u9FA5]/g.test(value)) {
callback(new Error("登录名不能输入汉字"));
} else {
callback();
}
};
//
// const validpassword = (rule, value, callback) => {
// if (!value) {
// callback(new Error(""));
// } else {
// if (
// /^(?=.*\d)(?=.*[a-z]).{6,16}$/.test(
// value
// )
// ) {
// callback();
// } else {
// callback(new Error(",,6"));
// }
// }
// };
//
// const validpassword = (rule, value, callback) => {
// if (!value) {
// callback(new Error(""));
// } else {
// if (
// /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,16}$/.test(
// value
// )
// ) {
// callback();
// } else {
// callback(new Error(",,6"));
// }
// }
// };
//
const validpassword = (rule, value, callback) => {
if (!value) {
callback(new Error("请输入密码"));
} else {
if (
/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~@#$%\*-\+=:,\\?\[\]\{}]).{6,16}$/.test(
value
)
) {
callback();
} else {
callback(new Error("密码必须包含大小写,数字与特殊字符混合,最小长度为6位"));
}
}
};
const checkEmail = (rule, value, callback) => {
const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
if (!value) {
return callback(new Error("邮箱不能为空"));
}
setTimeout(() => {
if (mailReg.test(value)) {
callback();
} else {
callback(new Error("请输入正确的邮箱格式"));
}
}, 100);
};
return {
loading:false,
//
dialogVisible: false,
//
isEdit: false,
//title
formTitle: "",
//
total: 0,
//
queryInfo: {
//
currentPage: 1,
//
pagesize: 20,
Sorting: "",
},
//
options: [],
//ID
usersId: "",
//
concurrencyStamp: "",
//
form: {
userName: "",
phoneNumber: "",
name: "",
email: "",
roleNames: [],
password: "",
surname: "",
lockoutEnabled: true,
isActive: true,
},
//
passwordType: "password",
//
multipleSelection: [],
//table
tableData: [],
rules: {
userName: [
{ required: true, trigger: "blur", validator: validName },
{
min: 2,
max: 20,
message: "长度在 2 到 20 个字符",
trigger: "blur",
},
],
name: [
{ required: true, trigger: "blur", message: "请输入姓名" },
{
min: 2,
max: 20,
message: "长度在 2 到 20 个字符",
trigger: "blur",
},
],
email: [{ required: true, validator: checkEmail, trigger: "blur" }],
phoneNumber: [
{ required: true, trigger: "blur", validator: validPhone },
],
password: [
{ required: true, trigger: "blur", message: "请输入密码" },
{
min: 6,
max: 16,
message: "长度在 6 到 16 个字符",
trigger: "blur",
},
],
roleNames: [
{ required: true, message: "请选择角色", trigger: "change" },
],
},
};
},
created() {
//
usersroles().then((res) => {
this.options = res.items;
});
},
mounted() {
this.pageList();
},
methods: {
checkPermission,
//
userOptions(val){
let options = this.$staticOptions[val]
return options()
},
//table
pageList(val) {
this.loading = true
const data = {
Filter: val || '',
Sorting: this.queryInfo.Sorting,
SkipCount: (this.queryInfo.currentPage - 1) * this.queryInfo.pagesize,
MaxResultCount: this.queryInfo.pagesize,
};
getPageListUsers(data).then((res) => {
this.loading = false
const data = res;
this.total = data.totalCount;
this.tableData = data.items;
}).catch(()=>{
this.loading = false
});
},
//
showPwd() {
if (this.passwordType === "password") {
this.passwordType = "";
} else {
this.passwordType = "password";
}
this.$nextTick(() => {
this.$refs.password.focus();
});
},
//
sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
this.queryInfo.Sorting = "";
this.handleFilter();
return;
}
this.queryInfo.Sorting = prop + " " + order;
this.handleFilter();
},
//
handleFilter() {
this.queryInfo.currentPage = 1;
this.pageList();
},
//
filtrate(val) {
this.queryInfo.currentPage = 1;
this.pageList(val);
},
//
handleSizeChange(val) {
this.queryInfo.pagesize = val;
this.pageList();
},
//
handleCurrentChange(val) {
this.queryInfo.currentPage = val;
this.pageList();
},
//
resetform() {
this.$refs.form.resetFields();
this.dialogVisible = false;
this.form.userName = "";
this.form.phoneNumber = "";
this.form.name = "";
this.form.email = "";
this.form.roleNames = [];
this.form.password = "";
this.form.surname = "";
this.form.isActive = "";
this.$refs.multipleTable.clearSelection();
},
handleCreate() {
this.formTitle = "创建用户";
this.dialogVisible = true;
this.isEdit = false;
this.form.phoneNumber = this.getRandomPhoneNumber()
this.form.email = this.getRandomEmail()
usersroles().then((res) => {
this.options = res.items
})
},
//
Createview() {
this.queryInfo.currentPage = 1;
this.queryInfo.Sorting = "";
this.$refs.normalSearch_UserManage.searchNormalClear()//
usersroles().then((res) => {
this.options = res.items;
});
this.$refs.multipleTable.clearSort();
},
//
usersID(data) {
getusersID(data).then((res) => {
const data = res.items;
this.form.roleNames = data.map((item) => {
return item.name;
});
});
},
//
Update(row) {
if (row) {
this.formTitle = "编辑用户";
this.usersId = row.id;
this.usersID(row.id);
this.form.userName = row.userName;
this.form.phoneNumber = row.phoneNumber;
this.form.name = row.name;
this.form.email = row.email;
this.form.surname = row.name;
this.form.lockoutEnabled = row.lockoutEnabled
this.concurrencyStamp = row.concurrencyStamp;
this.form.isActive = row.isActive;
usersroles().then((res) => {
this.options = res.items;
});
this.isEdit = true;
this.dialogVisible = true;
}
},
//
submitForm() {
this.$refs.form.validate((valid) => {
//
if (valid && !this.isEdit) {
this.form.surname = this.form.name;
postCreateUser(this.form)
.then((res) => {
this.resetform();
this.$successMsg("创建成功!");
this.pageList();
})
.catch((err) => {
this.resetform();
});
} else if (valid && this.isEdit) {
//
const data = JSON.parse(JSON.stringify(this.form));
delete data.password;
data.concurrencyStamp = this.concurrencyStamp;
postUpdateUser(data, this.usersId)
.then((res) => {
this.$successMsg("编辑成功!");
this.pageList();
this.resetform();
})
.catch((err) => {
this.resetform();
});
} else {
this.$errorMsg("请按照提示继续输入!");
return false;
}
});
},
//
deleteUser(row){
this.$confirm("您确认删除 " + row.userName + " 用户吗?", "提示", {
confirmButtonText: "确认删除用户",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.loading = true
postDeleteUser(row.id)
.then((res) => {
this.loading = false
this.$successMsg("删除成功!");
this.pageList();
})
.catch((err) => {
this.loading = false
})
})
.catch((err) => {
console.log(err)
})
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
//table
handleRowClick(row, column, event) {
if (
this.multipleSelection.length == 1 &&
this.multipleSelection[0].id == row.id
) {
this.$refs.multipleTable.clearSelection();
return;
}
this.$refs.multipleTable.clearSelection();
this.$refs.multipleTable.toggleRowSelection(row);
},
// 11
getRandomPhoneNumber () {
return '1' + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1)
},
getRandomEmail () {
return '' + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + '@' + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + '.com'
},
},
};
</script>
<style lang="scss" scoped>
.appMainPage {
.main {
.table-active {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
padding: 20px 0;
.bttton-box {
display: flex;
}
}
}
.el-table__body-wrapper {
tbody {
span {
cursor: pointer;
&:hover {
color: #409eff;
}
}
}
}
.Footer {
padding: 25px;
// background-color: #f2f2f2;
display: flex;
justify-content: flex-end;
::v-deep button {
background-color: #fff;
}
}
::v-deep .el-dialog {
.el-dialog__header {
button {
display: none;
}
}
}
.el-form-item{
margin-bottom: 30px;
}
.show-pwd {
position: absolute;
right: 10px;
}
}
</style>

612
PC/UI.WinIn.FasterZ.Job/src/views/menuList/ExportCustomUserSetting.vue

@ -1,267 +1,271 @@
<template>
<div class="page-box" v-loading="Loading.tableLoading">
<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"
:currentPageProps="oldSkipCount"
:quicklySearchOption="quicklySearchOption"
@quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear"
:primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData"
:buttonOperationList_right="buttonOperationList_rightBase"
@buttonOperationClick_right="buttonOperationClick_right"
>
<!-- :buttonOperationList_left="buttonOperationClick_leftBase"
@buttonOperationClick_left="buttonOperationClick_left" -->
<!-- <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"
@changeSelect="changeSelect"
></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"
:Butttondata="[]"
:propsData="propsData"
@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>
</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 { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index'
import { getPageList } from '@/api/wms-api'
import {
postCreate,
postUpdate,
} from "@/api/wms-api"
export default {
name: "ExportCustomUserSetting",
mixins: [
tableMixins,
LoadingMixins,
drawerMixins,
TableHeaderMixins,
mixins,
filterSelectMixins,
newAndEdiDialogMixins
],
computed: {
editDialog: {
get: function (val) {
return this.displayDialog.newDialog || this.displayDialog.editDialog;
},
<div class="page-box" v-loading="Loading.tableLoading">
<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"
:currentPageProps="oldSkipCount"
:quicklySearchOption="quicklySearchOption"
@quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear"
:primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData"
:buttonOperationList_right="(row)=>{return buttonOperationList_rightBase(
{permission:['Z.ExportCustomUserSetting.Update'],hide:OperaButtonHide(row)},
{permission:['Z.ExportCustomUserSetting.Delete'],hide:OperaButtonHide(row)}
)}"
@buttonOperationClick_right="buttonOperationClick_right"
>
<!-- :buttonOperationList_left="buttonOperationClick_leftBase"
@buttonOperationClick_left="buttonOperationClick_left" -->
<!-- <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"
@changeSelect="changeSelect"
></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"
:Butttondata="[]"
:propsData="propsData"
@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>
</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 { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index'
import { getPageList } from '@/api/wms-api'
import {
postCreate,
postUpdate,
} from "@/api/wms-api"
export default {
name: "ExportCustomUserSetting",
mixins: [
tableMixins,
LoadingMixins,
drawerMixins,
TableHeaderMixins,
mixins,
filterSelectMixins,
newAndEdiDialogMixins
],
computed: {
editDialog: {
get: function (val) {
return this.displayDialog.newDialog || this.displayDialog.editDialog;
},
},
watch:{
'displayDialog.editDialog'(n){
if(n){
this.editFormData.exportColumnNameArr = this.editFormData.exportColumnName_old.split(" ")
this.getColumList()
}
},
watch:{
'displayDialog.editDialog'(n){
if(n){
this.editFormData.exportColumnNameArr = this.editFormData.exportColumnName_old.split(" ")
this.getColumList()
}
},
data () {
const userInfo=this.$store.getters.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,
exportColumnNameArr:null,
exportTableName_old:null,
},
//
editFormData: {
id:null,
customUserSetting: null,
exportUserName: userInfo.name,
exportUserId: userInfo.id,
exportColumnName: null,
exportTableName: null,
exportColumnNameArr:null,
exportTableName_old:null,
exportColumnName_old:null
},
editOptions: {},
CreateForm: [
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 },
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 },
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", options: "whetherOrNotForNum", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName_old", userOptions: this.initTablesName(), colSpan: 12 },
{ type: "select", disabled:true, multiple:true, label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnNameArr", userOptions:null, colSpan: 12 },
],
editForm: [
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", options: "whetherOrNotForNum", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName_old", userOptions: this.initTablesName(), colSpan: 12 },
{ type: "select", multiple:true, label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnNameArr", userOptions:null, colSpan: 12 },
],
editRules: {
cerateRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnNameArr: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName_old: [{ required: true, trigger: "blur", message: "不可为空" }],
},
editRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnNameArr: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName_old: [{ required: true, trigger: "blur", message: "不可为空" }],
}
},
columsList:[],
};
},
mounted () {
this.paging();
},
methods:{
pagingCallback(callback){
this.Loading.tableLoading = false
this.tableData.forEach(item=>{
item.exportTableName_old = item.exportTableName
item.exportColumnName_old = item.exportColumnName
item.exportTableName = zhApiColumnsLable(item.exportTableName)
let _arr = item.exportColumnName.split(" ")
let _zhArr = []
_arr.forEach(item2=>{
let _item2 = zhApiColumnsLable(item.exportTableName_old+firstWordSizeChange(item2,'Upper')) || item2
_zhArr.push(_item2)
})
item.exportColumnName = _zhArr.join(',')
})
if(callback)callback()
}
},
data () {
const userInfo=this.$store.getters.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,
exportColumnNameArr:null,
exportTableName_old:null,
},
// /
initTablesName(){
let _names = this.$store.getters.tablesName
let tablesList = []
_names.forEach(item=>{
let _item = {
label:zhApiColumnsLable(item),
value:item
}
tablesList.push(_item)
})
return tablesList
//
editFormData: {
id:null,
customUserSetting: null,
exportUserName: userInfo.name,
exportUserId: userInfo.id,
exportColumnName: null,
exportTableName: null,
exportColumnNameArr:null,
exportTableName_old:null,
exportColumnName_old:null
},
changeSelect(prop,val){
//
if(prop=='exportTableName_old'){
if(this.formReveal){
this.CreateForm[2].disabled = false
// this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old
this.CreateFormData.exportColumnNameArr = []
}else{
this.editForm[2].disabled = false
// this.editFormData.exportTableName = this.editFormData.exportTableName_old
this.editFormData.exportColumnNameArr = []
}
this.getColumList()
editOptions: {},
CreateForm: [
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 },
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 },
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", options: "whetherOrNotForNum", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName_old", userOptions: this.initTablesName(), colSpan: 12 },
{ type: "select", disabled:true, multiple:true, label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnNameArr", userOptions:null, colSpan: 12 },
],
editForm: [
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", options: "whetherOrNotForNum", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName_old", userOptions: this.initTablesName(), colSpan: 12 },
{ type: "select", multiple:true, label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnNameArr", userOptions:null, colSpan: 12 },
],
editRules: {
cerateRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnNameArr: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName_old: [{ required: true, trigger: "blur", message: "不可为空" }],
},
editRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnNameArr: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName_old: [{ required: true, trigger: "blur", message: "不可为空" }],
}
},
getColumList(){
let val = this.formReveal ? this.CreateFormData.exportTableName_old : this.editFormData.exportTableName_old
getPageList(this.PageListParams, val+'/base').then(res=>{
columsList:[],
};
},
mounted () {
this.paging();
},
methods:{
pagingCallback(callback){
this.Loading.tableLoading = false
this.tableData.forEach(item=>{
item.exportTableName_old = item.exportTableName
item.exportColumnName_old = item.exportColumnName
item.exportTableName = zhApiColumnsLable(item.exportTableName)
let _arr = item.exportColumnName.split(" ")
let _zhArr = []
_arr.forEach(item2=>{
let _item2 = zhApiColumnsLable(item.exportTableName_old+firstWordSizeChange(item2,'Upper')) || item2
_zhArr.push(_item2)
})
item.exportColumnName = _zhArr.join(',')
})
if(callback)callback()
},
// /
initTablesName(){
let _names = this.$store.getters.tablesName
let tablesList = []
_names.forEach(item=>{
let _item = {
label:zhApiColumnsLable(item),
value:item
}
tablesList.push(_item)
})
return tablesList
},
changeSelect(prop,val){
//
if(prop=='exportTableName_old'){
if(this.formReveal){
this.CreateForm[2].disabled = false
// this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old
this.CreateFormData.exportColumnNameArr = []
}else{
this.editForm[2].disabled = false
// this.editFormData.exportTableName = this.editFormData.exportTableName_old
this.editFormData.exportColumnNameArr = []
}
this.getColumList()
}
},
getColumList(){
let val = this.formReveal ? this.CreateFormData.exportTableName_old : this.editFormData.exportTableName_old
getPageList(this.PageListParams, val+'/base')
.then(res=>{
let _column = res.items[0]
this.columsList = []
for(let item in _column){
@ -279,46 +283,60 @@
this.editForm[2].userOptions = this.columsList
}
})
},
//
FormSubmit(val) {
this.ref = val
this.Loading.newAndEdiLoading = true
let _updata = this.formReveal ? this.URLOption_add : this.URLOption_edit
let _url = _updata ? _updata : this.URLOption_base
switch (this.formReveal) {
case true:
this.CreateFormData.exportColumnName = this.CreateFormData.exportColumnNameArr.join(" ")
this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old
if(!_updata){_url = _url + '/create'}
postCreate(this.CreateFormData, _url).then(res => {
this.oldSkipCount = 1;
this.Loading.newAndEdiLoading = false
this.paging()
this.FormResult("success")
}).catch(err => {
this.Loading.newAndEdiLoading = false
this.FormResult("error")
})
break;
case false:
if(!_updata){_url = _url + '/update-by-id'}
this.editFormData.exportColumnName = this.editFormData.exportColumnNameArr.join(" ")
this.editFormData.exportTableName = this.editFormData.exportTableName_old
postUpdate(this.editFormData, this.editFormData.id, _url).then(res => {
this.propsData = res
this.Loading.newAndEdiLoading = false
this.paging()
this.FormResult("success")
}).catch(err => {
this.Loading.newAndEdiLoading = false
this.FormResult("error")
})
}
},
.catch(err=>{
let _name = ''
if(this.formReveal){
this.CreateForm[2].userOptions = []
_name = this.CreateFormData.exportTableName
}else{
this.editForm[2].userOptions = []
_name = this.editFormData.exportTableName
}
this.$message.error(`暂无【${_name}】模块权限`)
})
},
//
FormSubmit(val) {
this.ref = val
this.Loading.newAndEdiLoading = true
let _updata = this.formReveal ? this.URLOption_add : this.URLOption_edit
let _url = _updata ? _updata : this.URLOption_base
switch (this.formReveal) {
case true:
this.CreateFormData.exportColumnName = this.CreateFormData.exportColumnNameArr.join(" ")
this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old
if(!_updata){_url = _url + '/create'}
postCreate(this.CreateFormData, _url).then(res => {
this.oldSkipCount = 1;
this.Loading.newAndEdiLoading = false
this.paging()
this.FormResult("success")
}).catch(err => {
this.Loading.newAndEdiLoading = false
this.FormResult("error")
})
break;
case false:
if(!_updata){_url = _url + '/update-by-id'}
this.editFormData.exportColumnName = this.editFormData.exportColumnNameArr.join(" ")
this.editFormData.exportTableName = this.editFormData.exportTableName_old
postUpdate(this.editFormData, this.editFormData.id, _url).then(res => {
this.propsData = res
this.Loading.newAndEdiLoading = false
this.paging()
this.FormResult("success")
}).catch(err => {
this.Loading.newAndEdiLoading = false
this.FormResult("error")
})
}
},
OperaButtonHide(data){
return data.creatorId != this.$store.getters.currentUserInfo.id
}
};
</script>
<style lang="scss" scoped>
@import "@/styles/basicData.scss";
</style>
}
};
</script>
<style lang="scss" scoped>
@import "@/styles/basicData.scss";
</style>

32
PC/UI.WinIn.FasterZ.Job/src/views/profileuser/index.vue

@ -0,0 +1,32 @@
<template>
<div class="app-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>个人中心</span>
<!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button> -->
</div>
<el-tabs v-model="activeTab">
<el-tab-pane label="用户信息" name="userInfo">
<userInfo />
</el-tab-pane>
<!-- <el-tab-pane label="修改密码" name="resetPwd">
<resetPwd />
</el-tab-pane> -->
</el-tabs>
</el-card>
</div>
</template>
<script>
import resetPwd from "./resetPwd";
import userInfo from "./userInfo";
export default {
name: "Profileuser",
components: { resetPwd,userInfo },
data() {
return {
activeTab: "userInfo",
};
},
};
</script>

106
PC/UI.WinIn.FasterZ.Job/src/views/profileuser/index_dy.vue

@ -0,0 +1,106 @@
<template>
<div class="app-container">
<!-- 左右东阳版本 -->
<el-row :gutter="20">
<el-col :span="6" :xs="24">
<el-card>
<div slot="header" class="clearfix">
<span style="font-size: 18px">个人信息</span>
</div>
<div>
<ul class="list-group-striped">
<li>
<div class="left"><i class="icon el-icon-user-solid"></i></div>
<div class="pull-right">
<p class="title">用户名</p>
<p class="name">{{ user.userName }}</p>
</div>
</li>
<li>
<div class="left"><i class="icon el-icon-info"></i></div>
<div class="pull-right">
<p class="title">姓名</p>
<p class="name">{{ user.name }}</p>
</div>
</li>
<li>
<div class="left"><i class="icon el-icon-s-check"></i></div>
<div class="pull-right">
<p class="title">角色</p>
<p class="name">{{ user.roles.join(',') }}</p>
</div>
</li>
</ul>
</div>
</el-card>
</el-col>
<el-col :span="18" :xs="24">
<el-card>
<div slot="header" class="clearfix">
<span style="font-size: 18px">基本资料</span>
</div>
<el-tabs v-model="activeTab">
<el-tab-pane label="修改密码" name="resetPwd">
<resetPwd :user="user" />
</el-tab-pane>
</el-tabs>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import resetPwd from "./resetPwd";
export default {
name: "Profileuser",
components: { resetPwd },
data() {
return {
user: {},
roleGroup: {},
postGroup: {},
activeTab: "resetPwd",
};
},
created() {
this.user = this.$store.getters.currentUserInfo
},
};
</script>
<style lang="scss" scoped>
.list-group-striped{
list-style: none;
padding-left: 10px;
li{
display: flex;
padding-bottom: 15px;
background: #e9f6ff;
padding: 13px 15px;
border-radius: 4px;
margin-bottom: 18px;
min-height: 70px;
}
.icon{
font-size: 22px;
padding-right: 5px;
vertical-align: top;
color: #49a4f7;
width: 24px;
flex-shrink: 0;
padding-top: 18px;
}
.pull-right{
padding-left: 10px;
color: #999;
p{
margin: 0;
}
.title{
padding-bottom: 5px;
color: #333;
}
}
}
</style>

100
PC/UI.WinIn.FasterZ.Job/src/views/profileuser/resetPwd.vue

@ -0,0 +1,100 @@
<template>
<el-form ref="form" :model="user" :rules="rules" label-width="80px">
<el-form-item label="旧密码" prop="oldPassword">
<el-input
v-model="user.oldPassword"
placeholder="请输入旧密码"
type="password"
/>
</el-form-item>
<el-form-item label="新密码" prop="newPassword">
<el-input
v-model="user.newPassword"
placeholder="请输入新密码"
type="password"
/>
</el-form-item>
<el-form-item label="确认密码" prop="confirmPassword">
<el-input
v-model="user.confirmPassword"
placeholder="请确认密码"
type="password"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="submit">保存</el-button>
<!-- <el-button type="danger" size="mini" @click="reset">清空</el-button> -->
</el-form-item>
</el-form>
</template>
<script>
import { postLoginUserInfo } from "@/api/wms-auth";
export default {
data() {
const equalToPassword = (rule, value, callback) => {
if (this.user.newPassword !== value) {
callback(new Error("两次输入的密码不一致"));
} else {
callback();
}
};
return {
user: {
oldPassword: undefined,
newPassword: undefined,
confirmPassword: undefined,
},
//
rules: {
oldPassword: [
{ required: true, message: "旧密码不能为空", trigger: "blur" },
],
newPassword: [
{ required: true, message: "新密码不能为空", trigger: "blur" },
{
min: 6,
max: 20,
message: "长度在 6 到 20 个字符",
trigger: "blur",
},
],
confirmPassword: [
{ required: true, message: "确认密码不能为空", trigger: "blur" },
{ required: true, validator: equalToPassword, trigger: "blur" },
],
},
};
},
methods: {
submit() {
this.$refs["form"].validate((valid) => {
if (valid) {
postLoginUserInfo({
currentPassword: this.user.oldPassword,
newPassword: this.user.newPassword,
}, this.$store.getters.currentUserInfo.id)
.then((response) => {
this.$notify({
title: "成功",
message: "修改成功",
type: "success",
duration: 2000,
});
})
.catch(() => {
//
});
}
});
},
reset() {
this.$refs["form"].resetFields();
//this.$store.dispatch("tagsView/delView", this.$route);
//this.$router.push({ path: "/index" });
},
},
};
</script>

52
PC/UI.WinIn.FasterZ.Job/src/views/profileuser/userInfo.vue

@ -0,0 +1,52 @@
<template>
<el-descriptions
class="profileuser_userinfo_page"
:column="2"
:border="true"
:labelStyle="{width:'200px'}"
>
<el-descriptions-item>
<template slot="label"><i class="item-icon el-icon-user-solid"></i>用户名</template>
{{ user.userName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label" :span="2"><i class="item-icon el-icon-info"></i>姓名</template>
{{ user.name }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"><i class="item-icon el-icon-s-check"></i>角色</template>
{{ user.roles.join(',') }}
</el-descriptions-item>
</el-descriptions>
</template>
<script>
export default {
data() {
return {
user:{}
};
},
created() {
this.user = this.$store.getters.currentUserInfo
},
};
</script>
<style lang="scss">
.profileuser_userinfo_page{
padding: 20px;
.el-descriptions-item__container{
padding: 20px 10px;
font-size: 18px;
}
.item-icon{
font-size: 22px;
margin-right: 8px;
color: #49a4f7;
line-height: 18px;
vertical-align: text-bottom;
}
}
</style>

2
PC/UI.WinIn.FasterZ.Job/vue.config.js

@ -13,7 +13,7 @@ const name = defaultSettings.title || '接口看板-QAD&WMS' // page title
// For example, Mac: sudo npm run
// You can change the port by the following method:
// port = 9527 npm run dev OR npm run dev --port = 9527
const port = process.env.port || process.env.npm_config_port || 9527 // dev port
const port = process.env.port || process.env.npm_config_port || 60023 // dev port
const Timestamp = new Date().getTime();
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {

Loading…
Cancel
Save